# The MCP server Published Sep 28, 2026 · Updated Nov 25, 2026 Kotatsu serves one MCP endpoint at `/mcp`. Source reads run through Kotatsu. This note describes the door that the code already serves: the transport, the authorization, the tools, and the limits. `src/mcp/transport.ts` holds the transport facts with their sources. This note tells the owner how to connect a client to it. ## Feedback When available, call `feedback_submit` when a Kotatsu tool fails, behaves unexpectedly, lacks needed behavior, or the user asks to send feedback. Ask the user what they wanted to do and why. Give at least two detailed sentences for both `problem` and `goal`. Set `kind` to `bug`, `feature`, or `other`. For a bug, include `steps`, `expected`, `actual`, and `error` with exact codes and messages. Add `tools_involved`, the user's own words in `who_asked`, and `severity` when known. Send one issue per report. The result gives an id. `feedback_get` returns the submitter's report and status. The operator can call `feedback_list` with kind, status, tenant, and date filters. Call `feedback_get` for full details and `feedback_update_status` to change a report's status. The operator tools are absent from non-operator tool lists. analytics_lookup is available only on the new memory, owner only, and hidden from everyone else, including feedback operators. It returns the account email for a stored usage id without changing any account config. Other agents cannot list reports and can use `feedback_get` only for their own submissions. ### Feedback notices `/path/to/feedback-watcher.mjs` checks operator feedback through MCP. Its first run records current report IDs without sending a notice. Later runs send one short notice for each new batch through the command after `--`. The command receives the notice on standard input, or in place of `{}` in any argument. Keep the state file between runs. ```sh node /path/to/feedback-watcher.mjs --once --client-config /path/to/claude-config.json --entry kotatsu --state /path/to/seen.json --label tenant-id=Work -- /path/to/notifier '{}' ``` ## Transport | Property | Value | |---|---| | Path | `/mcp` | | Transport | Streamable HTTP | | Methods | `POST` only. `GET` and `DELETE` answer 405. | | Session | None. The server assigns no `Mcp-Session-Id`. | | Answer | One JSON object for each request. The server opens no SSE stream. | | Protocol version | Negotiated. The client of this note received `2025-06-18`. | | `Accept` | The client must send `application/json, text/event-stream`. | | Result cap | 256 KiB of text. A capped result carries `"capped": true`. | The endpoint is stateless because a Worker isolate keeps nothing between requests. Each request authorizes again from the stored grant, so a revocation reaches the next call. The `initialize` result carries the five agent rules of the `kotatsu:rules v9` block in its `instructions` string, after one line that asks the agent to offer once to remove a `kotatsu:rules` block from its global instructions. Claude Code and Codex show this string to the model, so they save no block. The same rules appear in the `skill_get` use form and at `/start`. A client with two Kotatsu connections in one session can send `Kotatsu-Rules: other-connection` on one connection; the value must match after trimming whitespace, without regard to case. That connection answers `initialize` with the intro line and a pointer to the other connection's rules block. | Form | Document | What it holds | |---|---|---| | `use` (default) | Kotatsu Use | The MCP address and five agent rules (`kotatsu:rules v9`). | | `sort` | Kotatsu Sort | The short sort skill that any task-level agent runs end to end, with the Memory guide. | | `dream` | Kotatsu Dream | The short dream skill that reads pages again against their record and leaves the memory smaller, truer and better linked, with the Memory guide. | | `setup` | Kotatsu Setup | The MCP address, connector setup, and sign-in facts. | Eight Markdown routes are public before sign-in: `/start`, `/README.md`, `/setup.md`, `/docs/integrations.md`, `/docs/mcp.md`, `/docs/runbooks/remote-mcp.md`, `/docs/runbooks/composio.md`, and `/docs/runbooks/shopify-catalog.md`. Passthrough services report the last live read, search, or list failure by safe class (`auth`, `rate_limited`, `timeout`, `provider_error`, or `bad_request`), HTTP status when known, operation, and time. Provider failures set the service to `degraded` until a successful call. A bad request is recorded without degrading the service. Health and Connections show the report check time; a site snapshot older than five minutes falls back to live health. ## Authorization The door takes `Authorization: Bearer `. The token is issued by Kotatsu's own OAuth 2.1 authorization server, which runs in the same Worker. | Endpoint | Standard | What it does | |---|---|---| | `/.well-known/oauth-protected-resource/mcp` | RFC 9728 | Names the resource and its authorization server. | | `/.well-known/oauth-authorization-server` | RFC 8414 | Names the three endpoints below and `S256`. | | `/oauth/agent/register` | RFC 7591 | Dynamic client registration. A client registers itself. | | `/agents/authorize` | OAuth 2.1 | Parks a pending approval and sends the owner to sign in. | | `/oauth/agent/token` | OAuth 2.1, RFC 7009 | Code exchange, refresh, and revocation. | Facts that a client integrator needs: - PKCE is required and `S256` is the only method. - The one scope is `kotatsu:mcp`. The scope never carries the permission. - An access token lives 15 minutes. A refresh token rotates on each use, so a client must store the new one. An agent's access ends after 90 days without use: each refresh and each authenticated call moves that date forward, so an agent in use never needs a new approval. After 90 idle days the refresh is refused with `invalid_grant`, the agent is removed from `/agents`, and the client connects again. Agents approved before this rule count as last used on November 10, 2026. - An unauthenticated call answers 401 with a `WWW-Authenticate` header that names the resource metadata address. A client follows that header to discovery without any configuration. The permission is owner data, not a client request. The client asks for access; the owner approves it on the approval page at `/agents/approve`. An approval grants the `task` level. The page shows no level choice. A client cannot change its grant by changing its request. Every approval, through OAuth or pairing, connects a new agent; the page offers no choice of an existing one. The owner can revoke an agent on the **Agents** page at `/agents`. The `read` level can use read tools. The `task` level adds writes to pages, sections, tasks, uploads, feedback, and `arrivals_mark_handled`. Connection tools keep their own rules and are available at every level. `tools/list` shows only tools allowed by the agent's level. A call to a known tool above that level returns `permission_denied` and the required level. `whoami` returns the current agent's ID, shown name, account, level, and expiry without probing a provider. A grant that an older release stored with the `sorter` level acts as `task`. Kotatsu does not rewrite the stored record. The owner of an agent is the user who approves it. The approval binds the grant and every token of the agent to the tenant of that user, and `/mcp` reads the tenant from the token. An agent never reads or writes another tenant. The bearer token proves only *which* agent calls. Every request reads the current grant record from R2 before any tool runs, so a revocation on the **Agents** page ends the session at once even while the signed token is still inside its 15 minutes. ### The two permission levels | Level | What it holds | |---|---| | `read` | The brain reads and the raw reads of every connected source. | | `task` | The same, plus writes to tasks, pages, sections, uploads, feedback, and handled arrivals. | The level alone decides the raw reads. Every approved agent reads the raw data of every connected source, also a source that the owner connects later. A grant record that an older release stored with a `rawGrants` list still loads; Kotatsu ignores the list and drops it on the next write of that record. A proof of an integration call stays readable while the integration holds the account of that proof. ## The tools `tools/list` includes only tools allowed by the caller's level. It also hides the operator-only feedback tools from non-operators and analytics_lookup from everyone except the owner. The lookup requires valid caller and OWNER_EMAIL addresses that match after trimming and case normalization. `tools/list` also includes the invite tools only for operator accounts with Beta and new features on. A direct call to a known tool above the caller's level returns `permission_denied` with `isError: true` and the required level. Every result is one JSON text block. A refusal keeps the same shape and adds `{ "code": ..., "message": ... }`. | Tool | Permission | Input | |---|---|---| | `feedback_submit` | task | `kind: "bug" / "feature" / "other", title: string, problem: string, goal: string, steps?: string, expected?: string, actual?: string, error?: string, tools_involved?: string, who_asked?: string, severity?: string` | | `feedback_list` | read | `kind?: "bug" / "feature" / "other", status?: "new" / "triaged" / "planned" / "done" / "won't do", tenant?: string, from?: string, to?: string` | | `feedback_get` | read | `id: string` | | `feedback_update_status` | task | `id: string, status: "new" / "triaged" / "planned" / "done" / "won't do"` | | `analytics_lookup` | read | `id: string` with `an_` followed by 32 lowercase hex characters; returns `{ email }` or `not_found` | | `agents_list` | read | none | | `agents_self_setup` | task | `name?: string, platform?: string, picture?: string, wake_test?: true, wake_method?: "command" / "wait" / "email" / "none", wake_email?: string, wake_email_code?: string, dreamer?: boolean`; at least one of name, platform, wake_method, wake_email_code, wake_test, picture or dreamer; `dreamer` true makes the caller the one dreamer, false steps down | | `whoami` | read | none | | `arrivals_list` | read | `after?: string, limit?: integer` | | `arrivals_mark_handled` | task | `through: string` | | `connection_health` | read | `account?: string` | | `doctor` | read | none | | `skill_get` | read | `form?: string` | | `raw_search` | read | `query: string, limit?: integer, account?: string` | | `raw_facets` | read | `field: string, query?: string, source?: string, limit?: integer` | | `proof_get` | read | `proofId: string, offset?: integer, length?: integer, format?: "base64" / "text"` | | `storage` | read | `action: "list" / "get" / "upload" / "change", folder?: string, ref?: string, after?: string, limit?: integer, path?: string, offset?: integer, length?: integer, format?: "base64" / "text", link?: boolean, contentBase64?: string, byteLength?: integer, contentType?: string, replace?: boolean, keepBoth?: boolean, move?: {from: string, to: string}` | | `source_search` | read | `serviceId: string, query?: string, limit?: integer, account?: string` | | `source_list` | read | `serviceId: string, query?: string, limit?: integer, account?: string` | | `source_read` | read | `serviceId: string, itemId: string, account?: string` | | `task_list` | read | `done?: boolean, waitingOnOwner?: boolean, agent?: string, limit?: integer, offset?: integer, changed?: boolean` | | `task_get` | read | `pageId: string, peek?: boolean` | | `task_create` | task | `owner?: string, title: string, description: string, detail?: string, update?: string, waitingOnOwner?: boolean, ask?: { question: string, why?: [string], choices?: [string], steps?: [string], then?: string }, proofId?: string, goAheadProofId?: string, noSourceReason?: "unsourced" / "owner-request-in-current-session" / "sorter-organization" / "legacy-uncited" / "not-applicable"` | | `task_update` | task | `pageId: string, update?: string, expectRevision?: integer, quiet?: boolean, done?: boolean, close?: "done" / "dropped", waitingOnOwner?: boolean, ask?: { question: string, why?: [string], choices?: [string], steps?: [string], then?: string }, detail?: string or null, completionProofIds?: [string], owner?: string, answers?: string, proofId?: string, goAheadProofId?: string, noSourceReason?: "unsourced" / "owner-request-in-current-session" / "sorter-organization" / "legacy-uncited" / "not-applicable"` | | `task_create`, `task_update` | task | With Beta updates, `files?: [string]` takes up to 10 Storage paths. It replaces the attachments. `[]` clears them. | | `proof_upload` | task | `contentBase64: string, contentType: string, filename?: string, declaredSource?: string, declaredItemId?: string, locator?: string` | | `proof_upload_link` | task | `byteLength: integer, contentType?: string, filename?: string, declaredSource?: string, declaredItemId?: string, locator?: string` | | `owner_statement_upload` | task | `text: string, speakerId?: string, locator?: string` | | `proof_retire` | task | `proofId: string, reason: string, replacedBy?: string` | | `sent_message_upload` | task | `recipient: string, channel: string, threadId: string, text: string` | | `integration_list` | read | none | | `integration_describe` | read | `integration: string, call?: string, account?: string` | | `integration_call` | read | `integration: string, call: string, args?: object, account?: string` | | `integration_propose` | read | `manifest?: {shape: "api-key", id: string, name: string, baseUrl: string, auth: {header: string, template: string} or {query: string}, addresses?: [string], description?: string, calls?: [{name: string, description: string, method: string, path: string, effect: string, args?: object}], test: {call?: string, path?: string, args?: object}, skill: string, connection?: {scope: "account" / "workspace", label: string, keyLabel: string}, passthroughHeaders?: [string]} or {shape: "remote-mcp", name: string, url: string, auth: {kind: "oauth" / "bearer" / "none"}} or {shape: "composio", toolkit: string}, url?: string, name?: string, auth?: "oauth" / "none" / "bearer" / "api-key", header?: string, summary?: string, includeGuideOnError?: boolean, update?: boolean` | | `integration_archive` | task | `integration_id: string, reason: string` | | `connect_link` | read | `{integration?: string, source?: "google" | "slack" | "notion" | "github" | "pocket" | "shopify" | "x", connection?: string}` | | `tailscale_join` | task | `{step: "key" or "report", machine: string, wipes_itself?: boolean, backend_state?: string, tags?: string[], tailnet?: string}` | | `ssh_access` | task | `{step: "register" or "read" or "remove", public_key?: string, node_id?: string, addresses?: string[]}` | | `password_ticket` | task | `{machine?: string}` | | `password_list` | task | none | | `password_save` | task | `item?: string, name?: string, kind?: "login" / "password" / "api_key" / "secure_note" / "config", note?: string, websites?: [{origin: string, match: "exact" / "site"}], source?: "kotatsu" / "1password", fields?: {field: string or {type: "text" / "concealed" / "otp", value: string}}, remove_fields?: [string], expected_revision?: number, purpose?: string` | | `password_request` | task | `url: string, method?: string, headers?: {name: string}, body?: string, content_type?: string, purpose: string` | | `invite_create` | task | `name: string, limit?: integer or null` | | `invite_list` | read | none | | `invite_revoke` | task | `name: string` | | `memory_read` | read | `path: string, sources?: boolean, fromLine?: integer, lineCount?: integer, status?: "open" / "done" / "dropped", assignee?: string, notReadSince?: string, changedSince?: string, changed?: boolean, limit?: integer, after?: string` | | `memory_search` | read | `query: string, folder?: string, limit?: integer` | | `memory_history` | read | `kind: "log" / "show" / "diff" / "blame", path?: string, commit?: string, limit?: integer, before?: string, query?: string` | | `memory_save` | task | `changes: [{path: string, text: string, base?: string, remove_many?: boolean, restore?: boolean} or {path: string, rename_to: string, base: string} or {path: string, delete: true, redirect?: string, base: string}], reason: string, sources?: [string], facts?: [{path: string, line: integer, sources?: [string], kind?: "said" / "seen" / "guess"}], structure?: {folder?: {name: string, rule: string, guide: string}, fields?: [{folder: string or null, name: string, meaning: string, format: string, example: string}]}` | For a page, give `memory_read` either `fromLine` or `lineCount` to read a line window. `fromLine` starts at 1 by default. `lineCount` accepts 1 to 500 and defaults to 100. Pass `nextFromLine` as `fromLine` to read the next window. Join the returned text in order without adding separators. With `sources: true`, entries in `lines` include fact keys and keep their page line numbers. Window reads return the full page's `blob` for use as `base` in `memory_save`. Task text limits: title 80 and update 300 characters, each one line; detail 4,000 characters. Characters invalid in page names become spaces in titles. A description has at most 4,000 characters; its first line is the description, at most 500 characters, and later lines become detail. Angle-bracket text in task descriptions, detail and updates is saved as inline code. `waitingOn` entries are an agent name (at most 80 characters, no quotes), `[[Person]]` or `[[Task]]`, or a UTC date `YYYY-MM-DD` or `YYYY-MM-DD HH:mm`. A longer value is refused with its length. `proof_upload_link` is available only when the account's proof upload link switch is on. Give the exact file size from 1 to 100,000,000 bytes. The link accepts one HTTP PUT within 15 minutes with matching `Content-Length`; its reply is the proof receipt. To attach a file to a page, upload it first, then cite its proof id in memory_save `sources`. The proof upload tools check each file's type by its bytes and refuse programs, scripts, Office files with macros, and archives. This is not a virus scan: an accepted file can still be harmful, so download and open proofs with care. ### Storage with Beta updates The `storage` tool requires Beta updates. Its `action` selects one operation. Read agents can list and read files. Task agents can also upload, rename, and move files. With Beta updates off, the tool is absent and calls are refused. | Action | Inputs | |---|---| | `list` | `folder?: string, ref?: string, after?: string, limit?: integer` | | `get` | `path?: string, ref?: string, offset?: integer, length?: integer, format?: "base64" / "text", link?: boolean` | | `upload` | `path: string, contentBase64?: string, byteLength?: integer, contentType?: string, replace?: boolean, keepBoth?: boolean` | | `change` | `move: {from: string, to: string}` | `storage` with `action: "list"` reads one folder or finds the names of a file by its citation ref. Use `after` with the preceding `nextAfter` to continue. `limit` is 1 to 100, defaulting to 100; `folder` defaults to `/`. With `action: "get"`, give exactly one path or ref. It returns a bounded base64 window by default, or text with `format: "text"`. `offset` defaults to zero; `length` is 1 to 131,072 bytes, capped at 65,536 for text. Follow `nextOffset` while `capped` is true. With `link: true`, it returns a one-use download link that expires after 15 minutes. Integration files still require access to their active connection. `storage` with `action: "upload"` takes `path` and either `contentBase64` up to 10 MiB or an exact `byteLength` up to 100,000,000 bytes to obtain an upload link. The link takes one PUT within 15 minutes with matching `Content-Length`. Its reply is the Storage receipt. Storage takes any file type. These uploads are downloads only, and they create no arrival for sorting. An existing path is refused with its size and date. `replace: true` keeps the name and appends a version. `keepBoth: true` chooses the next free name. Paths are unique without regard to case. A path has up to 12 segments and 512 characters. Each segment has 1 to 128 characters, has no control characters, and cannot be `.` or `..`. `storage` with `action: "change"` takes `move: {from, to}` to rename or move a file or folder by changing its path. Existing destinations are refused. Folder moves process up to 1,000 files per call. Repeat the move while the reply has `more: true`. The stored bytes and memory citations keep their identity. Deletion and task attachments are separate changes. The same self-check is available as `GET /doctor` with the agent's bearer token. It returns JSON. A missing or expired token returns a pairing or reconnection fix. The endpoint and MCP tool share the per-agent limit. ## Retry recovery A timeout ends the wait and does not cancel the work. Repeat a write only if the matching write is missing after the complete lookup below. For task creation, read open and closed `task_list` pages across every offset, then `task_get` for each matching task. For updates, match the update anywhere in the task's updates, including before a later revision. Read page History; for a new page, search and read all candidates rather than only their newest Current. For uploads, read every `arrivals_list` page from `after: "start"`, following `nextAfter`, including handled items. Match the arrival's `contentHash` and `proof_get`'s `byteLength` against the decoded upload bytes, or the trimmed UTF-8 text of an owner statement or sent message. Retry only if that matching entry is missing. A `source_read` timeout may still save a proof. A `task_get` timeout may already mark that revision seen. Reread and handle all updates. Other reads may still finish. ## Sorting Read the root guide with `memory_read` path `/` and the folder's `README.md` before a memory write. Sorting is the `kotatsu-sort` skill, which `skill_get` returns for the `sort` form. A `task` agent uses `memory_search`, `memory_read`, `memory_save`, and the two arrivals tools. Kotatsu holds no lease and never refuses a write because of a sort. `arrivals_list` without `after` starts after the handled mark. Use `after: "start"` to include handled arrivals, then continue with `nextAfter`. `arrivals_mark_handled` moves that mark forward to `through` and answers `advanced: false` when the mark is already at or past `through`. The instance coordinator serializes each mark, so two agents that sort at once can see an item twice but never move the mark back. ## Dreaming Dreaming is the `kotatsu-dream` skill, which `skill_get` returns for the `dream` form. Sorting files what is new; dreaming reads what is already there. A run takes every page that is new or changed since the last run, with no page limit: `memory_read` on `/` with `changedSince` lists them oldest first. A save whose reason starts with `Dream:` does not count when the owner of the open Dream task makes it; the save records the pages it wrote, so a waiting task update by another agent that rides in the same save still counts. Each answer gives `through` (a commit) and, inside one save, `after`; the dreamer writes them on the Dream task as a `Dream mark:` update after each answer, so the next session or run goes on from there. A first run, with no mark, takes every page. When work is left, the dreamer sets `waitingOn` to a few minutes ahead so the task wakes it again. The run reads each page again with its record (`memory_read` with `sources`, `proof_get`, `memory_history` with `blame` and `diff`), fixes lines the record contradicts, merges pages about one subject, drops agent narration once one line states the outcome, links each page from where someone would look for it, and moves detail down from long pages. Every save sends the blob it read as `base`, and every deleted page carries `redirect`. The run ends with one task update as its receipt. The skill holds the rules; Kotatsu runs no model. To start one, run `skill_get` with form `dream` and follow it. For a standing run, one agent owns a task named "Dream" with `waitingOn` set to the next date; that date wakes the owner agent, and the run sets the next date when it ends. That agent is the dreamer. The owner picks it on the Agents page, or an agent calls `agents_self_setup` with `dreamer` true; Kotatsu makes the Dream task for the dreamer and hands it over when the dreamer changes. A save that makes a page longer than 200 lines returns a `long-page` warning; the page is saved. ## Memory Task properties are `status`, `assignee`, `due`, `origin`, `waiting_on` and `last_check_in`. `task_get` always records the UTC day it was read on open tasks and keeps `readOnlyHint: true`. The page's last change then shows that write. A `waiting_on` entry is `Owner`, an agent's name, a link to a person's or task's page, or a date written `YYYY-MM-DD`. `task_list` takes `filter` set to `ready`, `waiting_on_owner`, `waiting_on_others` or `waiting_for_date`. A date holds its task until noon UTC on that date (the latest date, if there are several); until then the task matches only `waiting_for_date`. A task link holds its task until the linked task is done or dropped. - Kotatsu's `memory_read` with path `/` returns the root `README.md`, which holds the guide and the folder map. Read it, and the folder's `README.md`, before adding a page. - Kotatsu's `memory_search` matches words in titles, aliases and lines. Exact title and alias matches come first, then the most relevant pages. This is keyword search, so reword. If results are empty or don't answer the question, search again with synonyms, broader or related terms, or the likely page title or section; for brother's house, try brother, family, home, address. Try up to 3 rewordings before saying Kotatsu has nothing. - Kotatsu's `memory_save` writes pages as one Git commit, one fact per line. Write so the page can be found later: a title that names the thing plainly, and lines that use the words people search for, such as the relationship (brother), the category (dentist, address, allergy) and the common name next to any nickname or abbreviation. A change to an existing page sends the blob id it read as `base`. A correction changes the line in place; Git keeps the old version. `structure` adds a folder or declares a field in the same save as its first page or first use, and Kotatsu updates `README.md` in that save. - `memory_history` kind `log` lists commits as ` : `, newest first. - `skill_get` form `sort` returns the sort skill with its Memory guide. Form `dream` returns the dream skill with the same guide. ## Work with other agents See [Work with other agents](../README.md#work-with-other-agents). ## Changed tasks and wake `agents_list` gives the stable ID, shown name, wake method (`null` when not chosen), and last seen time of each paired agent. The shown name is `name · app`: the owner's rename, else the agent's own name, then the app without a trailing Kotatsu parenthetical. If either name already holds the other as word runs, ignoring case and punctuation, Kotatsu shows that whole name without repeating the app. Without a name, it shows the app. `whoami` and task owner labels use the same shown name. An ordinary `task_update` saves the task in the Durable Object at once. Its receipt returns the saved `revision`, `commit: null`, and `historyPending: true`. `task_get`, `task_list`, `memory_read`, and `memory_search` see the update at once. The hourly batch adds the saved updates to Git. Tasks history keeps each update's author. A failed batch keeps the saved updates for retry. Creation, closure, reopening, and handoff commit at once. Their receipts name a commit that contains the saved task. To claim a task, call `task_get` and check its latest updates. If it is free, call `task_update` with a claim note in `update` and the returned `revision` in `expectRevision`. The optional guard takes a nonnegative safe integer, including zero. Start work only after the call succeeds. If the task changed, the call returns `parent_moved` and saves nothing. Read the task again, check the latest updates, and stand down if another agent claimed it. `task_create` and `task_update` take `owner` to give a task to a paired agent. Kotatsu matches `owner`, ignoring case and surrounding whitespace, against the agent ID, then the owner's rename, then the client or shown name, then the agent's own name. It uses the first step that matches and refuses an unknown owner, a revoked agent's ID, or two agents that match at the same step. When anyone other than its owner agent changes a task, the change waits for that agent. Each MCP result of that agent then carries `taskHint`, which counts the changed tasks and names the newest. `task_get` reads a task and clears it up to the revision it read, unless `peek` is true; a later change stays pending. An agent's own changes never wait for it. `task_update` with `quiet: true` records a progress note and wakes no one; it is refused for a close, reopen, handoff, owner ask, answer or Someday change. Done and dropped tasks count too. Kotatsu runs no agent. Once per agent per setup change, a result also carries `setupHint` when the agent was approved before `SETUP_CHANGE.at` and has not yet been told about that change. The hint asks Claude Code and Codex to offer once to remove a `kotatsu:rules` block from their global instructions. It points every other client to the current block at /start. It never appears on `whoami` or for clients that embed instructions, identified by their client name or the `kotatsu/embedsInstructions` flag, known from the agent's last initialize. A flag-only client whose session began before this shipped may get it once. An agent re-paired under its old name keeps its first approval time and gets the line once. Two calls in flight together may both carry it. Move `SETUP_CHANGE.at` to a time after the deploy that ships the change whenever the rules block, /start or the kotatsu-setup skill changes in a way agents must copy. After a successful `tools/list`, Kotatsu records a schema key for the agent. When a later call uses an older key, `setupHint` says that the tools changed and gives the owner the refresh step for the approved client. Kotatsu sends this notice once per older key, before any rules notice. Clients with no recorded key get no tools notice. The check uses the existing coordinator call and adds no R2 read or coordinator round trip to tool calls. An agent's tool list is out of date when its recorded key differs from the current key for its permission, or when it called a retired tool name after its last `tools/list`. An agent with no recorded key is not out of date. `agents_list` then adds `toolsOutOfDate: true` to that agent. `doctor` returns a `tools` check: `ok` when the list is current or no key is recorded, else `failed` with the client's reload step as `fix`. `agents_list` uses the agent records it already reads. To ask the person, pass `ask` on the task (new memory) with no `update`; it sets `waitingOnOwner`. Say what changed in a quiet update first. When the person answers, upload their exact words with `owner_statement_upload`, then call `task_update` with that `proofId` and `answers` set to `waitingOnOwner.since`. Kotatsu refuses an answer that names another question. ### Asking the owner The owner reads the question on their phone, with no task history, so `ask` holds one question in the owner's words and nothing else. Kotatsu refuses anything else with `page_text_invalid` and names the fix, and reports each automatic fix in `fixed`. | Field | Required | Limit | Rule | |---|---|---|---| | `question` | yes | 1 to 140 characters, one line | Ends with `?` or starts with Decide, Sign in, Pay, Give, Unblock, Confirm, Choose or Send. At most one `?`. | | `why` | no | 1 or 2 lines of at most 120 characters | What the agent tried or knows, only what the owner needs to decide. | | `choices` | no | 2 to 4 items of at most 40 characters | Answers the owner picks with one tap; the label is sent word for word. Not with `steps`. | | `steps` | no | 1 to 4 items of at most 100 characters | What the owner must do, one action per item. The owner taps Done. Not with `choices`. | | `then` | no | one line of at most 120 characters | What the agent does after the answer. | The whole ask is at most 1,000 characters. No text may hold a code, an ID, a file path, a link, a backtick or an `@name`; those go in `detail`. `ask` with `update`, `answers`, `quiet`, `close`, `done`, or `someday` true is refused. The page keeps the ask as an `## Ask` section between the detail and `## Updates`, with `Question:`, `Why:`, `Choice:`, `Step:` and `Then:` lines; the update line repeats the question. The section goes when the ask is answered or cleared. `task_get`, `task_list` and write receipts return it as `waitingOnOwner.ask` with `question`, `why`, `choices`, `steps` and `then`, or `ask: null` for an ask recorded before this format; the owner agent of such a task gets `next: "This ask has no question. Re-ask with ask when you next update."` from `task_get` and `task_update`. Only the first `## Ask` section before `## Updates` is the ask: its first `Question:` and `Then:` lines and its `Why:`, `Choice:` and `Step:` lines. Every other line, in that section or in a later `## Ask` section, stays as detail. A `task_update` needs `update` or `ask`. Until Nov 17, 2026, `waitingOnOwner` true with an `update` and no `ask` still asks the owner: an update of at most 140 characters must itself be a valid question and becomes the `ask` question; a longer one stays an ask with `ask: null`. `fixed` reports both. Work from the owner, or a task from one of the owner's approved agents, is the owner's go-ahead. Do not ask the owner to approve it again. Ask the owner when the request is unclear or conflicts with another instruction. Payments still go through Link or Mercury. On new memory, attach an owner statement recorded by the owner or an active approved agent as `goAheadProofId` on `task_create` or `task_update`. `task_get` returns `ownerGoAhead` with `verified`, the stored `text`, `capturedAt`, and `recordedBy`. Old memory does not offer the field and always returns an unverified go-ahead. Each approved agent calls `agents_self_setup` to set its name, platform, wake method, picture, dreamer role, a mix, or send itself a test wake. Set `name` to the name the owner gave the agent. An application's name is never the agent's own name. `platform` names the product the agent runs in, such as `Grok Bot` or `Instinct`. Kotatsu displays `Name · Platform`, or one name when both are equal. Existing `name · application · machine` names remain stored in full. Their application is the platform fallback, followed by the connecting client's name. The machine appears in the agent's ⋯ details. Kotatsu trims names and platforms, collapses whitespace, strips control characters, and refuses more than 80 characters. An empty value clears that field. A platform-only call keeps the name. The owner's rename on the Agents page appears exactly as entered and wins over the agent's name and platform. Old-memory tools/list keeps its existing schema; a platform is still accepted. A call with only a name or platform never changes the wake method or creates a checker token. Kotatsu audits each name change with the agent as actor. The tool has no agent ID argument, so it cannot change another agent. During setup, the owner's one yes covers the method you picked; after setup, ask the owner before changing it. The optional `picture` input takes base64 PNG, JPEG or WebP bytes, up to 128 KiB and between 16 by 16 and 512 by 512 pixels. Kotatsu checks the container headers, refuses animation and strips metadata before storage. It does not decode or validate pixel data. An empty string clears the picture. Each agent may set or clear its own picture at most five times per rolling hour. Refused uploads do not count. The owner can reset the picture without that limit; a reset does not lock future changes. A set returns `picture` with `version`, `type`, `width`, `height` and the stored `bytes` count; a clear returns `picture: null`. `whoami` returns the same field, including `null` after a reset. Pictures are stored under the account and agent, with old objects removed on replacement, clear and revoke. Account deletion removes them. Only the signed-in owner can read `GET /agents/picture?agent=&v=`. The response uses the stored image type, private immutable caching, `nosniff` and a sandbox CSP. Once your wait loop or checker is running or your email wake is confirmed, call `agents_self_setup` with `wake_test: true`. It creates a task titled "Kotatsu wake test" (a repeat test adds a number, such as "Kotatsu wake test (2)") and wakes you through your recorded method. The woken turn reads and closes it as its update says. The result has `wakeTest: { taskId }`. An unchosen method and `none` are refused. See `/start`, step 5, for how each method confirms receipt. - `command`: A checker on your machine runs a command when a task changes. - `wait`: A command you start in the background exits when a task changes. - `email`: Kotatsu emails your inbox a content-free doorbell when a task is handed to you. - `none`: You see changed tasks on your next Kotatsu tool call. Use `email` if your host starts a turn when mail arrives from a trusted sender and the account has Beta updates on. Use `none` if your host cannot start a turn through a wake method. Use `wait` only if a finished background command starts a turn. Use `command` on a machine that can run the checker; Kotatsu holds changes while it sleeps. If you can schedule your own turns, also check every 15 minutes with `task_list` or the curl check without `hold`. If your files were wiped, call `agents_self_setup` again. Command and wait return `wakeToken`, plus `checkerToken` with the same value for older readers. Calling setup again rotates the token. Switching to email or none deletes it. The kgi1 token can only list task IDs and revisions on `GET /inbox/check`; it cannot call MCP or clear a task. Sending `wake_test: true` with the method you already recorded keeps the token and only sends the test. Use your own folder under `~/.config/kotatsu/`, named from `wakeToken` with its last dot and secret removed. Give the folder mode 700. File-writing tools need its full path. Start every shell command below by setting `KOTATSU_WAKE_DIR` to that full path; each new shell starts without it. The folder name has no secret. Write `Authorization: Bearer ` to `wake-header` in that folder with mode 600 through stdin or a file-writing tool. Keep it out of chat, logs, shell history, and command arguments. For `command`, the `/start` hidden-input setup also saves the raw token in that folder as `checker-token` for the Node checker. It sets `KOTATSU_WAKE_DIR` to the folder path using `${KOTATSU_WAKE_TOKEN%.*}`. Give each token file mode 600. ### Email Email wakes use the native `EMAIL` send binding and send from `wake@` on the `PUBLIC_ORIGIN` host. Subscribe the `kotatsu-email-events` Queue to Email Sending's `message.bounced` and `message.complained` events and set its dead-letter queue. Without `EMAIL`, email wakes are not configured. The account's Beta updates setting must be on. Call `agents_self_setup` with `wake_method: "email"` and `wake_email` set to your own inbox address. Kotatsu mails a six-digit code. Kotatsu returns `emailConfirm` with `sentTo`, `sender` and `expiresAt`. Your previous wake method stays active until you confirm. Before you read the code, add the returned `sender` to your trusted senders. If your host can check email authentication, you can also require DKIM to pass for the sender's domain. Read the code from your inbox, then call `agents_self_setup` with `wake_email_code`. The code expires after 30 minutes. Confirmation saves the email method and clears your checker token. Only the requesting agent can confirm its address. `agents_list` shows the email wake's state without its address. Each doorbell holds no task or owner details. Call `task_list` with `changed: true`, then `task_get` each task it returns. Do the tasks handed to you and record progress, a question for the person, or the result with `task_update`. Kotatsu combines changes received within 60 seconds into one doorbell. If the task stays unread, Kotatsu sends one reminder after an hour. Each account sends at most 200 wake emails per rolling 24 hours, shared by all its agents. At the limit, Kotatsu holds the doorbell and sends it when the window frees, and your next Kotatsu result carries `taskHint` with the time. `agents_list` and `doctor` return `wakeEmails` with `used`, `limit` and `freesAt`. To stop email wakes, call `agents_self_setup` with `wake_method: "none"`. Every confirmation and doorbell also has a Stop email wakes link. Open it and confirm, or use your mail app's unsubscribe action. This stops email wakes for that inbox across all Kotatsu accounts. Hard bounces and spam complaints also stop its email wakes. ### Wake socket The current Node checker keeps one WebSocket open in continuous `--hold` mode. It uses the same account and agent as its checker token. When it connects, due pending work arrives in batches of at most 50 task IDs and revisions. Later, each task change sends one message for that task. Reconnect follows the held poll reminder schedule: the first offer, then 1, 5, 20 and 60 minutes later. Stale reminders marked send-once are not repeated. Stream offers do not consume the held poll reminder schedule. The account object accepts the socket with the hibernation API. It answers `kotatsu:ping` with `kotatsu:pong` without running an object handler. An idle checker sends a ping every 30 seconds. The socket adds no idle poll timer inside the object. After a deploy or another socket close, the checker waits a random 2 to 5 seconds before reconnecting. Work missed while disconnected arrives on reconnect. An unread revision is offered again only when its next reminder is due. A running revision's local lock prevents a second launcher from starting for it. If a launcher fails, the checker keeps the socket open and retries that task locally at 1, 5, 20 and 60 minutes after its first launch. It starts at most once per schedule step, skips steps missed while a launcher was running, and stops retries after the 60-minute step. A successful launch cancels its pending retry. A new socket message for the task cancels the old retry timer. A newer revision starts its own schedule; the same revision keeps its schedule through repeated messages and reconnects. Timers pause while the socket is closed. Send-once reminders have no local retry. Socket messages preserve the `once` flag so the checker can enforce this rule. If the upgrade fails, a message is invalid, or a pong does not arrive, the checker uses `hold=`. Socket retries have a random 30 to 60 second cooldown. Older checker copies and curl clients keep using `hold=`. Updating the saved checker or repeating install enables the socket. `--once`, `--interval` and `--dry-run` retain their HTTP checks. The wait command below still exits when work is due. The socket endpoint is `GET /inbox/check` with a WebSocket upgrade. Raw clients can send the checker bearer in `Authorization`. The native Node client supplies the subprotocols `kotatsu-inbox` and its checker token; the server selects `kotatsu-inbox`. The token stays out of the URL. Invalid credentials return 401. An unavailable coordinator returns 503. Replacing or revoking the token, or stopping wakes, closes the persistent connection. ### Held poll `GET /inbox/check?hold=25` waits up to 25 seconds. A smaller integer hold is allowed. When work is due, it returns 200 with `waiting`, `tasks` (IDs and revisions), and `text`. An empty hold returns 204 with no body. During a move freeze, a held poll offers nothing and returns 204 when its hold ends. A 401 means the wake token must be replaced. Back off after network errors. Without hold, the check returns 200 with every pending task immediately. Unread changes are offered once, then at 1, 5, 20 and 60 minutes after the first offer. Reading through `task_get`, or writing the task, stops that revision's wakes. The taskHint still appears on other calls while unread. An owner's update also notifies the agent that created the task. ### Wait Run this as a background task that notifies you when it exits. In Claude Code, use the Bash tool's background mode. It exits 0 when work is due and 1 on a bad token. It exits 2 with a message if the folder is unset or its `wake-header` is unreadable. Then read `wake.json`, call `task_get` for each ID, and record progress with `task_update`. After handling the tasks, start the wait command again as a background task, and repeat after every wake. If your host cannot notify you when a background task exits, use command or none with a scheduled 15-minute check if available. ```sh test -n "$KOTATSU_WAKE_DIR" && test -r "$KOTATSU_WAKE_DIR/wake-header" || { printf 'Set KOTATSU_WAKE_DIR to your folder with a readable wake-header.\n' >&2; exit 2; } while :; do c=$(curl -sS -o "$KOTATSU_WAKE_DIR/wake.json" -w '%{http_code}' --max-time 40 -H @"$KOTATSU_WAKE_DIR/wake-header" "https://kotatsu.ai/inbox/check?hold=25"); case "$c" in 200) sleep 5; exit 0;; 204) sleep 2;; 401|403) exit 1;; *) sleep 5;; esac; done ``` ### Command For a local Claude Code or Codex agent, run this from the project folder that woken turns should use: ```sh npx kotatsu-connect --origin https://kotatsu.ai ``` For every account, the package connects the agent, installs a per-user macOS LaunchAgent or Linux systemd user service, records `command`, and sends one test wake. Its one-line result distinguishes a received test from a test that has not arrived. Windows wake setup is not supported yet. Use `--no-wake` to connect without wake setup. Repeating the command updates its own service. `npx kotatsu-connect remove --app codex --name work` stops only that connection's service and records `none` before removing its key. The package bundles its checker. It downloads no executable checker during setup. The checker and token stay in the selected connection's private `wake/` folder, with mode 700 on the folder and 600 on the files. Service arguments contain only Node and the checker path. Each service is bound to the approved origin, tenant and agent. The checker refuses redirects and passes only task IDs and revisions to its launcher. It sends no task text or token. `--launch ""` replaces the client turn with your host's launcher. That command receives the same fixed task-ID and revision prompt on stdin. It must route to a chat that uses this account's Kotatsu entry. Keep the command's credentials in its own private files. The remaining commands describe existing manual installations. Run install from the project folder that the woken turns should use. If Kotatsu is registered under another name, use `mcp__` instead of `mcp__kotatsu`. Use the Node checker installer below. It starts each changed task without waiting for other runs, from a per-user service that survives the setup session. Each run is stopped after 30 minutes (`--run-limit ` on install); a stopped task stays changed and is offered again. The checker log stamps each run’s start, exit and stop in UTC. For Codex, replace `claude -p --allowedTools mcp__kotatsu` with `codex exec -C /absolute/path/to/project -s workspace-write -c sandbox_workspace_write.network_access=true -c 'mcp_servers.kotatsu.default_tools_approval_mode="approve"'`. That setting lets woken Codex runs use the tools of the Codex entry named `kotatsu` without asking. Woken runs use the workspace-write sandbox with network access and keep your other approval settings. Use your entry's name if it differs, and keep the settings on the command line, never in your Codex config. If woken runs have no network, run install again with the same token file and this launcher; it replaces the old one. The setting needs Codex 0.122.0 or later; older versions ignore it. If the name matches no entry, Codex stops with "invalid transport". ### Node checker and custom launchers Prefer the Node checker. It passes only the fixed task ID and revision prompt, keeps per-task locks, and backs off on failures. Download it with Node 22 or later. Save the raw wake token privately to `checker-token` in your folder with mode 600, using its full path. Set `KOTATSU_WAKE_DIR` to that same full path before running this block. ```sh umask 077 mkdir -p "$HOME/.config/kotatsu" chmod 700 "$HOME/.config/kotatsu" curl -fsS https://kotatsu.ai/inbox/checker.mjs -o "$HOME/.config/kotatsu/inbox-checker.mjs" node "$HOME/.config/kotatsu/inbox-checker.mjs" --token-file "$KOTATSU_WAKE_DIR/checker-token" --once -- claude -p --allowedTools mcp__kotatsu ``` The Claude launcher allows only tools from the MCP server named `kotatsu`. The checker sends the task prompt on stdin; do not add a positional prompt after `--allowedTools`. After approval, run this in the foreground and report its one output line: ```sh node "$HOME/.config/kotatsu/inbox-checker.mjs" install --token-file "$KOTATSU_WAKE_DIR/checker-token" --hold 25 -- claude -p --allowedTools mcp__kotatsu ``` Install writes a private LaunchAgent on macOS or a systemd user service on Linux, preserves the current working directory and launcher arguments, and starts it. On Linux it checks and enables linger for the current user, so the user manager survives logout and starts at boot. If the system refuses this step, install reports the owner action instead of readiness. It prints `ready` only when Kotatsu sees a live held poll carrying this install's unique marker. A PID or an immediate HTTP 200 does not count. The wake-token-authenticated `GET /inbox/check?ready=` reports this signal without returning tasks or granting MCP access. It becomes false when that held poll closes. Old checkers without markers keep working. If install prints `not ready`, report the reason and the owner action it names. Run it from the owner's login session with permission to manage user services. If neither service manager exists, install uses `setsid` and reports that the detached checker will not survive a reboot. Repeating install replaces the service for the same agent and host. The private checker copy, token copy and log are under `~/.config/kotatsu/ai.kotatsu.checker./`. Existing manual service files and checker flags keep working; install does not change those services. The service reads its token copy, so another setup cannot replace its wake. Old installed services keep their old token path until this installer runs again. Install preserves supported client configuration paths and proxy settings. It does not copy credentials from the shell environment into service files. If the launcher relies on model API keys or cloud credentials in environment variables, install reports `not ready`. Use the client's stored login or a private launcher that loads those credentials, then repeat install. For an existing manually managed checker, use `--hold 25` instead of `--once`. The checker first tries the wake socket. Its fallback hold loop logs a 401 once and retries every 5 minutes. The once check exits 1 on a 401. The checker accepts integer `--hold` values from 1 to 25; anything else exits 2. In fallback mode, it waits at least 5 seconds after a 200 and starts held polls at least 2 seconds apart. Network errors, timeouts, bad JSON, and server errors retry with jitter from 2 to 30 seconds in fallback held mode. Interval mode keeps its 1-to-30-second retry range. HTTP 401, 403, and 410 log once and retry every five minutes. Loop modes keep running on failures. A held request times out after the hold plus 20 seconds. Existing `--interval 5` checkers still work. Add `--dry-run` to a unit's arguments to check its token without a wake. It reads `--token-file` and uses the origin saved in the unit's environment. It ignores the command, `--hold`, `--interval`, and `--once`, makes one check without hold, and creates no lock. It prints only the HTTP status, waiting count, and origin (scheme and host), or the error kind. It exits 0 on 200, 1 on failure, and 2 for a bad or missing token. For another host on macOS, use `--app other --launch` instead of writing a LaunchAgent by hand. Use an existing private launcher that reads the fixed prompt from stdin and routes it to the host's chat for this Kotatsu account. The dashboard launcher is available at `/inbox/host-launcher.mjs`. Run it with `--chat ` and `--host-api `. Without `--host-api`, it looks in `~/.local/share/kotatsu/host-api` first. The adapter exports `hostApiRuntimeRegistryDir`, `hostApiRuntimeInstanceKey`, `isValidRuntimeIdentity`, and `sendHostApiRequest`. Select a runtime with `KOTATSU_HOST_INSTANCE_KEY` or `KOTATSU_HOST_DATA_DIR`. For a manually managed checker, set `KOTATSU_ORIGIN` and use a private `--token-file`, or supply `KOTATSU_CHECKER_TOKEN` in its environment. New services save `KOTATSU_ORIGIN` and keep the token in its private file. The host selects the chat and supplies its routing command: ```sh npx kotatsu-connect --origin https://kotatsu.ai --app other --name dashboard --launch '/absolute/path/to/private-wake-launcher' ``` Add the printed MCP address and header helper to that host. A test wake is confirmed only after the host reads and closes its test task. If the launcher has not done that within five minutes, setup reports that the test has not arrived and keeps the service for diagnosis. For Claude Code, install the checker at login on macOS with launchd. Replace the Node and Claude paths with the output of `command -v node` and `command -v claude`. Save this as `~/Library/LaunchAgents/kotatsu-inbox.plist`. Replace `TOKEN_PREFIX` with the setup folder name: ```xml Labelkotatsu.inbox ProgramArguments/opt/homebrew/bin/node/Users/AGENT/.config/kotatsu/inbox-checker.mjs--token-file/Users/AGENT/.config/kotatsu/TOKEN_PREFIX/checker-token--hold25--/Users/AGENT/.local/bin/claude-p--allowedToolsmcp__kotatsu RunAtLoad KeepAlive ``` ```sh mkdir -p "$HOME/Library/LaunchAgents" launchctl bootstrap "gui/$(id -u)" "$HOME/Library/LaunchAgents/kotatsu-inbox.plist" launchctl print "gui/$(id -u)/kotatsu.inbox" ``` On Linux, save this as `~/.config/systemd/user/kotatsu-inbox.service`. Replace the Node and Claude paths with `command -v node` and `command -v claude`, and `TOKEN_PREFIX` with the setup folder name: ```ini [Unit] Description=Kotatsu inbox checker [Service] ExecStart=/usr/bin/node %h/.config/kotatsu/inbox-checker.mjs --token-file %h/.config/kotatsu/TOKEN_PREFIX/checker-token --hold 25 -- /home/AGENT/.local/bin/claude -p --allowedTools mcp__kotatsu Restart=always [Install] WantedBy=default.target ``` ```sh systemctl --user daemon-reload systemctl --user enable --now kotatsu-inbox.service systemctl --user status kotatsu-inbox.service ``` Confirm the service is active and that a test task given to the agent starts it. Agents that can't run a checker use `none` and check on their next Kotatsu call. For setup, see `/start`. `noSourceReason` is one of `owner-request-in-current-session` (the default), `sorter-organization`, `legacy-uncited`, or `not-applicable`. Each task update carries its UTC time in ISO 8601 form. Pages written before this change keep their date-only lines. Write receipts include `waitingOnOwner` with its `since`, `update` and, on new memory, `ask`, or null. `waitingOn` lists agent names, page links and dates, and is left out when there are none; an owner wait shows as `waitingOnOwner`. `task_list` returns, for each task, `state` (`open`, `done`, or `dropped`), `closedAt`, `lastUpdatedAt`, `latestUpdate` as `{ at, text }`, and `waitingOnOwner` as `{ since, update }` (with `ask` on new memory) or null. It lists the tasks waiting on the owner first, then the last update first. `done: true` returns the done and the dropped tasks. `waitingOnOwner` true needs `ask` on new memory (see Asking the owner), or on old memory the update of the same call, which says what the owner must do. Omitting `waitingOnOwner` keeps the question and its original time, including on quiet updates. `waitingOnOwner` false clears it. `close` "done" needs `completionProofIds`; `close` "dropped" needs no proof and its update gives the reason. `done` true is the same as `close` "done", and `done` false opens the task again. A closed task is never waiting on the owner. `done` and `dropped` are finished states. Closed task pages stay in `Tasks/`. Reopening a task changes its status in the same page. Before an agent starts a connection, it checks the provider's official connection methods and full API. It chooses OAuth sign-in or approval first, then API key or MCP, then another supported method, unless the person asks for a specific method. It includes every capability the person wants, the full API by default, and does not choose a read-only subset without that request. Agents add integrations with `integration_propose`. The tool returns a link to the proposed card under **User connections** on **Connections**. The owner approves and connects from the card. The optional `summary` is the card's short line, such as "Bases, tables, and records"; Kotatsu leaves out a line that does not fit and returns a `warning` with the reason. An API manifest can name an account or workspace and its connection fields with `connection`. Every approved agent can call every integration of its Kotatsu account; there are no per-agent grants. A call needs a verified account whose last test pinned the current base URL origin. Kotatsu applies an hourly call budget to some integrations. The default is 300 calls per account. Kotatsu stores the request and response as a proof with the source `integration-`, and returns the proof ID. Kotatsu adds no approval for money movement. Link and Mercury handle money approvals. A proposal from an agent waits as a pending card until the owner approves it and connects it. A task agent can archive a connected key, remote MCP or Composio card, or a built-in provider with one card, such as Slack. Use `integration_archive` with a reason. The card stops working for every agent at once. One agent can archive 5 cards an hour. Google Workspace, Plaid, Retell, PostHog and pending cards are unavailable to this tool. On **Connections**, **Remove** archives a Google account and stops all Google cards for that account. The owner can restore a card from **Archived** within 30 days, or use **Delete now**. The daily sweep deletes expired cards and their stored keys. It removes Composio accounts at Composio and revokes Slack, Notion and GitHub OAuth credentials. Plaid live reads require the owner to turn the agent on under **Connections → Plaid**. A live read saves a call receipt and returns bank rows in the reply. When Sync is on, Kotatsu saves synced accounts, balances and transactions as raw items. Turning Sync off keeps the saved data. X is the built-in integration `x`, available to every account. The owner enters four X app keys under **Connections → X**. The read calls are `x_get_me`, `x_search_posts`, `x_get_user`, `x_get_user_posts`, `x_get_post`, `x_get_home_timeline`, and `x_get_mentions`. `x_create_post` is `send` and asks the agent to ask the owner before posting on their behalf. See [the X connection details](integrations.md) for permissions, pagination, plan restrictions and error handling. No X Sync, schedule or wake is added. When Beta updates and `KOTATSU_PASSWORD_HELPER` allow it, `password_ticket` pairs a password helper for the calling agent alone. It requires task access and the `task_write` capability. Input is `{machine?: string}`. A machine name has 1 to 80 characters after trimming and no control characters. The reply contains `{ticket, expires_at, origin, command}`. Run `command` in your own shell. Never save the ticket in a page, task or memory. A ticket has the format `kpt1..<64 lowercase hex>`. Kotatsu stores only its hash with the agent, expiry, and optional machine name. It expires after 10 minutes and is consumed on the first well-formed redemption attempt. Each agent can issue ten per rolling hour. A limited reply is an error result with `{code: "rate_limited", retry_after}` in seconds. A revoked agent cannot issue or redeem tickets. An agent that no longer has task access cannot redeem a ticket. `POST /helper/pair/ticket` takes `{ticket, machine, signing_key, encryption_key}` and returns 201 `{device_id, agent_ids: []}`. Unknown, used, and expired tickets return 401 `ticket_invalid`. The route refuses Authorization, owner sessions, and device headers. Same-machine rekey requires the same agent set, so pairing cannot replace another agent's device. Owner approval links remain available. The helper gets no access to your Kotatsu. It only receives the passwords these agents use. The same helper beta and task access enable `password_list`, `password_save`, and `password_request`. `password_list` takes no input and returns `{items, checked_at}` with live item ids, names, kinds, notes, websites, source types, field names and types, revisions, and update and last-use times. The `checked_at` time is the last successful vault list, or null if none is known. A skipped or failed sync adds `stale` with `interval`, `daily_lookup_cap`, `budget`, `rate_limited`, or `source_unavailable`. The saved list remains available. Uses accept an exact original 1Password title as well as an id or name; duplicate titles return `ambiguous_item` with matching names. It has no log or rate limit. When the live lookup switch allows, it first checks the linked 1Password vault for new items, at most once every 5 minutes, and a request or save that names an item Kotatsu doesn't know checks it at once. When Kotatsu follows the vault, an item deleted or archived there is left out of lists, and renamed items and fields take their new names. An item waiting on 1Password carries `waiting: true`; every other item has no `waiting` field. A waiting item can't be used yet; use another item or tell the owner, and never add it again. `password_save` takes `{item?, name?, kind?, note?, websites?, source?, fields?, remove_fields?, expected_revision?, purpose?}` and returns `{id, name, kind, source, revision}`. It adds without `item`. For a change, `item` names the live item whose id is exactly that text; otherwise the one live item whose name equals it, ignoring case; otherwise the store answers `unknown_item`. Names are unique ignoring case, so an id wins if an id and name both match. A `#` in `item` is refused and logged after resolving only the text before it. Changes cannot set kind or source. Values supplied in `fields` pass through the chat, and stored values are never shown back. Each agent has 30 saves per rolling hour. `password_request` takes `{url, method?, headers?, body?, content_type?, purpose}` and returns `{status, headers, body, scrubbed}`, or `{status, location_origin, scrubbed}` for a redirect. HEAD has no body. Templates `{{kotatsu:REF}}` go only in query values, header values, and the body. All templates name one item and are all bare or all name fields. Kotatsu uses the platform's public-destination boundary and global fetch only. It refuses its own hosts, private address literals, local hostnames, explicit ports including `:443`, encoded templates, and non-HTTPS URLs, and never follows redirects. Allowed methods are GET, POST, PUT, PATCH, DELETE, and HEAD. GET and HEAD have no request body. Host, Cookie, Content-Length, Transfer-Encoding, Connection, and Proxy-Authorization request headers are refused. Header values and `content_type` must be ASCII and cannot contain CR, LF, or NUL. The body bound is 65,536 UTF-8 bytes before filling, counting bytes outside templates plus 16,384 bytes per template; `purpose` has 1 to 200 characters. The store checks the item's websites. Each agent has 60 requests per rolling hour, with a 10 second timeout, at most 128 KiB of scrubbed reply body, and a 4 MiB raw read backstop. Replies keep only Content-Type, Retry-After, and WWW-Authenticate headers, scrub while reading, stop and cancel once the scrubbed body exceeds the cap, and cut the body to 128 KiB with `body_truncated: true` when needed. Raw reads over 4 MiB answer `provider_failed`. Scrubbing covers raw, base64, Basic, hex, JSON Unicode and slash escapes, HTML entities, percent encodings, Latin-1, and UTF-16 forms. Short values and OTP codes use raw scrubbing only, best effort. Every save and request, including a refusal, is logged. A refusal is an error result with `code` and, on 429, `retry_after` in seconds. With Beta updates on, `ssh_access` lets a task agent register its own ed25519 public key, read its On computers, or withdraw its key. Get `agentId` from `whoami` and use `~/.ssh/kotatsu_agentwork__ed25519` for your key file. The private key stays on the runner. Register with the node id and addresses from `tailscale status --json`. Replacing a key turns that agent’s switches Off. Only the owner can turn a switch On after adding a computer. The reply to `read` includes the host keys and SSH command for `agentwork`. Save the host keys and keep host key checking on. Off stops new sign-ins. Existing sessions can continue. Removing SSH setup ends `agentwork` processes. Agents on one runner share network access and use separate keys. If your old key matches your registration, rename `~/.ssh/kotatsu_agentwork_ed25519` and its `.pub` file to the new names. No new registration is needed. With Beta updates on, task agents use `tailscale_join` to connect their own machine. The owner sets up an OAuth client on Connections once, with Auth keys write and only `tag:agent`. Join the machine you run on to the owner's Tailscale as an agent machine. No owner approval is needed. 1. Run `tailscale status --json` and `tailscale switch --list`. If the machine is signed in or any account is listed, stop and tell the owner. Never sign it out or switch accounts: it may be the owner's own computer. 2. Call step key with machine, a short name. Set wipes_itself only for a machine that loses its Tailscale state when it restarts. 3. Write join_key to a file only you can read, run the command for your system from the reply, then delete the file. Never print, save or log the key. 4. Call step report with machine, backend_state, tags (Self.Tags) and tailnet (MagicDNSSuffix) from `tailscale status --json`. Do what next says. Never add --ssh, routes or exit nodes. Step `key` makes one join key with the owner's OAuth client. The key works once, expires in one hour, is preauthorized, and carries only `tag:agent`; `wipes_itself` sets `ephemeral`. Kotatsu refuses and keeps back a key whose capabilities differ from that request. The reply holds `join_key`, `expires_at`, the `macos` and `linux` commands, and `next`. Kotatsu keeps only the key id and writes a `tailscale_join_key` audit event for each key it makes or fails to make. The agent never sees the OAuth client secret. Kotatsu makes at most ten keys per rolling hour for the account (`rate_limited` after that) and lists at most 50 machines. A timeout or unknown outcome must not be retried. The machine name uses lowercase letters, digits, and dashes, up to 63 characters. Another live agent's machine name is refused. Step `report` needs a key or row for that machine from the same agent. It uses `machine`, `backend_state` (BackendState), `tags` (Self.Tags, empty when absent), and `tailnet` (CurrentTailnet.MagicDNSSuffix, with the legacy MagicDNSSuffix fallback). Running with `tag:agent` joins the machine. Running without it, Stopped, InUseOtherUser, NeedsMachineAuth and a different tailnet are problems with their own `next`. NeedsLogin, Starting and NoState answer `waiting`. The first joined report pins a hash of the suffix; later machines on another suffix show a different-tailnet hint. Suffix comparisons ignore case and one trailing dot. Kotatsu does not read the tailnet policy and cannot see devices. Key rows expire with the key, problem rows after 24 hours. Forgetting the last machine clears the pin. All join state is excluded from coordinator backups. The agent setup and by-hand steps are in `docs/runbooks/tailscale-agent-keys.md`. Shopify is a built-in integration with the ID `shopify`. The owner connects it with a Shopify Catalog client ID and secret; see `docs/runbooks/shopify-catalog.md`. `shopify_search_catalog` and `shopify_get_product` read Shopify's Global Catalog. `shopify_create_cart`, `shopify_update_cart`, `shopify_create_checkout`, and `shopify_get_checkout` take a `shop` domain and call that store's UCP server. Kotatsu accepts only an endpoint on the shop's host or on `*.myshopify.com`. The live reply keeps the checkout's `continue_url`, which the agent gives to the owner; the stored proof masks it. The owner pays in Shop Pay. Kotatsu refuses `checkout.payment` and has no call that pays. Every call names Kotatsu's agent profile at `/ucp/agent-profile.json`. A Composio app (`{"shape":"composio","toolkit":""}`) runs one Composio toolkit through Kotatsu's Composio project. It is available only when the Worker has `COMPOSIO_API_KEY`. It offers managed OAuth and the key schemes `API_KEY`, `BEARER_TOKEN`, `BASIC`, and `BASIC_WITH_JWT`. At Connect, Kotatsu reuses an enabled auth config for the app or creates one. Composio's hosted page collects the credentials. Key apps need defaults for all required auth-config creation fields. `integration_describe` lists the pinned actions, and `call` returns one action's argument schema. `integration_call` takes the action slug as `call`. Kotatsu derives the Composio user from the Kotatsu account, checks that Composio still lists the connected account for that user before each call, sends the pinned tool version, and stores a `composio-call` proof. Composio limits answer `integration_unavailable` with `rate_limited` or `quota_exhausted`; an expired sign-in answers `sign_in_required`. The "Stop all key use" switch refuses Composio calls and connections. `raw_facets` groups the raw index by one `field`: `source`, `month`, `sender`, `domain`, or `recipient`. The mail fields come from the From, To, and Cc headers; `month` is the mail Date month or else the observed month. The optional `query` counts only the items that `raw_search` would match, and the optional `source` counts one source. The result holds `field`, `query`, `source`, `rows` of `{ value, count }` largest first, `more`, and `limit`. The counts cover retained indexed source records, including historical records. The `account` input of `connection_health`, `raw_search`, `source_search`, `source_list`, and `source_read` names one connected account of a source by its label or email. Without it, every account of the source answers, and each row names its `account`. Raw search also covers retained historical evidence; a null account can mean an upload or an account that no longer resolves. The accounts belong to the tenant of the token, so an agent never names or reads an account of another tenant. An account that the tenant does not hold answers `unknown_account`. The `account` input of `integration_call` names an account of the integration instead. A read tool returns at most 50 rows by default and 200 at most. One proof or one passthrough body returns at most 128 KiB. `proof_get` caps text at 64 KiB and base64 bytes at 128 KiB; continue at `nextOffset` using `returnedBytes` until `capped` is false. One page text is at most 64 Ki characters. ### Stop wakes Ask the owner before stopping or removing a setup. To stop email wakes, call `agents_self_setup` with `wake_method: "none"`. Email wakes have no local process to stop. For `wait`, stop your background task. For `command`, stop and remove only your own checker using the method that installed it. An already woken turn may continue. Several agents can share one machine; never touch another agent's checker, plist, unit or folder. An email recipient can also use the Stop email wakes link in any confirmation or doorbell, or the mail app's unsubscribe action. The link stops that inbox across all Kotatsu accounts. Opening the link shows a confirmation button; it sends no mail and stops nothing until the recipient confirms. Hard bounces and spam complaints also stop email wakes for the inbox. Set `KOTATSU_WAKE_DIR` to your own setup folder as above. Derive the installed checker's label from that folder's public token prefix and this Kotatsu host, without reading a token. Run the applicable stop command and removal in that same shell: ```sh test -n "$KOTATSU_WAKE_DIR" && test "$(dirname "$KOTATSU_WAKE_DIR")" = "$HOME/.config/kotatsu" || { printf 'Set KOTATSU_WAKE_DIR to your own setup folder.\n' >&2; exit 2; } KOTATSU_CHECKER_LABEL=$(node --input-type=module -e 'import { createHash } from "node:crypto"; const prefix = process.argv[2]; if (!/^kgi1\.[A-Za-z0-9-]+\.[0-9A-HJKMNP-TV-Z]{26}$/.test(prefix)) process.exit(2); process.stdout.write("ai.kotatsu.checker." + createHash("sha256").update(process.argv[1] + ":" + prefix.slice(5)).digest("hex").slice(0, 16));' "https://kotatsu.ai" "$(basename "$KOTATSU_WAKE_DIR")") || exit 2 KOTATSU_CHECKER_DIR="$HOME/.config/kotatsu/$KOTATSU_CHECKER_LABEL" ``` macOS LaunchAgent: ```sh launchctl bootout "gui/$(id -u)/$KOTATSU_CHECKER_LABEL" && rm -f "$HOME/Library/LaunchAgents/$KOTATSU_CHECKER_LABEL.plist" ``` Linux user service: ```sh systemctl --user disable --now "$KOTATSU_CHECKER_LABEL.service" && rm -f "$HOME/.config/systemd/user/$KOTATSU_CHECKER_LABEL.service" && systemctl --user daemon-reload ``` Leave user linger enabled; other services may need it. Detached start: check the PID against your checker's path before stopping it. If it belongs to another process, keep the folders and inspect the install. ```sh KOTATSU_CHECKER_PID=$(cat "$KOTATSU_CHECKER_DIR/checker.pid") || exit 1 case "$KOTATSU_CHECKER_PID" in ''|*[!0-9]*) exit 1;; esac test "$KOTATSU_CHECKER_PID" -gt 1 || exit 1 case "$(ps -p "$KOTATSU_CHECKER_PID" -o args=)" in *" $KOTATSU_CHECKER_DIR/checker.mjs --token-file $KOTATSU_CHECKER_DIR/checker-token "*) kill -TERM "$KOTATSU_CHECKER_PID";; *) printf 'PID is not this agent checker; keep the folders and inspect the process.\n' >&2; exit 1;; esac ``` After your command checker stops, remove only its service folder and your setup folder. Keep `~/.config/kotatsu` and its shared scripts for other agents. ```sh rm -rf -- "$KOTATSU_CHECKER_DIR" "$KOTATSU_WAKE_DIR" ``` For wait, after stopping the background task, remove only your setup folder: ```sh test -n "$KOTATSU_WAKE_DIR" && test "$(dirname "$KOTATSU_WAKE_DIR")" = "$HOME/.config/kotatsu" || exit 2 rm -rf -- "$KOTATSU_WAKE_DIR" ``` To turn wakes off on Kotatsu's side, call `agents_self_setup` with `wake_method: "none"`. This deletes your wake token, removes your email wake and pending confirmation. It does not stop a local process. Use your Kotatsu host instead of `https://kotatsu.ai` if it differs. For a custom launcher, also stop its own LaunchAgent: ```sh launchctl bootout "gui/$(id -u)/kotatsu.inbox" && rm -f "$HOME/Library/LaunchAgents/kotatsu-inbox.plist" ``` ## Add your own integration 1. Call `integration_list` and check existing entries, including pending cards. 2. Read the service's official methods and coverage. Use the person's chosen method; otherwise prefer compatible OAuth, then API key or MCP. Cover the full API by default, including writes. Read the [remote MCP runbook](runbooks/remote-mcp.md) or [Composio runbook](runbooks/composio.md) when choosing that route. 3. Propose once with one card per service. For REST, give the primary address and up to eight additional official addresses, up to 250 named calls, the published OpenAPI or Swagger JSON description when available, and a safe GET test. Generated actions stop at 1,000; inspect `api.actions` and `api.unlistedHosts`, then use `request` for omitted methods at confirmed addresses. Read the returned checks before giving the owner one focused action at the card link. 4. After "Done", call `integration_list` for the intended service and account, then `integration_describe`. Describe the selected call too when `argsOmitted: true`. Run the saved safe test when available, then the first useful operation the owner requested. Use the actual call schema; there is no universal `test` call. 5. Say Connected only after that operation works with the expected status and required payload fields. Remote MCP must also have no upstream `isError`; Composio must report app success. For media, complete upload, run, bounded polling, and fetch. Otherwise say Ready for owner, Blocked by provider setup, or Failed at the named stage. Recovery rules: - `sign_in_required`: stop and give the owner one sign-in or key action at the focused card. - `account_unverified`: show the saved test and failure reason, then give the owner the card test or missing prerequisite once. - `address_unconfirmed`: give the owner the exact card Confirm step; never send the key through another host. - Invalid input or unknown call: describe the call schema and correct once before rebuilding a working connection. - 401: follow the authentication recovery; a path-specific 403 needs a scope or key-permission check for that operation. - `composio_setup_required`: Composio cannot connect this app with the offered sign-in methods. Choose another offered app or a documented direct REST alternative. - Approved-app-only OAuth: do not repeat registration or consent; choose the documented API-key or bearer alternative, or report the provider setup block. - `uploadNotice` or an empty required field: stop before generation and send one `feedback_submit` when available with the goal and diagnostic reasons. - Rate limits: report the limit and follow the provider's bounded retry delay. - Quota limits: stop and report the limit; do not retry until the owner frees space, adds credits or the quota resets. - Ambiguous write timeout: check the provider outcome before retrying the write. Read [Build a Kotatsu connection](integrations.md) for full manifests and safe GET examples. Binary proofs have owner-only download links; such a link alone does not prove that an agent fetched the requested result. ## Connect a client ### Claude Code Claude Code pairs: see [Pair Claude Code and Codex](#pair-claude-code-and-codex). Use the OAuth steps here only when this computer has no Node 22 or later, the owner can't install it, and the owner can approve in this computer's browser. ```bash claude mcp add --scope user --transport http kotatsu https:///mcp ``` Follow `/start` before adding the server. Ask once for the whole setup before machine and account changes. In a new Claude Code session, run `/mcp` and choose **Authenticate**. The browser opens Kotatsu, you sign in with your Google account, and you approve the agent with one button. The approval grants the `task` level. Claude Code stores the tokens and refreshes them on its own. Do not pass a token with `--header`. An access token expires after 15 minutes, so a pasted header stops working in the middle of a session. The OAuth sign-in steps refresh OAuth tokens. Pairing uses a private key file and a header helper. ### Codex Codex pairs: see [Pair Claude Code and Codex](#pair-claude-code-and-codex). Use the OAuth steps here only when this computer has no Node 22 or later, the owner can't install it, and the owner can approve in this computer's browser. Follow `/start` before adding the server. Ask once for the whole setup before machine and account changes. Run `codex mcp add kotatsu --url https:///mcp`, then `codex mcp login kotatsu`. Keep login running until approval returns. ### Pair Claude Code and Codex Claude Code and Codex pair by default, even on the owner's own computer. OAuth approval goes back to localhost on the device the owner approves from, so it fails when the owner approves elsewhere. For remote Claude Code or Codex, ask once for the whole setup before downloading, pairing, or replacing an older `kotatsu` entry. With Node 22 or later: ```sh umask 077 mkdir -p "$HOME/.config/kotatsu" chmod 700 "$HOME/.config/kotatsu" curl -fsS /agents/pair.mjs -o "$HOME/.config/kotatsu/pair.mjs" chmod 600 "$HOME/.config/kotatsu/pair.mjs" node "$HOME/.config/kotatsu/pair.mjs" --app claude --name "" --wait 0 ``` Replace `` with the agent's Kotatsu name, `name · application · machine`. An application's name is never the agent's own name. Use `--app codex` for Codex. Use OAuth for Claude Code or Codex only when this computer has no Node 22 or later, the owner can't install it, and the owner is at this computer's browser. These commands need network access and write to `~/.config/kotatsu`, and to `~/.codex` for Codex; if a sandbox blocks them, ask to run them outside it. The first run prints the link and returns at once. Give the owner the printed link and code. Approval works on any device. Then run `node "$HOME/.config/kotatsu/pair.mjs" --app claude` or `node "$HOME/.config/kotatsu/pair.mjs" --app codex` to wait for approval. If the command stops before approval, run it again to continue the same request. After it connects, if the tools aren't available in this session, the agent calls them with pair.mjs call. If a network error or a 30 s timeout prevents a reply, the tool call may have run, so read the current state before you retry a change. The default wait is 90 seconds; `--wait ` allows up to 900. Exit 2 means approval is still pending. Transient network failures, HTTP 429 and server errors keep the saved request. When a key is saved and no request is pending, the run first checks the key with one MCP `ping` that waits at most 5 seconds. If Kotatsu refuses the key, the same run requests a new link and code, and the old key stays until the new approval replaces it. A run can last that check, the wait, and one 20-second poll timeout. Exit 1 means the request was denied, expired, unsafe, the saved-key check couldn't reach Kotatsu or got an unexpected answer, or a client configuration step failed. A saved key remains available after a client refusal; rerun after fixing the client policy or version. The script stores pending requests and keys under `~/.config/kotatsu//` with folder mode 700 and file mode 600. Claude Code uses `headersHelper`; Codex uses `http_headers_helper` in its `config.toml`. Both commands use absolute paths for Node and this script. `node pair.mjs headers --app claude|codex` trades the key at `/agents/pair/token`, keeps the tokens in `token.json` beside the key (mode 600), renews them with the refresh token, and trades the key again when renewal fails. It writes only a JSON header object with the short-lived access token for the client. If Kotatsu refuses the key, it says to pair again. Keep that output out of chat and logs. The key never goes into a CLI config. A disabled or unsupported helper has no static-header fallback. The owner can revoke the key on the Agents page. ### Claude Desktop Add the same URL as a custom connector in **Settings → Connectors**. The same approval page opens in the browser. ### Any other client The server needs nothing beyond standard discovery. Point the client at `https:///mcp`. A client that follows the `WWW-Authenticate` header of the 401 finds the metadata, registers itself, and runs the code flow. ## Revoke a client Open the **Agents** page at `/agents` and revoke the agent. The next MCP call of that agent is refused. A refused call of a revoked or unknown agent also ends that agent's OAuth grant, so its client can no longer refresh and asks the owner to connect again. Every refusal answers 401 with a JSON body `{ "status": "error", "reason", "message", "fix" }`. `reason` is a code such as `agent_revoked` or `agent_expired`. `message` says in plain words what happened, and `fix` names the step the agent can take by itself: the OAuth sign-in at `/mcp` for an OAuth token, or the pairing request at `/agents/pair/request` for a pairing key. Each path needs only the owner's usual one-tap approval. ## Pairing keys and browser calls An agent can start pairing at `/agents/pair/request` and receive a `kgp1` key after the owner approves the request. Kotatsu stores its hash. The key works until the owner revokes the agent or until 90 days pass without a call; each authenticated call moves that date forward. The key is an exchange credential. The agent sends `POST /agents/pair/token` with the header `Authorization: Bearer ` and receives the same tokens an OAuth client gets: an `access_token` that lives 15 minutes, a `refresh_token` with the 90-day sliding life, and `client_id` `kotatsu-pairing` for the refresh at `/oauth/agent/token`. Kotatsu keeps the newest three exchanged token sets per key and revokes older ones, so sessions that share a key keep working. When a refresh answers `invalid_grant` or a call answers 401, the agent trades the key again; the reply's `fix` says so. No owner step is needed while the key is valid. Too many calls from one address answer 429 with a `fix` that says when to try again. Until December 10, 2026 the key itself also works as a bearer token on `/mcp` and `/doctor`. From that date such a call answers 401 with the reason `pairing_key_exchange_required` and a `fix` that names the exchange call. The key still exchanges after that date; only an agent idle for 90 days or a revoked agent must pair again, with the owner's usual one-tap approval. For agents whose vault can fill browser forms but cannot set HTTP headers, `/agents/call` accepts `kgp1..` as a username and `key_secret` as a password. Each submission runs one MCP tool call, or lists tools when the tool is blank. A form may be up to 640 KiB, so the largest picture fits even when base64 characters need percent encoding. The form has no session cookie and does not retain or display the password. The owner approves each pairing by hand. There is no owner mint-a-token button. ## Out of scope - **No SSE stream and no server-initiated message.** The endpoint answers one JSON object for each POST. - **No MCP prompts.** The server also serves the integration guide as the resource `kotatsu://docs/integrations`. - **Tenant isolation.** One Worker serves independent tenant brains. An agent uses separate accounts or deployments to connect to multiple brains. - **Source reads run through Kotatsu.** No agent holds a source credential. No source token reaches an agent. A passthrough tool returns a captured body. ## Proof A local run on 2026-09-22 drove the whole journey against `wrangler dev test/e2e/dev-entry.ts`: discovery, dynamic client registration, the PKCE code flow, the owner approval at level `read`, the token exchange, and then `initialize`, `ping`, `tools/list`, and `tools/call`. ``` GET /.well-known/oauth-protected-resource/mcp 200 resource + authorization_servers GET /.well-known/oauth-authorization-server 200 S256, the three endpoints POST /mcp no token 401 WWW-Authenticate names the metadata POST /oauth/agent/register 201 client registered GET /agents/authorize 302 to the approval page POST /agents/approve permission=read 303 state echoed, one-time code POST /oauth/agent/token 200 bearer, expires_in 900 POST /mcp initialize 200 kotatsu 0.1.0, protocol 2025-06-18 POST /mcp ping 200 {} POST /mcp tools/list 200 24 tools POST /mcp tools/call connection_health 200 isError=false POST /mcp tools/call task_create 200 isError=true, permission_denied POST /mcp wrong token 401 invalid_token GET /mcp 405 POST only ``` `node scripts/verify-local.mjs` runs the repository's own version of this journey and writes sanitized evidence. `docs/runbooks/e2e.md` runs it against a deployed host. ## Retired tool names A name leaves `RETIRED_TOOLS` 90 days after its last recorded call. Tool calls refuse unknown top-level arguments. The error names each unknown key, gives its current name when known, lists the current arguments and gives the owner the client refresh step only for arguments that the same tool once served. Other unknown arguments get no out-of-date sentence or refresh step. Removed owner_statement_upload arguments such as subject and edit are refused. Valid plain-text statements still work.