# mcpx — full text (levels 1–2) Every level-1 and level-2 page of the mcpx book, concatenated. The compendium is in llms-compendium.txt; deeper pages are listed under ## Optional in llms.txt. --- # mcpx — for agents mcpx is code mode for MCP: every MCP server behind one daemon, driven by scripts instead of schemas. This page is the agent twin of the mcpx home page. Every other page of the book has a twin beside it at `.html.md`; `llms.txt` indexes them all and `llms-full.txt` concatenates levels 1–2. ## Install mcpx (one-shot procedure) You are an agent setting mcpx up on this machine. Do these steps in order; stop and report if a step fails. 1. **Install the latest mcpx.** The channel that exists today is nix: ```sh nix profile install github:developing-today/code#mcpx ``` (No nix? The other channels — container, release installer — and their current status are on the install page: `install.html.md`. Do not invent a download URL.) 2. **Verify — the version guard.** Run: ```sh mcpx --version mcpx doctor ``` `mcpx doctor` diagnoses the installation and says what to do about each failed check. The docs inside the binary always match the installed version: if anything on this page or any twin disagrees with `mcpx help`, prefer `mcpx help` — that preference is the version guard, and it is why this prompt never pins a version. 3. **Wire mcpx into your harness.** - **opencode** (full wiring): copy the plugin from the repository checkout of developing-today/code: ```sh mkdir -p ~/.config/opencode/plugin cp -R pkgs/mcpx/plugin/opencode/mcpx-session.ts pkgs/mcpx/plugin/opencode/mcpx ~/.config/opencode/plugin/ ``` `mcpx/` must stay a subdirectory of `plugin/`. The plugin finds the daemon over its unix socket and needs no mcpx binary on its own machine, but a daemon must be running somewhere; enable its tools with `MCPX_PLUGIN_TOOLS=1` (or `tools: true` in the plugin config) and its guidance with `instructions: true`. - **Any other harness:** run mcpx as an MCP server. Point the harness's MCP configuration at mcpx (the daemon autostarts on first use); per-harness adapters beyond "run mcpx as an MCP server" are not written yet. 4. **Confirm the loop works:** ```sh mcpx ls ``` Then drive servers with the loop — `ls` / `search` / `types` / `run` | `exec` — as `AGENTS.md` in the repository and the twins of the CLI and exec pages (`cli.html.md`, `exec.html.md`) describe. --- # Archive Where retired entries go. `docs/release-runbook.md` says never to delete a feature entry: either strike its heading through and set `status: retired`, or move the whole entry here and leave a one-line stub in the feature list pointing at it. Heavy refactors move the old text here too. This file is **append-only and unordered**. It is not a changelog and nothing reads it in sequence; it exists so that a question about why something was removed has an answer that is still in the tree, rather than only in a squashed commit message. An entry keeps the key block it had when it was live, plus the reason it was retired and what replaced it. It is empty because nothing has been retired yet. The runbook named it before it existed, which is the documentation form of a capability declared and not delivered; `TestEveryDocumentationLinkResolves` in `internal/defaults` is what noticed, and what will notice the next one. --- # The binary ## Binary mcpx ships as **one Go binary**, built from `cmd/mcpx`. This page states what is shipped — what the binary contains, what it needs next to it, and how the two packaged forms are built — not what could be built. Where a fact changes per release channel, this page says so and stops; release and install channels are a different page's subject. ### What is in it The version is `0.1.0`, hard-coded as the default in `cmd/mcpx/main.go` and stamped by the package with `-X main.version=0.1.0`; a build may override it with the same `-ldflags` variable, and nothing else about the binary changes. Everything else is the module's direct dependencies. `go.mod` is the source of truth — seven direct requirements: | module | what it is for | | ------------------------------------------ | -------------------------------------------------------------------------------------- | | `modernc.org/sqlite` | the log index: a pure-Go translation of SQLite, not a cgo binding | | `github.com/charmbracelet/bubbletea` | the full-screen browser, `mcpx tui` | | `github.com/charmbracelet/bubbles` | its widgets | | `github.com/charmbracelet/lipgloss` | its layout | | `gopkg.in/yaml.v3` | OpenAPI documents, which are published as YAML as often as JSON | | `github.com/santhosh-tekuri/jsonschema/v6` | JSON Schema validation (`internal/schemaval`) | | `github.com/tetratelabs/wazero` | the WebAssembly runtime behind wasm tool sources and embeddings (`internal/wasmtools`) | The three charmbracelet modules are one decision: about 1.2 MB in the stripped binary, in exchange for not hand-writing terminal handling. [dependencies.md](dependencies.html.md) argues each of the original five in full; it and `package.nix` still say "five" because both predate the last two rows — trust `go.mod`, and this table, over that count. Two absences are as deliberate as the presences: - **No MCP SDK.** mcpx is built on none — there is no MCP module in `go.mod`. The MCP client (`internal/mcpclient`), the server (`internal/mcpserver`) and the JSON-RPC framing are mcpx's own code, about a package each. That is most of why the dependency list stays this short. - **Everything else is the standard library**: the daemon and its HTTP API, the process pools, the JSON Schema to TypeScript compiler, the CLI. ### How the shipped builds link Every direct dependency is pure Go, so a `CGO_ENABLED=0` build is fully static, and that is what the **Nix package ships**: `env.CGO_ENABLED = "0"` in `package.nix`, stripped (`-s -w`), so the shipped binary is a static executable that needs no libc next to it. The **container image** ships the same static binary: `container-image.nix` builds the Nix package above (unwrapped, `CGO_ENABLED=0`) into a `dockerTools.buildLayeredImage` with Bun and the CA bundle. The old Debian-based `Containerfile` prototype (which defaulted `CGO_ENABLED` to `1` and linked glibc) was removed in the #5771 audit; its measurements stay in [container.md](container.html.md), which this page links rather than restates, because the container is still changing. The behavioural difference between the two is narrow and worth stating exactly: with cgo off, pure-Go `os/user` reads `/etc/passwd` rather than asking NSS/LDAP, and the pure-Go resolver bypasses NSS modules — on Linux only; on macOS, `CGO_ENABLED=0` changes neither, because Go uses the system resolver and user database there without cgo either way. Neither difference prevents a static build, and this page never claims they do; which form to ship where is a policy question, tracked with the release work, not a technical block. Size, as last measured in [container.md](container.html.md): the mcpx binary is about 14.8 MB in the container build. (The 21 MB figure sometimes quoted is an older linux/arm64 static build; measure the artifact you are shipping, not either number here.) ### What it needs next to it The binary alone answers `ls`, `types`, `catalog`, `search` and `call`. The rest of what it reaches for is external programs — the full table, with what degrades when each is missing, is in [dependencies.md](dependencies.html.md): - **A JavaScript runtime** — deno, bun or node — for `mcpx run` and `mcpx exec` only. Without one, those two commands fail and everything else still works. - **`git`** — a fallback only. mcpx reads `.git` itself for the `repo` and `worktree` scopes (see [git-discovery.md](git-discovery.html.md)) and runs `git rev-parse` only for a repository layout its own reader does not vouch for. Without git, those rare layouts degrade to keying by directory, and `mcpx doctor` says why. - **The configured MCP servers themselves** — spawned with the `command`, `args`, `env` and `cwd` the config names, or reached over Streamable HTTP for `url` servers. The Nix package wraps the binary with a `PATH` **suffix** naming `git`, `deno`, `bun-bin` and `nodejs`, so those four are findable without depending on the calling shell — and because it is a suffix, a runtime already on your `PATH` wins over the wrapped one. The same package installs the generated man page and shell completions (see [the CLI page](cli.html.md#cli)). The container image ships exactly one runtime — bun — and sets `MCPX_SCRIPT_RUNTIME=bun`, so the runtime choice inside the image is unambiguous; it leaves git out entirely, for the reason above. What the image deliberately does not contain, and why, is [container.md](container.html.md)'s subject. --- # The CLI The `mcpx` command line, in three parts: how a session with it normally goes, the two kinds of flag it accepts, and where the full command reference lives. The CLI is one of the [client interfaces](interfaces.html.md#client-interfaces) — everything it does goes through the daemon's `/v1` API, and anything a person can do here, a script or a plugin can do there. ## The CLI ### The loop Almost every session is the same four steps (the same loop `AGENTS.md` teaches agents): 1. `mcpx ls` — which namespaces exist. Cheap; run it whenever. 2. `mcpx search ` — find a tool by name or description. 3. `mcpx types ` — load signatures for that namespace only (or `mcpx types .` for one tool, which is far cheaper). `mcpx catalog` fits every namespace into a token budget when you are still deciding. 4. `mcpx run ` or `mcpx exec ''` — do the work. Do not run `mcpx types` for every namespace: loading one costs a few hundred tokens, loading all of them costs thousands and defeats the point of keeping schemas out of context until asked. ### Output a program can read Human output is for humans. Anything that has to be parsed gets `--json` instead: ```sh mcpx --json ls mcpx --json run screenshot ``` `--json` returns one document — for a script run, the result, the logs, the exit code and the duration. Never parse the human tables. ### Bare invocation, and a runnable first argument Bare `mcpx` opens the TUI (the `tui` browser) when there is a terminal to draw on, and prints help when there is not — a pipe gets the old behaviour. A first argument that is obviously a script runs without naming a command: a path ending in `.ts`, `.js`, `.mts` or `.mjs`, any existing file, or text that is obviously source (it contains `(){};`, `await `, `console.`, `tools.` or `=>`) is handed to `run` or `exec` as appropriate: ```sh mcpx ./report.ts mcpx 'await chrome_devtools.list_pages({})' ``` This is deliberately conservative: a bare word that is not a file fails as an unknown command, because guessing that `mcpx serach` was a snippet would replace a clear error with a baffling one. ### Exit codes worth knowing | code | meaning | | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | 0 | success | | 1 | the command failed; the error is on stderr | | 2 | an unknown command, an unknown global flag, or a settings conflict — including a contradiction in a config file, which is reported once, before dispatch | | 75 | `EX_TEMPFAIL`: a call stopped to ask a question (an elicitation). Not a failure, and not a cue to retry: the call continues as a task — answer with `mcpx elicit answer …`, then collect the original call's result with `mcpx task result `. Retrying would start a second call | Task IDs are 128-bit unguessable bearer handles, not a separate permission check: anyone who learns an ID and can reach the daemon can retrieve that task. For MCP's legacy `tasks/list`, only tasks owned by the current identified connection are listed; an unbound task can be collected by ID but is not listed. Supply an identity when starting a legacy task that must appear in that connection's list. ### The man page and shell completions Both are generated from the same command declarations as everything else, so they cannot drift from the binary: ```sh mcpx man mcpx completion bash # also: zsh, fish ``` The Nix package installs both for you: the man page to `share/man/man1/mcpx.1`, and completions for all three shells. One more surface from the same declarations: `mcpx help agents` prints the agent documentation (`AGENTS.md`) embedded in the binary, so the instructions an agent reads are the ones the binary it is driving was built with. ## CLI arguments Flags come in **two kinds**, and most confusion about mcpx flags is really about which kind one is looking at. ### Kind 1: hand-parsed global flags, before the subcommand A short list, parsed by hand in `cmd/mcpx/main.go` before any subcommand is chosen. These, and only these, have fixed global meanings: | flag | what it does | | ----------------- | ----------------------------------------------------- | | `--json` | one machine-readable document instead of human output | | `--tui` | open the TUI browser (also a subcommand) | | `--profile ` | add profiles to the active set | | `--skip-default` | narrow the active set to exactly the named profiles | | `--all-profiles` | activate every profile | | `--config ` | use this config file alone | | `--version`, `-v` | print the version and exit | | `--help`, `-h` | print help and exit | One extension to that list: a setting that **every** command accepts is also accepted as a global flag, so `mcpx --plumbing-strict-unknown-keys ls` means what `mcpx ls --plumbing-strict-unknown-keys` does. An unrecognised global flag is an error (exit 2), never a guess. ### Kind 2: registry flags, bound per command Every other flag is generated from the settings registry and **bound per command**: `parseFlags` calls `BindFlags` for the command being run, which binds exactly the settings that command reads (`internal/cli/root.go`, `internal/settings/bind.go`). A command accepts the settings it reads — no more, no less — so the flag list of `mcpx run` and the flag list of `mcpx ls` are different lists, on purpose. Flags for internals are marked `[plumbing]` in help rather than hidden. Three consequences worth knowing: - **The full inventory is generated, not listed here.** Every setting, its flag, its environment variable, its default and its scope are in [configuration.md](configuration.html.md), which a test keeps identical to the registry; the environment names are in [environment.md](environment.html.md). `mcpx help ` shows one command's own flags; `mcpx settings` shows the resolved values and where each came from. - **Aliases are spellings of one setting.** A setting may publish shorter aliases (`--runtime` for `--script-runtime`). Giving two spellings of the same setting on one command line is an error that names both — they are the same setting, and mcpx will not guess which value you meant. - **Flag names are derived, not chosen per setting.** The flag is derived mechanically from the setting's dotted path (`daemon.leaseTTL` becomes `--daemon-lease-ttl`), so the spelling in [configuration.md](configuration.html.md) is authoritative; do not guess a spelling the table does not show. Where a value can come from at all — built-in default, config files, environment, presets, flags — and which source wins, is the precedence chain in [configuration.md](configuration.html.md) ("Where a value can come from"). This page only adds: a contradiction between sources that the chain cannot resolve is reported once, up front, with exit code 2, rather than by whichever command happens to read the value first. ## CLI commands The command table is **generated, and this page does not copy it.** Every command is declared once in `Commands()` (`internal/cli/manual.go`) — name, aliases, group, usage, detail, examples — and from that declaration come `mcpx help`, the man page, the shell completions, and the generated **CLI commands** table in [parity.md](parity.html.md), which lists each command beside the operation it reaches. A test (`TestEveryDispatchedCommandIsDeclared`) holds the declaration and the binary's dispatch table equal, in both directions: no dispatched command is missing from the list, and nothing on the list fails to run. That parity is recent — `serve`, `api`, `registry`, `adapter`, `openapi`, `man` and `completion` were once dispatched but undeclared, and therefore invisible to help, the man page and completions; the test exists so that cannot happen silently again. What prose can usefully add over the generated table is the grouping `mcpx help` presents, and what each group is for: | group | what is in it | | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **running** | doing the work: `run`, `exec`, `scripts`, `skills`, `recipes`, `prompt`, `proxy`, `embeddings`, `feedback` | | **discovery** | finding out what exists before paying for its schemas: `ls`, `catalog`, `types`, `search`, `call`, `batch`, `client`, `schema`, `prompts`, `resources`, `openapi` | | **daemon** | the daemon's own lifecycle: `status`, `daemons`, `refresh`, `reload`, `upgrade`, `restart`, `stop`, `supervise`, `daemon`, `serve`, `cache`, `stdio-proxy` | | **configuration** | shaping mcpx itself: `config`, `settings`, `servers`, `secrets`, `init`, `registry`, `api`, `adapter`, `plugin`, plus `help`, `man` and `completion` | | **inspection** | looking at what happened: `diagnose`, `elicit`, `doctor`, `tui`, `explore`, `dashboard`, `interactions`, `log`, `stats`, `hook`, `want` | | **operations** | one generated command per `/v1` operation (for example `mcpx artifact list`) — these exist the moment an operation is declared, with flags from its parameters | For any one command, `mcpx help ` is the reference: it is printed from the same declaration the table is generated from, so the two cannot disagree. ### The verb sets Several commands are families: one name, a verb as the first argument. The generated table lists each family once; the verbs are declared with it and printed by `mcpx help `. | command | verbs | what the family does | | ---------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `adapter` | `list`, `check`, `call`, `tools`, `serve`, `import`, `add`, `remove` | command-line programs declared as MCP tools: show them, check the programs are installed, call one tool, print the tool definitions an MCP host would see, serve one as a namespace, generate a declaration (`import` — from shell completions, a man page or `--help`, in that order), or write and remove declarations through the daemon | | `api` | `list`, `tools`, `call`, `add`, `remove` | HTTP services described by an OpenAPI document (`--spec`), as tools — the same shapes as `adapter`, over a document instead of a program | | `servers` | `list`, `show`, `add`, `remove` | the configured MCP servers, changed live without restarting anything | | `registry` | `search`, `show`, `add` | find a server in a public registry, inspect what would be added, add it | | `secrets` | `list`, `set`, `unset`, `requests`, `request`, `decline` | the in-memory secret store: what is held, what servers have asked for, and answering or declining a request. In memory only — nothing here is written to disk | | `settings` | `list`, `get`, `set`, `unset` | read and change any setting, from anywhere — see [Configuration](configuration.html.md) | | `skills` | `list`, `install` | the agent skills embedded in the binary, managed by `mcpx skills`: list them, or install them into an agent's configuration (`--agent `, `--to `) | | `cache` | `prune`, `remove` (a bare `mcpx cache` lists) | the shared cache: list its entries, prune them by policy, or remove one entry by kind and key | | `plugin` | `list` | the plugins discovered under `paths.plugins`, each one an MCP server | | `stats` | `calls`, `servers`, `errors`, `sessions`, `volume`, `slowest` | one aggregation of the log per mode word: counts, per-server totals, errors, sessions, bytes, and the slowest individual calls | The daemon-operations group is the same idea, generated: one command per `/v1` operation (`artifact`, `ask`, `task`, `session`, and the rest), each with the operation's own verbs — `mcpx help ` prints them, and [parity.md](parity.html.md) maps every one to its route. --- # Configuration Every number in mcpx is a setting, including the ones nobody will ever change. That sounds like an overreaction until you have hit the alternative. A constant written next to the code that needs it is fine right up to the day somebody's proxy kills an idle event stream at thirty seconds, or their sandbox refuses to exec the running binary, or a tool legitimately takes a five-megabyte argument. At that point the only remedies are a patched binary or a fork, and both are absurd outcomes for a number that was chosen in five seconds and never revisited. Declaring it costs one line and removes that outcome entirely. So the rule is: nothing is hardcoded. A value lives in `internal/defaults/defaults.json` as data, and -- wherever a user could conceivably want it different -- it is declared once in the settings registry, from which its configuration key, its environment variable, its command-line flag, its `/v1` representation and its MCP tool are all derived. There is no second place to update, which is the point: the arrangement this replaced had four, and they drifted. The handful of exceptions are permission bits. `0700` on the state directory and `0600` on the socket are not preferences. The socket grants the power to run tools as you; a configuration key that widens it would be a footgun with no legitimate use. They are in `defaults.json` as data so there is still one place to read them, and they are deliberately absent from the registry. A guard test enforces this. It matches inline durations in both spellings gofmt produces, byte sizes written as shifts, bounds assigned to variables whose names say they are bounds, and permission literals, with an allowlist that carries a reason for each exemption. The version it replaced matched fixed strings and missed every duration gofmt had compacted into a function argument -- nine of them, including the daemon's shutdown grace and the event stream's keepalive. ## Where a value can come from Lowest to highest: 1. **default** -- `internal/defaults/defaults.json`, embedded in the binary. 2. **file** -- every configuration file on the search path, ranked by distance, nearest highest. `mcpx config --sources` lists them. 3. **env** -- `MCPX_*`. Every setting has one, derived from its path, whether or not anybody uses it. 4. **flag** -- the command line. 5. **runtime** -- an override set through `PUT /v1/settings/{path}` or `mcpx settings set`. Highest because it is the most recent statement of intent: somebody changed their mind while the thing was running, and having a flag from ten minutes ago win would be inexplicable. `mcpx settings get ` prints the winning value, where it came from, and what it displaced. "Why is this not what my config says" is the most common configuration question there is, and the answer is always in that list. The search path itself is decided before any of those layers exist, in two passes. The discovery pass walks the default locations, seeded by `MCPX_PATHS_CONFIG` / `--paths-config`, and reads only `paths.config`. The load pass resolves that list and loads everything on it, nearest last: a file's `paths.config` governs the rest of the chain from that point, a null entry stands for the locations the default walk provided, and a list with no null replaces the farther remainder. A `paths.config` found only in the load pass is reported by `mcpx config --sources`, not applied, and a cycle is refused naming the path that closed it. `MCPX_CONFIG` bypasses both passes and loads exactly one file. Two spellings of one setting at the same level is an error rather than a race: `--log-level` and `--logging-level` together, or two variables that mean the same thing with different values. The environment has no order, so there is genuinely nothing to prefer, and picking one silently is how a configuration becomes unexplainable. ## Scope: who reads it Every setting says which process acts on it. This exists because of a failure with no symptom. A daemon is started once, in whatever environment it happened to have, and then serves every command for hours. A flag on one of those commands that governs something the _daemon_ does was simply lost: accepted, validated, printed back, and then ignored, because the process that would act on it had read its configuration an hour earlier. Nothing anywhere said so. - **daemon** -- the pooled servers, the listener, the log the daemon writes. A client changes one by persisting it and restarting, or through `mcpx settings set` if the setting is hot. - **client** -- the CLI process itself: how it renders, how it finds a daemon, whether it may start one. Setting it on the daemon does nothing. - **call** -- meaningful per request. The CLI sends its effective value with every request in an `X-Mcpx-Settings` header, and the daemon honours it for that request only. This is what makes `mcpx search --limit 3` work against a daemon that was started without it. Only call-scoped settings are honoured from that header: widening it would make a header a way for any client to reconfigure a shared daemon. - **plugin** -- read by the opencode plugin, which is neither. The plugin reads `process.env` directly, so the variable names are the contract between the two and a test pins them. ## Hot: does it take effect now A **hot** setting is read afresh every time it is used, so changing it at runtime works. A cold one was consumed once at startup -- a listener address, a log file that is already open -- and recording a change to it would do nothing. `PUT /v1/settings/{path}` says so rather than accepting a value that would be silently inert. ## Reaching them | surface | read | change | | ----------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------- | | config file | any `mcpx` config on the search path | edit it | | environment | `MCPX_*` | export it | | CLI | `mcpx settings list`, `mcpx settings get ` | `mcpx settings set [--persist runtime\|project\|user]`, `mcpx settings unset ` | | `/v1` | `GET /v1/settings`, `GET /v1/settings/{path}` | `PUT /v1/settings/{path}`, `DELETE /v1/settings/{path}` | | MCP | `mcpx_settings_list`, `mcpx_settings_get` | `mcpx_settings_set`, `mcpx_settings_unset` | `mcpx settings list` resolves locally, which is what the _client_ will use. `--daemon` asks the daemon what it resolved, which is what a daemon-scoped setting actually is. The two differing is information, not a bug: it is exactly the case that used to be invisible. `--persist runtime` changes the running daemon and nothing on disk, which is what an experiment wants. `project` and `user` write the corresponding configuration file _and_ apply at once where the setting allows it -- a change written to a file but not applied would leave `mcpx settings get` answering with the old value, which reads as the write having failed. ## Common config Start with `mcpx init`: it writes a starter configuration whose every key is one the loader reads, comments included, and `mcpx ls` will tell you immediately whether it took. The file is JSON. Its two halves are the `mcpServers` object — the servers, next section — and settings, carried in nested blocks named for each setting's first segment (a `logging` block, a `pool` block), the same grouping the inventory at the bottom of this page uses. There is rarely one file. mcpx merges every configuration file on its search path, so a project can add its servers in a file of its own without anybody copying the user-level file to edit it. The search path, in the order the files are consulted: 1. If `MCPX_CONFIG` is set, that one file, alone. 2. Otherwise, at each directory from the working directory up to the root: .config/mcpx/config.json, then .mcpx.json, then .mcpx/config.json, then .mcp.json. 3. Then the user level: $XDG_CONFIG_HOME/mcpx/config.json, ~/.config/mcpx/config.json, ~/.mcpx.json. 4. Finally /etc/mcpx/config.json. Files nearer the working directory win: merging is per key and per server name, so a nearer file overrides what it names and inherits the rest, and a server it does not want it can drop with `"disabled": true`. One honest surprise in that list: .mcp.json is Claude Code's project file, and mcpx reads it on purpose — a project already configured for Claude Code is already configured here, its `mcpServers` included. An explicit `--config ` stands outside all of this and is used alone, because naming a file means meaning it. (`paths.config` can redirect the search itself, in two passes — discovery, then load. That machinery is [Where a value can come from](configuration.html.md#where-a-value-can-come-from), above; the list here is the default it starts from.) Whatever the file, a value in it is one layer of five — defaults, file, environment, flag, runtime override, in that order — and the file layer is the only one most people ever touch. When a value is not what the file says, do not guess: `mcpx config --sources` lists the files that were actually read, and `mcpx settings get ` names the winning value, where it came from, and what it displaced. ## Server config A server is one entry in `mcpServers`: ```json { "mcpServers": { "chrome-devtools": { "command": "chrome-devtools-mcp", "args": ["--headless", "--isolated"], "mcpx": { "sharing": "exclusive", "scope": "session", "max": 4 } }, "internal-docs": { "url": "http://docs.internal:8080/mcp" } } } ``` Two names for this, and they are not interchangeable: the file key is `mcpServers` — the same object other MCP hosts use, so an existing configuration pastes in unchanged — while `servers` is the CLI command (`mcpx servers list`) and the `/v1` resource (`GET /v1/servers`). A file that says `servers` configures nothing. A block with a `command` is a stdio server: the command and its `args`, an `env` map for the child, nothing more needed. A block with a `url` is a remote server, reached over Streamable HTTP; it may carry `headers` and an `auth` block, and `transport` is filled in as `http` when left blank. What the transports actually mean — including the legacy-SSE fallback — is [Transport options](modes.html.md#transport-options). The `mcpx` block is mcpx's own, ignored by other hosts, and it is where a server stops being a line in a file and starts being a process policy: - `sharing`: `shared` (default) lets any number of callers use one process at once; `exclusive` gives one caller at a time and queues the rest. Stateful servers want exclusive. - `scope`: what a live process is keyed by — `global` (default), `repo`, `worktree`, `cwd`, `session`, `parent-session`, `pid`, `call`. One process per distinct key. `session` and `parent-session` are resolved by the caller, through `MCPX_SESSION_ID` / `MCPX_PARENT_SESSION_ID`; a scope that cannot resolve degrades to per-call isolation and says so in the log. - `profiles` and `default`: which profile selections see the server at all; a server is default-on unless it says otherwise. - `tools` / `excludeTools`: the allowlist and denylist of tool names callers may see — [Hiding tools](configuration.html.md#hiding-tools), below. - `max` and `idleTimeout`: how many processes a scope may hold, and how long an idle one is kept. An **alias** is a second entry pointing at the first: `"aliasOf": ""`, with its own `mcpx` block giving a different namespace, tool subset, or description over the same server — aliases of aliases are refused. Whether an alias shares its target's *process* depends on whether its pooling fields match; change its `scope` and it is a separate process. Adding and removing servers does not require editing by hand — the CLI, `/v1`, and MCP surfaces for it are the [Servers](configuration.html.md#servers) table above, the entry is written to a configuration file, and the daemon reloads and makes it callable immediately. ## Client config Client configuration is the settings whose reader is the process you ran — or the single call you are making — as opposed to the daemon's settings, which were fixed when the daemon started. The distinction is the [Scope](configuration.html.md#scope-who-reads-it) section above; this is what it means when you go to set something. **Client-scoped** settings govern how the CLI finds and treats a daemon: `daemon.endpoint` (a daemon somewhere else instead of the local socket), `daemon.autostart` and the `autostart.*` family (how a started daemon is launched and waited for), `daemon.inline` (the last-resort in-process mode). Setting one of these *on the daemon* — recording it as a value the daemon holds — does nothing at all: the process that acts on it is the next client, not the running daemon. Set them in a file, the environment, or a flag, where a client will read them. **Call-scoped** settings travel with a request, so they work against any daemon however it was started: the CLI sends its effective value in a header and the daemon honours it for that request only. `mcpx search --limit 3` is `search.limit` arriving this way; `catalog.budget`, the `artifacts.*` delivery settings, and `diagnose.preflight` behave the same. Only call-scoped settings are honoured from that header — widening it would let any client reconfigure a shared daemon. A **host** configuring mcpx for its users — an editor plugin, a harness, a script's launcher — mostly sets client configuration: the endpoint if it runs its own daemon, the profile if it exposes a subset, the session identifiers if it multiplexes agents. The opencode plugin is the worked example: it reads its settings from the environment directly (the plugin scope), which is why the variable names it uses are a contract a test pins. What a host does *not* configure per user is the daemon's behaviour — that is [Common config](configuration.html.md#common-config) and the daemon's own settings, set once, on purpose. ## Env vars Every setting has an environment variable, derived from its path — `daemon.endpoint` is `MCPX_DAEMON_ENDPOINT`, `search.limit` is `MCPX_SEARCH_LIMIT` — and the inventory below lists each one beside its setting, so there is no separate list to keep current. As a layer, the environment sits above files and below flags: export a variable to change one value for one shell without editing any file, and expect a flag on the command line to beat it. Two spellings of one setting at the same level — two variables that mean the same setting, carrying different values — are an error, not a race. The environment has no order, so there is nothing to prefer, and picking one silently is how a configuration becomes unexplainable. Three cautions about what the variables are *for*: - **Setting a variable is not the same as the script environment.** Everything above is input: a person telling mcpx something. The names mcpx and the plugin hand *to* a script — its session, its endpoint, its socket — are output, a different list with a different owner, generated on [The script environment](environment.html.md) page. Names appear on both sides (`MCPX_SESSION_ID` is how a caller tells mcpx its session *and* how a script learns it); that page is the authority for the script-facing direction. - **A few names act before any setting exists.** `MCPX_CONFIG` selects the configuration file itself, and `MCPX_PATHS_CONFIG` (or `--paths-config`) seeds the discovery pass; neither could be a setting, because a setting's value is read from the very files these choose. They are the whole hand-written remainder: if a name is not a setting's derived variable, not in the script environment, and not one of these, mcpx does not read it. - **A variable only reaches the process that reads it.** Exporting a daemon-scoped variable after the daemon has started changes nothing until it restarts — scope again, not a special property of the environment. `mcpx settings list --daemon` shows what the daemon actually resolved. ## Local-model controls by surface These are independent controls, not one fleet-wide Qwen switch. In particular, parking hosted chat-model listings does not disable embeddings or an interpreter. The checked-in state below is from this repository's main configuration, not a guarantee about a running process: nearer files, environment, flags and runtime overrides can change it. See [#2218](https://github.com/developing-today/code/issues/2218) for the remaining single-switch work. | Surface | Control and checked-in state | What it does not control | | --- | --- | --- | | mcpx catalog embeddings | `embeddings.backend` defaults to `auto`; `.mcpx.json` sets no `embeddings` block. With no URL or WASM path configured there, the cascade reaches the built-in pure-Go subword engine, not a Qwen model. `local` forces that engine. | Prompt generation, OpenCode messaging and provider listings. `auto` can use a configured remote or WASM model; it is not a global local-model off switch. | | mcpx prompt generation | `prompt.sample` defaults to `never`; `model.provider` defaults to `none`. Neither is set in `.mcpx.json`. The file does contain a legacy `repair` block naming `opencode` and `claude-code/claude-haiku-5-5`, not Qwen. | Embeddings or arbitrary models chosen by a caller or external OpenCode. | | OpenCode messaging embeddings | `.opencode/opencode.jsonc` sets `messaging.embedding` to `"off"`. Removing that setting restores the OpenCode default, which starts its Qwen3-Embedding local server. | Chat provider listings or mcpx embeddings. | | OpenCode chat provider listings | Qwen definitions for `cline-pass` and `commandcode` are parked as comments; other Qwen/Llama listings are under disabled providers or commented blocks. | Messaging embeddings. Restoring the parked blocks requires editing them: there is not yet a single switch restoring all listings. | | OpenChamber route interpreter | The separate local route-interpreter stage is controlled in OpenChamber Settings; its Qwen2.5 model requires a download and was reported absent on the laptop in the #2218 audit. | OpenCode provider listings and mcpx. This is a separate cross-repository remainder, not inherited state. | For catalog embeddings, `auto` tries the configured `embeddings.url` remote endpoint, then a successfully loaded `embeddings.wasmPath`, then the subword engine. `remote` and `wasm` each fall back to subword on failure; `local` uses subword directly. A remote endpoint may itself be local (for example Ollama): the backend name does not say where the model runs. `embeddings.model` names the remote model, not a local download. These settings select an embedder; they do not switch semantic search itself off. For prompt generation, `prompt.sample: never` prevents an unmatched-recipe request from asking a model by default; `ask` allows it. An explicit request provider or model, or a non-`none` `model.provider`, also opts in even when `prompt.sample` is `never`. `model.provider` selects the newer model layer (`none`, `auto`, `sampling`, `plugin`, `openai`, `anthropic`, or `google`), with `model.baseURL` and `model.default` for a configured endpoint and model. `model.providers` is a JSON object keyed by provider name, with per-provider `baseURL` and explicitly named `apiKeyEnv` entries; `model.profiles` is a JSON object of named, ordered `provider/model` fallback chains, optionally bounded by a token budget and per-attempt timeout. Either `model.default` or a per-operation model override may name a profile or a provider/model id. mcpx never scans the environment for key names. An OpenAI-compatible local endpoint can serve Qwen when explicitly configured. The singular `model.baseURL` and `model.apiKeyEnv` remain the fallback for `model.provider` and keep single-provider configurations working. `model.provider: none` alone is not a universal veto: the legacy scripting provider can resolve an explicit request, environment or installed CLI when generation is allowed. The legacy `repair.provider` and `repair.model` keys in the fleet file are not registered settings in this version, so do not assume that block selects the effective provider. Per-request `mcpx prompt --provider` / `--model` can also select a provider. None of these controls constrain independent callers of external services. Use `mcpx settings get embeddings.backend --daemon`, `mcpx settings get prompt.sample --daemon`, and `mcpx settings get model.provider --daemon` to inspect the daemon's resolved settings; check `mcpx config --sources` and the daemon environment as well. Embedding backends are constructed when settings are installed, so verify the running daemon after changing configuration rather than assuming an existing index or embedder has switched. Model provider and prompt sampling settings are daemon-scoped and cold. ## Servers Servers are configuration too, and until now adding one meant an editor and a restart. | surface | list | add | remove | | ------- | ------------------- | ---------------------------------------------------------------------- | ---------------------------- | | CLI | `mcpx servers list` | `mcpx servers add -- ...`, `mcpx registry add --write` | `mcpx servers remove ` | | `/v1` | `GET /v1/servers` | `POST /v1/servers` | `DELETE /v1/servers/{name}` | | MCP | `mcpx_servers_list` | `mcpx_servers_add` | `mcpx_servers_remove` | The entry is written to a configuration file and the daemon reloads, so the server is callable immediately and is still there tomorrow. A server whose process definition did not change keeps its running child: adding one server must not restart the rest, or a stateful server -- a browser holding a session -- loses it because a neighbour appeared. The daemon also re-reads its configuration files when they change on disk, checked on the same tick that reaps idle instances (`daemon.watchConfig`). An edit by hand therefore takes effect within `daemon.reapInterval` without anything being restarted. Making that work required changing what identifies a daemon. The socket used to be keyed to the _contents_ of the config files, so that editing one got a fresh daemon rather than a stale one. A daemon that reloads changes the contents of the files it is keyed by, which moves its own key, which makes it unreachable by the client that just edited it -- and hands the next command a different daemon that happens to match the new key with old servers loaded. That was observed: `mcpx servers remove` succeeded, the file was correct, and the next `mcpx servers list` showed the removed server. The key is now the file _set_, and staleness is handled where it belongs. ### Hiding tools `tools` (an allowlist) and `excludeTools` (a denylist) go in a server's `mcpx` block, or in the top-level `pool` block to apply to every server. A hidden tool is left out of every listing -- `mcpx tools`, generated types, search, the MCP pass-through -- and a call to it by name is refused with 400. ```json { "pool": { "excludeTools": ["delete_*"] }, "mcpServers": { "datadog": { "command": "mcp-remote", "args": ["..."], "mcpx": { "excludeTools": ["execute_*", "/^(update|upsert)_.*dashboard/"] } } } } ``` Each entry is one of: | entry | means | example | | ------------------------ | -------------------------------------------------------------------------------------- | ------------------------- | | `/.../` | a Go regular expression, unanchored as regexps are | `/delete/`, `/^delete_/` | | contains `*`, `?` or `[` | a glob over the whole name: `*` any run, `?` one character, `[a-z]` / `[!a-z]` a class | `delete_*`, `*_monitor` | | anything else | the exact tool name | `delete_datadog_workflow` | A pattern that cannot compile is a configuration error naming the field, not a rule that silently matches nothing. ### Constraining calls by their arguments Hiding decides by tool name: a tool is callable with any arguments or not at all. `argumentRules` decides by the call: a per-server map in the `mcpx` block -- also allowed in the top-level `pool` block -- whose keys are tool patterns matched exactly as `tools`/`excludeTools` match (exact name, glob, or `/regexp/`), and whose values are JSON Schema objects. A call is allowed only if its arguments validate against **every** rule whose key matches the tool. Pool rules and server rules add up, and so do rules from layered config files: rules only tighten, and a nearer file cannot loosen a farther one. ```json { "mcpServers": { "github": { "command": "...", "mcpx": { "argumentRules": { "create_repository": { "required": ["private", "organization"], "properties": { "private": { "const": true }, "organization": { "pattern": "^(my-org|my-org-sandbox)$" } } }, "/^(push_files|create_or_update_file|delete_file)$/": { "required": ["branch"], "properties": { "branch": { "not": { "enum": ["main", "master"] } } } }, "*": { "properties": { "owner": { "pattern": "^(my-org|my-user)$" } } } } } } } } ``` Per-argument rules are the same mechanism: a `"*"` key whose schema is a `properties` object constrains that argument on every tool that carries it, and leaves tools without the argument untouched. A refused call is a 400, as a hidden tool is, before the server is started: the message names the argument path, the value sent, the constraint it broke, and where the rule came from (config file, server, key). Over the MCP pass-through the same refusal arrives as a tool result with `isError: true`. Listings advertise the tightened schema: the `inputSchema` shown by `mcpx types`, the generated client, search, and the pass-through's `tools/list` is the upstream schema `allOf` every matching rule, so an agent sees `private: true` before it ever calls. A rule whose key matches no tool on its server warns at load and on catalog changes -- a server that renames a tool must not silently disable the rule that guarded it. A value that is not a valid schema, or a `pattern` the validator cannot compile (JSON Schema patterns are ECMA-262; lookahead and backreferences are unsupported), is a configuration error naming the server and key, like a bad tool pattern. Two cautions, plainly: - **Server defaults are invisible.** A rule constrains what is *sent*, not what the server fills in. If a constraint matters, list the argument in `required` -- never rely on a server-side default to satisfy it. - **Free-form arguments cannot truly be constrained.** A `pattern` over a `query`/`jql`/`sql` string matches text, not meaning. A tool whose danger lives in a free-form argument belongs in `excludeTools`, not in a rule. `extraIncludeTools` takes the same entries and adds them to the allowlist instead of replacing it, so a server can widen a pool-wide `tools` by one tool without restating the rest: ```json { "pool": { "tools": ["get_*", "list_*", "search_*"] }, "mcpServers": { "datadog": { "mcpx": { "extraIncludeTools": ["create_datadog_monitor"] } } } } ``` With no `tools` anywhere, `extraIncludeTools` is the allowlist -- it includes, as `tools` does, so everything it does not name is hidden. `excludeTools` wins over both. A server's own `tools` replaces the pool's; `extraIncludeTools` and `excludeTools` from the pool and the server all apply, so a server that hides one more tool does not undo a pool-wide rule. A nearer config file's `pool.extraIncludeTools` likewise adds to a farther one's. An alias (`aliasOf`) filters independently of the server it shares a process with. Names are the server's own tool names, as `mcpx tools` prints them in its `tool` column, not the generated function names. Some servers can filter on their side too -- Datadog's `omit_tools` URL parameter, GitHub's `GITHUB_READ_ONLY` -- which keeps the tool from ever reaching mcpx. Those are each server's own convention; this one works for any server. ## Write policy (`policy.write`) A tool call is a **write** when its tool is not annotated `readOnlyHint` true, read with the specification's defaults: an unannotated tool may write, and may be destructive. The daemon-wide setting `policy.write` (default `ask`) gates every such call, between resolving an instance and using it: | mode | what happens to a write call | | --- | --- | | `ask` | a confirmation is raised showing the exact call -- the tool and its arguments in canonical (key-sorted) JSON -- and the call proceeds only if somebody answers true | | `allow` | the call proceeds with no confirmation from the policy | | `deny` | the call is refused, with an error naming the tool, the mode, and the settings that can change it | A server's own `writePolicy` in its `mcpx` block overrides the daemon mode for that server alone: ```json { "mcpServers": { "datadog": { "command": "...", "mcpx": { "writePolicy": "deny" } } } } ``` Under `ask`, a caller that cannot answer questions is **refused**, not waited out and not let through: the error says the policy is ask, that there is no question broker to answer it, and that setting `policy.write` to `allow` (or `deny`) is the escape. An unanswered or refused confirmation refuses the call too. `elicit.confirmDestructive` is a **floor** on top of this, not an alternative to it: with it on, a destructive call asks even under `allow` -- raised by the destructive confirmation itself, with its annotation-trust rules unchanged -- and the floor never weakens a `deny`. Under `ask` the policy has already asked once, so no call is asked about twice. ### Operator-declared read-only tools (`readOnlyTools`) The gate reads a tool's classification from its annotations, and many real servers publish none -- fff, whose tools are all searches, is one. The specification's defaults then make every call a possibly destructive write, so under `ask` a headless caller (an API session, a script -- the normal fleet mode) can never run them at all: the confirmation question has no answerer, and every call comes back as the gate's error (#6116). The operator can declare specific tools read-only in a server's `mcpx` block, by exact name: ```json { "mcpServers": { "fff": { "command": "...", "mcpx": { "readOnlyTools": ["find_files", "grep", "multi_grep"] } } } } ``` A declared tool is classified read-only whatever its annotations say (or do not say): the write policy does not gate it in any mode, and the destructive floor does not ask about it. The declaration is the operator's own word in their own configuration, which is why it is trusted -- a server cannot declare its own tools read-only this way, and a remote server's annotations still clear nothing (#2191). Names are exact, never patterns, and the declaration covers only the tools listed: a tool the server adds later, under a new name, is gated by the defaults until the operator lists it too. Listing a tool that actually writes is the operator's mistake to make -- and theirs alone; nothing infers the list. When the gate does refuse a call -- an unanswered confirmation, a denied write -- the refusal is typed, not a generic execution failure: HTTP 403 with a `code` in the error body (`confirmation_required` for an unconfirmed call, `write_policy_denied` for a policy denial), so a caller can tell "the gate refused this" apart from "the tool ran and failed". This gate is an operator consent gate, not the autonomy dial (`docs/decisions/0002-autonomy-dial.md`): the dial bounds what mcpx does on its own, the write policy bounds what a caller may do to the outside world through it, and neither clamps the other. ## Every setting Everything between the markers below is generated from `settings.Registry()` by `TestTheDocumentationListsEverySetting`, which fails when it is stale: ``` go test ./internal/settings -run TestTheDocumentationListsEverySetting -update ``` It used to say it was generated while being written by hand, and it had drifted: two settings were missing an alias their flag really answers to. `mcpx config --schema --plumbing` prints the same inventory, and `mcpx settings list` prints it with the values that are actually in force. The final column names the end-to-end test that exercises each setting, or gives the registry’s reason for an exemption. A test name records the coverage contract. Execution results belong to the test run for the revision being examined. Entries marked _(plumbing)_ are internals. They work and they are supported, but there is no ordinary reason to change one, so they are kept out of ordinary help rather than hidden -- a flag a user can find in the source and that `--help` denies exists is worse than a long list. `paths.configFile` is the one setting a configuration file may not set: it decides which file is read, so it is accepted from the environment and from the global `--config`, which goes before the command. `plumbing.strictUnknownKeys` governs keys **no setting claims**, and keys a server entry declares that mcpx does not know — `type`, `alwaysAllow` and the rest, which belong to the other hosts that read the same file. Those are recorded, reported by `mcpx doctor`, and refused only when this is on. A key inside a server's `"mcpx"` block is not governed by it and is always refused. That block is mcpx's alone — nothing else writes into it — so a key it does not know is a typo or a name that no longer exists, not another host's field. This is deliberately not a setting: it is how `mcpx init` wrote `"mode": "session"` into every new config for months without anyone noticing, and a switch to turn the report off would have kept it quiet. A script whose first line names its interpreter (`#!`) runs under that interpreter, ahead of every setting below: a `-S`/`--split-string` payload is re-split with shell quoting rules (so `-S sh -c "printf hello"` keeps `printf hello` one argument; an unterminated quote fails the run), `VAR=value` assignments reach the child even when the value contains `/`, `env -u`/`env -i` apply (the child starts from the parent's environment minus what they remove, or from an empty one), and `env -C`/`env --chdir` moves the run, beating `script.cwd` the way the interpreter choice beats `script.runtime`. An env option mcpx does not implement fails the run rather than being dropped. A dispatched run never inherits `MCPX_CLIENT`, `MCPX_RUNTIME`, `MCPX_ENTRY` or `MCPX_DISPATCH` from an outer run, and its notice names anything else it goes without (no generated client, no enforced permission profiles, skipped launcher phases). ### adapters | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `adapters.allowBare` | bool | `false` | client | no | `--adapters-allow-bare` | `MCPX_ADAPTERS_ALLOW_BARE` | permit bare (passthrough) adapter declarations to load | `TestAdaptersAllowBareGatesABareDeclaration` | ### artifacts | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `artifacts.chunkBytes` | bytes | `256KiB` | daemon | no | `--artifacts-chunk-bytes` | `MCPX_ARTIFACTS_CHUNK_BYTES` | *(plumbing)* how much of a body one streamed frame carries | `TestArtifactsChunkBytesSplitsAStreamedBody` | | `artifacts.delivery` | enum | `reference` | call | yes | `--artifacts-delivery` | `MCPX_ARTIFACTS_DELIVERY` | how artifact bodies reach the caller | `TestArtifactsDeliveryInlinesTheBody` | | `artifacts.dir` | string | *(empty)* | call | yes | `--artifacts-dir` | `MCPX_ARTIFACTS_DIR` | write this run's artifacts here | `TestArtifactsDirReceivesTheRunsArtifacts` | | `artifacts.enabled` | bool | `true` | daemon | no | `--artifacts-enabled` | `MCPX_ARTIFACTS_ENABLED` | whether the daemon keeps files scripts produce | `TestArtifactsEnabledGatesTheStore` | | `artifacts.gcInterval` | duration | `10m` | daemon | no | `--artifacts-gc-interval` | `MCPX_ARTIFACTS_GC_INTERVAL` | *(plumbing)* how often expired artifacts are swept | `TestArtifactsGCIntervalSetsWhenExpiredArtifactsAreSweptFromTheEnvironment` | | `artifacts.idleTtl` | duration | `0s` | daemon | no | `--artifacts-idle-ttl` | `MCPX_ARTIFACTS_IDLE_TTL` | when set, reading an artifact renews it for this long; off keeps absolute expiry | `TestArtifactsIdleTTLRenewsAReadArtifactFromTheEnvironment` | | `artifacts.inlineMaxBytes` | bytes | `1MiB` | call | yes | `--artifacts-inline-max-bytes` | `MCPX_ARTIFACTS_INLINE_MAX_BYTES` | the largest artifact that may be base64'd into a result | `TestArtifactsInlineMaxBytesBoundsAnInlinedBody` | | `artifacts.interceptImages` | bool | `true` | call | yes | `--artifacts-intercept-images` | `MCPX_ARTIFACTS_INTERCEPT_IMAGES` | turn image and audio content in a result into artifact references | `TestArtifactsInterceptImagesStoresAnEmittedImage` | | `artifacts.maxAge` | duration | `168h` | daemon | no | `--artifacts-max-age` | `MCPX_ARTIFACTS_MAX_AGE` | the absolute ceiling on a renewed artifact's life, however often it is read | `TestArtifactsMaxAgeCapsARenewedArtifactFromTheEnvironment` | | `artifacts.maxBytes` | bytes | `64MiB` | daemon | no | `--artifacts-max-bytes` | `MCPX_ARTIFACTS_MAX_BYTES` | the largest single artifact that may be stored | `TestArtifactsMaxBytesRefusesALargeArtifact` | | `artifacts.quota` | bytes | `1GiB` | daemon | no | `--artifacts-quota` | `MCPX_ARTIFACTS_QUOTA` | the total the artifact store may hold | `TestArtifactsQuotaBoundsTheStore` | | `artifacts.ttl` | duration | `24h` | daemon | no | `--artifacts-ttl` | `MCPX_ARTIFACTS_TTL` | how long an artifact is kept before it is collected | `TestArtifactsTTLExpiresAnArtifactFromTheEnvironment` | ### autonomy | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `autonomy.max` | enum | `run` | daemon | no | `--autonomy-max` | `MCPX_AUTONOMY_MAX` | the most autonomy this daemon exercises, whatever a caller asks for | `TestAutonomyMaxClampsARecipeRunFromTheEnvironment` | ### autostart | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `autostart.args` | list | `daemon,--detached` | client | no | `--autostart-args` | `MCPX_AUTOSTART_ARGS` | *(plumbing)* the arguments an auto-started daemon is given | `TestAutostartArgsReplaceTheDaemonCommandLineFromTheEnvironment` | | `autostart.bin` | string | *(empty)* | client | no | `--autostart-bin` | `MCPX_AUTOSTART_BIN` | which executable is started as the daemon | `TestAutostartBinChoosesTheDaemonExecutableFromTheEnvironment` | | `autostart.connectTimeout` | duration | `20s` | client | no | `--autostart-connect-timeout` | `MCPX_AUTOSTART_CONNECT_TIMEOUT` | how long to wait for a started daemon to answer | `TestAutostartConnectTimeoutBoundsTheWaitForADaemon` | | `autostart.idleExit` | duration | `4h0m0s` | client | no | `--autostart-idle-exit` | `MCPX_AUTOSTART_IDLE_EXIT` | how long an auto-started daemon survives with nothing to do | `TestAutostartIdleExitStopsAnIdleDaemonFromTheEnvironment` | | `autostart.logTail` | bytes | `2000` | client | no | `--autostart-log-tail` | `MCPX_AUTOSTART_LOG_TAIL` | *(plumbing)* how much of the daemon log is shown when it will not start | `TestAutostartLogTailBoundsTheFailureExcerptFromTheEnvironment` | | `autostart.pingTimeout` | duration | `2s` | client | no | `--autostart-ping-timeout` | `MCPX_AUTOSTART_PING_TIMEOUT` | *(plumbing)* how long a health check waits before calling it dead | `TestAutostartPingTimeoutBoundsEachReadinessPing` | | `autostart.pollInterval` | duration | `50ms` | client | no | `--autostart-poll-interval` | `MCPX_AUTOSTART_POLL_INTERVAL` | *(plumbing)* how often a starting daemon is probed | `TestAutostartPollIntervalPacesTheReadinessPollFromTheEnvironment` | ### catalog | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `catalog.bias` | list | *(empty)* | call | yes | `--catalog-bias`, `--bias` | `MCPX_CATALOG_BIAS` | words that pull matching tools toward the front | `TestCatalogBiasPicksWhatATightBudgetShows` | | `catalog.budget` | int | `2000` | call | yes | `--catalog-budget`, `--budget` | `MCPX_CATALOG_BUDGET` | token ceiling for the catalog listing | `TestCatalogBudgetFitsTheSignatures` | | `catalog.instructions` | bool | `true` | call | yes | `--catalog-instructions` | `MCPX_CATALOG_INSTRUCTIONS` | include each server's own instructions | `TestCatalogInstructionsShowsServerGuidance` | | `catalog.pinnedTools` | list | *(empty)* | daemon | no | `--catalog-pinned-tools` | `MCPX_CATALOG_PINNED_TOOLS` | tools always exposed in reactive mode | `TestCatalogPinnedToolsAlwaysListInReactiveMode` | ### completion | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `completion.maxValues` | int | `100` | daemon | yes | `--completion-max-values` | `MCPX_COMPLETION_MAX_VALUES` | *(plumbing)* how many completions one reply carries | `TestCompletionMaxValuesCapsTheValues` | | `completion.perMinute` | int | `120` | daemon | yes | `--completion-per-minute` | `MCPX_COMPLETION_PER_MINUTE` | *(plumbing)* how many completion requests one caller may make against one server per minute; 0 disables | `TestCompletionPerMinuteLimitsOneCallerFromTheEnvironment` | | `completion.serverPerMinute` | int | `600` | daemon | yes | `--completion-server-per-minute` | `MCPX_COMPLETION_SERVER_PER_MINUTE` | *(plumbing)* how many completion requests one server may receive per minute across all callers; 0 disables | `TestCompletionServerPerMinuteLimitsAllCallersFromTheEnvironment` | ### daemon | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `daemon.address` | string | `127.0.0.1` | daemon | no | `--daemon-address`, `--address` | `MCPX_DAEMON_ADDRESS` | which interface the daemon listens on | `TestDaemonAddressIsReachableFromTheEnvironment` | | `daemon.autostart` | bool | `true` | client | no | `--daemon-autostart` | `MCPX_DAEMON_AUTOSTART` | start the daemon on demand when it is not running | `TestDaemonAutostartIsReachableFromTheEnvironment` | | `daemon.endpoint` | string | *(empty)* | client | no | `--daemon-endpoint` | `MCPX_DAEMON_ENDPOINT` | a daemon somewhere else, instead of the local socket | `TestDaemonEndpointNamesTheDaemonToReachFromTheEnvironment` | | `daemon.idleExit` | duration | `0s` | daemon | no | `--daemon-idle-exit`, `--idle-exit` | `MCPX_DAEMON_IDLE_EXIT` | stop the daemon after this long with nothing to do | `TestDaemonIdleExitStopsAnIdleDaemonFromTheEnvironment` | | `daemon.inline` | enum | `off` | client | no | `--daemon-inline` | `MCPX_DAEMON_INLINE` | as a last resort, run servers inside this process; one of off (also false), fallback (also true), always | `TestDaemonInlineAlwaysAnswersWithoutASocketFromTheEnvironment` | | `daemon.inlineStartPoll` | duration | `20ms` | client | no | `--daemon-inline-start-poll` | `MCPX_DAEMON_INLINE_START_POLL` | *(plumbing)* how often a starting in-process daemon is probed | Exempt — daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically | | `daemon.inlineStartTimeout` | duration | `5s` | client | no | `--daemon-inline-start-timeout` | `MCPX_DAEMON_INLINE_START_TIMEOUT` | *(plumbing)* how long an in-process daemon has to become reachable | `TestDaemonInlineStartTimeoutBoundsTheInProcessStartFromTheEnvironment` | | `daemon.leaseTTL` | duration | `30m0s` | daemon | yes | `--daemon-lease-ttl` | `MCPX_DAEMON_LEASE_TTL` | *(plumbing)* how long a silent caller's instances are remembered | `TestDaemonLeaseTTLForgetsASilentCallerFromTheEnvironment` | | `daemon.port` | int | `0` | daemon | no | `--daemon-port`, `--port` | `MCPX_DAEMON_PORT` | listen on a TCP port instead of choosing one | `TestDaemonPortBindsTheChosenPortFromTheEnvironment` | | `daemon.probeTimeout` | duration | `200ms` | client | no | `--daemon-probe-timeout` | `MCPX_DAEMON_PROBE_TIMEOUT` | *(plumbing)* how long another daemon's socket is given to answer | `TestDaemonProbeTimeoutDecidesWhetherASiblingDaemonIsReportedFromTheEnvironment` | | `daemon.reapInterval` | duration | `30s` | daemon | no | `--daemon-reap-interval` | `MCPX_DAEMON_REAP_INTERVAL` | *(plumbing)* how often idle instances are swept | `TestDaemonReapIntervalSetsWhenIdleInstancesAreReapedFromTheEnvironment` | | `daemon.refreshTimeout` | duration | `3m0s` | daemon | yes | `--daemon-refresh-timeout` | `MCPX_DAEMON_REFRESH_TIMEOUT` | how long POST /v1/refresh may take | `TestDaemonRefreshTimeoutBoundsARefresh` | | `daemon.roots` | paths | *(empty)* | daemon | no | `--daemon-roots` | `MCPX_DAEMON_ROOTS` | filesystem paths exposed to upstream servers through roots/list | `TestDaemonRootsAnswersAnUpstreamRootsRequest` | | `daemon.saveInterval` | duration | `5m` | daemon | no | `--daemon-save-interval` | `MCPX_DAEMON_SAVE_INTERVAL` | *(plumbing)* how often daemon state is written to disk | `TestDaemonSaveIntervalWritesTheLeaseTableFromTheEnvironment` | | `daemon.socketProbeTimeout` | duration | `500ms` | daemon | no | `--daemon-socket-probe-timeout` | `MCPX_DAEMON_SOCKET_PROBE_TIMEOUT` | *(plumbing)* how long a socket left by a crashed daemon is given to answer | `TestDaemonSocketProbeTimeoutDecidesWhetherALiveSocketIsStale` | | `daemon.takeoverTimeout` | duration | `15s` | daemon | no | `--daemon-takeover-timeout` | `MCPX_DAEMON_TAKEOVER_TIMEOUT` | *(plumbing)* how long a handoff may take, and how long the old daemon waits for its successor to hang up | `TestDaemonTakeoverTimeoutBoundsTheHandoverFromTheEnvironment` | | `daemon.tsnet.hostname` | string | *(empty)* | daemon | no | `--daemon-tsnet-hostname` | `MCPX_DAEMON_TSNET_HOSTNAME` | also serve the daemon on a tailnet, under this name | Exempt — daemon lifecycle, binding, or timing: its effect is a bound, an interval, or a network identity the isolated harness cannot vary deterministically | | `daemon.tsnetUpTimeout` | duration | `30s` | daemon | no | `--daemon-tsnet-up-timeout` | `MCPX_DAEMON_TSNET_UP_TIMEOUT` | *(plumbing)* how long a node may take to authenticate | Exempt — tsnet bring-up needs a tailnet the harness does not have | | `daemon.ui` | bool | `true` | daemon | yes | `--daemon-ui`, `--ui` | `MCPX_DAEMON_UI` | serve the dashboard page at /dashboard | `TestDaemonUITurnsTheDashboardOff` | | `daemon.uiDir` | string | *(empty)* | daemon | yes | `--daemon-ui-dir`, `--ui-dir` | `MCPX_DAEMON_UI_DIR` | serve your own pages instead of the embedded dashboard | `TestDaemonUIDirOverridesTheDashboard` | | `daemon.warm` | bool | `true` | daemon | no | `--daemon-warm`, `--warm` | `MCPX_DAEMON_WARM` | read every server's schemas in the background at startup | `TestDaemonWarmReadsTheServersAtStartupFromTheEnvironment` | | `daemon.warmTimeout` | duration | `3m0s` | daemon | no | `--daemon-warm-timeout` | `MCPX_DAEMON_WARM_TIMEOUT` | *(plumbing)* how long the background schema fetch may take | `TestDaemonWarmTimeoutBoundsTheStartupWarm` | | `daemon.watchConfig` | bool | `true` | daemon | yes | `--daemon-watch-config` | `MCPX_DAEMON_WATCH_CONFIG` | re-read the configuration files when they change on disk | `TestDaemonWatchConfigPicksUpAHandEditFromTheEnvironment` | ### deps | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `deps.autoInstall` | enum | `off` | client | no | `--deps-auto-install` | `MCPX_DEPS_AUTO_INSTALL` | whether the runtime may fetch a missing package on its own | `TestDepsAutoInstallSelectsTheBunInstallPolicyFromTheEnvironment` | | `deps.manifest` | source | *(empty)* | client | no | `--deps-manifest` | `MCPX_DEPS_MANIFEST` | the package.json or package.jsonc naming a script's packages | `TestDepsManifestNamesTheManifestResolutionReads` | | `deps.packages` | list | *(empty)* | client | no | `--deps-packages`, `--package` | `MCPX_DEPS_PACKAGES` | packages a script may import, as name or name@version | `TestDepsPackagesPinContradictingTheManifestFailsTheRun` | | `deps.source` | enum | `host` | client | no | `--deps-source` | `MCPX_DEPS_SOURCE` | where a script's packages come from when nothing more specific says | `TestDepsSourceNoneDropsTheManifestLayer` | ### diagnose | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `diagnose.history` | int | `8` | daemon | no | `--diagnose-history` | `MCPX_DIAGNOSE_HISTORY` | *(plumbing)* how many changes are kept per tool | `TestDiagnoseHistoryCapsRecordedSchemaChanges` | | `diagnose.preflight` | bool | `true` | call | yes | `--diagnose-preflight` | `MCPX_DIAGNOSE_PREFLIGHT` | check a script's tool calls against the live schemas first | `TestDiagnosePreflightStopsAMismatchedScript` | ### doctor | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `doctor.timeout` | duration | `20s` | client | no | `--doctor-timeout` | `MCPX_DOCTOR_TIMEOUT` | how long `mcpx doctor` gives the daemon to answer | `TestDoctorTimeoutBoundsTheDaemonCheck` | ### elicit | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `elicit.askTimeout` | duration | `45s` | daemon | no | `--elicit-ask-timeout` | `MCPX_ELICIT_ASK_TIMEOUT` | how long mcpx waits for an answer to a question it raised itself | `TestElicitAskTimeoutBoundsTheWaitForAnAnswerFromTheEnvironment` | | `elicit.confirmDestructive` | bool | `false` | daemon | no | `--elicit-confirm-destructive` | `MCPX_ELICIT_CONFIRM_DESTRUCTIVE` | ask before a call to a tool that may be destructive | `TestElicitConfirmDestructiveGatesADestructiveCallFromTheEnvironment` | | `elicit.disambiguate` | enum | `never` | daemon | no | `--elicit-disambiguate` | `MCPX_ELICIT_DISAMBIGUATE` | ask which instance of a stateful server to use when several are live and the script did not choose | `TestElicitDisambiguateAsksWhichInstanceFromTheEnvironment` | | `elicit.disambiguateDefault` | enum | `new` | daemon | no | `--elicit-disambiguate-default` | `MCPX_ELICIT_DISAMBIGUATE_DEFAULT` | which instance is used when nobody answers in time: the one the scope would have chosen, or the most recently used | `TestElicitDisambiguateDefaultPicksTheRecentInstanceFromTheEnvironment` | | `elicit.maxAge` | duration | `30m` | daemon | no | `--elicit-max-age` | `MCPX_ELICIT_MAX_AGE` | the absolute ceiling on a question's life, however often it is read | `TestElicitMaxAgeCapsAnUpstreamQuestionsDeadlineFromTheEnvironment` | | `elicit.pendingLimit` | int | `100` | daemon | yes | `--elicit-pending-limit` | `MCPX_ELICIT_PENDING_LIMIT` | *(plumbing)* how many unanswered questions one listing returns | `TestElicitPendingLimitBoundsTheListingFromTheEnvironment` | | `elicit.ttl` | duration | `120s` | daemon | no | `--elicit-ttl` | `MCPX_ELICIT_TTL` | how long a question waits for an answer, renewed by use | `TestElicitTTLSetsAnUpstreamQuestionsDeadlineFromTheEnvironment` | ### embeddings | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `embeddings.apiKey` | string | *(empty)* | daemon | yes | `--embeddings-api-key` | `MCPX_EMBEDDINGS_API_KEY` | API key for remote embeddings endpoint | `TestEmbeddingsAPIKeyIsSentAsABearerToken` | | `embeddings.backend` | string | `auto` | daemon | yes | `--embeddings-backend` | `MCPX_EMBEDDINGS_BACKEND` | which embedding engine to use (auto, local, remote, wasm) | `TestEmbeddingsBackendLocalSkipsTheRemoteEndpoint` | | `embeddings.model` | string | `text-embedding-3-small` | daemon | yes | `--embeddings-model` | `MCPX_EMBEDDINGS_MODEL` | model name for remote embeddings endpoint | `TestEmbeddingsModelNamesTheRequestedModel` | | `embeddings.url` | string | *(empty)* | daemon | yes | `--embeddings-url` | `MCPX_EMBEDDINGS_URL` | OpenAI-compatible embeddings endpoint URL | `TestEmbeddingsURLSendsSemanticSearchToTheEndpoint` | | `embeddings.wasmPath` | string | *(empty)* | daemon | yes | `--embeddings-wasm-path` | `MCPX_EMBEDDINGS_WASM_PATH` | path to compiled WebAssembly neural embedding model | Exempt — embeddings backend: needs a compiled wasm model fixture the harness does not provide; the Go wasm runtime (wazero) can compile a module but no embed-exporting model ships with the repo, so the setting's effect (wasm embedder availability) is not observable end to end | ### events | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `events.history` | int | `1024` | daemon | no | `--events-history` | `MCPX_EVENTS_HISTORY` | how many past events a late subscriber can replay | `TestEventsHistoryBoundsTheReplay` | | `events.reconnect` | duration | `2s` | client | no | `--events-reconnect` | `MCPX_EVENTS_RECONNECT` | how long a client waits before resuming a dropped stream | `TestEventsReconnectWaitsForTheConfiguredDelay` | ### exec | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `exec.maxOutputBytes` | bytes | `64KiB` | call | yes | `--exec-max-output-bytes` | `MCPX_EXEC_MAX_OUTPUT_BYTES` | cap the stdout a run returns, with a truncation marker | `TestExecMaxOutputBytesCapsStdoutFromTheEnvironment` | | `exec.output` | enum | `text` | call | yes | `--exec-output`, `--output` | `MCPX_EXEC_OUTPUT` | text for a terminal, structured for one document, stream for frames | `TestExecOutputShapesTheResultFromTheEnvironment` | | `exec.timeout` | duration | `120s` | call | yes | `--exec-timeout` | `MCPX_EXEC_TIMEOUT` | kill a script after this long | `TestExecTimeoutStopsALongScriptFromTheEnvironment` | | `exec.where` | enum | `auto` | call | yes | `--exec-where` | `MCPX_EXEC_WHERE` | in this process, or on the daemon | `TestExecWhereRemoteRunsOnTheDaemon` | ### hooks | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `hooks` | string | *(empty)* | daemon | no | `--hooks` | `MCPX_HOOKS` | config-declared hooks over the event bus: a JSON array of hook objects | `TestHooksRunOnTheirEvent` | | `hooks.autonomy` | enum | `run` | call | yes | `--hooks-autonomy` | `MCPX_HOOKS_AUTONOMY` | whether configured script hooks (before, onSuccess, onError) run | `TestHooksAutonomySkipsAConfiguredHookFromTheEnvironment` | | `hooks.timeout` | duration | `2s` | daemon | no | `--hooks-timeout` | `MCPX_HOOKS_TIMEOUT` | the hard timeout for a declared hook that does not set its own | `TestHooksTimeoutStopsASlowHook` | ### http | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `http.bodyLimit` | bytes | `1048576` | daemon | yes | `--http-body-limit` | `MCPX_HTTP_BODY_LIMIT` | *(plumbing)* the ceiling on an ordinary /v1 request body | `TestHTTPBodyLimitsRejectOversizedBodies` | | `http.callBodyLimit` | bytes | `67108864` | daemon | yes | `--http-call-body-limit` | `MCPX_HTTP_CALL_BODY_LIMIT` | the ceiling on a POST /v1/call body | `TestHTTPBodyLimitsRejectOversizedBodies` | | `http.controlBodyLimit` | bytes | `65536` | daemon | yes | `--http-control-body-limit` | `MCPX_HTTP_CONTROL_BODY_LIMIT` | *(plumbing)* the ceiling on a body that should hold one field | `TestHTTPBodyLimitsRejectOversizedBodies` | | `http.idleConnTimeout` | duration | `30s` | client | no | `--http-idle-conn-timeout` | `MCPX_HTTP_IDLE_CONN_TIMEOUT` | *(plumbing)* how long an unused connection is kept | `TestHTTPIdleConnTimeoutExpiresAnIdleClientConnection` | | `http.idleConns` | int | `8` | client | no | `--http-idle-conns` | `MCPX_HTTP_IDLE_CONNS` | *(plumbing)* idle connections kept to a local daemon | `TestHTTPIdleConnectionPoolSettingsChangeReuse` | | `http.readHeaderTimeout` | duration | `10s` | daemon | no | `--http-read-header-timeout` | `MCPX_HTTP_READ_HEADER_TIMEOUT` | *(plumbing)* how long a client has to finish sending its headers | `TestHTTPReadHeaderTimeoutClosesSlowClients` | | `http.remoteIdleConns` | int | `16` | client | no | `--http-remote-idle-conns` | `MCPX_HTTP_REMOTE_IDLE_CONNS` | *(plumbing)* idle connections kept to a daemon over the network | `TestHTTPIdleConnectionPoolSettingsChangeReuse` | | `http.requestTimeout` | duration | `10m0s` | client | no | `--http-request-timeout` | `MCPX_HTTP_REQUEST_TIMEOUT` | how long a CLI request to the daemon may take | `TestHTTPRequestTimeoutBoundsAClientCall` | | `http.shutdownGrace` | duration | `5s` | daemon | yes | `--http-shutdown-grace` | `MCPX_HTTP_SHUTDOWN_GRACE` | how long in-flight requests have when the daemon stops | `TestHTTPShutdownGraceBoundsHowLongAStopWaits` | | `http.ssePing` | duration | `15s` | daemon | yes | `--http-sse-ping` | `MCPX_HTTP_SSE_PING` | *(plumbing)* how often a comment is sent on an idle event stream | `TestHTTPEventStreamSettingsChangeTheStream` | | `http.sseRetry` | duration | `2s` | daemon | yes | `--http-sse-retry` | `MCPX_HTTP_SSE_RETRY` | *(plumbing)* how long a dropped subscriber is told to wait | `TestHTTPEventStreamSettingsChangeTheStream` | | `http.streamBufferInit` | bytes | `65536` | client | no | `--http-stream-buffer-init` | `MCPX_HTTP_STREAM_BUFFER_INIT` | *(plumbing)* the initial line buffer when reading an event stream | Exempt — Scanner allocation-capacity hint only; changing it does not change emitted events or line limits, and allocation size is not a stable e2e behavior oracle | | `http.streamBufferMax` | bytes | `8388608` | client | no | `--http-stream-buffer-max` | `MCPX_HTTP_STREAM_BUFFER_MAX` | *(plumbing)* the largest single event line that will be read | `TestHTTPStreamBufferMaxEndsAnOversizedEventLine` | ### logging | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `logging.dir` | string | *(empty)* | daemon | no | `--logging-dir`, `--log-dir` | `MCPX_LOGGING_DIR` | where the JSONL files are written | `TestLoggingDirHoldsTheDurableLog` | | `logging.file` | bool | `true` | daemon | no | `--logging-file` | `MCPX_LOGGING_FILE` | whether the durable JSONL log is written at all | `TestLoggingFileOffWritesNoDurableLog` | | `logging.format` | enum | `text` | client | no | `--logging-format`, `--format` | `MCPX_LOGGING_FORMAT` | how records are rendered | `TestLoggingFormatRendersJSON` | | `logging.include` | list | `host,user,process,version` | daemon | no | `--logging-include`, `--include` | `MCPX_LOGGING_INCLUDE` | which context blocks are attached to lifecycle records | `TestLoggingIncludeChoosesTheAmbientBlocks` | | `logging.keep` | int | `8` | daemon | no | `--logging-keep`, `--keep` | `MCPX_LOGGING_KEEP` | how many rolled files to keep | `TestLoggingKeepPrunesRotatedFiles` | | `logging.level` | enum | `info` | daemon | yes | `--logging-level`, `--log-level` | `MCPX_LOGGING_LEVEL`, `MCPX_LOG_LEVEL` | the lowest level that is kept | `TestLoggingLevelShowsDebugRecords` | | `logging.maxAge` | duration | `24h` | daemon | no | `--logging-max-age` | `MCPX_LOGGING_MAX_AGE` | roll the log file once it is this old | `TestLoggingMaxAgeRotatesAnAgedFile` | | `logging.maxBytes` | bytes | `16MB` | daemon | no | `--logging-max-bytes` | `MCPX_LOGGING_MAX_BYTES` | roll the log file once it reaches this size | `TestLoggingMaxBytesRotatesTheFile` | | `logging.maxLines` | int | `0` | daemon | no | `--logging-max-lines` | `MCPX_LOGGING_MAX_LINES` | roll the log file once it holds this many records | `TestLoggingMaxLinesRotatesTheFile` | | `logging.source` | enum | `warn` | daemon | yes | `--logging-source`, `--log-source` | `MCPX_LOGGING_SOURCE` | from which level upward to record the calling file and line | `TestLoggingSourceAddsTheCallSite` | | `logging.trace` | bool | `false` | daemon | no | `--logging-trace` | `MCPX_TRACE` | log which instance served every tool call | `TestLoggingTraceLogsEachCall` | ### logstore | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `logstore.followBacklog` | int | `1000` | client | no | `--logstore-follow-backlog` | `MCPX_LOGSTORE_FOLLOW_BACKLOG` | *(plumbing)* how many records one poll of `mcpx log --follow` may emit | `TestFollowBacklogCapsWhatOneFollowPollEmits` | | `logstore.queryLimit` | int | `100` | call | yes | `--logstore-query-limit` | `MCPX_LOGSTORE_QUERY_LIMIT` | how many records a log query returns by default | `TestLogstoreQueryLimitBoundsALogQueryFromTheEnvironment` | ### mcp | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `mcp.pageSize` | int | `100` | client | no | `--mcp-page-size` | `MCPX_MCP_PAGE_SIZE` | how many items one tools/list reply carries | `TestMCPPageSizePagesToolsListFromTheEnvironment` | | `mcp.passthrough` | string | *(empty)* | client | no | `--mcp-passthrough`, `--passthrough` | `MCPX_MCP_PASSTHROUGH` | serve upstreams' tools, prompts and resources under their own names | `TestMCPPassthroughServesANamespaceDirectlyFromTheEnvironment` | ### model | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `model.apiKeyEnv` | string | *(empty)* | daemon | no | `--model-api-key-env` | `MCPX_MODEL_API_KEY_ENV` | the environment variable holding the configured provider's API key | `TestModelAPIKeyEnvNamesTheKeyVariableFromTheEnvironment` | | `model.baseURL` | string | *(empty)* | daemon | no | `--model-base-url` | `MCPX_MODEL_BASE_URL` | the OpenAI-compatible endpoint the configured provider calls | `TestModelBaseURLPointsTheProviderAtAnEndpointFromTheEnvironment` | | `model.budget` | int | `0` | daemon | no | `--model-budget` | `MCPX_MODEL_BUDGET` | hard ceiling on the tokens one generation through the layer may ask for; 0 is no ceiling | `TestModelBudgetCapsAHooksTokensFromTheEnvironment` | | `model.default` | string | *(empty)* | daemon | no | `--model-default` | `MCPX_MODEL_DEFAULT` | the model id used when an operation names none, as provider/model | `TestModelDefaultNamesTheModelFromTheEnvironment` | | `model.profiles` | string | `{}` | daemon | no | `--model-profiles` | `MCPX_MODEL_PROFILES` | JSON object of named ordered provider/model fallback chains | `TestModelProfilesResolvesANamedChainFromTheEnvironment` | | `model.provider` | enum | `none` | daemon | no | `--model-provider` | `MCPX_MODEL_PROVIDER` | where mcpx's own generation gets a model: a configured provider, sampling through the caller, or none | `TestModelProviderSelectsTheBackendFromTheEnvironment` | | `model.providers` | string | `{}` | daemon | no | `--model-providers` | `MCPX_MODEL_PROVIDERS` | JSON object mapping provider names to baseURL and apiKeyEnv | `TestModelProvidersRoutesAProviderToItsEndpointFromTheEnvironment` | | `model.timeout` | duration | `1m30s` | daemon | no | `--model-timeout` | `MCPX_MODEL_TIMEOUT` | how long one generation through the layer may take | `TestModelTimeoutBoundsAGenerationFromTheEnvironment` | ### output | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `output.color` | enum | `auto` | client | no | `--output-color` | `MCPX_OUTPUT_COLOR` | whether to colourise the browser | `TestOutputColorIsReachableFromTheEnvironment` | | `output.json` | bool | `false` | client | no | `--output-json`, `--json` | `MCPX_OUTPUT_JSON` | emit one machine-readable document | `TestOutputJSONIsReachableFromTheEnvironment` | ### paths | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `paths.adapters` | paths | *(empty)* | client | no | `--paths-adapters` | `MCPX_PATHS_ADAPTERS` | files declaring command-line programs as MCP servers | `TestPathsAdaptersFindsADeclarationFile` | | `paths.apis` | paths | *(empty)* | client | no | `--paths-apis` | `MCPX_PATHS_APIS` | files naming OpenAPI documents to expose as tools | `TestPathsAPIsFindsADeclarationFile` | | `paths.cache` | string | *(empty)* | client | no | `--paths-cache` | `MCPX_PATHS_CACHE`, `MCPX_CACHE_DIR` | where generated clients and schemas are kept | `TestPathsCacheChangesTheDoctorDirectory` | | `paths.config` | paths | *(empty)* | client | no | `--paths-config` | `MCPX_PATHS_CONFIG` | where configuration files are looked for | `TestPathsConfigReadsAConfigOnlyThatPathHolds` | | `paths.configFile` | string | *(empty)* | client | no | `--config` | `MCPX_CONFIG` | read exactly this configuration file instead of searching | `TestPathsConfigFileChangesWhichConfigLoads` | | `paths.deps` | paths | *(empty)* | client | no | `--paths-deps` | `MCPX_PATHS_DEPS` | where a script's package.json / package.jsonc is looked for | `TestPathsDepsExtendsManifestDiscovery` | | `paths.placeholders` | paths | *(empty)* | client | no | `--paths-placeholders` | `MCPX_PATHS_PLACEHOLDERS` | directories of files declaring launcher placeholders | `TestPathsPlaceholdersDeclaresALauncherPlaceholder` | | `paths.plugins` | paths | *(empty)* | client | no | `--paths-plugins` | `MCPX_PATHS_PLUGINS` | directories of plugins: an mcpx-plugin.json manifest, or executables loaded as zero-manifest plugins | `TestPathsPluginsDiscoversAPluginThatLivesOnlyThere` | | `paths.scripts` | paths | *(empty)* | client | no | `--paths-scripts` | `MCPX_PATHS_SCRIPTS` | where named scripts are looked for | `TestPathsScriptsFindsRecipesThatLiveOnlyThere` | | `paths.state` | string | *(empty)* | client | no | `--paths-state` | `MCPX_PATHS_STATE`, `MCPX_STATE_DIR` | where the daemon socket, logs and index live | `TestStateDirectoryIsReachableAsASetting` | ### plugin | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `plugin.annotate` | bool | `true` | plugin | no | `--plugin-annotate` | `MCPX_PLUGIN_ANNOTATE` | add mcpx's own notes to a tool result | `TestPluginAnnotateChangesToolResultsFromTheEnvironment` | | `plugin.backend` | enum | `auto` | plugin | no | `--plugin-backend` | `MCPX_PLUGIN_BACKEND` | whether the plugin talks to the daemon or spawns the binary | `TestPluginBackendChoosesDaemonOrBinaryFromTheEnvironment` | | `plugin.bin` | string | `mcpx` | plugin | no | `--plugin-bin` | `MCPX_PLUGIN_BIN` | the executable the plugin invokes | `TestPluginBinInvokesTheConfiguredExecutableFromTheEnvironment` | | `plugin.binArgs` | list | *(empty)* | plugin | no | `--plugin-bin-args` | `MCPX_PLUGIN_BIN_ARGS` | arguments put in front of every plugin invocation of mcpx | `TestPluginBinArgsPrependsTheConfiguredArgumentsFromTheEnvironment` | | `plugin.daemonTools` | enum | `auto` | plugin | no | `--plugin-daemon-tools` | `MCPX_PLUGIN_DAEMON_TOOLS` | offer the tools that list and choose between daemons | `TestPluginDaemonToolsAreOfferedFromTheEnvironment` | | `plugin.disabledTools` | list | *(empty)* | plugin | no | `--plugin-disabled-tools` | `MCPX_PLUGIN_DISABLED_TOOLS` | model-facing mcpx tools hidden from every session | `TestPluginDisabledToolsHidesToolsFromTheEnvironment` | | `plugin.discoveryRetry` | duration | `1m0s` | plugin | no | `--plugin-discovery-retry` | `MCPX_PLUGIN_DISCOVERY_RETRY` | how long the plugin waits before looking for mcpx again | `TestPluginDiscoveryRetryDelaysRediscoveryFromTheEnvironment` | | `plugin.env` | enum | `full` | plugin | no | `--plugin-env` | `MCPX_PLUGIN_ENV` | how much session context is put into each command's environment | `TestPluginEnvLevelChangesShellEnvFromTheEnvironment` | | `plugin.headless` | enum | `auto` | plugin | no | `--plugin-headless` | `MCPX_PLUGIN_HEADLESS` | suppress toasts, because nobody is looking at a screen | `TestPluginHeadlessSuppressesToastsFromTheEnvironment` | | `plugin.instructions` | bool | `false` | plugin | no | `--plugin-instructions` | `MCPX_PLUGIN_INSTRUCTIONS` | add mcpx usage guidance to the system prompt | `TestPluginInstructionsAppendsTheContextParagraphFromTheEnvironment` | | `plugin.remember` | enum | `session` | plugin | no | `--plugin-remember` | `MCPX_PLUGIN_REMEMBER` | how long a chosen daemon stays chosen | `TestPluginRememberScopePersistsTheDaemonChoiceFromTheEnvironment` | | `plugin.toolTiming` | bool | `false` | plugin | no | `--plugin-tool-timing` | `MCPX_PLUGIN_TOOL_TIMING` | write every tool outcome into mcpx's log | `TestPluginToolTimingRecordsToolCallsFromTheEnvironment` | | `plugin.tools` | bool | `false` | plugin | no | `--plugin-tools` | `MCPX_PLUGIN_TOOLS` | expose mcpx itself as tools the model can call | `TestPluginToolsRegistersTheToolSetFromTheEnvironment` | ### plumbing | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `plumbing.allowTsJsOverlap` | bool | `false` | client | no | `--plumbing-allow-ts-js-overlap` | `MCPX_PLUMBING_ALLOW_TS_JS_OVERLAP` | *(plumbing)* permit a script directory holding both foo.ts and foo.js | `TestPlumbingAllowTsJsOverlapPicksAmbiguousScripts` | | `plumbing.indexOnQuery` | bool | `true` | daemon | no | `--plumbing-index-on-query` | `MCPX_PLUMBING_INDEX_ON_QUERY` | *(plumbing)* bring the log index up to date before answering a query | `TestPlumbingIndexOnQueryIngestsBeforeALogQuery` | | `plumbing.launcherPlaceholderRepeat` | list | *(empty)* | client | no | `--plumbing-launcher-placeholder-repeat` | `MCPX_PLUMBING_LAUNCHER_PLACEHOLDER_REPEAT` | *(plumbing)* launcher placeholders permitted to resolve more than once | `TestPlumbingLauncherPlaceholderRepeatAllowsATwiceUsedName` | | `plumbing.sourceDirAllowed` | bool | `true` | client | no | `--plumbing-source-dir-allowed` | `MCPX_PLUMBING_SOURCE_DIR_ALLOWED` | *(plumbing)* whether a directory may stand in for a source string at all | `TestPlumbingSourceDirAllowedTakesADirectoryAsSource` | | `plumbing.sourceDirRecursive` | bool | `false` | client | no | `--plumbing-source-dir-recursive` | `MCPX_PLUMBING_SOURCE_DIR_RECURSIVE` | *(plumbing)* when a directory is given as source, descend into subdirectories | `TestPlumbingSourceDirRecursiveReadsSubdirectories` | | `plumbing.sourceProbePaths` | bool | `true` | client | no | `--plumbing-source-probe-paths` | `MCPX_PLUMBING_SOURCE_PROBE_PATHS` | *(plumbing)* treat a source argument that names an existing file as a file | `TestPlumbingSourceProbePathsReadsANamedFile` | | `plumbing.strictUnknownKeys` | bool | `false` | client | no | `--plumbing-strict-unknown-keys` | `MCPX_PLUMBING_STRICT_UNKNOWN_KEYS` | *(plumbing)* fail on a configuration key no setting claims | `TestStrictUnknownKeysRefusesATypo` | | `plumbing.validatePaths` | bool | `true` | client | no | `--plumbing-validate-paths` | `MCPX_PLUMBING_VALIDATE_PATHS` | *(plumbing)* resolve and verify every referenced path before doing any work | `TestPlumbingValidatePathsChecksTheLogDirUpFront` | ### policy | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `policy.write` | enum | `ask` | daemon | no | `--policy-write` | `MCPX_POLICY_WRITE` | what to do before a call that may write: ask for confirmation, allow it, or deny it | `TestPolicyWriteDeniesAnUnannotatedCallFromTheEnvironment` | ### pool | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `pool.callTimeout` | duration | `120s` | daemon | yes | `--pool-call-timeout` | `MCPX_POOL_CALL_TIMEOUT` | how long one tool call may take | `TestPoolCallTimeoutBoundsASlowCall` | | `pool.idleTimeout` | duration | `5m` | daemon | yes | `--pool-idle-timeout` | `MCPX_POOL_IDLE_TIMEOUT` | how long an unused server lingers before it is stopped | `TestPoolIdleTimeoutReapsAnIdleInstanceFromTheEnvironment` | | `pool.max` | int | `4` | daemon | yes | `--pool-max` | `MCPX_POOL_MAX` | how many copies of one server may run at once | `TestPoolDefaultsAreReachableFromTheEnvironment` | | `pool.min` | int | `0` | daemon | yes | `--pool-min` | `MCPX_POOL_MIN` | how many copies to keep started even when idle | `TestPoolMinKeepsAnInstanceWarmFromTheEnvironment` | | `pool.scope` | enum | `global` | daemon | no | `--pool-scope` | `MCPX_POOL_SCOPE` | what counts as the same caller for sharing purposes | `TestPoolDefaultsAreReachableFromTheEnvironment` | | `pool.sharing` | enum | `shared` | daemon | no | `--pool-sharing` | `MCPX_POOL_SHARING` | whether callers reuse one instance or each get their own | `TestPoolDefaultsAreReachableFromTheEnvironment` | | `pool.startTimeout` | duration | `60s` | daemon | yes | `--pool-start-timeout` | `MCPX_POOL_START_TIMEOUT` | how long a server has to become ready | `TestPoolStartTimeoutBoundsServerStart` | ### preset | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `preset` | list | *(empty)* | client | no | `--preset` | `MCPX_PRESET` | which presets to apply, in order | `TestPresetSelectsADefinedBundle` | ### presets | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `presets` | string | *(empty)* | client | no | `--presets` | `MCPX_PRESETS` | named flag bundles: {name: ["--json", "--timeout=30s"]} | `TestPresetsDefinesNamedFlagBundles` | ### prompt | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `prompt.autonomy` | enum | `propose` | call | yes | `--prompt-autonomy` | `MCPX_PROMPT_AUTONOMY` | whether a request returns the script (propose) or runs it (run) | `TestPromptAutonomyRunsTheMatchedRecipeFromTheEnvironment` | | `prompt.catalogBudget` | int | `1200` | call | yes | `--prompt-catalog-budget` | `MCPX_PROMPT_CATALOG_BUDGET` | approximate token ceiling for the slice of catalog sent with a sampling request | `TestPromptCatalogBudgetBoundsTheCatalogSentToTheModel` | | `prompt.maxTokens` | int | `1500` | call | yes | `--prompt-max-tokens` | `MCPX_PROMPT_MAX_TOKENS` | *(plumbing)* maxTokens on the sampling request | `TestPromptMaxTokensSetsAHooksTokenCapFromTheEnvironment` | | `prompt.runTimeout` | duration | `5m0s` | call | yes | `--prompt-run-timeout` | `MCPX_PROMPT_RUN_TIMEOUT` | how long a recipe or generated script may run | `TestPromptRunTimeoutBoundsARecipeRun` | | `prompt.sample` | enum | `never` | daemon | no | `--prompt-sample` | `MCPX_PROMPT_SAMPLE` | whether a request with no matching recipe may ask the caller's model to write one | `TestPromptSampleAskLetsAnUnmatchedPromptSeekAModel` | | `prompt.sampleTimeout` | duration | `1m30s` | daemon | no | `--prompt-sample-timeout` | `MCPX_PROMPT_SAMPLE_TIMEOUT` | how long a generation request waits for a model | `TestPromptSampleTimeoutBoundsASamplingQuestion` | ### proto | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `proto.askPoll` | duration | `500ms` | daemon | no | `--proto-ask-poll` | `MCPX_PROTO_ASK_POLL` | *(plumbing)* how long one wait for a question may block | `TestAskPollCeilingIsReachableFromTheEnvironment` | | `proto.askRounds` | int | `8` | daemon | no | `--proto-ask-rounds` | `MCPX_PROTO_ASK_ROUNDS` | how many times one request may come back asking for more | `TestAskRoundsLimitIsReachableFromTheEnvironment` | | `proto.askTTL` | duration | `15m` | daemon | no | `--proto-ask-ttl` | `MCPX_PROTO_ASK_TTL` | *(plumbing)* how long the daemon keeps a call waiting for an answer | `TestAskTTLBoundsAnInterruptibleCallFromTheEnvironment` | | `proto.askTimeout` | duration | `10m` | daemon | no | `--proto-ask-timeout` | `MCPX_PROTO_ASK_TIMEOUT` | how long one request may be held while a question goes unanswered | `TestAskTimeoutReleasesAHeldRequestFromTheEnvironment` | | `proto.elicitationPerMinute` | int | `30` | daemon | no | `--proto-elicitation-per-minute` | `MCPX_PROTO_ELICITATION_PER_MINUTE` | max elicitation requests one upstream server may make per minute, across all its sessions | `TestElicitationPerMinuteRefusesAServersSecondQuestion` | | `proto.mcpPath` | string | `/mcp` | daemon | no | `--proto-mcp-path` | `MCPX_PROTO_MCP_PATH` | where the daemon serves MCP | `TestMCPPathMovesTheEndpointFromTheEnvironment` | | `proto.native` | bool | `true` | daemon | no | `--proto-native` | `MCPX_PROTO_NATIVE` | put an upstream server's questions to mcpx's own MCP client | `TestNativeAsksTheCallingClientFromTheEnvironment` | | `proto.samplingPerMinute` | int | `60` | daemon | no | `--proto-sampling-per-minute` | `MCPX_PROTO_SAMPLING_PER_MINUTE` | max sampling requests one upstream server may make per minute, across all its sessions | `TestSamplingPerMinuteRefusesAServersSecondSampling` | | `proto.samplingSessionPerMinute` | int | `20` | daemon | no | `--proto-sampling-session-per-minute` | `MCPX_PROTO_SAMPLING_SESSION_PER_MINUTE` | max sampling requests one upstream server may make within a single session per minute | `TestSamplingSessionPerMinuteRefusesASessionsSecondSampling` | | `proto.serveMCP` | bool | `true` | daemon | no | `--proto-serve-mcp` | `MCPX_PROTO_SERVE_MCP` | mount mcpx's own MCP server on the daemon's listeners | `TestServeMCPUnmountsTheEndpointFromTheEnvironment` | | `proto.sessionIdle` | duration | `30m` | daemon | no | `--proto-session-idle` | `MCPX_PROTO_SESSION_IDLE` | *(plumbing)* how long an unused Streamable HTTP session is kept | `TestSessionIdleReapsAnUnusedSessionFromTheEnvironment` | | `proto.stateTTL` | duration | `30m` | daemon | no | `--proto-state-ttl` | `MCPX_PROTO_STATE_TTL` | *(plumbing)* how long a client may resume an interrupted request with | `TestStateTTLExpiresAResumableRequestFromTheEnvironment` | ### protoMessages | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `protoMessages.listMaxAge` | duration | `1m0s` | daemon | no | `--proto-messages-list-max-age` | `MCPX_PROTO_MESSAGES_LIST_MAX_AGE` | ttlMs on server/discover and every list result sent to a 2026-07-28 client | `TestListMaxAgeSetsTheListCacheHintFromTheEnvironment` | | `protoMessages.readMaxAge` | duration | `0s` | daemon | no | `--proto-messages-read-max-age` | `MCPX_PROTO_MESSAGES_READ_MAX_AGE` | ttlMs on resources/read results sent to a 2026-07-28 client | `TestReadMaxAgeSetsTheReadCacheHintFromTheEnvironment` | | `protoMessages.taskAfter` | duration | `2s` | daemon | no | `--proto-messages-task-after` | `MCPX_PROTO_MESSAGES_TASK_AFTER` | how long a tools/call runs in line before a tasks-extension client is handed a task | `TestTaskAfterHandsASlowCallATaskFromTheEnvironment` | ### protoTasks | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `protoTasks.cancelGrace` | duration | `5s` | daemon | no | `--proto-tasks-cancel-grace` | `MCPX_PROTO_TASKS_CANCEL_GRACE` | how long cooperative task work may finish after cancellation | `TestProtoTasksCancelGraceExpiresACancelledTaskFromTheEnvironment` | | `protoTasks.maxPerRequestor` | int | `32` | daemon | no | `--proto-tasks-max-per-requestor` | `MCPX_PROTO_TASKS_MAX_PER_REQUESTOR` | how many non-terminal tasks one requestor may hold at once | `TestProtoTasksMaxPerRequestorCapsUnfinishedTasksFromTheEnvironment` | | `protoTasks.maxTTL` | duration | `1h0m0s` | daemon | no | `--proto-tasks-max-ttl` | `MCPX_PROTO_TASKS_MAX_TTL` | the longest TTL a task may ask for; longer requests are clamped | `TestProtoTasksMaxTTLClampsATasksRetentionFromTheEnvironment` | | `protoTasks.perMinute` | int | `120` | daemon | no | `--proto-tasks-per-minute` | `MCPX_PROTO_TASKS_PER_MINUTE` | the tasks/* admission window per requestor; 0 disables it | `TestProtoTasksPerMinuteWindowsTaskReadsFromTheEnvironment` | | `protoTasks.pollInterval` | duration | `1s` | daemon | no | `--proto-tasks-poll-interval` | `MCPX_PROTO_TASKS_POLL_INTERVAL` | the pollInterval every task carries | `TestTaskPollIntervalSetsTheTaskPollHintFromTheEnvironment` | ### proxy | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `proxy.timeout` | duration | `10m` | daemon | no | `--proxy-timeout` | `MCPX_PROXY_TIMEOUT` | how long the daemon waits for a chat-completions upstream | `TestProxyUpstreamTimeoutIsReachableFromTheEnvironment` | ### recipes | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `recipes.limit` | int | `5` | call | yes | `--recipes-limit` | `MCPX_RECIPES_LIMIT` | how many ranked recipes are returned | `TestRecipesLimitBoundsTheRankingFromTheEnvironment` | | `recipes.matchMargin` | int | `150` | call | yes | `--recipes-match-margin` | `MCPX_RECIPES_MATCH_MARGIN` | how far ahead the best recipe must be, as a percentage of the next one | `TestRecipesMatchMarginSettlesATieFromTheEnvironment` | | `recipes.minScore` | int | `30` | call | yes | `--recipes-min-score` | `MCPX_RECIPES_MIN_SCORE` | the score below which a request is not considered a match for any recipe | `TestRecipesMinScoreRefusesAWeakMatchFromTheEnvironment` | ### registry | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `registry.limit` | int | `20` | call | yes | `--registry-limit` | `MCPX_REGISTRY_LIMIT` | how many registry results are returned | `TestRegistryLimitReachesTheCLI` | | `registry.maxPages` | int | `10` | client | no | `--registry-max-pages` | `MCPX_REGISTRY_MAX_PAGES` | *(plumbing)* how many requests one registry search may make | `TestTheRegistryPageCapSaysItStoppedEarly` | | `registry.pageSize` | int | `30` | client | no | `--registry-page-size` | `MCPX_REGISTRY_PAGE_SIZE` | *(plumbing)* how many entries are fetched per registry request | `TestRegistryPageSizeChangesWhatTheCLIAsksFor` | | `registry.timeout` | duration | `30s` | client | no | `--registry-timeout` | `MCPX_REGISTRY_TIMEOUT` | how long a registry request may take | `TestRegistryTimeoutBoundsARegistryRequest` | | `registry.url` | string | `https://registry.modelcontextprotocol.io` | client | no | `--registry-url` | `MCPX_REGISTRY_URL` | where `mcpx registry` looks for servers | `TestRegistryPageSizeChangesWhatTheCLIAsksFor` | ### repair | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `repair.autonomy` | enum | `advise` | call | yes | `--repair-autonomy` | `MCPX_REPAIR_AUTONOMY` | how far mcpx goes about a failed call: off attaches nothing, advise attaches diagnostics | `TestRepairAutonomyOffDropsTheDiagnosticsFromTheEnvironment` | ### retention | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `retention.maxTools` | int | `24` | daemon | no | `--retention-max-tools` | `MCPX_RETENTION_MAX_TOOLS` | maximum active tools in reactive working set | `TestRetentionMaxToolsCapsTheReactiveWorkingSet` | | `retention.stickyWindow` | duration | `2h` | daemon | no | `--retention-sticky-window` | `MCPX_RETENTION_STICKY_WINDOW` | duration explicitly requested tools remain retained | `TestRetentionStickyWindowExpiresReactiveTools` | ### sampling | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `sampling.answerLocally` | bool | `false` | daemon | no | `--sampling-answer-locally` | `MCPX_SAMPLING_ANSWER_LOCALLY` | answer upstream sampling requests with mcpx's configured model provider instead of relaying them to the caller | `TestSamplingAnswerLocallyAnswersAnUpstreamFromTheEnvironment` | ### script | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `script.before` | source | *(empty)* | client | no | `--script-before` | `MCPX_SCRIPT_BEFORE` | runs first, ahead of the globals being installed | `TestScriptPhasesRunFromTheEnvironment` | | `script.captureConsole` | bool | `true` | client | no | `--script-capture-console` | `MCPX_SCRIPT_CAPTURE_CONSOLE` | route console calls into the log | `TestScriptCaptureConsoleOffDropsConsoleOutput` | | `script.check` | enum | `off` | client | no | `--script-check`, `--script-typecheck`, `--typecheck` | `MCPX_SCRIPT_CHECK`, `MCPX_SCRIPT_TYPECHECK` | check the generated program before running it; path alias: script.typecheck; one of off, types (also on), strict | `TestScriptTypecheckOnRefusesATypeError` | | `script.checkOnError` | enum | `fail` | client | no | `--script-check-on-error` | `MCPX_SCRIPT_CHECK_ON_ERROR` | what to do when script checking finds an error | `TestScriptCheckOnErrorDecidesOnACheckError` | | `script.checkOnUnsupported` | enum | `warn` | client | no | `--script-check-on-unsupported` | `MCPX_SCRIPT_CHECK_ON_UNSUPPORTED` | what to do when the selected runtime cannot check the script | `TestScriptCheckOnUnsupportedDecidesWhatANonDenoCheckDoes` | | `script.cwd` | enum | `caller` | client | no | `--script-cwd` | `MCPX_SCRIPT_CWD` | where a script runs: caller, script, config or workdir | `TestScriptCwdIsReachableFromTheEnvironment` | | `script.devshell` | string | `host` | client | no | `--script-devshell` | `MCPX_SCRIPT_DEVSHELL` | environment the script runs inside: host, or `flake:` for a Nix flake devshell | `TestScriptDevshellIsReachableFromTheEnvironment` | | `script.env` | list | *(empty)* | client | no | `--script-env`, `--env` | `MCPX_SCRIPT_ENV` | KEY=VALUE pairs added to the script's environment | `TestScriptEnvIsReachableFromTheEnvironment` | | `script.imports` | enum | `report` | client | no | `--script-imports` | `MCPX_SCRIPT_IMPORTS` | resolve the script's import graph before running it | `TestScriptImportsOffSkipsTheImportPipeline` | | `script.importsCrossProject` | enum | `isolate` | client | no | `--script-imports-cross-project` | `MCPX_SCRIPT_IMPORTS_CROSS_PROJECT` | how to handle a file edge into another project's manifest | `TestScriptImportsCrossProjectDecidesAForeignProjectEdge` | | `script.importsNetwork` | enum | `on` | client | no | `--script-imports-network` | `MCPX_SCRIPT_IMPORTS_NETWORK` | allow registry lookups when a package has no declared version | `TestScriptImportsNetworkDecidesWhetherToPinAnUndeclaredPackage` | | `script.importsOnDynamic` | enum | `warn` | client | no | `--script-imports-on-dynamic` | `MCPX_SCRIPT_IMPORTS_ON_DYNAMIC` | what to do about an import() whose specifier is computed | `TestScriptImportsOnDynamicDecidesAComputedImport` | | `script.importsOnMissing` | enum | `fail` | client | no | `--script-imports-on-missing` | `MCPX_SCRIPT_IMPORTS_ON_MISSING` | how to handle a package absent from the dependency set | `TestScriptImportsOnMissingDecidesOnAMissingPackage` | | `script.interpreter` | string | *(empty)* | client | no | `--script-interpreter`, `--interpreter`, `--shell` | `MCPX_SCRIPT_INTERPRETER` | command line that runs scripts instead of a JavaScript runtime | `TestScriptInterpreterIsReachableFromTheEnvironment` | | `script.language` | enum | `auto` | client | no | `--script-language`, `--language` | `MCPX_SCRIPT_LANGUAGE` | language a script is written in: auto, typescript, javascript, python or roc | `TestScriptLanguageRunsPython` | | `script.launcher` | source | *(empty)* | client | no | `--script-launcher` | `MCPX_SCRIPT_LAUNCHER` | replace the generated launcher entirely | `TestScriptLauncherReplacesTheLauncher` | | `script.onError` | source | *(empty)* | client | no | `--script-on-error` | `MCPX_SCRIPT_ON_ERROR` | runs when the script throws; the error still propagates | `TestScriptPhasesRunFromTheEnvironment` | | `script.onSuccess` | source | *(empty)* | client | no | `--script-on-success` | `MCPX_SCRIPT_ON_SUCCESS` | runs when the script returns without throwing | `TestScriptPhasesRunFromTheEnvironment` | | `script.permissions` | string | `all` | client | no | `--script-permissions`, `--permissions` | `MCPX_SCRIPT_PERMISSIONS`, `MCPX_PERMISSIONS` | permission profiles, composed in order, or raw: flags | `TestScriptPermissionsSandboxesNode` | | `script.prefix` | source | *(empty)* | client | no | `--script-prefix` | `MCPX_SCRIPT_PREFIX` | runs after globals are installed, before the script | `TestScriptPrefixIsReachableFromTheEnvironment` | | `script.profiles` | string | *(empty)* | client | no | `--script-profiles` | `MCPX_SCRIPT_PROFILES` | user profiles: {name: {deno: [flags], node: [flags]}} or {name: "raw flags"} | `TestScriptProfilesDefinesAProfile` | | `script.runtime` | string | `auto` | client | no | `--script-runtime`, `--runtime` | `MCPX_SCRIPT_RUNTIME` | which JavaScript runtime executes the script | `TestScriptRuntimeSelectsTheRuntime` | | `script.runtimeOrder` | list | `deno,bun,node` | client | no | `--script-runtime-order` | `MCPX_SCRIPT_RUNTIME_ORDER` | the runtimes auto tries, in order | `TestScriptRuntimeOrderRanksTheAutoPick` | | `script.runtimes` | string | *(empty)* | client | no | `--script-runtimes` | `MCPX_SCRIPT_RUNTIMES` | named runtime binaries: {name: {kind, bin, args}} | `TestScriptRuntimesDeclaresARuntime` | | `script.suffix` | source | *(empty)* | client | no | `--script-suffix` | `MCPX_SCRIPT_SUFFIX` | runs last on both paths, like a finally | `TestScriptPhasesRunFromTheEnvironment` | ### search | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `search.limit` | int | `20` | call | yes | `--search-limit`, `--limit`, `--n` | `MCPX_SEARCH_LIMIT` | how many tools a search returns | `TestSearchLimitCapsTheResults` | | `search.semantic` | bool | `false` | call | yes | `--search-semantic` | `MCPX_SEARCH_SEMANTIC` | rank search results using local dense vector embeddings | `TestSearchSemanticRanksWithTheConfiguredEmbedder` | ### serve | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `serve.mode` | string | `code-mode` | daemon | no | `--serve-mode`, `--mode` | `MCPX_SERVE_MODE` | server mode: code-mode, reactive, or full | `TestServeModeSelectsTheServedSurface` | ### session | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `session.releaseTimeout` | duration | `10s` | client | no | `--session-release-timeout` | `MCPX_SESSION_RELEASE_TIMEOUT` | *(plumbing)* how long releasing a finished session may take | `TestSessionReleaseTimeoutBoundsTheEndOfRunReleaseFromTheEnvironment` | ### spec | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `spec.first` | string | *(empty)* | daemon | no | `--mcp-spec` | `MCPX_MCP_SPEC` | move one MCP revision to the front of spec.precedence | `TestTheRevisionPolicyDecidesWhetherProgressKeepsItsMessage` | | `spec.lenient` | list | *(empty)* | daemon | no | `--spec-lenient` | `MCPX_SPEC_LENIENT` | MCP revisions not held strictly; every revision not listed is strict | `TestTheRevisionPolicyDecidesWhetherAServerInitiatedRequestIsAnswered` | | `spec.precedence` | list | `2026-07-28,2025-11-25,2025-06-18,2025-03-26,2024-11-05` | daemon | no | `--spec-precedence` | `MCPX_SPEC_PRECEDENCE` | MCP revisions in the order their rules win a conflict, first wins | `TestSpecPrecedenceDecidesWhetherProgressKeepsItsMessageFromTheEnvironment` | ### stats | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `stats.top` | int | `20` | call | yes | `--stats-top` | `MCPX_STATS_TOP` | how many rows a ranked statistic shows | `TestStatsTopLimitsTheRowsTheStatsAPIReports` | ### tasks | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `tasks.maxAge` | duration | `1h0m0s` | daemon | yes | `--tasks-max-age` | `MCPX_TASKS_MAX_AGE` | the maximum retention period for a terminal task result, even when repeatedly read | `TestTasksMaxAgeIsReachableFromEnvironment` | | `tasks.resultWait` | duration | `2m0s` | call | yes | `--tasks-result-wait` | `MCPX_TASKS_RESULT_WAIT` | how long collecting a task result blocks before giving up | `TestTasksResultWaitBoundsCollectingAResultFromTheEnvironment` | | `tasks.ttl` | duration | `10m0s` | daemon | yes | `--tasks-ttl` | `MCPX_TASKS_TTL` | how long a finished task's result is kept | `TestTasksTTLSetsAnExecTasksRetentionFromTheEnvironment` | ### transport | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `transport.allowedOrigins` | list | *(empty)* | daemon | no | `--transport-allowed-origins` | `MCPX_TRANSPORT_ALLOWED_ORIGINS` | browser Origins, beyond loopback, that may reach /mcp | `TestTransportAllowedOriginsAreServed` | | `transport.bearerToken` | string | *(empty)* | daemon | no | `--transport-bearer-token` | `MCPX_TRANSPORT_BEARER_TOKEN` | when set, every /v1 and /mcp request must carry this token as a Bearer credential | `TestTransportBearerTokenGatesTheDaemon` | | `transport.sessionMetaKeys` | list | `dev.mcpx/session,ai.opencode/sessionID` | daemon | yes | `--transport-session-meta-keys` | `MCPX_TRANSPORT_SESSION_META_KEYS` | the _meta keys a client may name its session with, first present wins | `TestTransportSessionMetaKeysNameTheSession` | | `transport.sseKeepAlive` | duration | `15s` | daemon | no | `--transport-sse-keep-alive` | `MCPX_TRANSPORT_SSE_KEEP_ALIVE` | how often a quiet MCP event stream carries a comment line | `TestTransportSSEKeepAliveCommentsOnAQuietStream` | | `transport.stdioDrain` | duration | `30s` | client | no | `--transport-stdio-drain` | `MCPX_TRANSPORT_STDIO_DRAIN` | how long `mcpx serve` finishes in-flight requests after its input closes | `TestTransportStdioDrainBoundsServeShutdown` | ### upstream | setting | kind | default | scope | hot | flag | variable | governs | effect probe or exemption | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `upstream.eraCache` | bool | `true` | daemon | no | `--upstream-era-cache` | `MCPX_UPSTREAM_ERA_CACHE` | remember which era each server configuration speaks, across restarts | `TestTheEraIsProbedOnceAndRememberedAcrossDaemonRestarts` | | `upstream.probeTimeout` | duration | `2s` | daemon | no | `--upstream-probe-timeout` | `MCPX_UPSTREAM_PROBE_TIMEOUT` | how long a stdio server/discover may go unanswered before initialize is also sent | `TestUpstreamProbeTimeoutBoundsTheDiscoverWaitFromTheEnvironment` | | `upstream.protocol` | enum | `prefer-discover` | daemon | no | `--upstream-protocol` | `MCPX_UPSTREAM_PROTOCOL` | which request to send first to a server that names no protocol of its own; one of prefer-discover (also modern, prefer-modern, prefer-stateless, prefer-newest), prefer-initialize (also legacy, prefer-legacy, prefer-session, prefer-oldest), force-discover (also force-modern, force-stateless), force-initialize (also force-legacy, force-session), follow | `TestTheEraIsProbedOnceAndRememberedAcrossDaemonRestarts` | ## Adapter declarations An entry in a `paths.adapters` file names a program and the subcommands worth exposing. `command` is normally a binary on `PATH`; `runtime` makes it a script instead, and resolves the interpreter for you: ```jsonc { "adapters": [{ "name": "reports", "command": "./tools/report.py", "runtime": "py", "tools": [{ "name": "daily", "params": [{ "name": "day", "required": true }] }] }] } ``` `runtime` is `bash`, `js`, `ts` or `py`. bash resolves `bash` (then `sh`), py resolves `python3` (then `python`), and js/ts use the same deno/bun/node order `script.runtimeOrder` chooses for `mcpx exec`. This is a separate resolver on purpose: `script.runtime` names the runtime mcpx itself executes generated scripts on, not the one a declaration asks for. A relative `command` resolves against the declaration's `dir`, then `PATH`. Without `runtime`, nothing changes: `command` is looked up on `PATH` and exec'd directly. `mcpx adapter check` reports a missing interpreter or script. ### Generating a declaration: `mcpx adapter import` Hand-writing is not the only way in. `mcpx adapter import ` generates one declaration deterministically — no model anywhere in the loop — from the most machine-regular source it can find, in this order (`--source auto|completion|man|help` pins one rung): 1. **Completions.** Packager-shipped files in the system completion directories first (fish, then zsh, then bash), then the binary's own `completion ` output (the cobra/clap convention). `mcpx adapter import --completion ` parses a completion script handed to it directly — the only path when the binary is not installed. 2. **Man.** The rendered man page's OPTIONS section. 3. **`--help`.** Usage lines, flag blocks and subcommand tables, with one level of subcommand `--help` recursion. Import runs the binary to do this (`--help`, `--version`, and the completion probe), so only import programs you were about to expose as tools anyway. A source that parses to nothing is a clear error naming what was tried, never a partial declaration. Output goes to stdout by default; `--out FILE` writes the file atomically instead. Either way, import emits **one standalone declaration file** and never merges into an existing adapters file: re-importing produces a fresh file, and hand edits in the old one are not carried over — diff and replace by hand. A generated declaration records its provenance (source, resolved binary path, the version read from `--version`, a fingerprint of the source text, generation date), `mcpx adapter check` reports version drift against that record, and generated declarations load through the same validation and de-duplication as hand-written ones. ```sh mcpx adapter import git > git.json mcpx adapter import --completion ./_jq --name jq ``` ### Passthrough declarations: `--bare` `mcpx adapter import --bare --description "what it is for"` declares the binary as a single passthrough tool that takes an argv array: no per-subcommand validation, and no schema for an agent to reason about. The description is required, the import prints a loud warning about what passthrough costs, and `mcpx adapter list` marks the entry `bare`. A bare adapter is an **argv** hole, not a **shell** hole: mcpx builds an argv and execs it directly, with no shell in between. The exception is a binary with its own argv-level exec escape — passthrough on one of those is a shell escape mcpx cannot see. Common offenders: `git` (`-c core.pager=...` and friends run commands), `ssh` (`-o ProxyCommand=...`), `find` (`-exec`), and anything with an editor, pager, or "run this command" option of its own. Declare those with generated or hand-written tools instead, so each subcommand is named and checked. ### Example: tailscale, no credential The shipped declaration at `examples/tailscale.json` wraps the local `tailscale` CLI (#1936). It declares no credential and needs none: the CLI is already logged in on the machine, and that session is the authentication. Only two tools are exposed, both over `tailscale status --json`: ```jsonc { "adapters": [{ "name": "tailscale", "command": "tailscale", "tools": [ { "name": "listTailnet", "args": ["status", "--json"], "json": true }, { "name": "listHostnames", "args": ["status", "--json"], "json": true } ] }] } ``` Point `paths.adapters` at a copy of that file and the tailnet appears in `mcpx ls` like any other server. The shipped copy is pinned by `TestShippedTailscaleAdapterDeclaration`, so it cannot drift from the shape above. ### Example: Dropbox, Google Drive and Outlook, a token in the environment The shipped declarations at `examples/dropbox.json`, `examples/google-drive.json` and `examples/outlook.json` (#1936) take the other route: each declares an HTTP API whose tools are generated from the OpenAPI document shipped beside it (`examples/dropbox.openapi.json` and siblings). The vendor documents cannot be used as published — Drive's is a discovery document, Dropbox's is a Stone spec, and the Microsoft Graph document covers every Microsoft 365 service — so each shipped document is a curated, read-only subset: listing, search, metadata and the caller's own account or profile, and nothing that writes. Each declaration carries exactly one credential shape, an `Authorization` header whose value is a `${VAR}` placeholder (`${DROPBOX_ACCESS_TOKEN}`, `${GOOGLE_DRIVE_ACCESS_TOKEN}`, `${OUTLOOK_ACCESS_TOKEN}`) expanded from the environment when the declaration loads — the declaration can be checked in, a token cannot. Dropbox is the one deliberate exception to the read-only default: API v2 is RPC over POST, so its declaration sets `"methods": ["POST"]` while every operation in its document is still a read. Point `paths.apis` at a copy of a declaration (with its document beside it) and the service appears in `mcpx ls` like any other server. The shipped copies are pinned by `TestShippedAPIDeclarations`, so they cannot drift from the shapes above. `mcpx catalog` also ends with the recipe tools in `tools/list`: how many are exposed against the recipe budget, and which recipes were kept out by a name collision or the cap. --- # Modes "Mode" is three questions wearing one word, and most confusion about mcpx is two of them being answered at once. How does a _client_ — the CLI, a script, the plugin — reach a daemon? How does the daemon reach an upstream _server_? And in what form does mcpx itself run: a daemon in the background, a process a host started, or no daemon at all? This page takes them in that order. The knobs themselves live on the [configuration page](configuration.html.md); this page is about the choices they add up to. ## Client modes Every command walks the same ladder, cheapest first: 1. **socket** — an existing local daemon, over its unix socket. 2. **url** — a named remote daemon, over HTTP. 3. **spawn** — start a daemon, then use it. About 135× the cost of a warm socket, paid once; everything after it is cheap. 4. **inline** — run the servers inside this command's own process. The first two are found, not chosen per command. A daemon is keyed by the set of configuration files it was started from, so the socket a command looks for is the one belonging to its own configuration — two projects with different configs get different daemons, and a command never answers from a neighbour's. A remote daemon is named with the `daemon.endpoint` setting (the `MCPX_DAEMON_ENDPOINT` variable, or `--daemon-endpoint`): an `http://` URL, or `unix:///path` for a non-default local socket. Naming an endpoint stops the ladder at that rung: if the remote daemon is unreachable the command fails rather than quietly starting a local one and answering from the wrong machine. **Spawn** is the default life of most installs: `daemon.autostart` is on, so the first command that finds no daemon starts one detached, waits for it to answer, and proceeds; the daemon then outlives the command and serves the rest. **Inline** is the last rung and off by default (`daemon.inline`). It hosts the same API inside the command, on a private socket, for exactly as long as the command runs — which means every server starts again on every command and nothing, a browser session included, survives between them. It exists for sandboxes with no fork, read-only filesystems, and containers whose init will not reap: places where the alternative is not working at all. Where a script runs follows from the same choice. `exec.where` (`--local` / `--remote`, default `auto`) runs a script locally when the daemon is local and on the daemon when it is not; asking for `--local` against a remote endpoint is refused, because the script would succeed and still write its files on the wrong side. See [Where a script runs](exec.html.md#where-a-script-runs). Two controls shape what a client sees once connected. **Profiles** select which servers exist for a command at all — `mcpx ls` shows the default set, `--profile web` adds a group, `--skip-default` narrows to exactly it, `--all-profiles` ignores profiles — and the selection applies to everything derived from the list, the generated client included. **Output** is client- and call-scoped configuration: how results are rendered and truncated is decided by the process asking, per call, not by the daemon serving everyone. ## Transport options There are two directions, and they have different answers. Keeping them apart is most of this section. **Upstream — the daemon to a configured server.** A server block with a `command` is spoken to over **stdio**: mcpx starts the process and talks JSON-RPC down its pipes; there is nothing else a spawned process could offer. A server block with a `url` is spoken to over **Streamable HTTP** (the setting is `transport: "http"`, and it is filled in from the `url` when left blank). Replies from a Streamable HTTP server may _arrive_ as a server-sent-events stream — that is a property of the response, not a second transport. The `/v1` API also accepts `transport: "sse"` when adding a server. That value does not conjure an SSE-only client. What actually happens with a legacy server: if a remote server turns out to speak only the deprecated 2024-11-05 HTTP+SSE transport, the pool falls back to a dedicated legacy client for it and forces the legacy protocol era for that connection. So old servers still work, and the fallback is a property of the server you pointed at, not a mode you select. **Downstream — a client to the daemon.** The daemon serves its whole API, `/v1` and `/mcp` together, on the listeners it already has: the unix socket, and a TCP port that is loopback unless you bind it wider (`mcpx daemon --address 0.0.0.0 --port 8899`). There is no separate MCP listener to configure; one listener, one access-control decision. Binding beyond loopback prints a warning, because the API is unauthenticated: whatever can route to the port can run tools as you. Events travel as **server-sent events**, deliberately not WebSockets: SSE is plain HTTP, passes the proxies HTTP passes, and a browser's `EventSource` reconnects it for free, while answers never needed the return channel — they go back as ordinary POSTs. Every event carries a sequence number, and a reconnect with `Last-Event-ID` (or `?since=N` on `GET /v1/events`) replays everything after it, so a dropped connection is a pause, not a hole; a reconnect older than the retained history gets an in-band `gap` event saying so. ## Server modes "Server" is overloaded too, so here are its three meanings, kept apart. **An upstream server being pooled.** This is the sense in a config file's `mcpServers` block, and its modes are the `mcpx` block's two axes: `sharing` — `shared` (the default; any number of callers use one process at once) or `exclusive` (one caller at a time, others queue) — and `scope`, what a live process is keyed by: `global` (the default), `repo`, `worktree`, `cwd`, `session`, `parent-session`, `pid`, or `call`. One live process exists per distinct key, so scope is the answer to "how many of this server am I running, and who gets a separate one". A stateful server — a browser — typically wants `exclusive` + `session`; a stateless one wants the defaults and no thought at all. The full treatment is [Sharing and scope](story.html.md#sharing-and-scope) and the [server configuration section](configuration.html.md#server-config). **mcpx as an MCP server.** `mcpx serve` offers mcpx itself to a host that speaks only MCP — another editor, a hosted agent. The surface is ten tools reaching every server mcpx knows, `mcpx_exec` chief among them: it runs TypeScript next to the servers and only what the script prints crosses back, so schemas stay on this side of the wire instead of filling the host's context. On stdio, serve is a thin shim a host spawns, which is inherent to how MCP hosts start servers. On HTTP there is nothing separate to start: the daemon mounts `/mcp` on its own listeners, so serving MCP to the network is the daemon command above, not a second process. **The daemon's own process modes.** A daemon is either started for you — detached, by the first command that needs one, exiting after `autostart.idleExit` with nothing to do — or run in the foreground with `mcpx daemon`, which is the same daemon with its log in front of you, and the form a service manager should supervise. Inline mode, from the client ladder, is the third form: a daemon's API with no daemon process at all. Nothing about a server's pooling or an MCP host's view changes between the three; what changes is lifetime, and who owns it. --- # mcpx as a consumer > Sampling, elicitation and completion are things a server asks of its client. > mcpx is a client to its upstream servers and a server to whatever drives it, > so today it only passes them through. Are there cases where mcpx should > initiate them itself? > > — issue #41 Four, and they are not equally good. This is the record of which, why, and what was deliberately not built. ## 1. Deterministic schema-change diagnostics The most valuable thing here needs no model at all, and that was the central finding of the issue. mcpx already knows every tool's input schema. What it did not know was what those schemas _used to be_ — `internal/codegen` could fingerprint a catalog and diff two of them, but nothing ever stored one, so every diff was against nothing and the question "when did this change" had no answer anywhere in the program. So `internal/diagnose` keeps one. Each time the daemon reads schemas, it records every tool's flattened shape and appends whatever differs to a per-tool change list in `/catalog-history.json`. That file is the missing half. With it, a script that calls a tool with no arguments after that tool gained a required one is not a mystery; it is two facts mcpx is holding, put next to each other: ``` demo.echo: the argument object is no longer optional: message is required (schema changed 2026-09-20: `message` became required) you wrote: await demo.echo() (line 2) minimum: await demo.echo({ message: "" }) ``` Three decisions inside that are worth stating. **The scanner does not parse TypeScript.** It looks for two identifiers, a dot and a parenthesis, and skips every construct that could hide one: strings, template literals, both comment forms. A call assembled dynamically is invisible to it, and that is the correct failure — a diagnostic about a call nobody wrote is worse than no diagnostic. It also stops at the first sign of not knowing: a spread in an argument object silences the missing-argument check entirely, because a spread can supply anything. **Only configured namespaces are diagnosed.** `console.log(x)` and `JSON.parse(s)` are indistinguishable from tool calls at this level. Having an opinion about somebody else's code is not this package's business. **The issue's example needed correcting.** It reads: ``` demo.create_issue: argument 1 is now required (`options` became required). you wrote: await demo.create_issue("title") minimum: await demo.create_issue("title", {}) ``` mcpx's generated client does not take positional arguments. `codegen` binds every tool as `fn(args?: {...})` — one object, optional exactly when the schema has no required properties. So the diagnostic mcpx can actually produce is "the argument object is no longer optional", which is the same fact in the shape the generated code has. Anything else would be advice that does not compile. The upstream half, `diagnose.CallError`, runs in `Registry.Call` (`internal/daemon/callerr.go`), the one place a failed call passes on its way to every surface. The server's error stays first and whole; the rendered diagnostic follows it, and `/v1/call` carries the same finding as data: ```json { "error": "mcp error -32602: Invalid params\ndemo.create_issue: the call was rejected and repo is required but was not sent (schema changed 2026-09-30: `repo` was added and is required)\n minimum: await demo.create_issue({ repo: \"\", ... })", "diagnostics": [{ "kind": "invalid-params", "tool": "demo.create_issue", "field": "repo", "changed": { "when": "2026-09-30T…", "kind": "argument-added", "what": "`repo` was added and is required" }, "fix": "await demo.create_issue({ repo: \"\", ... })", "fatal": true }] } ``` So `mcpx call` prints it, `mcpx --json call` puts the document on stdout, a task's result carries it, a script's `ToolError` has `.diagnostics`, and `mcpx_call` shows the text. Data beside the prose, because an agent can act on `field` where it would have to parse a sentence. Three conditions decide whether it runs, and each is there because of what it said without them. Only an answer from a server is explained: a timeout or a server that would not start never answered, so the arguments were not at fault. Not a code in `-32000..-32099`: mcpx's own client reports a dropped connection as `-32000 connection closed: unexpected EOF`, and the text match read "unexpected" as "expected" — a crash was explained as a missing argument. And not a namespace whose schemas have not been read, where `CallError` said "no server is configured under this namespace" about a configured server; it used to answer that for any failure, before it looked at the code at all. Not covered: `mcpx_call` from a client that can answer questions goes through `CallAsk`, which leases the pool itself; `/v1/call/{server}/{tool}` carries the text but not the field; and a server that reports bad arguments as a result with `isError` has made a successful call, so there is no failure to explain. `--diagnose-preflight` is on by default on `run` and `exec`. The failure it catches surfaces otherwise as an error from a server, halfway through, after the side effects of every call before it. ## 2. Elicitation mcpx raises for itself Two policies, both off by default, both landing on `Registry.Call` between resolving an instance and using it. **Disambiguation** (`elicit.disambiguate`, `never | ask`). It asks only when the answer is genuinely open: the server is exclusive, so its instances are distinct things rather than copies; several are live; and the caller's own scope key names none of them. When the caller already has an instance, the scope key _is_ the answer and a question would be theatre. The form is an enum of the live keys plus "new", each with what it is doing — holders, calls, idle time, pid — because a choice without that is not a choice. **Destructive confirmation** (`elicit.confirmDestructive`, off). Before a call to a tool that may be destructive: annotated `destructiveHint: true`, or (the specification's default) not annotated `readOnlyHint: true` or `destructiveHint: false`. This is the step a human-driven client has and a script does not. A tool the operator declared in the server's `readOnlyTools` (#6116) is pre-authorized and never asked about: the declaration is the answer, given in configuration ahead of time, which is the only answer a headless caller can give. The two disagree about what a silent deadline means, deliberately. An unanswered disambiguation takes `elicit.disambiguateDefault`, which is `new` — a caller that wanted a particular browser and did not say so gets a fresh one rather than somebody else's. An unanswered confirmation refuses the call. There, doing nothing is safe; here, doing nothing is the destructive thing. Routing needed no change in `internal/elicit`. A confirmation is a lone boolean called `confirm`, which `Route` already sends to a human because consent is not the agent's to give; a disambiguation is an enum, which goes to the agent that raised the call. `internal/elicit/policy.go` adds only the constructors, whose job is to make it impossible to raise one of mcpx's own questions without a default and a deadline. The daemon had no access to settings before this — `daemon.Options` carries a `config.Config` and nothing else — so `settings.Resolve` folds the same configuration files and environment the CLI reads. Whether a destructive call is confirmed is not a question with two correct answers depending on which process asked. **Several daemons**, the other disambiguation case in the issue, is not here. It belongs to the plugin: the question is which daemon serves a directory, and by the time mcpx is answering, that has been decided. ## 3. Recipes A recipe is not a new artefact. It is a script already on the search path that declares its own holes: ```ts // Close stale issues in a repository. // @param repo:string which repository, as owner/name // @param days:number = 30 how old counts as stale const found = await demo.search({ repo: @repo, olderThanDays: @days }); ``` Declaration is a header comment because a comment survives every runtime, cannot affect execution, and is visible in the file somebody edits. References are `@name`, the spelling the launcher already uses for its own holes. **A recipe is also an MCP tool.** The `@param` header is already a typed schema, so tools/list carries one tool per recipe, named `recipe_`, with that schema and the summary as its description. Calling it runs the recipe through `/v1/recipes/{name}/run` -- the same render, diagnostics and runner `mcpx recipes run` uses. Exposure is on by default; `// @tool false` in the header opts one out. The number exposed is capped (`DefaultToolBudget`, 25) so fifty saved scripts do not become fifty schemas in every host, and `mcpx catalog` ends with the count, the cap and any recipe kept out -- a name another producer already claimed is reported there rather than silently dropped. **Values are substituted as JSON, never as text.** A recipe runs with the user's credentials; raw substitution would make every placeholder an injection site. A string arrives quoted, an object arrives as an object, and a recipe with an unfilled required hole is an invalid script — which is the right way round, because it cannot then be run by accident. **Matching is a score over four things the recipe already carries**: its name, its summary, its placeholder names and the tools it calls. No model, no embedding, no index. The same request gives the same recipe every time, at no cost. `Decide` refuses to choose when the leader is not ahead of the runner-up by `recipes.matchMargin` (150%, half as much again), because running the wrong saved script is a side effect rather than a wrong answer. JavaScript built-ins are excluded from the tool list. `console.log` counted as a tool makes every recipe match the word "log". Missing placeholders become one form with one deadline, not one question each: a person filling in four fields is doing one thing, and four deadlines are four chances for a run to die half-configured. ## 4. `/prompt`, which is `POST /v1/intent` **The name.** `POST /v1/prompt` was taken, by the operation that renders an upstream server's MCP prompt, and Go's mux keys on method and path. Renaming somebody else's operation to free a word was not worth it. The CLI command is `mcpx prompt`, which is what the issue asked for; the route is `/v1/intent`. The order is recipes first, generation second, and generation is **off by default** (`prompt.sample: never`). The issue sequences sampling-backed generation last and conditions it on there being a caller that can answer sampling; most cannot, and a caller that cannot pays the entire deadline to find out. With it off, an unmatched request returns the ranked recipes and says so in one sentence. That is the honest default, and it is also the one that does not make `mcpx prompt` hang for ninety seconds on a machine with no answerer. With it on, the request goes out as an ordinary MCP sampling request through the same broker that carries every other question — so the plugin, an agent watching `mcpx elicit`, and an MCP client that declared sampling all answer it without learning anything new. It is given the slice of the catalog the existing search ranked for this request, inside `prompt.catalogBudget` tokens, and nothing else. The whole reason mcpx is worth having is that tool schemas stay out of a model's context; a generation request has to send some, so it sends as few as it can. The generated script is validated with the step-1 diagnostics before anything runs, and returned rather than run unless `autonomy: run` is asked for. Whatever is asked for, the daemon's `autonomy.max` is the most it does: a request above it — in a body, the `X-Mcpx-Settings` header, the CLI's `--run`, an MCP tool call or the plugin — is lowered to it, not refused, and the answer carries `requested` and `clampedBy` beside `autonomy`. The CLI prints `requested run, clamped to propose by autonomy.max (...)` on stderr. The same ceiling bounds `repair.autonomy` (whether a failed call carries diagnostics) and `hooks.autonomy` (whether configured script hooks run). ## Running a script from the daemon `recipe_run` and `intent` in run mode need to execute something, and the daemon has never run scripts. `Server.execScript` calls `internal/runner` directly, against the daemon's own endpoint. **This is a seam, not a design.** `POST /v1/exec` has since landed, with its own options and permission model (`internal/api/ops_exec.go`, `internal/daemon/routes_exec.go`), but `execScript` (`internal/daemon/consumer.go:517`) has not yet been rerouted through it. It is one function, marked, for exactly that reason. ## The concerns from the issue, and what was decided **Scope — "anything that makes mcpx call a model has to justify that it isn't rebuilding the harness."** Three of the four things built here never call one. The fourth originally stopped there: option 3 from the issue, a configured provider with an API key, was not built, on the grounds that it is the one that makes mcpx an agent. That conclusion has since been reversed by the facts #1925 records: the 2026-07-28 MCP revision deprecates sampling (SEP-2577) and names integrating directly with provider APIs as the migration, and no opencode — the primary consumer — declares sampling at all. So a configured provider now exists, as one backend of the thin provider layer in `internal/model`: a `Provider` interface with a single `Generate`, reached only through the `model.*` settings, with `model.provider` defaulting to `none` — a user who configures nothing gets exactly the behaviour described above. Sampling through the caller survives as another backend of the same layer: it is mcpx asking the harness it already sits under, which remains right where a client declares it. What has not changed is the guard that made the original refusal coherent: no operation calls a model on a path where a deterministic answer exists, and a provider error returns the deterministic result plus a note that the model was unavailable. A `Generate` function is not an agent; the harness mcpx sits under still owns the loop, the tools and the session. Provider credentials remain opt-in: `model.apiKeyEnv` names the variable for the singular provider, while `model.providers` can map provider names to their own `baseURL` and `apiKeyEnv`. mcpx never scans the environment for key names. `model.profiles` names ordered lists of `provider/model` ids. An upstream HTTP 402 ends this generation immediately. Other provider failures or unconfigured entries fall through to the next configured provider. A profile can set its own token budget and per-attempt timeout. `model.default` and an operation's model override may each name either a profile or a provider/model id; when every profile entry is unavailable, generation stays on its deterministic path. **Trust — "generated code runs with the user's credentials."** Return the script by default (`prompt.autonomy: propose`, one level of the dial in [decisions/0002](decisions/0002-autonomy-dial.html.md)); run only on explicit request. Recipe values are JSON-encoded, so a recipe cannot be turned into an injection site by its arguments. A recipe name that would become a path is refused. **Latency and cost — "never sample on a path that doesn't need it."** The deterministic diagnostics come first and answer the case the issue identified as the common one. Recipe matching is free and deterministic. Sampling happens on exactly one path, only when nothing matched, and only when it has been turned on. **Headless callers.** Every question mcpx raises for itself carries a default and a deadline, and `elicit.Ask` exists so that forgetting either is not possible. The defaults differ by question, for the reasons above. A caller that gets no answer is told which question it raised, so it can look up what was asked rather than guessing. ## Not built - **A language service.** The issue is right that suggesting a fix to a script is LSP work rather than MCP completion, and right to keep the two apart. `internal/diagnose` is the part an LSP would need; the server itself is a separate piece of work and nothing here presumes its shape. - **Sampled rewrites of a diagnostic.** When the caller is an agent it reads the error either way; the value is in the error being specific, not in a model rewording it. If a human-facing front end ever wants a proposed rewrite, `diagnose.Diagnostic` is already the structured input for one. - **Daemon disambiguation**, as above: the plugin's question, not mcpx's. ## Bugs found on the way The schema cache (`cacheVersion`) is not invalidated when a cached entry gains a field. Adding `Annotations` to `mcpclient.Tool` parsed cleanly against an existing cache file and left it empty, which presented as the destructive-call policy silently never firing — the annotations were there upstream and absent from the cache nobody had reason to reread. The version is bumped, with a comment saying why; the shape of the trap is still there for the next field. --- # Running mcpx in a container The Nix-built OCI image, what it deliberately does not contain, and the measurements made against the retired Containerfile prototype. ``` id: running-mcpx-in-a-container since: pre-release created: 2026-09-30T04:00:00-05:00 last-updated: 2026-11-05T10:40:00-05:00 status: implemented ``` Since: pre-release · Status: implemented The shipped image is a Nix-built OCI artifact exported as `packages.x86_64-linux.mcpx-container`. It contains the static mcpx binary, Bun as its one JavaScript runtime, and the certificate bundle needed for outbound TLS. The Containerfile prototype has been removed; image contents and dependencies are now declared in `container-image.nix`. --- ## 1. What it is The image closure is: | component | Nix input | why | | ---------- | -------------------------- | -------------------------------------------------- | | mcpx | `pkgs/mcpx/package.nix` | pure-Go static binary, built from the flake source | | JavaScript | pinned flake `bun` package | `mcpx exec` and `mcpx run` need a JS runtime | | TLS | `cacert` | registry and script HTTPS connections | The root flake lock pins the Nixpkgs revision supplying Bun and the image tools. The image tag comes from `pkgs/mcpx/VERSION`; this image is built from local source, not from a mutable upstream base-image tag. The image is built from scratch, runs as uid 1000, and sets an explicit PATH containing only mcpx and Bun. It has no git; §3 says why that is not a loss. Build and load the image from the repository root: ``` nix build .#packages.x86_64-linux.mcpx-container docker load < result docker run --rm mcpx:0.1.0 --version docker run --rm -v "$PWD/.mcpx.json:/work/.mcpx.json:ro" mcpx:0.1.0 ls ``` ## 2. The JavaScript runtime **The image ships bun.** `mcpx exec` and `mcpx run` are the point of mcpx, and neither can do anything without a JavaScript runtime -- `runner.Detect` returns `no JavaScript runtime found` and the command fails. An image that cannot run a script is an image that can only do the things a plain MCP client could already do. Bun because it is the smallest of the three. The binary-size comparison was measured on this machine (linux/arm64, inside each runtime's Debian image): | runtime | binary | | --------------------------------- | -------- | | bun 1.4.2 | 79.4 MB | | deno (`denoland/deno:debian`) | 85.0 MB | | node 22 (`node:22-bookworm-slim`) | 122.2 MB | Smaller margins than the x86-64 figures usually quoted, but the same order. `runner.Resolve` picks the first of `script.runtimeOrder` (by default **deno, bun, node**) on `PATH`, so an image with only bun would find bun anyway. `MCPX_SCRIPT_RUNTIME=bun` is set anyway, because relying on absence to select a default means adding a second runtime later silently changes which one runs. The setting is `script.runtime` (`--script-runtime`, `script.runtime` in config); naming a runtime the image does not contain is an error, not a fallback, so anyone who wants deno's permission model has to add deno to the image. That is the one real cost of choosing bun: bun has no permission model, so any `script.permissions` profile other than `all` is refused under it (see [runtimes.md](runtimes.html.md)). Node enforces the `readnet` profile through `--permission`; deno enforces all of them. Inside a container that is a smaller gap than it is on a laptop, but it is a gap. ## 3. No git The `repo` and `worktree` sharing scopes key server instances by the repository a call came from. They used to ask git, and the first version of this image installed git so they could: 105 MB, most of it perl. They no longer ask git. mcpx reads `.git` itself -- a port of git's own discovery rules, compared against `git rev-parse` case by case in the test suite -- and runs git only for the few layouts that port does not vouch for: a repository format newer than it knows, an extension it has not heard of, a config file it cannot parse. Without git those key by directory, and `mcpx doctor` says which file it could not read. The full record, every case and what was decided for it, is `docs/git-discovery.md`. Taking git out cost nothing, because in this image it had not been working: ``` $ docker run --rm -v "$PWD:/work:ro" --entrypoint git mcpx:before -C /work/proj \ rev-parse --git-common-dir fatal: detected dubious ownership in repository at '/work/proj' To add an exception for this directory, call: git config --global --add safe.directory /work/proj ``` A mounted checkout belongs to the host's uid, the image runs as 1000, and git refuses a repository someone else owns. So with git installed, the repo and worktree scopes fell back to per-directory keys for every mounted checkout -- the situation the old version of this section said git was there to prevent. Native discovery does not check ownership: `safe.directory` exists to stop git running configuration from a repository someone else controls, and discovery runs nothing. What was verified in the image with no git on `PATH`, one daemon for the whole run, a real repository with a linked worktree (made with `worktree.useRelativePaths`, so its paths survive the mount) and a submodule, a bare repository, and a tmpfs mounted inside the checkout: ``` INSTANCE CALLS KEY byrepo#2 4 repo:/work/proj/.git proj, proj/sub, proj-wt/sub, and exec from proj-wt byrepo#3 1 repo:/work/proj/.git/modules/mod the submodule is its own repository bytree#2 2 worktree:/work/proj proj and proj/sub bytree#3 2 worktree:/work/proj-wt proj-wt/sub and exec bytree#4 1 worktree:/work/proj/mod bytree#5 1 cwd:/work/bare.git no worktree: core.bare is true in /work/bare.git/config bytree#6 1 cwd:/work/proj/mnt/inner discovery stops at the mount point /work/proj/mnt tiny#1 1 global ``` The old image's git, told to trust the mount with `safe.directory=*`, gave the same answers for the submodule, the bare repository and the mount -- and refused the other three directories with `unknown repository extension found: relativeworktrees`, because Debian's git is 2.39 and the checkout was made by 2.55. With `GIT_DISCOVERY_ACROSS_FILESYSTEM=1` in the container's environment the mounted directory keys to `worktree:/work/proj`, as it would in git. `mcpx ls` listed all three namespaces, `call` and `exec` (on bun) reached each, and `mcpx doctor -v` from the linked worktree said: ``` ok git repo /work/proj/.git, worktree /work/proj-wt; resolved natively; no git on PATH, which only matters for a repository native discovery cannot read ``` A repository that does need git is visible, not silent: the key falls back to the directory, the daemon logs why once, and `doctor` turns the line into a warning that says to install git. Adding it back is one package in the `apt-get install` line. ## 4. Static linking: the policy `CGO_ENABLED` is unset in an ordinary Go build, which means _enabled_ on a native build, and two packages change behaviour when it is: - `internal/logging/trace.go:9` imports `os/user`, which under cgo calls `getpwuid_r` through libc rather than parsing `/etc/passwd`; - `net` is reachable from most of the tree, and under cgo its resolver is `getaddrinfo`, which honours `nsswitch.conf`. **Policy (#1987): the artifacts that ship as a bare mcpx binary ship static.** The trade-off is the two bullets above — pure-Go `os/user` does not consult NSS and the pure-Go resolver ignores `nsswitch.conf` — and it is accepted for these artifacts because neither behaviour is load-bearing for a daemon/CLI whose state lives in its own directories, while a binary that only runs beside one exact glibc (or one Nix store path) fails everywhere else silently. | artifact | static? | note | | --------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | Nix package | yes | `package.nix` sets `env.CGO_ENABLED = "0"`; the installed `bin/mcpx` is a `makeBinaryWrapper` launcher by design — the binary it launches is the static one | | this image's `mcpx` | yes | it is built from the same Go package, with the workstation wrapper disabled | | this image as a whole | no | Bun is dynamically linked; its Nix closure supplies the libraries it needs | | release tarball | not decided here | the release pipeline is #1881's; this policy is the input it should consume | Measured, not assumed (the CGO_ENABLED=0 build, before it became the default). The commands are kept as the historical record of the retired `Containerfile` prototype; the equivalent today is the Nix image above: ``` $ docker build -f Containerfile --build-arg CGO_ENABLED=0 -t mcpx:cgo0 . $ docker run --rm --entrypoint sh mcpx:cgo0 -c 'ldd /usr/local/bin/mcpx' not a dynamic executable $ docker run --rm mcpx:cgo0 --version mcpx 0.1.0 $ docker run --rm -v "$PWD:/work:ro" mcpx:cgo0 \ exec 'const r = await tiny.echo({ message: "cgo0" }); console.log(String(r));' you said: cgo0 ``` Same size to the byte-ish -- 14 811 298 against 14 811 401 -- so the pure-Go `os/user` and resolver cost nothing here. ### Tier-2 container legs Tier 2 (#1987) means: runs nightly and on pushes to main that touch `pkgs/mcpx`, never gates a PR. The legs are `scripts/tier2-containers.sh`, run by the `mcpx tier-2 containers` workflow; each leg asserts the surface its image can actually support, including mcpx's own clean refusal where a surface is absent: | leg | image | asserts | | --------------------------- | -------------------------------------- | ------------------------------------------------------------------- | | `alpine-nonexec` | `alpine:3.21` | `--version`; `exec` refuses with "no usable JavaScript runtime" | | `alpine-bunmusl-exec` | alpine + bun's musl build | `exec` runs a script | | `alpine-node-exec` | `alpine:3.21` + `apk add nodejs` | `exec` runs a script or gives an actionable transform-types refusal | | `scratch-nonexec` | `FROM scratch` + CA certs | `--version`; the same clean `exec` refusal | | `distroless-static-nonexec` | `gcr.io/distroless/static-debian12` | `--version`; the same clean `exec` refusal | | `distroless-cc-deno-exec` | `gcr.io/distroless/cc-debian12` + deno | `exec` runs a script | The **alpine + nodejs exec** leg (#2699) guards either a working Node TypeScript-transform path or mcpx's actionable refusal when that Node build does not support `--experimental-transform-types`. Tier 3 (fedora, flatpak, silverblue/kinoite hosts, the Windows port) is unchanged: separate issues when a user appears. ## 5. Historical prototype size measurements The following measurements are from the retired Debian-based Containerfile prototype on linux/arm64. They are not measurements of the current Nix image. | layer | with git | without | | -------------------------- | ------------------------------ | --------------------------- | | `debian:bookworm-slim` | 108 MB | 108 MB | | `apt-get install` | 105 MB (`ca-certificates git`) | 10.4 MB (`ca-certificates`) | | bun | 79.4 MB | 79.4 MB | | mcpx | 14.8 MB | 14.9 MB | | **layers, uncompressed** | **307 MB** | **213 MB** | | compressed content | 106 MB | 75.6 MB | | `docker images` disk usage | 413 MB | 288 MB | The 413 MB this document used to quote is the last row, which is the uncompressed layers plus the compressed blobs they were unpacked from. The layers are what a running container occupies; the compressed size is what a pull transfers. `git` costing more than bun was not expected: with `--no-install-recommends` already set, the weight is perl, which Debian's git depends on outright. What remains of the apt layer is `ca-certificates` and the openssl it pulls in, for the registry. `perl-base` is still in the image -- it is part of Debian's essential set, in the base layer -- but nothing in mcpx uses it. ## 6. What was deliberately left out - **Image build is change-scoped in CI.** The `mcpx nix build` workflow builds the Nix image on pull requests touching `pkgs/mcpx/**`, the root flake wiring, or that workflow. The broad tier-2 container legs (§4) remain nightly and on pushes to main. - **No full e2e suite inside an image.** The e2e suite spawns daemons and binds unix sockets; the tier-2 legs assert surfaces, which is a different, smaller harness. - **No shipped scratch or distroless variant.** They exist as tier-2 test legs; a shipped minimal image still drops `exec` (no static JS runtime exists to put in it), which is a product decision nobody has taken. - **No git, Deno or Node.** The image promises Bun as its only JavaScript runtime and leaves git discovery fallbacks unavailable, as described in §3. ## 7. What to watch The image recipe and its `contents` list live in `container-image.nix`; the root flake exports the image as `mcpx-container` for builds and CI. --- # Coverage: the book against the binary This chapter is the book's mechanical coverage proof: the whole surface of mcpx, dumped from the binary itself, set against the whole text of the book, with every difference named. It was first run on 2026-11-23 against the binary built from commit `0d29cdad5cf`, and the gaps it found were closed in the same change that added this chapter. The method is the point: anyone can re-run it, and the gates listed at the end hold most of it true between runs. ## Method The surface was dumped from the subject, never from memory or from older docs: - `mcpx --help` and the `--help` of every command, recursively; - `mcpx config --schema --plumbing` — the full settings registry, public and internal, with types, defaults, flag names and environment names; - `mcpx openapi` — the /v1 document the binary prints with no daemon running (94 paths, 109 operations); - `go doc` for the public library package, and the source tree for the settings registry, the internal packages and the design records. Each dimension below is a set difference between that dump and the book's text, computed mechanically. Literal matching has known false-positive classes — list-form tables that name a command once and its verbs in the next cell, a route the book documents as a template, a usage line whose bracket holds a flag rather than a verb — and every audit failure was hand-classified before it was called a gap. The classifications are stated with the numbers. ## Commands and verbs The binary declares **75 top-level commands** in six groups (running code, finding tools, the daemon, configuration, inspection, daemon operations). All 75 are in the generated command table in [Parity](parity.html.md), and the equality of the declaration list with the binary's dispatch table is a test: `TestEveryDispatchedCommandIsDeclared`. The prose group tables in [The CLI](cli.html.md) now also name all 75 — the audit found five missing there (`cache` and `stdio-proxy` from the daemon group, `plugin` from configuration, `hook` and `want` from inspection) and they are added. **64 verb forms** sit under those commands (`adapter add`, `settings set`, `task cancel`, …). Every family's verbs are now described in prose in [The CLI](cli.html.md)'s verb-set table. The literal audit matches 54 of 64 two-word forms in the text; of the ten it cannot see, six are in that table in split-cell form (the command in one cell, its verbs in the next), two are `stats` modes named in the story chapter's inventory, and two are extraction artifacts — a flag in a usage line, and the generic `mcpx help ` topic form. Three commands had no prose anywhere before this run: `skills` (now in the verb-set table and the running group), `supervise` and `upgrade` (parity rows and group-table entries, with the mechanism in the [Glossary](glossary.html.md) under _supervise_ and _takeover_). ## Flags The help dump carries **332 distinct `--flags`**. 215 of them are setting flags — every setting's flag spelling is in the book through its setting's row in [Configuration](configuration.html.md), with none missing. The other 117 are command-local. 75 of those appear in the book's prose; the remaining **42 are documented only in the generated surfaces** — `mcpx help `, the man page and the shell completions, all printed from the same declarations in `internal/cli/manual.go`, so they cannot drift from the binary. They are named here so the set is exact rather than approximate: `--args`, `--argument`, `--arguments`, `--base-url`, `--changed`, `--context`, `--deprecated`, `--dir`, `--dump`, `--exclude`, `--execution-score`, `--feedback`, `--install`, `--kind`, `--kinds`, `--max-score`, `--min-score`, `--namespace`, `--notes`, `--overwrite`, `--parallel`, `--ref`, `--replace`, `--retrieval-score`, `--safe-prefix`, `--score`, `--scores`, `--semantic`, `--sharing`, `--socket`, `--sort-by`, `--stop-on-error`, `--takeover`, `--target`, `--tools`, `--trace`, `--ttl`, `--until`, `--uri`, `--validate`, `--wait-ms`, `--yes`. This is the book's one deliberate non-duplication: per-command flags live in the generated reference, and this chapter is where the book says so, with the list. ## Settings and environment The registry declares **241 settings**: 193 public and 48 internal (the plumbing half, listed by `mcpx config --schema --plumbing`). All 241 appear in [Configuration](configuration.html.md)'s generated inventory with type, default, scope, whether they take effect hot, flag name and environment name — held byte-equal with the registry by `TestTheDocumentationListsEverySetting` and the shared golden test below. The book states no other count; an earlier programme census said 252, which counted `Path:` literals across the whole settings tree, test files included, rather than the registry the binary itself prints. Every setting carries an effect probe or a written exemption. The exemption count is pinned at **5** (`EffectExemptionPin`) and can only shrink: `daemon.inlineStartPoll`, `daemon.tsnet.hostname`, `daemon.tsnetUpTimeout`, `http.streamBufferInit`, `embeddings.wasmPath` — each named, with its reason, in the registry and in the configuration chapter's table. The schema names **246 `MCPX_*` environment variables** (some settings carry an alias); all 246 are in the book through the same inventory rows. One environment variable is deliberately _not_ a setting: `TS_AUTHKEY`, the Tailscale auth key for the tsnet transport, kept out of the settings system so it can never land in a config file or a settings dump. It is documented with the transport, in [Reaching a daemon on another machine](remote.html.md). ## The /v1 API The printed OpenAPI document has **94 paths and 109 operations**. 82 paths appear literally in the book (in [The /v1 HTTP API](http-api.html.md) and the parity table). The other 12 are the instances of the one templated family the API chapter names, `POST /v1/tools/{tool}` — one path per tool mcpx itself serves — and the chapter now enumerates the instances. The daemon's own served document additionally carries one path per tool in the _live_ catalogue, generated per request; those exist by construction, not by enumeration, and the API chapter says so. ## The library surface `pkg/client` exports **14 symbols**; all 14 are now documented in [Public Go client for /v1 (`pkg/client`)](public-client.html.md), with the call shapes and error types, and an example from the package's own tests. Nothing else in the repository calls the package yet — the chapter says that too. Of the **62 internal packages**, 59 are named somewhere in the book. The three that are not — `homeutil`, `pluginsession`, `statsorder` — are internal helpers with no public surface; they are recorded here rather than padded into chapters. ## Design records and the book's own inventory mcpx keeps its design records in the book tree, not in the repository-root `doc/` archive. The inventory: 7 decision records (`decisions/0001`–`0007`) under their index, 13 spec chapters, 12 comparison chapters and 23 register entries, 3 audit chapters, the catalogue, and the testing set. Every markdown file under `pkgs/mcpx` has a compendium manifest entry with a chapter or a stated reason — a test (`TestEveryDocumentHasAChapter`) walks the tree and fails on an unplaced file. Every file under `docs/` is in `SUMMARY.md` except the eight `changes/` fragments, which are docs-history metadata — consumed by the build's preprocessor, not chapters. Before this run, six placed chapters were missing from the summary and so never rendered: the testing set (4 files), the public client chapter, and decision record 0007. All are listed now. Every summary title equals its chapter's sole `# ` heading (the one exception is `index.md`, the styled home page, whose title is its HTML `

` by design), and the audit checked the relative links in the source tree: links that escape `docs/` are rewritten to repository URLs by the build, and the two genuinely dead links the audit found — a release-runbook link to a `tty.md` that does not exist, and a story-chapter link that only resolved by URL normalisation — are fixed. ## The build The book builds as `.#mcpx-docs` with the docs-twins gate inside it. Before this run the build carried 19 warnings — bare `` tokens in prose being read as HTML tags and silently vanishing from the rendered pages — across ten files; all 19 are escaped now, one of them at its source (the `script.devshell` description in the settings registry, whose generated table row carried the token). One warning remains by nature: the search index is large (12.8 MB), because the book is about 405,000 words. It is named here so it reads as a known quantity, not a defect. ## The gates that hold this - `TestCommittedRegionsAreCurrent` (`internal/refdoc`) — the generated regions of `configuration.md`, `parity.md` and `protocol.md` are byte-equal with the declarations they are generated from. Regenerate with the same test's `-update`. - `TestTheDocumentationListsEverySetting` and `TestEveryDocumentHasAChapter` (`internal/settings`) — the settings inventory and the manifest placement, above. - `TestEveryDispatchedCommandIsDeclared` (`internal/cli`) — declaration and dispatch, both directions. - The effect-coverage check (`internal/settings`) — every setting probed or exempt, the pin only shrinking. - `create-missing = false` and the docs-twins gate, inside the `.#mcpx-docs` build itself. The rule that follows, and the one this book shares with the fleet, Atlas and ID books: a change to a command, a flag, a setting, a transport or a route updates its chapter in the same change. A follow-up promise is how the gaps this chapter closed got there. --- # Declared but never read A knob that does nothing is worse than one that does not exist. A missing flag fails loudly at the prompt; a flag that parses, appears in `--help`, appears in `mcpx config --schema` and then changes nothing costs somebody an afternoon before they conclude the feature is broken rather than the wiring. This has shipped repeatedly. `--typecheck` on exec (#66). Five exec flags at once (#75). MCP `sampling`, declared and unreachable (#39). The opencode plugin's `permission.ask` hook. Every one of them was found by a person trying the thing, which is the expensive way. This is the audit that went looking for the rest of them, and the guard that makes the next one a test failure. ## What the audit was The settings registry had 149 entries when this audit ran; it has 164 today, and the counts below are the ones the audit measured, not current figures. Each one derives a config key, an `MCPX_` variable and a flag from a single declaration, which is the whole argument for the registry existing. The question is therefore not "is this path string mentioned anywhere" but "does anything read the **resolved value**". Those are not the same question, and the difference is where the interesting half of the findings came from. `pool.max` was read from a config file, through `config.Config.Pool`, which the JSON decoder fills. `MCPX_POOL_MAX` and `--pool-max` landed in the resolved `Set`, and nothing on that path looked at them. Grepping for `"pool.max"` finds a match in `internal/defaults` (an error label) and calls it live. A user who set the variable, saw nothing change, moved it into their config file and saw it work would reasonably conclude the variable name was wrong rather than that the layer was. That is fixed now: `config.ApplyPoolSettings` (`internal/config/poolsettings.go:36`) copies every layer of the resolved `Set` into `Config.Pool`, and a runtime change through `settings set` reloads the pools (`internal/daemon/routes_settings.go:268`), so the change reaches pools that are already running. So the audit looked for one specific shape: the path handed to an accessor on a resolved `Set` — `set.Int("pool.max")`, `a.Settings().Bool(...)`, `cs.Duration(...)`. That is the only reader in the program that has seen the file, the variable and the flag together. `os.Getenv` has seen one layer. A config struct field has seen one. A hand-written flag variable has seen one. It found **54**, in a registry of 149. ## Verdicts Counts: **24 wired**, **3 deleted**, **9 legitimately external** (the plugin — seven are named below, and two more were reclassified while the audit ran; there are twelve plugin-scoped settings today), **1 left open**, **2 added** (the inverse bug), plus 15 settings the naive path-string grep called dead that the accessor scan cleared. ### Wired | setting | layer | verdict | evidence | fix | | --- | --- | --- | --- | --- | | `pool.max` `pool.min` `pool.sharing` `pool.scope` `pool.idleTimeout` `pool.callTimeout` `pool.startTimeout` | settings | was partially dead — file only; wired | `config.Config.Pool` filled by the decoder (`config.go:174`); `Resolve` picks from it (`config.go:616`, the `pick` for `max`); no accessor read the resolved `Set` until `ApplyPoolSettings` (`poolsettings.go:36`) | `config.ApplyPoolSettings` folds the resolved value into `Config.Pool` — the layer beneath a server's own `mcpx` block, so a per-server choice still wins. Called at the five places a config is loaded next to a resolved set (`internal/daemon/routes_settings.go:659`, `internal/cli/root.go:157`, `internal/cli/root.go:392`, `internal/cli/connect.go:216`, `internal/cli/doctor.go:97`). A runtime change through `settings set` or `settings unset` reloads them (`routes_settings.go:268`), and a reload that fails is rolled back (`routes_settings.go:280`). | | `logging.maxBytes` `logging.maxLines` `logging.maxAge` `logging.keep` | settings | dead | every `NewFileSink` call passed `FileOptions{Dir: dir}` and nothing else (`cli/root.go`, `cli/commands.go`, `cli/logs.go`); `file.go:87-96` fell back to the built-in constants | `cli.fileOptions` builds the whole policy from the set; both durable sinks use it | | `logging.file` | settings | dead | nothing decided whether to open a sink at all | guards sink creation in the daemon and in `run`/`exec` | | `logging.include` | settings | partially dead — flag and file only | `os.Getenv("MCPX_INCLUDE")`, a name the registry does not own (`root.go:157`) | reads `set.List("logging.include")` | | `script.before` `script.prefix` `script.onSuccess` `script.onError` `script.suffix` | settings | partially dead — file and short flag only | `cfg.ScriptPhase(...)` plus a hand-written repeatable flag; `--script-prefix` and `MCPX_SCRIPT_PREFIX` were bound, recorded and never read | `App.phaseValues` adds `Set.ListAboveFile(path)`. Only the layers above the file: `cfg.ScriptPhase` folds the file layers itself, with an inheritance marker the registry does not model, and taking both would run a line twice. | | `script.env` | settings | dead twice over | `--env` is a hand-written alias so `Bind` skipped it; and `envPairs` was assembled, preflight-checked and then **ignored** in favour of `envVars.Values()` at the point the environment was actually built | the loop reads `envPairs` | | `script.launcher` | settings | dead | only `*launcherFlag` was read | falls back to the resolved value; the `Bare` form resolves to `none`, so `--script-launcher` and `--no-launcher` agree | | `paths.state` `paths.cache` | settings | partially dead — env alias only | `daemon.ResolvePaths` reads `MCPX_STATE_DIR`/`MCPX_CACHE_DIR` by name (`paths.go:37-42`) | `daemon.PathsAt`, applied in `parseFlags` once all three layers are known. The by-name reads stay, allowlisted: they run before any config file has been found. | | `output.json` | settings | partially dead — global flag only | `--json` consumed in `main` before the subcommand; `mcpx ls --json` set `output.json` and left `App.JSON` false | `App.adoptSettings` in `parseFlags` | | `catalog.instructions` | settings | dead | only `--no-instructions` on `types` was read | ANDed with the setting; `Commands` narrowed to `types`, the only output that carries instructions | | `proto.askTimeout` `proto.askPoll` `proto.askRounds` `proto.stateTTL` `proto.sessionIdle` | settings | dead | `internal/mcpserver` read `defaults.Proto*` at the point of use (`ask.go:155,165,196`, `state.go:59`, `server.go:1253`) | `mcpserver.Timing`, passed in from `cli/serve.go`. Passed rather than read there, because the protocol package should not know a config file exists. | | `proto.askTTL` | settings | dead | `routes_proto.go:260` | `s.set.Duration("proto.askTTL")` | | `plumbing.sourceDirAllowed` `plumbing.sourceDirRecursive` `plumbing.sourceProbePaths` | settings | dead — and `source.Options`' own doc comment claimed otherwise | both call sites wrote the three booleans as literals, and **disagreed**: a launcher refused a directory while a phase accepted one | `cli.plumbingSourceOptions` | | `plumbing.strictUnknownKeys` | settings | dead | `Set.Unknown()` was reported by `doctor` as a warning and nothing else | refuses in `App.Settings()`, after the files that carry the switch have been read | | `plumbing.validatePaths` | settings | dead | the one preflight path check ran unconditionally, on `os.Getenv("MCPX_LOGGING_DIR")` | guarded by the switch, and reads the resolved `logging.dir` | | `plumbing.indexOnQuery` | settings | dead | four unconditional `st.Ingest()` calls | guarded in `cli.openStore` and `daemon.openStore`. `log --follow` still ingests: its whole purpose is to see what was just written. | | `plumbing.launcherPlaceholderRepeat` | settings | dead | `opts.AllowRepeat` came only from `--allow-repeat` | appended from the setting | | `elicit.pendingLimit` | settings | dead | `elicit.go:415` used `defaults.ElicitPending` | passed in as `Filter.Limit`; the broker is a store and should not read policy | | `registry.timeout` `registry.pageSize` | settings | dead | `registry.go:43,129` used the constants | `registry.Options`, passed by both callers | | `tasks.ttl` | settings | dead | `tasks.DefaultTTL()` from the constant | the daemon supplies the configured value when a caller names none | | `plugin.discoveryRetry` | plugin | dead | `TUNING.missCooldownMs: 60_000`, hardcoded | `goDurationMs(env.MCPX_PLUGIN_DISCOVERY_RETRY)` — the plugin parses Go's duration spelling, because that is the syntax every `MCPX_` duration is written in | | `completion.maxValues` | settings | half-read | `/v1/complete` read it (`ops.go:350`); the MCP handler wrote `100` (`server.go:1558`) | `Server.MaxCompletions` | ### Deleted | setting | why | | --- | --- | | `plugin.skills` | `MCPX_PLUGIN_SKILLS` appears in no TypeScript and no Go. Skills are directories a user copies into `~/.config/opencode/skills/` by hand; nothing registers them from a list, and there is no code for the setting to be wired into. | | `plumbing.consoleReleaseOnExit` | "hand the original console back before the process ends". The console wrapper lives in the script's runtime, which is a child process that is about to die. Restoring it changes nothing anybody can observe. `releaseConsole()` remains a global a script can call mid-run, which is the case that was real. | | `Setting.AllowDir` (a schema field, not a setting) | declared on six `KindSource` settings, always `false`, read by nothing. It also contradicted `plumbing.sourceDirAllowed`, which is the switch that actually decides this. | ### Legitimately external `plugin.bin`, `plugin.binArgs`, `plugin.backend`, `plugin.toolTiming`, `plugin.env`, `plugin.instructions`, `plugin.tools` are read by the TypeScript plugin through `process.env`, by the exact name the registry derives (`mcpx-session.ts:180-191`, `mcpx/daemon.ts:848-850`). Verified, and now guarded: a plugin-scoped setting whose variable appears nowhere in `plugin/**/*.ts` fails the test. README mentions do not count — a README can describe a knob nobody wired. ### Left open `paths.config` was circular by construction (#5): the config search path is what produces the settings, so the settings cannot decide it. It is no longer left open. `config.ResolveChainFrom` resolves the chain in two passes (issue #1842): a discovery pass over the default locations, seeded by `MCPX_PATHS_CONFIG` / `--paths-config`, reads only `paths.config`; the load pass then resolves that list, nearest last. A `paths.config` found in pass 2 that differs is reported by `mcpx config --sources`, not applied, and a cycle is refused naming the path that closed it. `MCPX_CONFIG` bypasses both passes. ### The inverse bug The plugin honoured four variables the registry had never heard of, which breaks the registry's promise from the other side: `mcpx settings` was supposed to answer "what will the plugin do" without anybody reading TypeScript. `plugin.remember` and `plugin.annotate` are now declared. `MCPX_PLUGIN_HEADLESS` and `MCPX_PLUGIN_DAEMON_TOOLS` were allowlisted at the time, because their defaults are computed at boot — whether the plugin is on the main thread, whether discovery was ambiguous — so a declared *value* would be right in one of the two realms the plugin runs in and wrong in the other. They are declared now, as `plugin.headless` and `plugin.daemonTools` (`internal/settings/plugin.go:105`, `:114`), with the default `auto`: `auto` is the declared name for "work it out from the process shape", which is the thing a number could not express. ## The guard `internal/settings/consumed_test.go`, three tests. **`TestEverySettingIsReadSomewhere`** scans every non-test `.go` file outside `internal/settings` for each path used as the argument to a `Set` accessor. A plugin-scoped setting is checked differently: its `EnvName()` must appear in the plugin's own TypeScript sources. The obvious alternative was a `ReadBy: "daemon"` field on `Setting`. It was rejected, and the reason is worth stating because it generalises: that note lives in the same struct literal as the declaration. Whoever writes the declaration writes the note in the same keystroke, believing both, and nothing ever checks the second half. It would have been a second declaration, subject to exactly the bug it was meant to catch. A scan asks the code, which cannot be optimistic. The narrowness is the other half of the design. A scan for the path string anywhere would have passed `pool.max`, `script.prefix`, `logging.include` and every other half-wired setting in the table above — the ones that were hardest to find and most confusing to hit. Requiring the accessor is requiring the whole promise, because the `Set` is the only reader that has all three layers. **`TestNoHandRolledSettingEnv`** closes the other direction: `os.Getenv` of a variable the registry owns is how a setting becomes env-only. Three entries on its allowlist, each because the read genuinely happens before a `Set` exists. (Since replaced by `TestNoUndeclaredEnvRead`, which walks the syntax tree and also refuses a variable *nothing* declares -- see `docs/environment.md`.) **`TestThePluginReadsNoUndeclaredSetting`** closes the third: a variable the plugin honours that no setting declares. Every allowlist entry carries its reason in the map. There is deliberately no way to silence any of the three in bulk. ## The other three layers The same shape exists wherever something is declared in one file and consumed in another. ### /v1 parameters 161 declared across 60 operations at the time of the audit; 162 across 60 today. The parity tests in `internal/api` already bind every route to an op and every op to an MCP tool — but they match *paths*, not *parameters*, so a parameter can be declared, published in `InputSchema()`, rendered into the OpenAPI document, marshalled into the body by a generated MCP tool, decoded by the handler and discarded, with every test green. - **`POST /v1/diagnose`, `session`** — decoded into the request struct and never referenced. Its own description said "for the record", and no record was written. Fixed: a `diagnose.run` line now goes to the durable log, with the session on it, which is what makes it joinable to the run it was diagnosing. - **`GET /v1/log?chain=`** — `Chain(id, limitPerLevel)` takes no filters, so `level`, `event`, `server`, `tool`, `session`, `trace`, `grep`, `since` and `until` were all accepted and dropped. The result is the whole trace tree at every level, which reads as "that trace touched everything" rather than as a filter that did not run. Fixed: the combination is refused, in `/v1` and in `mcpx log`. The e2e test for chains was itself passing `--level debug`. - `GET /v1/stats?top=` is inert for four of seven dimensions and `GET /v1/events?since=` loses to `Last-Event-ID`; both say so in their own descriptions. Not defects. ### CLI flags No flag declared with `fs.String`/`fs.Bool` in `internal/cli` is wholly unread. The defects are of two kinds. The first is structural and was fixed: `Schema.Bind` registers every setting whose `Commands` list contains the command **or is empty**, so a command accepts flags it never reads. `--budget` and `--bias` were offered on `types`, `ls` and `search`; `--catalog-instructions` on `ls` and `catalog`. Narrowed. The second is a class this audit did not resolve and is reported rather than fixed, because each case is a judgement about the command rather than a wiring error: - `logging.*` declares no `Commands`, so `--log-level`, `--logging-format`, `--include`, `--keep` and the rotation flags bind on **every** command. Only `daemon` and `run`/`exec` read them. `mcpx log --log-level debug` parses and does nothing. Narrowing `logging.*` would be correct and is a larger change than this one. - `mcpx ls -v --json` silently drops the per-instance detail `-v` asks for; the JSON branch returns before it is used. `mcpx doctor -v --json` likewise. - `mcpx stats errors --by slowest` reports errors: a positional dimension wins over `--by` through `firstSet`, silently. - `mcpx stats --opencode` returns before `--server`, `--tool`, `--session` and `--log-dir` are used. - `mcpx log --format json --fields ts,msg` ignores `--format`: `--fields` bypasses the writer entirely. - `mcpx log --reverse --follow` reverses the backlog and not the tail; `followLog` resets `q.Reverse` unconditionally. - `mcpx prompt --mode script --run` becomes `run`; `mcpx recipes run x --mode run --script` becomes script mode. Both overwrite the flag they were given. - `mcpx servers add x --header K=V -- cmd` accepts the headers and drops them: they are read only inside the `--url` branch. - `mcpx api tools --methods all` does nothing without `--spec`: six flags are read only inside `if *specFlag != ""`. - `mcpx elicit show --session S` accepts `--session` and `--audience` on every subcommand and reads them in two. - `parseFlags` leaks into the package-level `flagSetCommand` map when `fs.Parse` fails, and the map is unguarded while `lazyMCP` builds on a request goroutine. ### MCP capabilities - **`logging`** — declared to every pre-2026-07-28 client. The capability means "this server sends log messages to the client"; mcpx emits no `notifications/message` anywhere in the package. Withdrawn. The `logging/setLevel` method is still answered, because refusing would make a well-behaved client that asked anyway treat the whole connection as degraded. - **`resources.subscribe`, `*.listChanged`** — gated on `s.Notify != nil`, a property of the *server*. Delivery is a property of the *connection*, and every HTTP connection the daemon serves is built with a nil send function. So every client over the transport the daemon actually mounts was told to subscribe, had its `subscriptions/listen` acknowledged, and then heard nothing for ever. Now gated on `Conn.canPush()`. - **`*.listChanged`** additionally requires a stream the client opened, and only 2026-07-28 has `subscriptions/listen`. An older client was told it would receive notifications it has no mechanism to receive. Now gated on the revision too. - **`subscriptionId` in `_meta`** — 2026-07-28 makes it mandatory on every notification delivered on a listen stream (`2026-07-28.ts:121-132`). mcpx sets it on the acknowledgement only. A client with two subscriptions cannot correlate anything. **Since fixed**: every notification on a listen stream carries it (`internal/mcpserver/listen.go:94`), pinned by `internal/e2e/subscribe_test.go` and `internal/e2e/protomsg_test.go`. - **`prompts` and `resources`** are declared unconditionally; both schemas say "present if the server offers any". The handlers return `[]` correctly, so this is over-declaration rather than a lie. **Not fixed** — reported. - `events.MCPNotification` translates `ElicitCompleted` to `notifications/elicitation/complete`, and nothing can reach that branch: `ListenFilter` has no field for it, correctly, since 2026-07-28 dropped it. ## One thing the audit found that it did not fix `Setting.EnvName()` derived `MCPX_PROTO_ASK_T_T_L` from `proto.askTTL`, and `--proto-ask-t-t-l` with it. The camel-case splitter did not know that `TTL` is one word. `proto.stateTTL`, `proto.askTTL`, `daemon.leaseTTL` and `proto.serveMCP` were affected. Fixed since: a run of capitals is now one word (`MCPX_PROTO_ASK_TTL`, `--proto-serve-mcp`), and `TestNoDeclaredNameHasASingleLetterWord` fails if a derived flag or variable contains a one-letter word, which is what the next acronym split into letters would look like. --- # Dependencies Everything mcpx needs, and why. Nothing here is incidental — if it is listed, something breaks without it. ## Go libraries **Twelve**, and `pkgs/mcpx/package.nix` states the trade for each one beside the `vendorHash` that pays for them. | module | what it is for | | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `modernc.org/sqlite` | the log index | | `github.com/charmbracelet/bubbletea` | the full-screen browser, `mcpx tui` | | `github.com/charmbracelet/bubbles` | its widgets | | `github.com/charmbracelet/lipgloss` | its layout | | `github.com/mattn/go-runewidth` | the cell width of a rune, for the browser's columns and truncation: wide East Asian characters, combining marks and emoji take one or two cells, and the arithmetic has to match the terminal rather than the byte count | | `gopkg.in/yaml.v3` | OpenAPI documents, which are published as YAML as often as JSON, and which one you get is not the caller's choice | | `github.com/santhosh-tekuri/jsonschema/v6` | the JSON Schema validator (`internal/schemaval`): tool input/output schemas and elicitation schemas are checked with a real validator, not by hand | | `github.com/tetratelabs/wazero` | the WebAssembly runtime: wasm tooling and the embeddings worker run without a cgo toolchain | | `golang.org/x/sys` | the OS-specific syscalls the standard library does not expose (peer credentials on the daemon socket, process groups) | | `golang.org/x/net` | `publicsuffix` and `idna` at the elicitation answer review (`internal/cli/elicit.go`): the registrable domain under a URL about to be answered, plus both host forms and a punycode warning (#1678) | | `tailscale.com` | the tsnet identity transport (#1967): the daemon embeds a Tailscale node and is reachable by its tailnet identity, still as a pure-Go `CGO_ENABLED=0` binary | | `github.com/creack/pty` | a PTY for the `output.color` end-to-end probe; production code does not use it | The three `charmbracelet` modules are one decision, not three: they cost about 1.2 MB in the stripped binary and replace raw terminal handling -- escape sequences, resize, a redraw loop -- which is the kind of code that is never finished and never correct on every terminal. `go-runewidth` is that decision's measuring stick: a rune is one or two cells wide, and truncation has to agree with the terminal rather than with `len()`. Everything else -- the MCP client, the JSON-RPC framing, the process pools, the JSON Schema to TypeScript compiler, the HTTP API and the CLI -- is standard library, and that is worth keeping. ### Why this driver `modernc.org/sqlite` is a pure-Go translation of SQLite rather than a binding. The usual choice, `mattn/go-sqlite3`, is cgo, and cgo would mean: - a C toolchain required to build, which the Nix derivation would have to carry; - cross-compilation broken, so no building a Linux binary from a Mac; - `CGO_ENABLED=0` builds failing outright. That is a large bill for a database that is only ever an _index_. The JSONL files remain the source of truth: the index can be deleted at any time and is rebuilt on the next query. Paying in build complexity for something reconstructible was the wrong trade. The cost of the pure-Go driver is a slower build and a larger binary. Both are acceptable; neither affects anyone running mcpx. ### What this means for the build - `vendorHash` is pinned in `pkgs/mcpx/package.nix` and must be updated when the dependency changes. - The build still needs no network beyond the vendor fetch, and still needs no C toolchain. The standard library packages doing real work: `net/http` (daemon and client), `encoding/json` (everything), `os/exec` + `syscall` (child processes and process groups), `sync` (pools), `path/filepath` (path identity), `text/tabwriter` (human output). If a dependency is ever added, it should be for something genuinely hard — a tokeniser, a SQLite driver — and the trade should be stated here. ## External programs | Program | Needed for | If missing | | -------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `git` | `repo` and `worktree` scopes, for repository layouts native discovery does not read | only those layouts degrade to `cwd`, with a log line and a `doctor` warning saying why | | `deno`, `bun` or `node` | `mcpx run` and `mcpx exec` | those commands fail; `mcpx call`, `ls`, `types`, `catalog`, `search` still work | | the configured MCP servers | their own namespaces | that namespace reports `error` with the server's stderr | **git** is optional. mcpx finds a repository by reading `.git` itself -- a port of git's discovery rules, `docs/git-discovery.md` -- and runs `git rev-parse --path-format=absolute --git-common-dir --show-toplevel` only for a layout that port does not vouch for, such as a repository format newer than it knows. That needs git 2.31 (March 2021); an older git's answer is refused rather than misread. Nothing else about git is used — no fetching, no writing, no config. **A JavaScript runtime** is chosen at first use: deno, then bun, then node. Override with `--runtime` or the `runtime` config key. Deno runs with `--no-check`; the generated client is machine-written and a type error in the agent's own script surfaces at runtime anyway. **MCP servers** are whatever the config names. mcpx spawns them with the given `command`, `args`, `env` and `cwd`, or connects over Streamable HTTP for `url` servers. Their own configuration is exactly those argv and environment entries — MCP has no separate configuration channel. ## Network The daemon binds two listeners, both local: a unix socket, and `127.0.0.1` on an OS-assigned ephemeral port. Generated script clients prefer the socket — Deno fetches over it with a custom HTTP client and Bun with a `fetch` option (`internal/codegen/emit.go`) — and fall back to the TCP port where a runtime cannot address a socket (Node's `fetch` cannot, without undici). Neither listener is reachable off the machine; the tailnet identity transport (#1967) is the separate, authenticated exception, and it is opt-in. Outbound traffic happens only when a configured server is a `url` server, or when a script makes its own requests. ## Nix packaging `pkgs/mcpx/package.nix` wraps the binary with `git`, `deno`, `bun-bin` and `nodejs` suffixed onto `PATH`, so behaviour does not depend on the calling shell. `git` is in that list because `repo` and `worktree` scopes are silently weaker without it — that was a real gap, found by asking this question. The unit suites run in the build sandbox. The end-to-end suite spawns JavaScript runtimes and binds unix sockets, so it runs outside with `go test ./...`. --- # Deploying this book This book is the root of the repository's single GitHub Pages site, and it shares that site with three sibling books. This chapter is how the deploy works, so a change to any of the four books can be landed without wiping the other three. ## One repository, one site GitHub Pages gives a repository exactly one site, and a deployment replaces the whole of it. Four books live in this repository — this one, the fleet book (`pkgs/fleet/book`), the Atlas book (`pkgs/atlas-search/book`) and the ID book (`pkgs/id/book`) — so they deploy together, in one workflow, or not at all: a deploy that published only one book would delete the other three from the site. The workflow is `.github/workflows/mcpx-docs.yml`. It has three jobs: 1. **build** — `nix build .#mcpx-docs`, on every push to main and every manual dispatch. Nothing deploys from this job; it is the same build the deploy job repeats with the deploy `siteUrl`. 2. **deploy** — main only. Builds all four books and stages them into one site tree, then uploads a single Pages artifact. 3. **publish** — a separate job that runs `deploy-pages` against the uploaded artifact. It is separate on purpose (#10956): when publish ran in the same job, it could fetch the artifact metadata before the upload had propagated and fail with "Found 0 artifact(s)". Deploys are serialised and never cancelled by a later one (#1941) — two deploys must never interleave. ## Where each book sits Each book is built with its own `siteUrl`, because mdBook bakes the base path into its generated pages (with the wrong one, the 404 page points its assets at the domain root and breaks): | book | sources | siteUrl | served at | | ----- | ------------------------ | -------------- | ------------------------------------------ | | mcpx | `pkgs/mcpx/docs` | `/code/` | `https://developing-today.github.io/code/` | | fleet | `pkgs/fleet/book` | `/code/fleet/` | `…/code/fleet/` | | Atlas | `pkgs/atlas-search/book` | `/code/atlas/` | `…/code/atlas/` | | ID | `pkgs/id/book` | `/code/id/` | `…/code/id/` | The mcpx book sits at the root because it was there first — it is the site's original book (#1939, #1941), and the others joined under subpaths as they were written. The staging step copies the mcpx build into the site root, then adds `fleet/`, `atlas/` and `id/` beside it; the copied tree comes out of the Nix store read-only, so the staging step makes the root writable before adding the subdirectories (#13225). Each sibling book also has a build-only workflow of its own (`fleet-docs.yml`, `atlas-docs.yml`, `id-docs.yml`) that builds it on every push to main. Those workflows never deploy — deploying is this workflow's job alone, precisely so no second deploy can replace the shared site with a partial one. ## What the mcpx build itself does `.#mcpx-docs` (`pkgs/mcpx/docs.nix`) renders these sources with mdBook, with two gates inside the build: - the **docs-history** preprocessor renders release metadata and history disclosures into the pages; - **docs-twins** then emits the agent surface — a `.html.md` twin for every page, plus `llms.txt` and `llms-full.txt` — and the build _fails_ if any page lacks a current twin (#1947). The deploy job asserts the twins are present in the staged site as well. Chapter links in the agent twins point to the target's rendered `.html.md` file. Each twin resolves relative links from its own directory. In the combined `llms-full.txt`, chapter links resolve from the site root. A directory chapter authored as `README.md` is published as `index.html` and `index.html.md`; the HTML and agent link writers use those names. `book.toml` sets `create-missing = false`: every chapter in `SUMMARY.md` must exist on disk, and a summary entry without a file fails the build instead of publishing a stub. ## After a book change lands The deploy runs on the push to main. Verify it the way the failure mode demands — not just the book you changed: 1. The workflow's publish job is green. 2. Fetch the root and every subpath live — `/`, `/fleet/`, `/atlas/`, `/id/` — and confirm each serves its book. The failure this guards against is a deploy that succeeds by wiping a sibling. ## The custom domain The site is the `github.io` address above. A custom subdomain for the mcpx docs is a recorded, pending decision (#1943) — applying the CNAME is the user's call, and until it is made this chapter describes the site as it is. --- # Elicitation: a design ``` id: elicitation-a-design since: pre-release created: 2026-09-28T18:00:00-05:00 last-updated: 2026-11-03T12:00:00-06:00 status: partial tags: area:protocol, area:integration description: how a server asks a question, and how the answer gets back through a CLI, a REST call, a script, an MCP host or a plugin. note: largely shipped, and differently in places ``` Since: pre-release · Status: partial **This was written before the feature existed, and the feature has since shipped -- not always in the shape proposed here.** It is kept as the design record, because the reasoning is still the reasoning. What actually ships is in `docs/parity.md` (the `elicit_*` rows) and `docs/consumer.md`; the authority is `internal/elicit/`, `internal/cli/elicit.go` and the three `/v1/elicit` routes in `internal/daemon/server.go:424-426`. Where this document and the code disagree, the code is right. The disagreements worth knowing before you read on: | this document says | what shipped | | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | §2's three "live bugs" | all three fixed: `dispatch` routes server-initiated requests (`internal/mcpclient/client.go:404-421`), `negotiate` no longer echoes a version it does not serve (`internal/mcpserver/server.go:1092-1095`), and the client declares `elicitation` (`internal/mcpclient/modern.go:71-84`) | | `mcpx call --elicit=` | not built. There is no `--elicit` flag on any command | | a waiting call exits `75` | built (#286), with a different document: `mcpx call`, `mcpx exec` and `mcpx run` exit `75` with the question, its schema, the `mcpx elicit answer` command and the task id that collects the result. The call keeps running on the daemon as a task. The wire is `POST /v1/call` with `X-Mcpx-Input: report`, answered `202 {"inputRequired": {...}}` -- see §5.1 | | `POST /v1/elicit//answer` | `POST /v1/elicit/{id}/{action}` -- the action is in the path, the body is content only | | `GET /v1/elicit/subscribe` | not built. `mcpx elicit watch` polls; the SSE stream is `GET /v1/events` | | `mcpx_elicit_pending` | the tool is `mcpx_elicit_list` | | `plumbing.elicitTTL`, `elicit.mode`, `elicit.rules` | none exist. The TTL is `elicit.ttl` in `defaults.json` and is not a setting; the shipped policy is `elicit.Route` (`internal/elicit/elicit.go:491`), which is not rule-based | | `MCPX_PLUGIN_ELICIT` | does not exist | | `onElicit()` / `ask()` script globals, the TUI view, the `mcpx-elicitation` skill | not built; `onElicit`/`ask` decided against (2026-11-03, #1935 / ELI-21): broker-only is the deliberate design, see §5.2. The TUI view and the skill remain unbuilt proposals | | a `202` with `Location` and `Retry-After`, an `Elicitation` OpenAPI component | not built. The retry shape that shipped is MCP-side `input_required` | --- ## 1. What elicitation actually is Every other MCP method runs client → server. Elicitation runs the other way: a **server asks the client a question** in the middle of handling a tool call, and waits for an answer before finishing. ``` mcpx ──── tools/call ────────────────▶ server mcpx ◀─── elicitation/create ──────── server "which account?" mcpx ──── {action:"accept", ...} ────▶ server mcpx ◀─── the tool result ──────────── server ``` Two modes: | mode | carries | for | | ------ | ---------------------------------------------- | ------------------------------------------------------------------------ | | `form` | `requestedSchema`, a flat object of primitives | a value the caller can type | | `url` | `url` + `elicitationId` | anything that must not pass through a model: credentials, OAuth, payment | Three answers, and the distinction matters: - **`accept`** — approved, with `content` matching the schema - **`decline`** — explicitly refused. The server should offer an alternative. - **`cancel`** — dismissed without choosing. The server may ask again later. Collapsing decline and cancel is the obvious mistake. A server that treats "not now" as "never" stops offering something the user wanted. ### Two eras, and mcpx is in the older one This is bigger than elicitation, and correcting it is a prerequisite. The spec divides implementations into two **eras**: | | versions | how it works | | ---------- | -------------------------------- | ------------------------------------------------------------------------------------------ | | **legacy** | `2025-11-25` and earlier | `initialize` handshake establishes a session; version negotiated once | | **modern** | `2026-07-28` (current) and later | no handshake; every request carries its version in `_meta`; `server/discover` is mandatory | The current version is **`2026-07-28`**. It is not a draft. The compatibility matrix is unforgiving. A modern client against a legacy server **fails**. A legacy client against a modern server **fails**. Only a _dual-era_ implementation bridges them, and it must implement both. mcpx was legacy on both sides when this was written: its client sent `initialize` with `ProtocolVersion = "2025-06-18"`, and its server answered `initialize`. It is dual-era now -- the client offers `2025-11-25` (`internal/mcpclient/client.go:22`) and probes modern with `server/discover` first, and the server serves both eras. **And its server lies.** `negotiate()` echoes whatever version the client asked for: ```console $ printf '{"jsonrpc":"2.0","id":1,"method":"initialize", "params":{"protocolVersion":"2026-07-28"}}\n' | mcpx serve we claimed: 2026-07-28 $ ... server/discover -32601 no method server/discover ``` A modern client is told "yes, I speak 2026-07-28", and then finds no `server/discover` and no `_meta` handling. The spec says an unsupported version **MUST** get an `UnsupportedProtocolVersionError` (`-32022`) listing what is actually supported. This was a second live bug, independent of elicitation. It is fixed: `negotiate` echoes a version only when it is both supported and non-modern, and otherwise answers `Latest` (`internal/mcpserver/server.go:1092-1095`); `server/discover` is implemented (`server.go:535`) and `-32022` exists (`server.go:327`). ### Elicitation in each era The delivery mechanism differs, which is why the era question comes first. - **Legacy**: a genuine mid-flight request. The server sends `elicitation/create` while `tools/call` is still open, and waits. - **Modern**: a **retry**. The call returns an `InputRequiredResult` carrying `inputRequests`, the call _ends_, and the client re-sends the original request with `inputResponses` attached. The modern shape is dramatically easier for mcpx, because nothing stays open: an invocation can return and a person can answer an hour later. The legacy shape is what every server that exists today actually speaks. So the broker below is designed around the modern semantics -- a question is state with a deadline -- and the legacy path is implemented by holding the call open and feeding it from the same broker. **Both are needed.** One shape of storage, two shapes of wire. --- ## 2. What is in the way today ### `recvLoop` silently drops server-initiated requests `internal/mcpclient/client.go`: ```go var resp rpcResponse if err := json.Unmarshal(raw, &resp); err != nil { continue } if resp.ID == nil { continue } // notification ch, ok := c.pending[*resp.ID] // ← a request has an ID too if ok { ch <- &resp } // ← no match, frame discarded ``` A server→client request has both an `id` and a `method`. It unmarshals cleanly, finds no pending entry, and is dropped. The server then waits forever, the call hits `pool.callTimeout`, and the error says "timed out" — which is true and useless. **This was a live bug, not only a missing feature**, and it has been fixed: `recvLoop` delegates to `dispatch`, which looks for a `method` as well as an `id` and routes the frame to `handleServerRequest` (`internal/mcpclient/client.go:404-421`). ### `initialize` does not declare the capability It did not, when this was written. mcpx advertised `tools`, `resources`, `prompts`, and a well-behaved server checking for `elicitation` would not send one -- protection by silence, which is luck rather than design. The client now declares `elicitation` (with `form`, and `url` when a handler is set), `roots` and `sampling` (`internal/mcpclient/modern.go:71-84`, wired in at `client.go:315`). ### Nothing owns "a question awaiting an answer" Every existing mcpx state is either in-process (a lease) or durable and append-only (the log). A pending elicitation is neither: it outlives a process and it is mutated once. --- ## 3. The shape: a broker One new component. `internal/elicit`. ```go type Request struct { ID string // elc-<16 hex> Trace string // the call that triggered it Parent string // that call's own parent Session string // who owns it Server string // which server is asking Tool string // during which tool call Mode string // form | url Message string // why, in words Schema json.RawMessage // form mode URL string // url mode Created time.Time ExpiresAt time.Time // Created + TTL State string // pending | answered | expired | abandoned } type Answer struct { ID string Action string // accept | decline | cancel Content map[string]any // accept, form mode only By string // which surface answered At time.Time } ``` Stored in the existing SQLite index beside `records`, in two tables. It is already there, already rotated, already queryable, and a pending question is exactly the kind of thing somebody will later want to ask `mcpx log sql` about. The broker is one object with four operations: Proposed as four operations; what shipped is seven, in `internal/elicit/elicit.go`: ```go OpenRequest(r Request) (Request, error) // register; fills id, mode, TTL Await(ctx, id) (Answer, error) // block until answered or expired Respond(a Answer) error // from any surface Get(id) (Request, bool, error) // the question Lookup(id) (Answer, bool, error) // its answer, once it has one Pending(f Filter) ([]Request, error) // what is outstanding Close() error ``` `Await` takes no timeout: the deadline rides on the `Request`, so one question cannot be awaited with two different lifetimes. **Identity.** The broker binds no user identity ([decision 0007](decisions/0007-elicitation-identity.html.md)). A question is addressed by its id; `Request.Session` is a correlation label as the caller sent it, stored and searchable but never checked. `Get`, `Respond` and `Lookup` take an id only, and `Filter.Session` narrows a listing without gating one. Answering authority is daemon access: whoever drives the daemon as its OS owner may see and answer every question. Any future identity enters at the transport, under a record superseding 0007. `Await` blocks on a channel when the answerer is in-process, and polls the table when it is not. Polling is acceptable here because the interval that matters is human — a 250 ms poll against a question a person answers in twenty seconds is not a cost anyone can measure. ### Time to live Every request carries one. The default is `elicit.ttl`, 120 s, in `internal/defaults/defaults.json` (`defaults.ElicitTTL`). It is **not** a registry setting and **not** per-server overridable: `OpenRequest` (`internal/elicit/elicit.go:206`) and the daemon's hooks use the constant unconditionally. Making it a setting is unfinished work, not a decision. On expiry the broker answers `cancel` on the requester's behalf, because that is what expiry _means_: dismissed without an explicit choice. Answering `decline` would tell the server the user said no, which is a different and wrong thing. The TTL is also the backpressure. Without it a stuck server accumulates questions nobody will ever see, and the table becomes a graveyard. --- ## 4. The policy layer: answering without a human A CLI invocation frequently has no human attached. Guessing is unacceptable; failing every time is unusable. So the broker consults a policy first, and only asks a human if the policy abstains. **Not built.** None of `elicit.mode`, `elicit.ttl` as a setting, or `elicit.rules` is in the registry, and `MCPX_ASSUME_YES` does not exist. The policy that shipped is `elicit.Route` (`internal/elicit/elicit.go:491`), which chooses an audience rather than matching rules, together with the settings `elicit.disambiguate`, `elicit.disambiguateDefault`, `elicit.confirmDestructive` and `elicit.askTimeout`. The block below is the design, kept for the reasoning. ```jsonc { "elicit": { "mode": "ask", // ask | auto | decline | error "ttl": "120s", "rules": [ { "match": { "server": "github", "field": "username" }, "answer": "octocat" }, { "match": { "mode": "url" }, "action": "decline", "because": "no browser in CI" }, { "match": { "field": "confirm" }, "action": "accept", "when": "MCPX_ASSUME_YES=1" }, ], }, } ``` The four modes: - **`ask`** (default, interactive) — a human is expected - **`auto`** — rules only; anything unmatched is `cancel`. This is the CI mode. - **`decline`** — refuse everything, politely. For a sandbox that should never be asked. - **`error`** — fail the call outright, so a script that did not expect a question does not silently get a cancelled one Rules are matched before a human is ever asked, and every match is logged with the rule that fired. A policy nobody can audit is a policy nobody should trust. --- ## 5. Every surface The same broker, six front doors. The rule throughout: **an unanswered question is a first-class result, not an error.** ### 5.1 CLI — the exchange you described A call that elicits does not hang. It returns a document and a non-zero exit code reserved for this case (`75`, `EX_TEMPFAIL`, which is what it is). ```console $ mcpx call github.create_issue '{"title":"x"}' { "status": "input-required", "elicitation": { "id": "elc-9f2c1a84bb0e7d31", "trace": "cal-d13e4c64102e9113", "session": "s87630-989154000", "server": "github", "mode": "form", "message": "Which repository should this issue go in?", "requestedSchema": { "type": "object", "properties": { "repo": { "type": "string", "description": "owner/name" } }, "required": ["repo"] }, "expiresAt": "2026-09-28T18:02:00Z", "ttlSeconds": 120, "respondWith": "mcpx elicit answer elc-9f2c1a84bb0e7d31 '{\"repo\":\"me/thing\"}'" } } $ echo $? 75 ``` What shipped (#286) carries the same information in a different shape: ```console $ mcpx call ask.need_repo; echo $? mcpx: ask.need_repo is waiting for input and nothing here can answer it. asks Which repository should this go in? schema {"properties":{"repo":{"description":"owner/name","type":"string"}},"required":["repo"],"type":"object"} expires 2026-09-30T22:31:37-05:00 (2m0s from now) answer mcpx elicit answer elc-93e18b28a5a3c1f5 '{"repo":"..."}' mcpx elicit decline elc-93e18b28a5a3c1f5 | mcpx elicit cancel elc-93e18b28a5a3c1f5 The call keeps running until it is answered or expires; collect its result with: mcpx task result tsk-06654ccc9f064a5c 75 $ mcpx elicit answer elc-93e18b28a5a3c1f5 '{"repo":"me/thing"}' $ mcpx task result tsk-06654ccc9f064a5c # the call's real result ``` `--json` puts `{"inputRequired": {callId, server, tool, questions[], text}}` on stdout. A script under `mcpx exec` or `mcpx run` stops at the call that asked and exits `75` with the same message, even if it catches `ToolError`: the generated client sees the daemon's `202` and exits rather than throwing. Two limits. A daemon running inside the command (`daemon.inline`) stops with it, so the call cannot outlive the exit and the message says so. And when other calls share the server's instance a question cannot be tied to one call for certain; it is still reported, marked `ambiguous`, because waiting out the TTL and exiting 0 was the bug. `respondWith` is there because the alternative is the caller assembling it from three fields, and they will get it wrong once and then copy it forever. ```console $ mcpx elicit answer elc-9f2c1a84bb0e7d31 '{"repo":"me/thing"}' $ mcpx elicit decline elc-9f2c... # explicitly no $ mcpx elicit cancel elc-9f2c... # dismissed $ mcpx elicit list # what is outstanding, with time left $ mcpx elicit watch # follow, for a terminal left open ``` Under the retry model, answering re-drives the original call automatically and the result lands in the log; `mcpx elicit result ` fetches it. Under the bidirectional model the original invocation is still blocked and simply proceeds. A flag for the common case, where the caller is a person who will wait. **Not built** -- `mcpx call` takes only `-session` and `-raw`, and `--elicit=prompt` is rejected as an undefined flag: ```console $ mcpx call --elicit=prompt github.create_issue '{...}' # NOT BUILT Which repository should this issue go in? repo (owner/name): me/thing ``` `--elicit` takes `prompt | return | auto | decline | error`, defaulting to `prompt` on a terminal and `return` otherwise. That default is the whole ergonomic story: interactive use just works, scripted use gets a document. ### 5.2 Scripts A script is the one place where blocking is natural, because a script already awaits. ```ts const issue = await tools.github.create_issue({ title: "x" }); ``` By default the runtime answers from policy or cancels, and the call returns whatever the server does with that. **Decision (2026-11-03, #1935, register row ELI-21): broker-only is the deliberate design. `onElicit` and `ask` will not be built** -- no `onElicit` and no `ask` are emitted into the script's globals (`internal/codegen/emit.go`), and that absence is now a decision, not a gap. The proposal that was considered, kept as the record: ```ts onElicit(async (q) => { // NOT BUILT -- decided against; see below if (q.mode === "url") return { action: "decline" }; if (q.schema.properties.repo) return { action: "accept", content: { repo: "me/thing" } }; return { action: "cancel" }; }); ``` (For a script run on a terminal, `ask(q)` would have prompted. The handler was to be registered rather than passed per call, because the question arrives from inside a call the script did not know would ask.) Why the broker stays the only answer path: - **Consent and credentials are routed to a human on purpose.** `elicit.Route` (`internal/elicit/elicit.go`) sends url-mode questions, credential-shaped fields, and bare confirmations to a human -- "a confirmation is consent, which is not the agent's to give". An inline script handler answers from inside the call, ahead of that routing; giving scripts first claim on a question would either bypass the human gate or force every generated client to re-implement `Route`. Neither is acceptable, so the routing lives in exactly one place: the broker. - **A script cannot reliably know which call asked.** The correlation the protocol has identifies a _call_, and a script is many calls, possibly concurrent over one shared upstream instance; questions that cannot be attributed are already marked `ambiguous` on the CLI path (§5.1). A registered global handler would answer questions it cannot attribute -- the failure mode the broker's claim-once, TTL-bound answer path exists to prevent. - **Scripts are not locked out; they answer through the broker like every other surface.** A script run stops with exit `75` and the `mcpx elicit answer` command (§5.1); anything that can speak HTTP or MCP can list, inspect, and answer pending questions via `GET /v1/elicit`, `POST /v1/elicit/{id}/{action}`, and the `mcpx_elicit_*` tools, and the ops surface exposes the same as `ops.elicitList()` / `ops.elicitAnswer()` (`docs/parity.md`). Whoever sends the answer, it still passes `Route`, the TTL, and the claim-once update. Revisit only if both change: run-scoped question correlation lands (a question provably belongs to one script run and one call), and the hook is restricted to questions `Route` already sends to the agent -- never url mode, never credential fields, never confirmations. ### 5.3 REST and OpenAPI HTTP has a status code for exactly this, and it is not 400. ``` POST /v1/call/github/create_issue → 202 Accepted # built only with X-Mcpx-Input: report, as {"inputRequired": {...}}; no Location/Retry-After Location: /v1/elicit/elc-9f2c1a84bb0e7d31 Retry-After: 120 { "status": "input-required", "elicitation": { ... } } ``` ``` POST /v1/elicit/elc-9f2c.../accept {"content":{...}} # also /decline, /cancel GET /v1/elicit list GET /v1/elicit/elc-9f2c... one, with time remaining ``` `202` is right: the request was understood and accepted, and completion is pending. A `400` would say the caller made a mistake, which they did not. The OpenAPI document gains a `202` response on every tool path and an `Elicitation` schema component. Both are generated, so they cannot drift. **Neither is built**: no operation declares a `202`, and there is no `Elicitation` component in `internal/api/openapi.go`. What shipped instead is the MCP-side `input_required` result (`internal/mcpserver/ask.go`). ### 5.4 mcpx as an MCP server — the pass-through This is the interesting one, and the reason the whole design is worth building. A question from a server three layers down has to reach the agent at the top. ``` agent ──▶ mcpx (MCP server) ──▶ mcpx daemon ──▶ github server │ agent ◀── elicitation/create ◀── broker ◀────── "which repo?" ``` mcpx declares `elicitation` in its own `initialize` capabilities **only if its client did**. Capability negotiation has to be honest in both directions, or mcpx promises something it cannot deliver and the failure surfaces at the worst moment. Then: - **Client supports elicitation** → forward it, rewriting the message to name the real originator: _"github (via mcpx) asks: which repository?"_. The agent must know which server is asking; that is a spec requirement and also just decent. - **Client does not** → fall back to policy, then to returning `input-required` in the tool result text so the agent can call `mcpx_elicit_answer` itself. That fallback means **an agent can answer a question with no client support at all**, which matters because most MCP hosts do not implement elicitation yet. Two new tools on the MCP surface: - `mcpx_elicit_list` — what is waiting, with schemas and deadlines - `mcpx_elicit_answer` — answer one ### 5.4a Who is the question for: the agent or the person? The spec does not have a field for this, and deliberately so. From the Python SDK's own words: _"If the client is an agent, it might decide how to handle the elicitation -- either by asking the user or automatically generating a response."_ **The decision is the client's, not the server's.** So mcpx needs a routing policy, and the useful thing is that the elicitation itself carries enough to route on: | signal | route to | why | | ----------------------------------------------------------------------- | --------------------------------- | ----------------------------------------------------------------- | | `mode: "url"` | **human** | the point is a browser and a person's consent | | `format: "password"`, or a name matching `token\|secret\|key\|password` | **human** | a model should not be handed a credential, and cannot know one | | a `confirm`/`approve` boolean on a destructive call | **human** | consent is the whole content of the question | | an enum the agent can evaluate from context | **agent** | "which of these three repos" is answerable from what it just read | | free text with no constraint | **agent first, human on decline** | the agent may know; if it does not it should decline, not invent | The last row is the one that matters. A model asked "which repository?" with no way to know will produce a plausible name. **The default for anything the agent cannot verify must be decline, not guess**, and the skill in §5.7 exists mostly to say so. A server may _hint_ through `_meta` -- `io.mcpx/audience: "user"` -- and mcpx should honour a hint toward the human and ignore one toward the agent, because a server pushing a question past a person is exactly the direction that needs resisting. In the plugin this becomes concrete: `notify` puts it to the agent, `ask` puts it to the person, and the routing policy decides which when the mode is `auto`. A question routed to the agent that the agent declines is _re-raised_ to the person rather than failing -- that escalation is the behaviour somebody would expect and would otherwise have to build by hand. ### 5.5 The opencode plugin The plugin is where this becomes genuinely good, because opencode has a real user and a real UI. ```ts "tool.execute.after": async (input, output) => { const pending = await pendingFor(input.sessionID) if (!pending.length) return output.output += "\n\n" + renderElicitation(pending[0]) } ``` Three levels, opt-in as everything else in that plugin is. **Not built**: `MCPX_PLUGIN_ELICIT` is not a variable the registry derives or the plugin reads, and there is no `--plugin-elicit`. 1. **`MCPX_PLUGIN_ELICIT=notify`** — a pending question is appended to the tool result, so the agent sees it and can answer via a tool. No UI needed. 2. **`MCPX_PLUGIN_ELICIT=ask`** — the plugin uses opencode's own permission mechanism (`ask({ permission, metadata })`) to put the question to the _user_. This is the real prize: a genuine dialog, in the harness the person is already looking at. 3. **`MCPX_PLUGIN_ELICIT=auto`** — policy only. The session id the plugin already injects is what makes this work: the plugin can filter the listing by its own session so it shows the user only the questions its calls raised. That filter is routing, not an access boundary, and the session id is not a user identity: under [decision 0007](decisions/0007-elicitation-identity.html.md) the label is a correlation value the caller supplies, and any surface with daemon access can still list and answer every question. ### 5.6 TUI **Not built** -- nothing in `internal/tui/` mentions elicitation. A seventh view, and a badge in the header when something is pending — because the one thing worse than a question nobody answers is a question nobody knows was asked. Form mode renders the schema as fields. URL mode shows the URL and offers to open it. `a` accepts, `d` declines, `c` cancels, `enter` opens the detail. The header badge is deliberately loud: `● 1 question` in the accent colour. ### 5.7 Skills **Not built** -- there is no `mcpx-elicitation` skill in `plugin/opencode/skills/`. `mcpx-elicitation`, loaded on demand, would cover: what `input-required` means, that `decline` and `cancel` are different, how to answer from a tool, and the one thing an agent gets wrong — **inventing a value rather than declining**. A model asked "which repository?" with no way to know will happily guess. The skill's job is to say: if you do not know, `decline` and explain why. --- ## 6. What it unlocks Elicitation is not only a feature. It is the missing half of four things mcpx already has. ### Third-party authorisation flows I overstated this in the first draft. Two different things share the word OAuth: 1. **MCP's own authorization spec** -- how a _client authenticates to a remote MCP server_ over HTTP. That is a separate document, separate machinery (OAuth 2.1, resource metadata, token handling), and elicitation does not provide it. It remains a genuine gap. 2. **A server sending its user through someone else's authorisation flow** -- "connect your GitHub account". _That_ is url-mode elicitation, and it does fall out of this design. The second is common and currently impossible. The first is unaffected. The line in `OPENCODE-V2.md` should be split accordingly rather than crossed off. ### Write operations in OpenAPI and CLI adapters Both currently default to read-only, because a specification describes what a service _can_ do rather than what you meant to allow. With elicitation there is a middle setting: expose writes, and elicit a confirmation before each one. ```jsonc { "methods": ["all"], "confirm": ["POST", "DELETE"] } ``` That is strictly better than the two options available now, which are "no writes" and "all writes, no questions asked". ### Credentials at the moment of need `mcpx registry add` currently reports which variables a server requires and leaves them empty, because inventing a secret is wrong. With elicitation the server can ask for it on first use, and the answer can go to a keychain rather than a config file. The current behaviour is the best available without elicitation; this is better. ### Disambiguation instead of guessing "Three repositories match, which did you mean?" is the single most common thing a tool cannot currently do. Today it either guesses or fails. Neither is what a person would do. ### And two things it unlocks that are not about servers at all **mcpx can elicit on its own behalf.** `mcpx doctor` finding an unconfigured server could ask rather than report. `mcpx registry add` could ask for the secrets it currently lists. The broker does not care whether the asker is an upstream server or mcpx itself, and building it only for pass-through would leave that on the table. **Long-running approvals become possible.** With a TTL measured in minutes and a durable store, "this deploy needs a second pair of eyes" is expressible: a question raised by CI, answered by a person from a terminal or the TUI, and the call resumes. That is a different product feature that falls out of the same machinery. --- ## 6a. How the answer travels: four mechanisms, not one The re-exec shape in §5.1 is right for one case and wrong as the only option. There are four ways an answer can reach the broker, and each is best somewhere. | mechanism | latency | survives exit | best for | | ------------------------------------------ | ---------------- | --------------- | ------------------------------------------ | | **stdin/stdout prompt** | immediate | no | a person at a terminal | | **re-exec** (`mcpx elicit answer`) | seconds to hours | yes | scripts, CI, anything that returned | | **daemon socket subscription** | immediate | while connected | the TUI, the plugin, any long-lived client | | **HTTP** (`POST /v1/elicit//`) | immediate | yes | remote callers, webhooks, another machine | The daemon already owns a unix socket and a loopback port. A long-lived client -- the TUI, the plugin, a `mcpx elicit watch` left running -- should **subscribe** rather than poll: ``` GET /v1/events → server-sent events, carrying elicit.* kinds (GET /v1/elicit/subscribe was proposed and not built; mcpx elicit watch polls, internal/cli/elicit.go:164) ``` That removes the polling in §3 for every case that matters, and polling survives only as the fallback for a process that cannot hold a connection. The defaults follow from the table: - terminal → prompt, no re-exec, no state to reconcile - non-terminal → return the document, expect `mcpx elicit answer` - TUI, plugin → subscribe - REST caller → the HTTP endpoints, which they are already speaking Re-exec is the _conventional_ shape because it is the only one that works when the asking process is gone, and that is the case a CLI has to handle. It is not the best shape when the process is still there. ## 6b. Continuity across the re-exec A re-exec means a new process, and the question is whether anything is lost. Nothing needs to be, because session identity already lives in the environment rather than the process. `MCPX_SESSION_ID` is injected by the harness; a second invocation in the same shell carries the same value and therefore leases the same pooled server. What the audit trail needs, and what the design should record: ``` elicit.open trace=cal-d13e… elicit=elc-9f2c… session=s876… pid=41201 elicit.answered elicit=elc-9f2c… action=accept by=cli session=s876… pid=41533 answeredAfterMs=18420 elicit.resumed trace=cal-a77b… parent=cal-d13e… elicit=elc-9f2c… ``` Three things fall out of that. The **pid changes and is recorded on both sides**, so "who answered this" is answerable. The **session is the same**, so `mcpx log --chain` walks from the resumed call back through the elicitation to the original call. And `answeredAfterMs` is the metric worth having: it is the human latency, and it is the number that tells you whether a TTL is set sensibly. If the session id is _absent_ -- a bare shell, no harness -- the broker binds the question to the config fingerprint and the working directory instead, and says so in the record. Refusing to work without a session would make the feature unusable from a plain terminal, which is where people debug. ## 7. Cost, and what could go wrong Roughly 1,200 lines, in five pieces. The broker and its two tables. The `recvLoop` fix plus a bidirectional path. Policy evaluation. Six surface adaptations, most of them under fifty lines each. The TUI view. Three things I would expect to go wrong: **Deadlock under the bidirectional model.** A call holds a lease while waiting for an answer; the answer arrives through a surface that needs the same pool. Mitigated by the TTL, but the retry model avoids it entirely — which is the strongest argument for preferring it. **Questions nobody sees.** A CLI invocation that returns `input-required` into a script that ignores exit codes produces a question that expires unanswered, and the user sees only a mysterious cancellation. The TUI badge and `mcpx elicit list` are the mitigation; so would be a `--elicit=error`, which would make not expecting a question a loud failure rather than a quiet one. Neither the badge nor the flag is built. **Rule-based auto-answers drifting into dishonesty.** A rule that answers "yes" to everything is a policy that lies to a server about a user's consent. Logging every rule that fires is the minimum; I would also make `auto` mode refuse to match a rule whose `match` is empty, so there is no "match everything" shorthand. --- ## 8. The explainer Everything mcpx does today assumes the conversation goes one way. You ask a server to do something; it does it; you read the answer. Every part of mcpx — the CLI, the scripts, the REST endpoints, the MCP server, the TUI — is shaped by that assumption. Elicitation breaks it. It lets a server stop halfway through a job and ask a question: _which repository did you mean? are you sure you want to delete this? I need you to log in — here is the link._ The server cannot continue until somebody answers. That is awkward for mcpx specifically, because mcpx is usually invoked by something that cannot answer. A shell script has no opinion about which repository. A cron job cannot log in. A model can answer, but it will happily invent a repository name it has no way to know, which is worse than not answering at all. So the design turns a blocking question into a **piece of state that anything can answer, later.** The question gets an identity, a deadline and a home in the existing database. The tool call stops and says "I need input, here is what and here is the ticket". Anyone holding that ticket — a person at a terminal, a script that knew this might happen, an agent through a tool, a dialog in the editor — can supply the answer, and the call resumes. Three consequences are worth stating plainly. **The answer does not have to come from whoever asked.** CI can raise a question a human answers from a laptop twenty minutes later. That is not a special feature; it falls out of the question being state rather than a blocked function call. **"No" and "not now" stay different.** The spec separates _decline_ from _cancel_, and it matters: a server told "no" should offer an alternative, and a server told "not now" should ask again later. Collapsing them — which is the tempting simplification — makes tools worse in a way nobody traces back to this decision. **Not answering is a legitimate outcome.** A deadline expires, the question becomes a cancellation, the server is told honestly that nobody chose. The failure mode to avoid is a system that waits forever, or one that invents an answer to avoid waiting. The reason to build it is not the feature itself. It is that four things mcpx already does are currently half-finished for want of a way to ask a question. OAuth is elicitation. Safe write access is elicitation plus a confirmation. Credentials-on-first-use is elicitation. Disambiguation is elicitation. Each of those is presently either missing or solved by refusing to do the risky thing, and they all become available from one piece of machinery. The catch worth knowing when this was written -- **since fixed**: mcpx's receive loop treated every inbound frame as a reply to something it sent. A server that asks a question gets silence, waits, and eventually times out — and the error mcpx reports is "the call timed out", which is true, useless, and points at entirely the wrong thing. That is worth fixing whether or not the rest of this is ever built. --- # The script environment Settings are what a person tells mcpx. This page is the other direction: what mcpx, and the opencode plugin, tell a program they start. A script reads its session from here. The generated client finds the daemon from here -- the endpoint, the socket, whether the daemon can see this filesystem. An `mcpx` command run inside a script, or inside a shell the editor opened, learns which session it belongs to from here, which is what lets a session-scoped server give each agent its own browser instead of sharing one. It is an interface with as many consumers as the settings have. Until #172 it was declared nowhere. The only list was the code that happened to set each name, spread across five packages and a TypeScript file, and the documentation had already drifted from it: it said the plugin sets `MCPX_SESSION` and `MCPX_CALL`. The plugin sets `MCPX_SESSION_ID` and `MCPX_CALL_ID`; `MCPX_SESSION` is a different variable, set by mcpx for its own scripts; and `MCPX_CALL` has never existed. Two variables, one renamed in somebody's head, is exactly the drift a hand-written list produces. ## How it is kept true The table below is generated from `settings.ScriptEnv()` in `internal/settings/scriptenv.go`, and tests hold that table to the code: - **Everything set is declared, by the right setter.** The Go sources are walked as syntax -- a map key, an assignment to an index, a `KEY=VALUE` string, `os.Setenv` -- and the plugin's `put(e, "MCPX_...")` calls are read, and every name found must be in the table with the part of mcpx that set it listed. A setter the table names that sets nothing fails too. - **Everything read is declared.** A lookup of an `MCPX_` variable anywhere outside `internal/settings` must be either a setting read through the resolved settings, a variable in this table, or one of four lookups on an allowlist that carries the reason for each -- three happen before any settings exist, the fourth where there is no App to ask. An entry nothing needs fails the test. A variable the registry owns may not be read by name even when it is also here, because that would ignore the config file and the flag. - **The "read by" column is checked.** If it says the generated client reads a variable, the generated TypeScript does; if the plugin reads one, the column says so. - **This page is current.** The test regenerates the table and fails when it differs. ## This table is what mcpx adds, not all a child gets Every one of these is _added to_ the environment mcpx itself was started with. A child gets the parent's environment entire, and then these on top — unless its shebang replaces part of it: `env -i` starts the child from an empty environment, and `env -u NAME` removes just that name (both then get these on top). Both the dispatched path and the JavaScript path apply what the shebang asked for: - `internal/runner/runner.go:359` — `cmd.Env = append(os.Environ(), …)`, every script the runner starts - `internal/adapter/adapter.go:239` — `cmd.Env = os.Environ()` - `internal/mcpclient/stdio.go:66` — `env = append(env, os.Environ()...)`, under `InheritEnv`, for every stdio MCP server the pool starts So a script also sees `SSH_AUTH_SOCK`, `GITHUB_TOKEN`, `AWS_*`, and whatever else was in the shell that started the daemon. `PATH` is inherited rather than constructed, which means a daemon started from a shell with an unusual `PATH` passes it on. `script.permissions` does not change this. It sandboxes the filesystem and the network through the runtime's own flags; there is no allowlist or denylist for the environment, and nothing here is filtered. This is worth knowing before putting a secret in the environment of a shell you then run `mcpx serve` from. It is stated rather than fixed because the alternative — an allowlist — would break every server that expects its own API key to arrive this way, which is most of them. ## Configuration is not here A variable here is a fact about one run -- which session, which daemon, which file -- handed from a parent to a child. A knob is a setting, with a configuration key, a flag, a `/v1/settings` row and an MCP tool; those are in [configuration.md](configuration.html.md). Two names are both: `MCPX_LOG_LEVEL` and `MCPX_DAEMON_ENDPOINT` are written for a child, and a child that is `mcpx` reads each as the setting it names. Some variables are read by mcpx and are neither: which configuration file to load (`MCPX_CONFIG`, the setting `paths.configFile`) and where the state lives (`MCPX_STATE_DIR`, `MCPX_CACHE_DIR`) are needed before there is a configuration to resolve settings from. They are settings, marked as such, and read by name for that reason. ## The variables | variable | set by | when | what it is | read by | | --- | --- | --- | --- | --- | | `MCPX_SESSION` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`); an event consumer | always | the session key this run's tool calls are leased under: --session, else MCPX_SESSION_ID, else one minted for the run | the generated client, which sends it with every call | | `MCPX_SESSION_ID` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`); an event consumer; the opencode plugin; the plugin loader, for a discovered plugin | the CLI passes through the value it was given, which may be empty; the plugin sets it at every plugin.env level | the session the host assigned. Unlike MCPX_SESSION it survives from one command to the next, so it is what session-scoped servers key on | `mcpx` run inside the script or shell, as its session when --session is not given | | `MCPX_PARENT_SESSION_ID` | `mcpx exec` / `mcpx run`; an event consumer; the opencode plugin | the CLI passes through what it was given; the daemon passes the caller's parent session into a script run's environment; the plugin at plugin.env=full, when there is a parent | the session that spawned this one, so a parent agent and its subagents can share a server | `mcpx` run inside the script or shell, and the generated client for parent-session scoping | | `MCPX_EPHEMERAL` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | always | 1 when the session key was minted for this run alone, so its instances may be stopped as soon as it ends | the generated client | | `MCPX_RUN` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | always | this execution's run id, which groups the artifacts it produces | the generated client, when storing an artifact | | `MCPX_INPUT` | `mcpx exec` / `mcpx run` | mcpx exec and mcpx run, locally and with --remote; not when mcpx serve collects the output | report: nothing in this run can answer a server's question mid-call, so a call that asks one exits 75 with the question instead of waiting for it to expire | the generated client, sent as X-Mcpx-Input | | `MCPX_HOOK_NAME` | the declared-hook runner, for a hook it runs | always | the declared name of the hook being run | the hook itself | | `MCPX_HOOK_PHASE` | the declared-hook runner, for a hook it runs; the exec service (`/v1/exec`, `mcpx_exec`) | always | the hook's phase; always observe for config-declared hooks, the exec hook's phase (pre, post, onError, onSuccess) for a per-call exec hook | the hook itself | | `MCPX_HOOK_POINT` | the exec service (`/v1/exec`, `mcpx_exec`) | always | the point the hook is attached to; script for per-call exec hooks in this version | the hook itself | | `MCPX_HOOK_ERROR` | the exec service (`/v1/exec`, `mcpx_exec`) | only for a hook running because the script failed; truncated to 1024 bytes | the error the hook is running for, in one line; the full hook context is JSON on stdin | the hook itself | | `MCPX_HOOK_EVENT_KIND` | the declared-hook runner, for a hook it runs | always | the kind of the event the hook is running for; the full event is JSON on stdin | the hook itself | | `MCPX_HOOK_EVENT_SEQ` | the declared-hook runner, for a hook it runs | always | the event's sequence number on the daemon's bus | the hook itself | | `MCPX_HOOK_EVENT_SERVER` | the declared-hook runner, for a hook it runs | empty when the event names no server | the server the event is about | the hook itself | | `MCPX_HOOK_EVENT_SESSION` | the declared-hook runner, for a hook it runs | empty when the event belongs to no session | the session the event belongs to | the hook itself | | `MCPX_HOOK_EVENT_URI` | the declared-hook runner, for a hook it runs | empty when the event names no resource | the resource URI the event is about | the hook itself | | `MCPX_ENDPOINT` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`); an event consumer | always | the daemon's HTTP endpoint | the generated client; the plugin as a fallback for MCPX_DAEMON_ENDPOINT | | `MCPX_SOCKET` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`); the plugin loader, for a discovered plugin | empty when the daemon is remote, since its socket is not reachable from here | the daemon's unix socket, which is faster than the endpoint. Also where a daemon binds and a client dials, for anyone who sets it by hand | the generated client, `mcpx` run inside the script or shell, the plugin | | `MCPX_TRANSPORT_BEARER_TOKEN` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`); an event consumer | only when transport.bearerToken is configured | the daemon's bearer token, handed to the script so the generated client can authenticate to a daemon that requires it (#1975); the token itself stays out of the generated code | the generated client, `mcpx` run inside the script or shell, the plugin; also the setting `transport.bearerToken` | | `MCPX_SETTINGS` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | only when the caller sent call settings with the run (for example a requested pool.callTimeout) | the call-settings header for this run, carried into the script so the generated client forwards the caller's per-call requests on the calls it makes on the script's behalf | the generated client, which sends it as the x-mcpx-settings header | | `MCPX_ARTIFACTS_LOCAL` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | always | 1 when the daemon shares this filesystem, so artifact({path}) may hand over a path instead of the bytes | the generated client | | `MCPX_CWD` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | the exec service only when the caller sent its working directory | the directory the caller ran mcpx from, which a remote run cannot discover | the generated client (paths.cwd, and cwd scoping) | | `MCPX_PID` | `mcpx exec` / `mcpx run`; the exec service (`/v1/exec`, `mcpx_exec`) | always | the pid of the mcpx process that started the script | the generated client, for pid scoping | | `MCPX_ENTRY` | the runner, for every script | always | the file the runtime was started on: mcpx's generated launcher, or the script itself under --no-launcher. For exec the script is a generated file | the generated client (paths.entry) | | `MCPX_CLIENT` | the runner, for every script | always | the generated client module | the generated client (paths.client) | | `MCPX_CONFIG_PATH` | `mcpx exec` / `mcpx run` | always | the nearest configuration file in effect, empty when there is none | the generated client (paths.config) | | `MCPX_PATHS_CONFIG` | `mcpx exec` / `mcpx run` | a daemon auto-started by this invocation, only when a --paths-config seed lives in this process's memory; an environment seed needs no forwarding, as the child inherits the environment | the paths.config seed this process resolved configuration discovery from, forwarded so the auto-started daemon resolves the same chain this process did | `mcpx` run inside the script or shell, in configuration discovery (a bootstrap read: paths.config decides which files the settings are read from, so there is no resolved Set to ask); also the setting `paths.config` | | `MCPX_SCRIPT_DIRS` | `mcpx exec` / `mcpx run` | always | the directories searched for named scripts, nearest first, colon-separated | the generated client (paths.scriptDirs) | | `MCPX_API_DECLARATION_SHA256` | `mcpx exec` / `mcpx run` | always | the fingerprint of a declared API's declaration, set on the child a declared API launches: PoolID hashes the environment, so editing the declaration replaces the pool instead of keeping a child started for the old one | the pool, as a pool identity input (api serve: PoolID hashes the server environment) | | `MCPX_ADAPTER_DECLARATION_SHA256` | `mcpx exec` / `mcpx run` | always | the fingerprint of an adapter's declaration, set on the server an adapter launches: PoolID hashes the environment, so editing the declaration replaces the pool instead of keeping a child started for the old one | the pool, as a pool identity input (PoolID hashes the server environment); the daemon, which exempts an adapter's own exact name from the namespace-collision check when the adapter is replaced | | `MCPX_ADAPTERS_ALLOW_BARE` | `mcpx exec` / `mcpx run` | only when the resolved adapters.allowBare is on | the bare-adapter permission the daemon resolved, forwarded to the adapter serve child it spawns for a declaration: the child re-resolves its own settings, and a grant made only by the daemon's flag would otherwise read as the default off there, so the child would refuse the declaration its parent accepted (#13118) | `mcpx` run inside the daemon's spawn (the adapter serve child), as its adapters.allowBare setting; also the setting `adapters.allowBare` | | `MCPX_RUNTIME` | the runner, for every script | always | deno, bun or node; on a dispatched run, the interpreter's name (sh, python3) | the generated client; on a dispatched run, the script itself | | `MCPX_DISPATCH` | the runner, for every script | only on a dispatched (non-JavaScript) run | how the interpreter was chosen: shebang or interpreter (script.interpreter) | the script itself, and anyone reading its environment | | `MCPX_ALLOW_READ` | the runner, for every script | only when the permissions allow reading files | 1: the client's file helpers may read. Without it they refuse, naming the permission, rather than leaving it to the sandbox | the generated client | | `MCPX_LOG_LEVEL` | `mcpx exec` / `mcpx run` | always | the lowest level the script's log keeps | the generated client; `mcpx` run inside the script or shell reads it as logging.level; also the setting `logging.level` | | `MCPX_LOG_SOURCE` | `mcpx exec` / `mcpx run` | always | which levels record a call site: a level name for that level and above, 0 for none | the generated client | | `MCPX_DAEMON_ENDPOINT` | the opencode plugin | plugin.env=standard or above, once the plugin has chosen a daemon | the daemon this editor session settled on, so a shell command that runs mcpx talks to the same one instead of looking for its own | `mcpx` run inside the script or shell, as daemon.endpoint; the plugin, as the daemon to use; also the setting `daemon.endpoint` | | `MCPX_TRACE_IDS` | the opencode plugin | plugin.env=standard or above, when there is anything to say | JSON pairs such as [["session_id","abc"],["worktree","/p"]], extended at full with the parent session and the whole ancestry | `mcpx` run inside the script or shell, which puts every pair on every log record | | `MCPX_CALL_ID` | the opencode plugin | plugin.env=standard or above | the editor's id for this one tool call | the command | | `MCPX_OPENCODE_CWD` | the opencode plugin | plugin.env=standard or above | the directory the command runs in, which is not always the project root | the command | | `MCPX_OPENCODE_DIRECTORY` | the opencode plugin | plugin.env=standard or above | the project directory the editor opened | the command | | `MCPX_OPENCODE_WORKTREE` | the opencode plugin | plugin.env=standard or above | the project's worktree | the command | | `MCPX_WORKTREE_NAME` | the opencode plugin | plugin.env=standard or above, when there is a worktree | the worktree's last path element | the command | | `MCPX_PROJECT_ID` | the opencode plugin | plugin.env=standard or above | the editor's project id | the command | | `MCPX_HARNESS` | the opencode plugin | plugin.env=standard or above | opencode | the command | | `MCPX_HARNESS_VERSION` | the opencode plugin | plugin.env=standard or above | the editor's version | the command | | `MCPX_HARNESS_PID` | the opencode plugin | plugin.env=standard or above | the editor's pid | the command | | `MCPX_HARNESS_STARTED` | the opencode plugin | plugin.env=standard or above | when the plugin started | the command | | `MCPX_SHELL_SEQ` | the opencode plugin | plugin.env=standard or above | a counter of shell commands in this editor process | the command | | `MCPX_SESSION_TITLE` | the opencode plugin | plugin.env=full | the session's title | the command | | `MCPX_SESSION_DIRECTORY` | the opencode plugin | plugin.env=full | the session's directory | the command | | `MCPX_SESSION_VERSION` | the opencode plugin | plugin.env=full | the editor version that created the session | the command | | `MCPX_SESSION_DEPTH` | the opencode plugin | plugin.env=full | how many parents the session has | the command | | `MCPX_SESSION_CREATED` | the opencode plugin | plugin.env=full, when known | when the session was created, ISO 8601 | the command | | `MCPX_SESSION_AGE_MS` | the opencode plugin | plugin.env=full, when known | the session's age when the command started, in milliseconds | the command | | `MCPX_SUPERVISOR_OWNER_PID` | the client pool, arming the supervisor owner watch | a test suite arms the watch via EnableSupervisorOwnerWatch (internal/testsupport); production daemons never set it | the PID of the process a supervisor belongs to; when that process dies, the supervisor terminates its child and exits instead of leaking (#10774) | `mcpx` run inside the script or shell, which arms the supervisors it spawns (internal/mcpclient owner watch) | --- # Examples Four scripts you can run as they are. Each one calls the same deterministic fixture server, prints something short, and has its output checked into [`examples/`](https://github.com/developing-today/code/blob/main/pkgs/mcpx/examples) beside it. `go test ./examples/` runs every script and compares stdout with that file, so an example that stops being true fails the build instead of sitting here looking plausible. They are deliberately small. `tools` is on `globalThis`, so none of them imports anything, and the first one is barely longer than the command that runs it. Run them from `pkgs/mcpx`. The first run writes `mcpx-client.ts` and its declarations beside the script, which is how `mcpx run` works for any file; the `.gitignore` in that directory keeps them out of git. ## Set up the demo server first Every script calls the `demo` namespace, which is not a public server: it is the deterministic fixture in `internal/testsupport/fakemcp`, and outside the test harness nothing configures it for you. From a clean checkout, build the fixture and `mcpx` itself, then give `mcpx` a config that maps `demo` to the fixture — the same arrangement `examples/examples_test.go` builds for itself: ```sh cd pkgs/mcpx go build -o /tmp/mcpx-bin/mcpx ./cmd/mcpx go build -o /tmp/mcpx-bin/fakemcp ./internal/testsupport/fakemcp cat > /tmp/mcpx-bin/demo.json <<'JSON' { "mcpServers": { "demo": { "command": "/tmp/mcpx-bin/fakemcp" } } } JSON export MCPX_CONFIG=/tmp/mcpx-bin/demo.json export PATH="/tmp/mcpx-bin:$PATH" ``` `MCPX_CONFIG` is how the `mcpx run` commands below pick that config up. With it set, the first example prints exactly what the page shows; without it, the same command fails, because no server answers to `demo`. ## Call one tool The whole shape: top-level `await`, one argument object, print the result. `demo.echo` answers with a text block, which arrives as a string. ```ts // Call one tool and print what it returns. // // Nothing is imported: `tools` is already on globalThis. const echoed = await tools.demo.echo({ message: "hello from a script" }); console.log("demo.echo:", String(echoed)); ``` mcpx run examples/call-a-tool.ts ``` demo.echo: hello from a script ``` ## Find a tool from inside the script `search()` and `describe()` read the generated client, so looking something up costs no round trip to the server. This one lists the namespace, reads one tool's signature, then calls two tools — one returning text, one returning `structuredContent`, which arrives already parsed. ```ts // Find out what a namespace offers from inside the script, then call two of // the tools it lists. // // `search()` and `describe()` read the generated client, so they cost no // round trip to the server. console.log("tools:", Object.keys(tools.demo).join(", ")); console.log(describe("demo.echo").trim()); const echoed = await tools.demo.echo({ message: "two tools" }); const structured = await tools.demo.structured(); console.log("echo:", String(echoed)); console.log("structured:", JSON.stringify(structured)); ``` mcpx run examples/discover.ts ``` tools: boom, chatty, echo, fancy_name, open, slow, state, structured, wipe demo.echo({ message }) Echo a message back. echo: two tools structured: {"n":42} ``` ## State that survives between calls `open` records a value in the server process and `state` reads it back. The daemon keeps one process for the session, so a later call sees what an earlier one did — no local variable involved. The script prints only whether its own two values are there, because the full list also holds whatever an earlier run recorded. `log()` is on `globalThis` too, and writes to the durable log on stderr. The expected output below is stdout, which is what the test compares. ```ts // `open` records a value in the server process and `state` reads it back, so // a later call in the same script can see what an earlier one did. // // log() writes to the durable log on stderr; console.log is the script's // stdout, which is what the expected output below holds. log("recording two values"); console.log(String(await tools.demo.open({ value: "alpha" }))); console.log(String(await tools.demo.open({ value: "beta" }))); const state = await tools.demo.state(); console.log("alpha recorded:", state.seen.includes("alpha")); console.log("beta recorded:", state.seen.includes("beta")); ``` mcpx run examples/stateful.ts ``` opened alpha opened beta alpha recorded: true beta recorded: true ``` ## A recipe with parameters The header declares the holes and the body uses `@name`, which is the whole recipe convention. `mcpx run` refuses a file like this — it cannot fill the holes — so it is saved and run with values instead. `times` has a default and is not passed here. ```ts // Echo a message a few times through the demo server. // // The header declares the holes; `mcpx recipes run` fills them. A plain // `mcpx run` refuses this file, because @message would reach the runtime // unfilled. // // @param message:string what to echo // @param times:number = 2 how many times for (let i = 0; i < @times; i++) { console.log(String(await tools.demo.echo({ message: @message }))); } ``` mcpx recipes save recipe-echo examples/recipe-echo.ts mcpx recipes run recipe-echo message="piped through a recipe" The `mcpx: recipe recipe-echo` line goes to stderr; the two echoed lines are stdout: ``` piped through a recipe piped through a recipe ``` --- Every one of these is executed by `go test ./...` on each change, against the same fixture server, so the output above is what the scripts print today rather than what they printed when the page was written. For why the fixture is a fake and not a real server, see [the FAQ](faq.html.md#examples). --- # exec and artifacts > A script produced a screenshot. Who gets it, and what does it cost them? --- ## The thing that was wrong `mcpx exec` ran the script in the CLI process. The CLI generated the client, spawned deno, and the script called back into the daemon over its socket. That is the right arrangement for a person at a terminal — the script owns stdout, reads real standard input, and a relative path in it means what it means on the command line. It is the only arrangement, and that was the problem. Two callers could not use it at all: - The **opencode plugin** holds a unix socket and nothing else. It has no mcpx binary to spawn. It could list tools, call one, read the log — and could not run a script, which is the thing mcpx exists for. - A **daemon on another machine** could not be asked to run one. The servers are over there; the script ran over here and reached across the network for every single call. So `POST /v1/exec`: the daemon runs the script. The generated client it writes points at the daemon's own socket, so the calls that used to cross a network now cross a socket, and a caller with no binary has one request to make. The refactor that made that safe is `internal/execsvc`. Two implementations of "run a script" would be two sets of bugs and a script that behaves differently depending on who asked — which is exactly what this whole feature is trying to stop. There is one. ### Why the CLI still builds its own runner options `execsvc.Run` is the wire entry point: everything arrives as `ExecOptions` and nothing is inherited from a terminal that is not there. `execsvc.RunWith` takes runner options the caller assembled. The CLI uses it, because `mcpx run` genuinely has more knobs than `/v1/exec` does — launcher templates, five injection phases, `--keep`, a typecheck mode, placeholder files — and flattening all of that into the wire type would make the wire type a mirror of one command's flag list. What must not be duplicated is everything _after_ the process starts: which frames are produced, how artifacts are reconciled, when media is intercepted, how delivery is applied. That is all in `RunWith`, and it is the same code for both. Hooks the caller already set are chained rather than replaced, so the CLI keeps rendering logs to a terminal while the service collects the same records for the result. ## Where a script runs `exec.where` is `auto`, `local` or `remote`, spelled `--local` and `--remote` at the command line. Auto runs locally when the daemon is on this machine and on the daemon when it is not. That is the rule that makes the common case right without anyone choosing: a person gets a terminal-shaped run, and a configured remote endpoint gets a remote one, because running locally against a remote daemon means every call crosses the network and every file the script writes lands on the wrong side. `--local` against a remote endpoint is **refused** rather than attempted. It does work, in the sense that the script runs and the calls succeed; it just quietly produces a different artifact story, and saying so beats a subtly different result. A remote run sends the script's _text_, not its path. A path would mean the daemon's filesystem, and somebody typing `mcpx run ./report.ts --remote` means the file in front of them. The consequence is that relative imports do not survive the trip: the daemon writes the text to its own disk, and a sibling module is not beside it. `--export` does survive, because the launcher imports the written file and calls the named export there. That is the default, not the only form. `--remote-file` sends the script's _name_ instead — the `file:` form of the request — and the daemon resolves it on its own script search path. Resolution is one rule for every surface (#2168): the shared `internal/scriptresolve` package searches the same directories the CLI searches (`.config/mcpx/scripts` then `.mcpx/scripts`, from the working directory up, then the user directory, with the `paths.scripts` setting spliced at its `null`), tries the same extensions (`.ts`, `.mts`, `.js`, `.mjs`), and a miss is an error naming every directory searched. So `POST /v1/exec {"file": "report"}` finds `report.ts` on the daemon's search path, and a caller with no mcpx binary can name a script the same way a person at a terminal does. `paths.scripts` is one setting shared by both sides — the daemon resolves it from its own configuration file and environment; there is no daemon-specific variant. On a daemon-resolved run `--export` works as it does locally, because the daemon's launcher imports the real file it resolved. Every flag that shapes the program travels with it: `--env`, `--typecheck`, `--launcher`/`--no-launcher`, `--allow-repeat`, `--no-capture-console`, `--export`, and the five phases (`--before`, `--prefix`, `--suffix`, `--on-success`, `--on-error`). The CLI resolves them -- reading any file a phase or launcher names on _its_ side -- and sends source, so the daemon runs the program that would have run locally. Until #192 the remote path sent five of these and silently dropped the rest; `TestEveryExecFlagChangesSomething` now runs every row both ways. ## ExecOptions One flat object that grows, rather than a new endpoint per capability. This is step 7 of the issue and it is the right shape: the caller declares what it can receive, the script declares what it produced, mcpx handles delivery. ```ts type ExecOptions = { runtime?: "auto" | "deno" | "bun" | "node"; timeout?: string; permissions?: string; placeholders?: Record; session?: string; cwd?: string; env?: Record; stdin?: string; output?: "text" | "structured" | "stream"; capabilities?: string[]; artifacts?: { delivery?: "reference" | "inline" | "stream"; maxBytes?: number; sharedFs?: string; dir?: string; }; task?: { ttl: number }; ns?: string[]; args?: string[]; export?: string; typecheck?: "off" | "types" | "strict" | "on"; // on is a legacy alias for types checkOnError?: "fail" | "warn" | "run"; checkOnUnsupported?: "skip" | "warn" | "switch"; // switch uses Deno only as the checker launcher?: string; launcherName?: string; // template text, or "none" allowRepeat?: string[]; captureConsole?: boolean; phases?: { before?: string[]; prefix?: string[]; onSuccess?: string[]; onError?: string[]; suffix?: string[] }; }; ``` `cwd`, `env` and `stdin` are the **caller's** context, not the daemon's. A remote daemon has a different working directory and a different environment, and a script that reads either should see the one belonging to whoever asked. A local caller passes its own, which is how the two cases stay identical. Three fields are not in the issue's list. `ns` and `args` are there because `mcpx exec --ns` and `mcpx run script a b` already exist, and an option the CLI has and `/v1` does not is a parity hole — the one thing this repository checks for automatically. `dir` sits beside `sharedFs` because they are different statements: `sharedFs` is "I can see your disk", `dir` is "put them here for me". They happen to be implemented the same way when the caller is local, and they are not the same claim. `task` reuses `internal/tasks` unchanged. A long exec with artifacts is a task whose result holds references, which already fits `tasks/result`. Its 128-bit ID is an unguessable bearer handle, not an ownership check: anyone who can reach the daemon API and learns the ID can retrieve the result from `/v1/tasks/{id}`. The `/v1` list addresses the daemon-wide task store; it is separate from MCP's connection-scoped legacy `tasks/list`. ## Output shapes Three renderings of one run. - **text** — the CLI default. stdout is the script's answer and a person reading it wants it unadorned. It goes to the terminal _as it is produced_, not collected and printed at the end; a long run that printed as it went must keep doing so. - **structured** — the `/v1` and MCP default. One document: `{result, emits[], logs[], stdout, artifacts[], exitCode, durationMs, error?, errorKind?}`. A caller over HTTP wants fields, not text it has to scrape. `errorKind` is the failure's typed kind (CODE-30), present exactly when `error` is: `timeout` (the run exceeded its bound), `not_started` (a missing runtime, an unreadable launcher, a type error found before execution), or `execution` (the script started and failed — it threw, exited non-zero, or the runner reported the failure). The message and exit details are unchanged; the kind is what a caller branches on. - **stream** — frames as they happen. SSE by default because it is plain HTTP and a browser consumes it with no code; NDJSON on `Accept: application/x-ndjson`, because a program with a JSON decoder should not have to strip `data: ` off every line first. `result` is the value of the snippet's final top-level expression when it has one (CODE-19): a snippet that ends in an expression statement reports that expression's value, REPL-style, with stdout and `emit()` values still carried separately under their own names. When the final expression is `undefined` -- a print-style snippet ending in `console.log(...)` -- or the source declares a default export instead, the older rule decides: the script's stdout parsed when stdout is JSON. That rule is inherited from `mcpx --json run` rather than invented, so the two agree. ### The frame order, and why it is the order ``` start{runId} hook{phase:"before",...} (one per before hook, in declaration order) log | emit | stdout | call{server,tool,argsHash,durationMs,ok,error?,destructiveHint?} (interleaved, as they happen) artifact{id,name,mime,size,sha256,uri} hook{phase:"onSuccess"|"onError",...} result | error hook{phase:"suffix",...} (one per suffix hook, either path) end{exitCode,durationMs} ---- only for delivery:"stream" ---- artifact.chunk{id,seq,data} artifact.end{id} ``` A `call` frame records one tool call the script made while it ran: the server and tool, a hash of the arguments (never the arguments -- a stream is a thing other people read), how long the call took, whether it succeeded, and the tool's `destructiveHint` when its annotations declare one. Call frames appear on runs the daemon itself executes, whose call path can reach the run's stream; a run whose calls arrive at a daemon that is not executing it has no stream there to join. Hook frames sit where the hook ran, so the answer a consumer reads is the final one: an `onSuccess`/`onError` hook frame precedes the `result`/`error` frame it may have replaced (its frame carries the original when it changed the value), and a `suffix` hook frame follows the outcome, before `end`. A replaced error produces no `error` frame at all. A hook entry declares exactly one action. `script` is the deterministic action above. `prompt` is the model-backed one (#1929 Approach C, first slice): the entry's `prompt` text is sent to the configured model provider (`model.provider` and friends, resolved per request on the daemon, from the same settings for a local CLI run), with `effect` defaulting to `advise` — the only effect this slice implements; `ask`, `propose`, `apply` and `run` are refused at validation rather than silently downgraded. `@placeholders` in the prompt text — the built-ins `@result`, `@error`, `@diagnostic`, `@calls`, `@artifacts`, `@source`, plus the call's own placeholder values — are substituted JSON-encoded, as data, never as raw text. The provider's answer rides the hook frame as `advice`, with `model` and `provider` naming what answered; advice never transforms the result or the error, in any phase. When no provider is configured, or the provider errors, the frame instead carries `error: "advice unavailable: …"` and the run continues deterministically — a prompt hook can slow a run down by its timeout, but it cannot change or fail it. A per-hook `model` names the model to ask, in the provider/model namespace. Prompt hooks are declared in the same lists as script hooks — the config `hooks` entries and a call's `options.hooks` — and run in declaration order among them. Artifact **metadata** comes before `end`; artifact **bodies** come strictly after it. That is the whole point of the design, and it is step 5 of the issue: a streaming consumer reads the emits and the return value, decides it does not need the 4 MB video, and disconnects at a frame boundary having paid for none of it. A disconnect is not merely tolerated. The sink returning an error cancels the run context, which kills the process group; and every file the CLI writes from a stream goes to a temporary name and is renamed on `artifact.end`. A cancelled stream must not leave something that looks like a complete file, because the next thing to read that directory cannot tell the difference. ## Artifacts ### The script API is the same everywhere ```ts const shot = await chrome_devtools.take_screenshot({ format: "png" }); await artifact("checkout.png", shot); return { total }; ``` `data` may be a string, a `Uint8Array`, an `ArrayBuffer`, `{ path }`, an MCP `image`/`audio`/`resource` content item, or a tool result carrying one on `.raw`. Accepting the content item directly is what makes the common case one line: a screenshot _arrives_ as `{type:"image",data,mimeType}` and that is exactly what gets passed in. The script never asks where it is running. The issue's step 1 — `if (mcpx.session.isRemote)` — was rejected for that reason: an author who has to know about remoteness writes two code paths and one of them is never tested. What actually happens underneath differs, and only in a way nobody has to think about. `artifact()` POSTs to `/v1/artifacts` over the transport the generated client already has. When the runner set `MCPX_ARTIFACTS_LOCAL=1` — which it does when a unix socket proves the daemon shares this filesystem — a `{path}` is sent as a header and the daemon reads, hashes, and copies the file into the store. Otherwise the bytes travel once to the daemon and are then fetched by whoever wants them. Remoteness is declared, never inferred. A unix socket can be ssh-forwarded and loopback TCP can be a container with its own filesystem; neither transport tells you whether the caller can see the daemon's disk. So the _caller_ says so, with `capabilities: ["artifacts"]` and optionally `sharedFs`. An `ssh://` endpoint is the clearest case of `sharedFs: false`: the bytes cross a process boundary on another machine, so the caller uploads a `{path}` artifact's bytes rather than giving the daemon a path it can read. ### The store Content-addressed by sha256 under `/artifacts/blobs/ab/cdef...`, with a SQLite index beside it. SQLite because it is already a dependency and because "list the artifacts of this run" is a query rather than a directory walk. The **handle is not the hash**. A content hash is guessable by anyone who can guess the content — and for a screenshot of a public page, that is everyone. So an artifact is served by a separate random 128-bit id mapped to the hash. That id is the entire access control until OAuth privilege levels land, which is why it is sized as a secret rather than as an identifier. When scopes arrive, the natural shape is that the session that produced an artifact owns it and a privileged scope can read any of them; the index already carries the session for exactly that. Two registrations of the same bytes share one blob and get two handles. The quota counts distinct content, so a script that produces the same screenshot twice pays once. Deleting a registration only removes the body when no other registration refers to it. Everything is written to a temporary name and renamed on completion — in the store, in `--artifacts-dir`, and in the stream consumer. A cancelled upload leaves nothing a later reader could mistake for a whole file. ### Names are untrusted The name comes from the script, and a script is not trusted with a path. `SanitizeName` takes the last component (so `../../etc/passwd` is `passwd`), keeps `[A-Za-z0-9.-_+]`, turns spaces into hyphens and everything else into underscores, strips leading and trailing dots, and truncates to `artifacts.nameMaxLength` while keeping the extension. An empty result becomes `artifact`, because a file has to be called something. Removal rather than rejection: a caller whose artifact is refused over its name has lost the file, and the name is decoration — the artifact is reached by id. Collisions get a numeric suffix **before** the extension — `shot-1.png`, not `shot.png-1` — so the file still opens in whatever the extension implies. Nothing is ever overwritten: two files called `shot.png` are two files, and silently keeping one of them is data loss. The reservation uses `O_CREAT|O_EXCL`, because testing with `Stat` and then creating is a race two concurrent runs of the same script would lose. ### Delivery | mode | what crosses | when | | --------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `reference` (default) | an id and a URI | always correct; the only mode whose cost does not scale with what the script happened to produce | | `inline` | base64 in the structured result, bounded by `artifacts.inlineMaxBytes` **and** the caller's `maxBytes` | a caller that cannot make a second request | | `stream` | frames after `end` | one response, cancellable | A `sharedFs` or `dir` lets the caller read the destination directly, but the store still copies the bytes into that directory; this saves a later transfer, not filesystem I/O. Reference is the default because of the round-trip arithmetic. Over a unix socket a second request costs about 0.2 ms, so separate GETs are free locally and bring Range and parallel downloads with them. Remotely a single stream is better, which is why `stream` exists — and artifacts remain fetchable by id afterwards either way, so choosing the stream costs nothing. `inline`'s ceiling is deliberately well under the per-artifact ceiling. Inline delivery puts bytes in the caller's context, which is the cost this whole feature exists to avoid. ### Intercepting upstream media When a structured or streamed result — or an emit — contains an MCP `image`, `audio` or blob `resource` block, **and** the caller declared `artifacts`, the block is stored and replaced by a `resource_link` carrying the URI, the name, the type and the size. This is the local win, and it is worth having with no remote daemon anywhere. chrome-devtools returns a screenshot as base64 image content; left alone that lands in an agent's context, where one screenshot costs more than the rest of the task and where nobody will ever look at it. It happens at the **output boundary**, not inside the script. A script that received a handle instead of the bytes could not inspect the image it just took — measure it, crop it, compare two — which is a real thing scripts do. So the script sees whatever the upstream server sent, and only what crosses back to the caller is rewritten. `artifacts.interceptImages` turns it off. ## Reaching an artifact | surface | how | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | MCP | `resource_link` in the `mcpx_exec` result, then `resources/read` on `mcpx://artifacts/{id}`; also `resources/list` and a resource template | | `/v1` | `GET /v1/artifacts/{id}` with Range, `GET /v1/artifacts?run=…`, `DELETE /v1/artifacts/{id}` | | CLI | `mcpx exec --artifacts-dir ./out` | `GET /v1/artifacts/{id}` goes through `http.ServeContent`, which brings Range, conditional requests and 206 for free — and Range is what makes reading the tail of a large artifact cheap, one of the three things printing the file could not do. `Content-Disposition` is `attachment` with the sanitised name, because a browser deciding to render somebody else's bytes inline is how a store of arbitrary files becomes an XSS surface. `resources/read` carries text, so a binary body comes back base64 with its real type stated. That is lossy in exactly one way — the client decodes — and it is what the protocol offers. A client that wants raw bytes has the `/v1` route. ### One edit outside this area `mcpserver.dispatch` returns a `string`, which cannot carry a `resource_link`. Threading a content array through a dozen cases to serve one of them would make eleven signatures worse to serve the twelfth. So `mcpx_exec` encodes its blocks into the string it already returns (`mcpserver.EncodeResult`), and `tools/call` decodes it in exactly one place. `EncodeResult` returns the text unchanged when there are no blocks, so every other tool is byte-for-byte what it was. ## Settings Everything is declared in `internal/settings/exec.go`. It is **not** declared _once_: unlike `internal/settings/consumer.go` and `internal/settings/wire.go`, which read `defaults.*`, every `Default:` in `exec.go` is an inline string literal (`"120s"`, `"64MiB"`, `"10m"`, …), so each value that also lives in `defaults.json` is written in two places with nothing holding them equal. Three of them — `exec.where`, `artifacts.enabled` and `artifacts.dir` — have no `defaults.json` key at all. The values below are what both say today. | setting | default | what it decides | | --------------------------- | ----------- | -------------------------------------------------- | | `exec.timeout` | `120s` | how long a script may run, wherever it runs | | `exec.output` | `text` | text, structured or stream | | `exec.where` | `auto` | local, remote, or decided by whether the daemon is | | `artifacts.enabled` | `true` | whether the store exists at all | | `artifacts.dir` | — | `--artifacts-dir` | | `artifacts.delivery` | `reference` | reference, inline or stream | | `artifacts.ttl` | `24h` | retention before collection | | `artifacts.maxBytes` | `64MiB` | the largest single artifact | | `artifacts.quota` | `1GiB` | the total, over distinct content | | `artifacts.inlineMaxBytes` | `1MiB` | the largest that may be base64'd into a result | | `artifacts.chunkBytes` | `256KiB` | one streamed body frame | | `artifacts.gcInterval` | `10m` | how often expired artifacts are swept | | `artifacts.interceptImages` | `true` | rewrite inline media at the boundary | Exceeding `maxBytes` is an error, not a truncation. A truncated screenshot is worse than a refused one, because it looks like it worked. `nameMaxLength`, `nameCollisionLimit`, `idBytes` and `listLimit` live in `defaults.json` without a registry entry: they are read at package initialisation and a configuration file arriving later could not change them, and a setting that does nothing is worse than no setting. (This paragraph used to offer `plumbing.eventHistory` as the comparison. That one _is_ a setting — `events.history`, `internal/settings/wire.go:239`, flag `--events-history` — so it was the wrong example.) ## Not done - **The other direction.** An inbox — uploading a file a script needs as input, with a script-side `input("name")` — is out of scope for this cut. Nothing here prevents it: `POST /v1/artifacts` already stores by content and the index already carries a session. - **OAuth scoping.** Artifacts are served by an unguessable id on an unauthenticated API, which is the same access control every other `/v1` route has. The index carries the session so a scope check has something to check. - **`multipart/mixed`.** The issue offers it as an alternative to base64 in the stream. NDJSON and SSE carry chunks base64'd, which costs 33% on the wire. Worth revisiting; not worth a second framing before the first one has a user. - **Relative imports on a remote run.** They need sibling modules on the runtime's disk, and a remote run sends one file's text. --- # FAQ > The five questions a skeptical first-time reader asks first, in the order > they ask them, answered in the same voice. --- Short answers here; the long ones live in the pages each answer links to. Every question keeps the wording it was written in. ## "so why'd you get rid of all the mcp and then make one, do you like mcp or not" We like MCP fine. What we got rid of is tool schemas sitting in the model's context, not MCP itself: mcpx is an MCP client of every server you configure, across four protocol revisions, reading the same `mcpServers` config every other host reads, and "mcpx puts every MCP server behind one command so their schemas stay out of the model's context until something asks for them". The server we made is deliberately tiny. "Exposing three hundred tools over MCP would rebuild the problem mcpx was built to solve, with extra steps", so it is `/mcp` on the daemon, `mcpx serve --transport stdio`, and `mcpx_exec` as the one tool that matters. More: [the story](story.html.md). ## "i mean, opencodemode is right there" It is, and not only in v2. opencode v1 ships code mode behind `OPENCODE_EXPERIMENTAL_CODE_MODE`, v2 has it on by default, and both accept TypeScript. Its version is better confined: a purpose-built interpreter that runs only the language features upstream implemented, plus OAuth and elicitation for remote servers. What it does not do is what mcpx is for. It only runs inside a model turn — there is no `opencode2 exec` — one daemon here serves every harness with a real process per session for stateful servers, and our scripts run on a real runtime with imports and a filesystem. Our own recommendation still stands: let code mode own ordinary MCP inside opencode's loop, and use mcpx for stateful servers and everything outside a turn. More: [the opencode plugin](opencode-plugin.html.md). ## "is it safe?", no. No. Scripts run on a real runtime with your authority — filesystem, network, subprocesses. `script.permissions` defaults to `all`. What a narrower profile does depends on the runtime, and the defaults say so exactly (`internal/defaults/defaults.json`): on Deno the profiles become Deno permission flags, and on node `readnet` / `read-net` are enforced with `--permission --allow-fs-read=*`. `net`, `read`, and `strict` are defined for Deno only. Ask for a named profile that has no entry for the runtime you chose and mcpx refuses to run the script at all — "permission profile %q defines no flags for %s, so %s cannot enforce it" (`internal/runner/runtimes.go`) — it never runs the script unenforced and pretends otherwise. Bun has no permission model, so no narrower profile is defined for it and every narrower ask there is refused the same way. The profiles that are defined for bun and node — `all`, `none`, `off`, `unsandboxed` — carry an empty flag list by design: defined, and deliberately unrestricted, not enforcement. The daemon API is unauthenticated. It listens on loopback and on a socket only you can open, and binding it wider prints a warning. `mcpx prompt` hands you a generated script instead of running it, because generated code runs with your credentials. So treat a script like a shell command you are about to paste: configure only servers you would run by hand, and do not expose the port. That is the whole answer. More: [the script contract](https://github.com/developing-today/code/blob/main/pkgs/mcpx/AGENTS.md). ## "but why would you.." Three reasons, then the history. Context cost: tool schemas sit in every request whether or not the tools get used, so mcpx's always-on cost is zero — "there are 27 Chrome tools live on this machine and not one byte of their schemas is in the agent's context". Concurrency: two agents sharing one browser corrupt each other, so each session gets its own process. Reach: the same tools from a shell, CI or any harness. The history is that this replaced lootbox, a fork 51 commits ahead of a quiet upstream, where discovery was uncached (about 650 ms per request) and the architecture "cannot express the one thing you actually need (more than one Chrome)". More: [the assessment](https://github.com/developing-today/code/blob/main/pkgs/mcpx/ASSESSMENT.md). ## "but can i get some examples?" Yes. `examples/` holds short scripts that CI runs on every change, against a deterministic fixture server, paired with the output they print today — so an example cannot quietly rot, and one of them is a real recipe (`mcpx recipes`). The gallery page pairs each script with its command and its expected output; copy one, change the server name, run it. They are deliberately small, and none of them needs Chrome or the network. If one is wrong, that is a bug worth reporting, because the only reason these are trustworthy is that they fail the build when they stop being true. More: [the examples gallery](examples.html.md). --- # Finding the repository without git How the `repo` and `worktree` scopes decide which repository a caller is in, why that no longer runs git, and what was decided for every layout git understands. ``` created: 2026-09-30T07:30:00-05:00 last-updated: 2026-09-30T07:30:00-05:00 status: implemented ``` Status: implemented This is the decision record for the change. `docs/container.md` §3 is the short version; it lives here rather than under `docs/decisions/` because that directory belongs to another area. --- ## 1. Two questions A server scoped `repo` gets one process per clone -- every linked worktree of one repository shares it. A server scoped `worktree` gets one per checkout. The keys are the answers to two questions git already has commands for: | scope | key | git's command | | --- | --- | --- | | `repo` | the common git directory | `git rev-parse --git-common-dir` | | `worktree` | the top of the checkout | `git rev-parse --show-toplevel` | Until this change mcpx asked exactly those, by forking git twice per directory and caching both answers -- negative ones included -- for the daemon's lifetime. That had four costs, three of which were only found by testing the replacement: 1. **105 MB of the container image.** Debian's git depends on perl outright. 2. **It did not work in the container anyway.** A checkout mounted into the image is owned by the host's uid, the image runs as uid 1000, and git refuses a repository someone else owns (`safe.directory`). Every mounted checkout, measured: `fatal: detected dubious ownership in repository at '/work/proj'`. The old image shipped git so that these scopes would work, and in the ordinary way of using it they fell back to per-directory keys. 3. **The daemon's environment leaked into every caller's key.** An autostarted daemon inherits the environment of whoever ran mcpx first. A git hook exports `GIT_DIR`; a hook that runs mcpx leaves a daemon carrying it for hours. With `GIT_DIR` absolute, every later caller -- from any directory -- was keyed to that one repository. With `GIT_DIR=.git`, as hooks set it, every caller outside a repository root degraded. Both are pinned by `TestTheDaemonsOwnGitDirDoesNotPinEveryCaller`, which fails against the old code. 4. **The cache made the first answer permanent.** A directory that became a repository after the first call there stayed "not a repository" until the daemon exited. ## 2. How it works now Finding a repository is a walk up the directory tree reading a handful of small files. Git's rules for that walk are fixed, and they are in its source: `setup.c` (`setup_git_directory_gently_1`, `read_gitfile_gently`, `is_git_directory`, `check_repository_format_gently`, the three `setup_*_git_dir` functions) and the config parser in `config.c`. `internal/config/gitdiscover.go` and `gitformat.go` are a port of those, from git v2.55.0, function by function and named after the originals so the two can be read side by side. At each directory, starting from the caller's cwd with every symlink resolved (git starts from `getcwd()`, which has already resolved them): 1. `.git` -- a directory that is a repository, or a file naming one; 2. the directory itself, as a bare repository; 3. the parent, unless a ceiling or a filesystem boundary says stop. Once found, the common directory comes from the `commondir` file if there is one, and the worktree from where `.git` was found -- unless the repository's `config` says otherwise through `core.bare` or `core.worktree`. Native discovery reads `HEAD`, `commondir`, a `.git` file, and from `config` three keys -- `core.repositoryformatversion`, `core.bare`, `core.worktree` -- plus whatever `extensions.*` holds, since an unknown extension is what makes a repository unreadable. When `extensions.worktreeConfig` is on it reads the worktree's `config.worktree` as well. It tests `objects/` and `refs/` for existence without reading them, which is the rest of what `is_git_directory` decides on. Nothing else, and it executes nothing. Every outcome is one of four: | outcome | meaning | what the scope does | | --- | --- | --- | | found | the same answer git gives | keys by it | | not a repository | git would say so too | keys by directory | | broken | something on disk git dies on -- a `.git` file naming nothing | keys by directory; `doctor` warns, with the fix | | unsure | a layout this port will not vouch for | asks git | **Git is the fallback only for "unsure".** It is asked once, as `git rev-parse --path-format=absolute --git-common-dir --show-toplevel`: the first answer is printed before the second fails, so a bare repository still yields its common directory from one process. It runs with git's own list of repository-local variables removed (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY` and eleven more -- `git rev-parse --local-env-vars`), so it answers the question native discovery answers. With no git on `PATH`, "unsure" keys by directory, and the reason says what could not be read and that git is not there to ask. **Nothing is cached.** One resolution five directories deep costs 0.073–0.081 ms (`BenchmarkDiscoverGit`, `-benchtime 300x -count=5`, M3 Pro / macOS / APFS); forking `git rev-parse --show-toplevel` from the same place costs 9.7 ms on the same machine, so the native answer is about 125× cheaper. A cache would save under a tenth of a millisecond per call and bring back the stale answers of §1.4. `mcpx doctor` reports what the two scopes resolve to from the current directory and what resolved them. A missing git is not a warning; it becomes one only when a repository here needs it. ## 3. Every case, and what was decided "Parity" means the case is built with the real git and native's answer is compared with `git rev-parse` for both questions. Test names are in `internal/config/gitdiscover_test.go` unless marked e2e. ### Checkouts | case | decision | test | | --- | --- | --- | | main clone, from its root or any depth below | same as git | parity: `main clone` | | linked worktree, git's relative `commondir` (`../..`) | same as git: `.git` file → private dir → `commondir` → common dir | parity: `linked worktree with git's relative commondir` | | linked worktree, absolute `commondir` | same | parity | | linked worktree with relative paths (`worktree.useRelativePaths`, git 2.48; sets `extensions.relativeWorktrees` and format 1) | same; the extension is one native knows | parity | | linked worktree moved by hand | same as git: still resolves, from its new place; the stale back-pointer is not consulted | parity | | main clone moved: its worktrees' `.git` files name nothing | same as git: an error, not a fallback. `doctor` warns and names `git worktree repair` | parity; `TestWithoutGitABrokenGitfileIsAWarning` | | **submodule** | **its own repository**, as git says: common dir `.git/modules/`, top the submodule's directory. A submodule has its own HEAD, objects and history; a server scoped to "the repository" that saw the superproject's instead would be looking at the wrong code | parity: `submodule is its own repository` (built from a local path, no network) | | nested repositories | innermost wins, as in git | parity | | `--separate-git-dir`, a relative `.git` file, CRLF endings | same | parity | | `.git` file path through a symlink and `..` | resolved by the kernel, not lexically, as git's `chdir` does | parity | | `.git` is a symlink to a git directory elsewhere | same: the symlink's target | parity | | symlinked checkout; `/tmp` vs `/private/tmp` | the physical path, as git; both spellings key alike | parity; `TestGitParityTmpAndPrivateTmp` | | a directory that is both a bare repository and holds a `.git` | `.git` wins, as in git's order | parity | ### Git directories | case | decision | test | | --- | --- | --- | | bare repository, from itself or inside it | common dir yes, worktree no -- `worktree` keys by directory | parity | | inside `.git`, or a worktree's private dir | same: a git directory, no worktree | parity | | worktree of a bare clone | has a worktree: a linked worktree ignores the common `core.bare` | parity | | bare clone with `extensions.worktreeConfig` | its worktrees become bare, as in git -- git's documented trap, reproduced rather than corrected | parity | | `HEAD` as a symlink into `refs/`, detached SHA-1, detached SHA-256 | valid | parity | | reftable repository | same | parity | | stray `.git` directory that is not a repository | skipped; discovery continues upward | parity | | nested repository whose `HEAD` is almost valid (40 non-hex characters, a symlink out of `refs/`, `ref:` outside `refs/`), or has no `objects/` | skipped, as git validates it | parity | ### `.git` files and entries git refuses Git stops at these rather than skipping them, so mcpx does too -- skipping would find the enclosing repository and share its instance. Every one is built inside a real repository so that skipping would be caught. | case | test | | --- | --- | | garbage; `gitdir:` without the space; no path; a path that does not exist; a path that is not a repository; trailing spaces (part of the path, as in git) | parity: `broken .git file: …` | | a `.git` file over git's 1 MiB ceiling (`git.gitfileMaxBytes`) | parity | | a `.git` that is neither file nor directory (fifo) | parity against git ≥ 2.54, which made this fatal; older git skipped it, and mcpx follows current git | | an empty `commondir` | parity | | a directory discovery cannot look inside | `a directory discovery cannot look inside` (git cannot `chdir` there at all) | | cwd that does not exist, or is a file | `cwd that does not exist, and cwd that is a file` | ### The repository's config | case | decision | test | | --- | --- | --- | | `core.worktree` absolute, relative (to the git dir, not the common dir), or with only its last component missing | same as git | parity | | `core.worktree` git cannot enter | git dies before printing either answer, so both scopes fall back | parity | | `core.bare`; `core.bare` with `core.worktree` | no worktree (git warns that the pair makes no sense) | parity | | per-worktree `config.worktree` with `worktreeConfig` | read, as git reads it | parity | | no `config`; a `config` without `repositoryformatversion` | as git: everything else in it is discarded, so `core.bare = true` there means nothing | parity | | `[include]` setting `core.worktree` | ignored, as git ignores it here: the repository format is read without includes | parity | | upper-case names, `[core "x"]`, `[foo "core"]`, `[core.x]`, quoting, comments, continuation lines, a BOM, CRLF, bare keys, numeric booleans | parsed as git parses them | parity; `TestGitConfigParserAgainstGitsOwn` compares values with `git config --file` | | an unknown extension in a version-0 repository | ignored, as git does | parity | | format version > 1; an unknown extension in version 1; a version-1 extension in version 0; a syntax error; a value git refuses (`bare = maybe`, `objectformat = md5`, a bare `worktree` key); a value git takes that this port does not parse (`bare = 1k`) | **unsure → git.** The git on the machine may be newer than this port | parity, marked unsure | ### Environment | variable | decision | test | | --- | --- | --- | | `GIT_DIR`, `GIT_WORK_TREE`, `GIT_COMMON_DIR`, `GIT_OBJECT_DIRECTORY` and the rest of git's local list | **Not honoured**, and removed from the fallback's environment. The key is computed in the daemon, for many callers, and the daemon's environment belongs to whoever started it -- honouring it is §1.3. The *caller's* variables never reach the daemon (`CallContext` carries the cwd, not the environment), and they do not need to: everywhere git itself sets `GIT_DIR` -- hooks, aliases, `submodule foreach` -- it also puts the cwd inside that repository, so discovery from the cwd reaches the same answer | `TestGitEnvironmentThatNamesARepositoryIsIgnored`; `TestGitLocalEnvCoversWhatGitCallsLocal` checks the list against the installed git; e2e `TestTheDaemonsOwnGitDirDoesNotPinEveryCaller` | | `GIT_CEILING_DIRECTORIES` | **Honoured**, with git's exact rules: relative entries ignored, entries symlink-resolved unless they follow an empty entry, a ceiling never examined from below it but honoured-as-absent when the walk starts there. It can only make keys narrower, and it lives in shell profiles, so a user who set it expects mcpx to agree with their shell | parity: `TestGitParityCeilingDirectories`, eight cases | | `GIT_DISCOVERY_ACROSS_FILESYSTEM`, and mount points | **Honoured**: discovery stops where the device changes, as git's does. A value that is not a boolean is unsure | `TestDiscoveryStopsAtAFilesystemBoundary` (a boundary cannot be mounted without privileges, so the device lookup is substituted); verified with a real tmpfs in the image, `docs/container.md` §3 | ### Deliberate differences from git | case | git | mcpx | why | test | | --- | --- | --- | --- | --- | | a repository owned by another user (`safe.directory`) | refuses | resolves | `safe.directory` stops git *running* configuration from a repository someone else controls. Native discovery runs nothing from it; it reads three small files and five keys. And the refusal is exactly what broke the container (§1.2). The fallback does not override git's check, so an unsure layout in a foreign repository still falls back, with git's reason | `TestGitOwnershipIsNotCheckedNatively` | | an implicit bare repository under `safe.bareRepository=explicit` | refuses | resolves | the same reasoning: the setting protects against embedded bare repositories' configuration | `TestGitSafeBareRepositoryIsNotCheckedNatively` | | a cwd spelled in the wrong case on a case-insensitive volume | on-disk spelling | the spelling given | Getting the on-disk spelling needs `F_GETPATH`, reachable from Go only outside the `unsafe` rules; the `cwd` scope has always behaved this way; the error over-isolates. Belongs in `canonical()` for every scope: [#190](https://github.com/dezren39/nix/issues/190) | `TestGitCaseOfAWrongCaseCwdIsKept` asserts the difference is case and nothing else | | git older than 2.31 as the fallback | prints `--path-format=absolute` back | refuses its answer | the echoed option would otherwise be read as a path. Only reachable for unsure layouts | `TestGitFallbackRejectsAGitWithoutPathFormat` | Windows is not handled: drive letters, `\`, and `//server/share` ceilings are not ported, because mcpx does not build there (`internal/runner` uses `Setpgid` and `Kill`). ## 4. How it was tested **Parity.** 54 subtests in six `TestGitParity*` functions build repositories with the real git in a fenced temporary root -- `GIT_CEILING_DIRECTORIES` at its parent, a private global config, no system config, none of the local variables -- and compare native discovery with `git rev-parse` for both questions. A case that expects git to refuse first checks that it does, so a fixture that accidentally built a valid repository cannot pass as a refusal. They skip only when git is absent (the Nix sandbox) or older than a feature they need. With git 2.55 on macOS none skip; with Debian's git 2.39 on Linux (the `golang:*-bookworm` builder image, as a non-root user) 52 pass and the two needing 2.45 and 2.48 skip. That run found the one portability gap so far: git 2.39 counts `GIT_INTERNAL_SUPER_PREFIX` as repository-local and newer git does not, so the scrub list is the union. **Without git.** `TestScopesResolveWithoutGit` and three siblings clear `PATH` and build repositories by hand -- `HEAD`, `objects/`, `refs/`, and the two files `git worktree add` writes -- so they run in the Nix sandbox too. The e2e `TestRepoAndWorktreeScopesResolveWithNoGitInstalled` does the same through the real binary and a live daemon, with `call` and `exec`, and reads the keys from `mcpx status` and the answer from `mcpx doctor`. **Falsified.** Every test that asserts new behaviour was run against code without it: - The three e2e tests, against the unchanged `origin/main`: all fail, for the reasons they name (keys are `cwd:` without git; every caller keyed to `other/.git` under an absolute `GIT_DIR`; the shared instance gone after an exec). - The unit tests, by mutation: 44 single-line changes to the port -- the walk order, the ceiling arithmetic, each gitfile refusal, each HEAD rule, `has_common`, the config parser's quoting, trimming and subsections, the format checks, the environment scrub -- each run against the suite on the final code. 41 are killed, each by a named test. The three that survive cannot change behaviour: two treat relative `GIT_CEILING_DIRECTORIES` entries differently, but a relative entry can never be a prefix of the absolute path discovery walks; the third reads the fallback's second line even when git fails, and git prints no second line when it fails. Five mutations first written so that they did not compile were rewritten, since a compile error proves nothing about a test. The first runs found five gaps, now covered: the order of the `.git` and bare checks at one level, a section whose *subsection* is `core`, `HEAD` values that are almost valid, a `.git` that cannot be stat'd, and a `.git` file over the size ceiling. **In the image.** §3 of `docs/container.md`, "No git". ## 5. Found along the way - **A sessionless `mcpx exec` stopped every shared instance it touched.** `CallContext.CallerOwned` returned true for any key when the session was ephemeral, so the release at the end of a run stopped the `global`, `repo` and `worktree` instances too -- contradicting `ReleaseCaller`'s own comment. Fixed in `scope.go`: an ephemeral caller owns its session's key and its pid's key, nothing shared. `TestOnlyKeysTheCallerMintedAreCallerOwned`, e2e `TestASessionlessExecLeavesASharedInstanceRunning`. - **The degraded-scope log line says "per-call"** when the key is the directory: [#191](https://github.com/dezren39/nix/issues/191). Not fixed here; `internal/daemon/registry.go` is another area's. - **Debian bookworm's git (2.39) refuses a checkout made by a current git** that used `worktree.useRelativePaths`: `unknown repository extension found: relativeworktrees`. Native discovery reads it, so the image is now more capable than the git it used to ship. --- # Glossary The words this book uses in exactly one sense. Where a word is defined by a chapter, the entry points at it. **adapter** — a command-line program declared as an MCP tool: mcpx runs it as a namespace, from a declaration file named by `paths.adapters`. See [The CLI](cli.html.md) and [Configuration](configuration.html.md). **agent twin** — the `.html.md` markdown copy of a rendered page, emitted into the site by docs-twins so agents read the book as text. See [Deploying this book](deploying.html.md). **API server** — an HTTP service described by an OpenAPI document and exposed as tools, declared through `mcpx api`. The counterpart of an adapter, over a document instead of a program. **artifact** — a file a script produced, kept by the daemon under the `artifacts.*` settings and reachable through `mcpx artifact`. See [exec and artifacts](exec.html.md). **catalogue** — the daemon's list of every tool on every configured server; `mcpx catalog` prints it inside a token budget. **ceiling** — the most a caller may do: an autonomy level, a write policy, a rate. Ceilings are set by the daemon's side, never raised by a caller's request. **compendium** — this book's level 3: everything that is built, described in as much detail as wanted, with every document placed by the manifest in `compendium.manifest.json`. See [The compendium: structure and mapping](compendium.html.md). **daemon** — the long-lived mcpx process that owns every MCP server process on the machine. Clients (the CLI, plugins, other programs) talk to it over the `/v1` API; they never spawn servers themselves. **effect probe** — a named end-to-end test proving that a setting changes behaviour. Every setting has one, or a written exemption. See [Configuration](configuration.html.md). **elicitation** — a server asking the user a question in the middle of a call. mcpx brokers the question; `mcpx elicit` answers it, and a call that stopped to ask exits 75 (`EX_TEMPFAIL`) rather than failing. See [Elicitation: a design](elicitation.html.md). **era** — one revision of the MCP protocol, as a set of expectations a peer may hold. mcpx speaks every era in both directions. See [Protocol: every revision, both directions](protocol.html.md). **exemption** — a setting with no effect probe, carrying a written reason instead. The count is pinned (`EffectExemptionPin`) and can only shrink, and only in the change that adds the replacing probe. **inline start** — when no daemon is running, the CLI starts one itself and polls for readiness (the poll interval is `daemon.inlineStartPoll`) instead of failing. **namespace** — the name a server's tools are grouped under: `mcpx types ` loads its signatures, and a script calls `.(…)`. **operation** — one entry in the daemon's `/v1` operation table (`api.Ops` in `internal/api/ops.go`): a method, a path, and where each parameter travels. The CLI commands, the MCP tools, the OpenAPI document and the Go client are all derived from this one table. See [Parity](parity.html.md). **parity** — the property that the four derived surfaces agree, because they are generated from the same declarations; also the chapter that prints the generated mapping. **plumbing settings** — the internal half of the settings registry: declared and enforced like any other setting, but listed only when asked (`mcpx config --schema --plumbing`). Mostly bounds and intervals a harness cannot vary. **pool** — the daemon's set of live server instances. A server's `scope` decides which process a call gets (one per repo, worktree, session, …) and its `sharing` whether callers share it or queue. **preset / profile** — a named bundle of configuration: a _profile_ selects which servers are active; a _preset_ is a named settings bundle. `--profile` is a global flag; presets live in the `presets` settings. **recipe** — a saved script that declares its own holes: `mcpx prompt` produces one from a request in words, and `mcpx recipes` runs them. See [Scripts](scripts.html.md). **registry** — two senses, kept apart by context: the _settings registry_ (every setting declared once, in `internal/settings`) and a _public registry_ of MCP servers that `mcpx registry` searches. **scope** — who reads a setting (daemon, client, one call, the plugin), or what decides which server process a call gets. The word is used for both; the chapter says which. **script** — TypeScript (or JavaScript) run by `mcpx exec` / `mcpx run` on a real runtime — deno, else bun, else node — with the generated client and every namespace preloaded. **supervise / supervisor** — `mcpx supervise` runs one stdio server child under a supervisor that owns the child's pipes for its whole life, so a daemon upgrade need not orphan it. The takeover handoff is the older mechanism it replaces. **takeover** — the upgrade handoff: `mcpx upgrade` starts the new binary as the old daemon's child and passes it the stdio children's pipes over a unix socket. Streamable HTTP sessions survive it; SSE sessions are closed and re-initialised. **transport** — how a client reaches the daemon — a unix socket, ssh, or a `tsnet://` tailnet identity — or how the daemon reaches a server: stdio for a spawned process, Streamable HTTP for a URL. See [Modes](modes.html.md) and [Reaching a daemon on another machine](remote.html.md). --- # The home-page example: copy it or run it in the page The example on the home page is not a picture of code. It is the working script from [`home-example/example.ts`](home-example/example.ts), and a reader can do two things with it before installing anything is required of them — and a third once it is. **Copy as mcpx exec.** One click puts a command on the clipboard that runs the example against your own daemon and your own servers: ```sh mcpx exec "$(cat <<'MCPX_EOF' const echoed = await tools.demo.echo({ message: "hello from a script" }); console.log("demo.echo:", String(echoed)); MCPX_EOF )" ``` The heredoc is quoted, which is the whole trick: an example full of apostrophes, `$` signs and backticks arrives at `mcpx exec` byte for byte, because `mcpx exec` takes its source as an argument and its stdin belongs to the script. *Copy as script* puts the source itself on the clipboard instead, for a file under `.mcpx/scripts/` and `mcpx run`. **Run it in the page.** The example is editable, and Run executes the edited version in the browser tab. This is a simulation and the page labels it as one: the script runs through the real generated client, but its `POST /v1/call` is answered by a fake daemon in the page whose only namespace is a mock `demo` server. It is the right tool for "what does this code do" — change a line, see the output change — and the wrong one for "what will this do against my servers", which is what the copy button is for. What the simulation does not have: real MCP servers, the launcher, and the runtime APIs (`Deno.*`, `node:fs`) a real run provides. Running an example against your own daemon from the page is a later, opt-in stage; running strangers' code on a hosted daemon is not planned at all. The component, its mocks, and its regeneration script live in [`home-example/`](home-example/index.html.md). --- # The /v1 HTTP API `/v1` is the daemon's own API — the one surface everything else sits on. The CLI talks to the daemon over it, the plugin's client is an HTTP client for it, and the MCP tools are generated from the same declarations it is. This page is the prose around the specification: how to reach the API, the few conventions a caller has to know, and how to get a client for it in your language. The specification itself is `GET /v1/openapi.json`, and it is generated — see below for why that sentence does real work. ## /v1 ### One table, one specification Every `/v1` operation is declared once, as an `Op` in the table in `internal/api/ops*.go` — 81 operations at the time of writing; the generated table in [parity.md](parity.html.md) is the live count and the live list. From that declaration come the route, the `mcpx_` MCP tool, a CLI command and the operation's entry in the OpenAPI document. `internal/api/openapi.go` builds the document from the table, so `GET /v1/openapi.json` describes the daemon that serves it, including one path per tool in the live catalogue. Because the document is generated from declarations compiled into the binary, it can be produced with **no daemon running**: `mcpx openapi` prints it. The two documents overlap but neither is a superset of the other. Every path they share is identical, byte for byte, and `mcpx openapi` adds the MCP endpoint, a REST path per mcpx tool (`POST /v1/tools/{tool}` is itself an operation in the table) and the settings index. In the printed document those per-tool paths are concrete — one `POST` path per tool mcpx itself serves: `/v1/tools/mcpx_exec`, `/v1/tools/mcpx_search`, `/v1/tools/mcpx_types`, `/v1/tools/mcpx_catalog`, `/v1/tools/mcpx_call`, `/v1/tools/mcpx_batch`, `/v1/tools/mcpx_namespaces`, `/v1/tools/mcpx_registry`, `/v1/tools/mcpx_status`, `/v1/tools/mcpx_stats`, `/v1/tools/mcpx_log`, and the batch form `/v1/tools/batch_call`. [parity.md](parity.html.md) carries the living table behind the names; the list above is the set the binary prints today. The daemon's document instead adds one concrete path per tool in the **live catalogue** (`POST /v1/call//`, with that tool's input schema, generated per request by `handleOpenAPI` in `internal/daemon/ops.go`), so a server that appears after startup is described without a restart. A third form, `GET /v1/openapi.json?static=1`, returns the daemon document _without_ the live catalogue merged in -- only the ops-table paths -- so a docs build can publish the API surface without publishing the builder's configured servers (#1883 item 4); the offline document reads no configured servers and covers upstream tools only through the declared `/v1/call/{server}/{tool}` template. The two documents that used to share this name — one of them describing a server that had been removed — are recorded in the header of `internal/cli/openapi.go`, so the confusion cannot quietly return. > **Which OpenAPI document do you want?** `GET /v1/openapi.json` > describes **the daemon as it is running on this machine**: its > operations, its routes, its settings, and the live catalogue's > per-tool paths. The `/v1` half of `mcpx openapi` describes the > same daemon surface as compiled into the binary, without the > live catalogue. `mcpx schema --format openapi` describes **the tools** of your configured MCP > servers, as operations for a client generator. Feed the wrong one > to a generator and you get a working client for the wrong thing. The rendered reference page and the protocol revision matrix are generated content, and generated content is never hand-copied into a prose page — it would be wrong within two releases. The generation that embeds them in this page set is still in progress; until it lands, the interim sources are the documents themselves: the operation table rendered in [parity.md](parity.html.md) (itself generated, and held current by a test) and the revision matrix in [protocol.md](protocol.html.md) §1, which defers to `GET /v1/protocol`. Both are named here, on the page, so a reader always knows which copy they are trusting. ### Reaching the API The daemon listens in two places at once: - **The unix socket** in its state directory (`paths.state`). This is the primary listener; the socket's file permissions are the access control. ```sh curl --unix-socket http://mcpx/v1/health ``` The host name is a placeholder — over a unix socket it names nothing; the socket is the address. The OpenAPI document's first `servers` entry (`http://mcpx`) is written for exactly this call. - **Loopback TCP**, on `daemon.port`. The default port is 0, which means the daemon chooses one at start-up; `GET /v1/health` reports the port this daemon chose, and the daemon writes its socket, endpoint and port into its info files in the state directory for clients to discover. A named endpoint (`MCPX_ENDPOINT`, as `unix:///path` or `http://host:port`) is how a program pins one daemon instead of discovering whichever is running. Every endpoint is unauthenticated. That is a deliberate local-API posture, not an oversight: binding the TCP listener wider than loopback is a deliberate act, and the responsibility of whatever does it, because whatever can route to the port can run tools as you. The same listeners mount the [MCP surface](mcp.html.md#mcp) at `/mcp` — one listener, one access-control decision. ### Call-scoped settings: the `X-Mcpx-Settings` header A daemon is started once and serves every later command, so a flag on one command that governs something the daemon does would be lost — accepted, validated, and ignored — if the client did not send the effective value with the request. That is what the `X-Mcpx-Settings` header is: a JSON object of setting path to value, carried on one request: ```sh curl --unix-socket 'http://mcpx/v1/search?q=screenshot' \ -H 'X-Mcpx-Settings: {"search.limit": "5"}' ``` Only **call-scoped** settings are honoured; a path the registry declares at any other scope is ignored, because a header that could reconfigure a shared daemon for everybody is not a per-call preference. A malformed header is also ignored rather than refused — the client's bug should not cost it the call itself. The setting names and scopes are the registry's, generated into [configuration.md](configuration.html.md). ### The event stream: `GET /v1/events` `GET /v1/events` is a server-sent events stream over the daemon's event bus — elicitations waiting for an answer, server state changes, resource updates, progress and log messages. Query parameters select what to hear: `kinds=` (prefixes; empty means everything), `session=`, `server=`, and `uri=` for resource updates on named resources (naming one subscribes to it upstream for as long as the stream is open). Reconnects resume. `?since=N` replays everything after sequence N, and the `Last-Event-ID` header a browser's `EventSource` sends on reconnect is honoured the same way; if the retained history no longer reaches back that far, the stream says so in-band with a `gap` event whose payload is `{"since": N, "latest": M}` — `since` is the cursor the subscriber asked to resume from and `latest` is the newest sequence the bus has published, **not** the oldest sequence still retained — so a subscriber knows it missed everything between its cursor and the retained history and can resynchronise instead of trusting a stream with a hole in it. Over MCP, the same stream is what `subscriptions/listen` carries — see [mcp.md](mcp.html.md#mcp). ### Admin operations An operation whose declaration carries `Admin` changes the daemon rather than reading from it — stopping it, restarting a server, setting configuration. In the OpenAPI document these are marked `x-mcpx-admin`, which is how a scoped token, when one exists, would know what to grant separately. Today they are **offered rather than hidden**, MCP annotations (`readOnlyHint`, `destructiveHint`) included: a caller that can reach the socket can already do these things, so withholding them would buy no safety. 20 of the 81 operations are admin at the time of writing; [parity.md](parity.html.md) lists which. ### Request body limits Bodies are bounded, per surface, by settings: `http.bodyLimit` (default 1 MiB) for ordinary requests, `http.callBodyLimit` (default 64 MiB) for tool-call payloads, which legitimately carry large arguments, and `http.controlBodyLimit` (default 64 KiB) for the control endpoints. A body over its limit is refused by the decoder rather than truncated into a half-parsed request. ## A /v1 SDK There is no published `/v1` SDK, in any language. What follows is the recommended way to get one anyway, and the one client that does exist. ### Recommended: generate one from the specification The specification is generated from the ops table, so a client generated from it cannot drift from the daemon the way a hand-written SDK would — a hand-written SDK is a second copy of the table, and keeping it correct is exactly the failure the table exists to prevent. Generate with the standard tool for your language: | language | tool | | ----------- | ---------------------------------------------------------- | | TypeScript | `openapi-typescript` (types) with `openapi-fetch` (client) | | Go | `oapi-codegen` | | Python | `openapi-python-client` | | most others | `openapi-generator` | The flow is the same everywhere: 1. Take the spec from the daemon you will talk to: `curl --unix-socket http://mcpx/v1/openapi.json -o openapi.json` (`mcpx openapi` works offline and every path it shares with the daemon document is the same bytes, but it has no live catalogue: a generated client that needs the concrete `/v1/call//` paths must be generated from the daemon's own document, not the offline one). 2. Run your generator over `openapi.json`. 3. Point the generated client at the daemon — which is the one mcpx-specific step, next. **The unix-socket caveat.** Generated clients assume a TCP base URL. The daemon's primary listener is a unix socket, so pick one: run the daemon on a known loopback port (`daemon.port`, or start it with `--port`) and use `http://127.0.0.1:` as the base URL; pin `MCPX_ENDPOINT` the same way for programs that read it; or give the generated client a fetch/transport that can dial a unix socket — the standard clients all accept a custom fetch or HTTP transport, which is where a socket dialer belongs. What does not work is handing a generated client the socket path as a URL and hoping. ### The client that exists: `DaemonClient` For harness plugins and Bun/TypeScript programs there is the plugin's `DaemonClient` (`plugin/core/daemon.ts`): a connection-reusing client that knows the discovery ladder (a named endpoint first, then the daemon info files, then health checks), speaks to the socket through Bun's `fetch` `unix` option, and reaches every operation through its generated `ops` methods (`plugin/core/ops.gen.ts`, generated from the same table), with named convenience methods beside them for the common calls. It is tested against a real daemon. It is also **not published as a package** — using it today means taking it from the plugin — and it is Bun-first, which is why it is the harness answer rather than the general one. The general answer is generation, above. ### What is not promised No SDK-generation check runs in CI yet: no job generates a client from the current spec and compiles it, so the generation flow above is documented and follows the spec's own generation, but it is not yet held by a test the way [parity.md](parity.html.md) is. That check belongs with the docs-generation work this page set leans on, and it is recorded as the named remainder on the parent issue rather than claimed here. --- # Ideas Unvetted. Everything from a brainstorm lands here first, numbered, so nothing is lost between thinking of it and deciding about it. Items graduate to [`proposals.md`](proposals.html.md) once they have a shape, and from there to the feature list in [`story.md`](story.html.md) once built. Nothing here is committed to. Some of it is probably wrong. ## Format Each item keeps **the thinking, not a summary of it**. A one-line version of "maybe support a list of dirs to add to the priority list, and allow either front or back, and maybe aliasing to dodge conflicts" loses the two open questions inside it, which are the part worth keeping. So: a heading, the original thought in enough detail to reconstruct the intent, and where it went. `→ proposal` means it has a written design. `→ shipped` means it is built. `→ answered` means it was a question, and **the answer is recorded here**, because an answer that only exists in a conversation is lost. ## Should this be issues instead? Probably, eventually. A file is right while there is one author and no repository to file against: it diffs, it reviews, and it cannot rot in a tracker nobody opens. The moment a second person is involved, or an item needs discussion threaded against it, these become issues and this file becomes an index of links. The graduation path is the same either way. --- ## Intake 2026-09-27 Extracted from one message, grouped, not prioritised. --- ### Paths and identity **1. Git version floor.** Does `--path-format=absolute` need a new git? → **answered.** It landed in git 2.31, March 2021. The stated policy is that anything released before 2026-01-01 is fair game, so it is now used directly, with a hand-absolutising fallback kept for older git. Cost of the fallback is one extra `git rev-parse` only when the first attempt fails. **2. Is `--git-common-dir` relative to cwd or to the repo root?** → **answered.** To **cwd**. Verified: from `pkgs/mcpx/internal` it returns `../../../.git`. This matters because joining with cwd is therefore correct, and joining with the repo root would have been wrong. It is also why `--show-toplevel` needs no treatment: it is already absolute. **3. Is there a realpath that does not involve cwd?** → **answered.** `realpath(1)` exists as a shell command, and Go's `filepath.EvalSymlinks` is the in-process equivalent. Neither needs cwd for an *absolute* path; both resolve a *relative* one against cwd. So the order is forced: absolutise first, resolve second. Doing it the other way silently resolves against the wrong directory. **4. Would `--absolute-git-dir` work instead?** → **answered: no, for either scope.** It returns the *git directory*, and for a linked worktree that is the worktree's private `.git/worktrees/`, not the shared common dir. Using it for `repo` scope would make every worktree look like a separate repository — the exact bug the scope exists to avoid. And for `worktree` scope the wanted value is the working tree root, not a git dir at all, so `--show-toplevel` is already the right call. **5. Prefer realpath everywhere for comparison and search.** → **shipped.** Every path that becomes a key goes through one `canonical()` helper: absolutise, then `EvalSymlinks`, falling back to `Clean` when the path cannot be resolved. `/tmp` and `/private/tmp` now key identically, as do symlinked checkouts. **6. Are there cases where the relative form should win?** Display, plausibly — `repo:../..` is unreadable but `repo:/Users/.../nix` is long. Never identity. Open. --- ### Catalogue, types and search **7. Implement round-robin budgeting.** → **shipped** as `mcpx catalog`. **8. Keep whole-namespace `types` too, or force the budget on everyone?** → **answered: keep both.** They answer different questions. `catalog` is "what exists, within a budget"; `types` is "I have chosen this namespace, give me all of it". Collapsing them would make the common case need a flag, and would ration an agent that already knows what it wants. **9. How are signatures ranked — is there similarity indexing? An agent? A library?** → **answered: none of those.** Catalogue ranking is by *cost*, `len(line)/4`, ties broken by path. No embeddings, no model, no dependency. That is deliberately different from `mcpx search`, which is *relevance*-ranked by substring scoring. Two rankings because they answer two questions. **10. Could a query bias what fits?** → **shipped** as `--bias`, which promotes matching signatures ahead of the pure cost order. This is the merge of the two ranking systems and it seems to work: at a budget too small for `take_screenshot`, `--bias screenshot` promotes it anyway. **11. `ls` does not search — is that a separate thing?** → **answered: yes.** `ls` enumerates namespaces and counts, never tools. `search` ranks tools across namespaces. `catalog` sits between them: every namespace, some tools. **12. Better search: typo tolerance, concept similarity, tags.** → proposal. Worth noting the ordering: tags are cheap and exact, typo tolerance is cheap and fuzzy, similarity is expensive and needs a model or an index. **13. Types improvements** beyond single-tool output. → proposal. --- ### Protocols beyond MCP **14. Import an OpenAPI service as a namespace.** → proposal. Confirmed feasible: the codegen already consumes JSON Schema, which is what an OpenAPI operation carries. **15. Emit OpenAPI *per namespace*.** The inverse, so non-agent consumers can use the same servers without speaking MCP. → proposal. **16. Expose mcpx itself as an MCP server and/or an OpenAPI endpoint**, optionally secured, with or without the MCP type wrappers. → proposal. This is distinct from 15: it makes mcpx a *server*, not just a client. **17. A common adapter interface** so MCP, OpenAPI and anything later plug in the same way. → proposal. **18. Steal from MCP alternatives and mcp++ efforts.** → proposal. --- ### MCP server mechanics **19. How are Chrome debugging ports handled?** → **answered: they are not, and do not need to be.** `chrome-devtools-mcp` has no listen-port flag. With `--isolated` it launches its own Chrome with a temporary profile and an ephemeral debugging port of Chrome's own choosing. This is why mcpx has no port machinery, and why the predecessor's auto-port code was solving a problem this server does not have. **20. Can you attach to different Chrome processes?** → **answered: yes**, via `--browserUrl http://127.0.0.1:9222` or `--wsEndpoint ws://...`. That is the case where per-instance templating becomes necessary, because each instance needs a *different* URL. **21. Auto-increment or random ports as a general feature.** → proposal, as argument templating plus an allocator. Generalises beyond Chrome to any server that does take a port. **22. MCP servers have their own config — how is that handled?** → **answered: argv and environment, and that is all there is.** MCP defines no configuration channel, so a server's options are its command-line flags and its environment. mcpx passes `command`, `args`, `env` and `cwd` per server. The one thing MCP *does* define that mcpx was ignoring is `instructions` from `initialize` — now surfaced. **23. `--pageIdRouting` defaults to true** and is documented as "useful for concurrent agent sessions". Worth understanding before assuming pooling is the only answer to concurrency. Open. **24. What other common MCP settings are we missing?** → proposal. Known gaps: sampling, roots, progress notifications, cancellation, elicitation, OAuth. --- ### Scopes and sessions **25. Config policy for scopes** — allow-list, default, and whether a flag or a script may override. → proposal. **26. Named sessions, and naming one that started anonymous.** → proposal. The subtle part: an anonymous key is torn down when its caller exits, so naming it must flip that bit. **27. Per-scope keepalive defaults.** → proposal. **28. Change keepalive at runtime, from CLI or script.** → proposal. **29. Reap on an HTTP status code.** → proposal, but MCP's own `ping` is the better first version: no configuration and works for every server. **30. Reap on a webhook.** → proposal. Splits into outbound (easy, it is events with an HTTP sink) and inbound (needs authentication; `mcpx session stop` already covers anything local). **31. Tie an instance to a pid.** → **shipped** as `scope: pid`, reaped on the reaper tick when the process is gone rather than waiting out an idle timer. --- ### Config and script discovery **32. Extra directories on the priority list**, with a choice of front or back: `--override-paths` and `--fallback-paths` taking lists of directories or files. → proposal. The open question inside it is whether "front or back" is two flags or one flag plus an ordering rule. **33. Aliasing a file to a different name to dodge conflicts.** → proposal, and flagged there as probably the wrong shape — shadowing already resolves conflicts by precedence, and an alias adds a second mechanism for the same job. **34. Do config and scripts share a directory?** → **answered: yes.** `.config/mcpx/config.json` and `.config/mcpx/scripts/*.ts`, with `.mcpx/` as the lower-precedence alternative spelling. Both are searched upward from cwd, and a directory carrying both spellings warns once. --- ### Logging and output **35-43.** Every command takes a display format; everything expressible as JSON is available as JSON; a logging helper for scripts accepting either a plain string or structured values; plain strings wrapped into the same record shape; automatic enrichment with ambient context; formats json / json-pretty / logfmt / text / compact / bare; message templates preserved next to the interpolated message; a default closer to a classic log line. → consolidated into one proposal. **Answer to "does the existing logger interpolate": there is no logger yet.** The daemon prints unstructured lines and scripts have no helper at all. --- ### Logging, round two **69. How does a script return several times?** → **answered: `emit()`**, a separate export, not a log level. Logs and results share one wire channel with a `kind` discriminator so they stay ordered, but they are different functions with different destinations: logs go to stderr rendering, results to stdout or the envelope. **70. Should the discriminator be `_kind`?** → **answered: it is not a user-facing attribute at all.** `kind` lives at the top of the wire record; user attributes are nested under `attrs`. A script writing `log.info("x", {kind: "y"})` sets an attribute, not the discriminator. The real collision was elsewhere -- see "Reserved attribute names". **71. Should there be `log.output()` / `log.return()` helpers?** Deliberately not. Logging and returning are different acts, and putting them on one object invites `log.return` being read as "log that we returned". `emit` is the verb. **72. Can JS attributes merge onto Go context?** → proposal, "Log context and enrichment layering". slog does have the seam (`Handler.Handle` takes a context) and mcpx does not use it yet. **73. Does a streamed result also produce a log line?** → **answered: no.** Verified: `emit({a:1})` produces one stdout line and no record. **74. How does variadic translate between JS and Go?** → **answered: it does not, and should not.** JS has real variadics, so `log.info(msg, ...rest)` with runtime type inspection is idiomatic. Go's slog uses alternating key/value pairs (`slog.Info("msg", "k", v)`) or typed `slog.Attr`. Forcing either into the other's shape would make one side unidiomatic. They meet at the wire format, which is a message plus a map, and each side reaches that in its own way. **75. How expensive is the Error-based source capture?** → **answered, measured:** `new Error().stack` costs **4.89 us** against a 0.10 us baseline for the JSON serialisation alone -- roughly fifty times the cost of the record it decorates. Parsing the frame adds only 0.3 us on top. So capture is opt-in, and the expensive part is building the stack, not reading it. **76. Does JS run for every log message even when filtered?** → **answered: yes, partly, and that is worth fixing.** The script always serialises and writes; the level threshold is applied in Go. A debug call in a hot loop therefore costs a write even when nothing will print. → proposal. **77. Should source capture be configurable globally and per server?** → **shipped for global** (`logging.source` in config, plus the flag and the environment variable), and per-server `logLevel` now resolves. Per-server *source* is not meaningful, because source capture describes the script, not the server it is talking to. ### Harness integration and distribution **44-53.** Plugins for opencode 1 and 2, Claude, Codex; the split between an instructions file, plugin-injected instructions, and a tool surface; a plugin suppressing a redundant instructions file by detecting a marker; an install command per harness; hash-matching so an update never clobbers a user's edits; daemon-side config updates; a curl-able install document; a curl-able **setup document written for an agent** rather than a human; `mcpx setup-prompt` / `install-prompt`; platform variants for nixos, flakes, darwin, darwin+homebrew. → consolidated into one proposal. The genuinely novel piece is the agent-targeted setup document: the artefact is a prompt, not a script. --- ### Packaging and service **54-59.** NixOS module and service; Homebrew formula; a non-flake nix installer; the binary installing its own service; autostart at boot versus on first use; whether sudo is ever appropriate. → consolidated into one proposal, with a firm view on the last one: **never sudo.** The daemon is per-user and owns per-user MCP servers; a system unit would run them as the wrong user and share state across users. --- ### Transport, scale and language **60. What does the daemon actually speak?** → **answered.** HTTP over two listeners: a unix socket for the CLI, and `127.0.0.1` on an OS-assigned ephemeral port for script clients, because `fetch()` over a unix socket is not portable across deno, bun and node. Not stdio, not named pipes, not files. **61. Is the port fixed or random? What if it is taken?** → **answered.** Ephemeral, chosen by the OS, so there is nothing to collide with. It is published in a daemon record file that the CLI reads. **62. Can multiple daemons run?** → **answered: yes, already.** One per config fingerprint, each with its own socket. `mcpx daemons` lists them. **63. Accept a URI with or without host and port** (`example.com`, `example.com:8008`, `:42`). → proposal. Parsing is trivial; authentication is the actual blocker, because loopback currently provides trust for free. **64. Load testing.** → proposal. Untested beyond 12 concurrent runs. **65. Go or Rust?** → proposal, with a recommendation to stay: the workload is process supervision and JSON, where the runtime is idle most of the time. --- ### Naming and comparison **66. `mcpx`, `xmcp`, or something else?** → proposal. Short version: `mcpx` is fine, renaming gets more expensive weekly, and the only real argument is that `mcpsh` states the actual pitch. **67. What does opencode v2 have that this does not?** → **answered**, and tracked: OAuth and elicitation for remote servers, in-sandbox `search()` so discovery never enters the transcript, a persistent PTY daemon, a shared background service, and OpenAPI import. mcpx is ahead on shell access, pooling and scoping, real-runtime TypeScript, and per-config isolation. **68. Track parity deliberately.** → proposal. --- ## Intake 2026-09-30 From one message about adapters, plus two language/transport requests. Filed straight to issues rather than proposals, per the graduation path above: these needed a design argument written down, not a line kept. --- ### Adapters without hand-writing JSON **78. Can a binary become a declaration automatically, without a model?** The AI-assisted version is already sketched (#114 has the `--help` parse plan, #83 has it as step 5), but both park it behind a large design and neither owns it. The deterministic half is shippable on its own. → **#295.** The thing worth keeping from the thinking: `--help` is the *worst* regular source, not the best, and leading with it is why this looks harder than it is. Shell completion scripts are generated data structures — fish's `complete -c tool -l flag -d 'desc'` is nearly a declaration already, and zsh `_arguments` specs carry flag, type and description in a fixed grammar. Cobra, clap and argparse all emit them. Ladder: completions → a published spec (which is `paths.apis`, not an adapter at all) → man → `--help` → `--bare`. And completions need **two ways in, not one**. Extracting from the binary (`tool completion fish`, `__complete`) is the convenient path and only works when the program ships a generator. Accepting a completion *file* is the one that matters: distributions already ship completions for programs that have no generator at all — `/usr/share/bash-completion/completions/*`, zsh `site-functions`, the Homebrew and Nix prefixes — and those are frequently packager-written for old tools whose `--help` is the worst in the first place. It also makes the parser testable from a corpus instead of from installed binaries, lets someone fix the *source* and re-import rather than hand-editing generated JSON, and covers binaries mcpx cannot run at all. So extraction is sugar over the file parser; build the parser first. Best version of the idea: `import` searches the system completion directories by name before it ever probes a binary. Also settled here: a generated declaration records the binary's version, so `mcpx adapter check` can say "written against jq 1.7, found 1.8" instead of drifting silently. That was #83's open question. **79. Can I just say `git` is an MCP that takes the subcommand and the flags?** Not ideal but fast. → **#295**, as `--bare`, opt-in and loud. Worth keeping *why* it is allowed at all, because #83 Approach A rejects the shell-escape version and the distinction is the whole argument: a bare adapter is an **argv** hole, not a **shell** hole. The cost is that it has no schema beyond "array of strings", so the agent gets nothing to reason about and `mcpx doctor` can only check the binary exists. Hence: required `description`, a visible marker in `mcpx adapter list`, and probably a settings gate so an organisation can forbid it centrally. The sharp edge found while writing it up: **`--bare` on a binary that has its own argv-level exec escape is equivalent to Approach A.** `git -c core.pager='sh -c ...'` is a shell escape mcpx cannot see. The sandbox is only as good as the wrapped program's own argv surface, and the docs have to name the common offenders. **80. Go can exec a program so it can't shell escape, right?** → **answered: yes, and it already does.** `Spec.Call` builds an argv and runs `exec.CommandContext(cctx, s.Command, full...)` (`internal/adapter/adapter.go:237`). No `/bin/sh -c` anywhere in `internal/adapter`, so no word-splitting, globbing, `;`, `$()`, backticks, pipes or redirection. The guarantee is real; see 79 for the one place it leaks. **81. Is there an issue for exec'ing bash, and for Python first-class?** → **answered: both already exist, no new issue needed.** Shell and shebangs are **#106** — its own notes already say "nearly just allow any shebang" and `--shell||--bash||--shell python3`. Python 1:1 with TypeScript is **#105**, framed there as "a second codegen backend and a second runner, not a second product". Both sit under #175. --- ### Languages and reach **82. Roc.** → **#296.** The reason it is not just "another interpreter": Roc's platform/application split means an application is pure and a *platform* supplies every effect it may have. That is the exact shape of an mcpx script — pure logic whose only effects are tool calls — and no other language in the runtime list models it natively. The dream version is mcpx *as* a Roc platform, where the capability boundary becomes the type system rather than a Deno flag set. Why it is staged behind a codegen backend anyway: a Roc host is ordinarily Rust/Zig/C and links against the compiled app, so a Go host means cgo and a separate toolchain. Plus Roc is pre-1.0 with no compatibility promise. Ship the boring backend, keep the platform as research. **83. Iroh.** → **#297.** Reach a daemon by *identity* rather than by address — no port forwarding, no public IP, no ssh key copied. ssh (#85) solves encryption and auth and solves routing only if you can already reach the host, which is exactly the laptop-behind-NAT case. The honest finding, kept because it is the part that would otherwise be rediscovered: **iroh is Rust and mcpx is pure Go**, and `tsnet` (Tailscale, embeddable in a Go program, mature hole-punching, real ACLs) and `go-libp2p` deliver most of the same property with no cgo. Where iroh genuinely wins is `iroh-blobs` — BLAKE3, content-addressed, resumable — which is the same shape #187 already wants for the dependency cache. If that convergence is the goal, iroh earns its sidecar; otherwise it probably does not. --- ### The gap both of those exposed **84. Nobody knows who is calling the daemon.** → **#298**, and the framing in the first draft was wrong. Not a bug — it is written down three times as a deliberate choice (`internal/daemon/server.go:214`, `internal/daemon/origin.go:13`, `internal/api/openapi.go:40`): unauthenticated, socket file permissions are the access control, and the TCP bind host is deliberately not defaulted because "that has to be somebody's decision rather than a default." The first draft called it *blocking* — a precondition for ssh, p2p and browser surfaces. → **answered: no.** There is no blocker for adding security and no blocker for not having it. An unauthenticated local daemon is a complete answer and stays one. The issue was rewritten to say so, and the auth coupling was stripped back out of the iroh (#297) and WASM (#299) issues, which should not carry it. The rule that came out of it, worth keeping: **do not mix auth with other things in issues.** Auth work goes in one line — #253 (the interface) with the pure-auth issues ordered behind it — and other issues reference it without depending on it. **85. The permissive-interface trick.** → **#300**, and this is the part worth remembering. When a spec demands an interface mcpx does not have, the move is to *build the interface and make it say yes*: accept a user and a password, and reply "good job, you're authorized." That satisfies every conformance row asserting the endpoint exists, is well-formed and accepts a valid credential — which is most of #253's 61 rows — and it cannot break anyone, because a daemon that authorizes everyone is exactly as secure as a daemon with no interface at all. The rows that require an **invalid** credential to be *refused* are the ones that change behaviour and can lock you out of your own daemon. Those get their own issue (#300), ordered behind #253, blocking nothing. The one hazard, and it is real: a permissive interface must be *visibly* permissive. `mcpx doctor` and startup should say "authorisation: permissive" so nobody ships it believing otherwise. **86. WASM as a tool source.** → **#299.** Distinct from #84, which is mcpx compiled *to* WASM. This is mcpx *running* a `.wasm` as a sandboxed tool source — a module reaches nothing until the host hands it an import, which is the inverse of `internal/runner/runner.go:43`'s admission that only Deno has a permission model worth the name. What makes it cheap where 73 and 74 are expensive: **wazero is a pure-Go WASM runtime with no cgo**, so `nix build` keeps cross-compiling for free and the release matrix does not grow. The open tension is that the component model — which is what would make the capability set a per-module declaration — may require wasmtime and therefore cgo, forfeiting the advantage. That is the one piece of research gating the rest. --- # In name only ``` created: 2026-10-01T09:00:00-05:00 last-updated: 2026-10-01T12:30:00-05:00 increment: 2 status: working tags: area:audit description: features, settings and tests that exist on paper and do little or nothing in practice. The curated list; the per-area audits carry the full detail. ``` Status: working Each entry is something a reader could reasonably believe works, and mostly does not. It is a list to fix from, not a list of excuses. Check an entry against the code before adding it -- two seeded here from `docs/spec/revision-conflicts.md` were already fixed. Add to it when you find one; remove an entry only in the change that makes it true, and say so in the commit. **Status of this file:** seeded from what the 2026-09-30/10-01 fix rounds found while doing other work, then extended by the 2026-10-01 audit of `origin/main` at `19237a0`. This page stays curated: it carries the entries worth acting on, and the three area files carry every row, with the command and output or the file:line behind it. - [audit/surface.md](audit/surface.html.md) -- commands, 173 settings, `MCPX_*` variables, flags, exit codes, `/v1` routes against the CLI. - [audit/spec.md](audit/spec.html.md) -- each MCP revision's requirements against the code and against the conformance matrix, both directions. - [audit/features.md](audit/features.html.md) -- opencode plugin, `exec`/`run`, daemon pools, recipes/`prompt`/autonomy, adapters and OpenAPI, diagnostics, elicitation. **What the audit did not cover.** Authorization was excluded throughout (known absent, #253). The settings sweep read all 173 statically but ran only 31 at two values, so most `proto.*`, `upstream.*`, `transport.*`, `prompt.*` and `recipes.*` settings are unverified either way. The twelve `plugin.*` settings are read by the TypeScript plugin and were not exercised from a live opencode. The spec pass read the shared-body loops in `utilities_test.go`, `lifecycle_test.go` and `clientfeatures_test.go` and the rest only by header, so it is a sample of ~1300 conformance cells, not a census. Each area file ends with its own "skipped" list; read it before concluding something is clean. **Read the specifications, not only the conformance suite.** The suite tests what it has scenarios for: nothing for 2024-11-05, three scenarios for 2025-03-26, and it measures zero for features no fixture exposes. Passing it is not conformance. The per-revision requirements are catalogued in `docs/spec/requirements.md` and `docs/compare/matrix-revisions.md`; check each against the code, and check each conformance pass against what the spec actually asks. The audit found the matrix itself is the weak point: most conformance bodies register one test for a list of requirement ids, so an id reads "tested" whether or not the body touches it. Legend: **absent** -- declared, nothing behind it. **minimal** -- does the least that lets a test or a doc say it exists. **partial** -- works on some paths and silently not on others. **untested** -- may work; no test would notice if it stopped. ## Authorization | what | state | detail | | -------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | OAuth as a client (to remote servers) | absent | `type: oauth` is refused before connecting. Every client-side conformance failure is this: token endpoint, metadata discovery, DPoP, client credentials. #253 | | Authorization on mcpx's own `/mcp` and `/v1` | absent | Anyone who can reach the socket or port is trusted. The `Origin`/`Host` check stops browsers, not callers. #253 | | The permissive auth interface | minimal | Authorizes everyone; exists so the shape is in place. #300 | | `autonomy.max` against a determined caller | partial | Holds per request, but a socket caller can `PUT` a higher ceiling with `persist:user` and restart the daemon. Decision 0002 says so. | ## Questions from servers (elicitation, sampling) | what | state | detail | | -------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Elicitation storage | partial | Readable by any local user and never pruned. #255 | | Answers checked against the requested schema | absent | Nothing validates an answer. Answering a question whose schema requires `repo` with `{"totally_not_in_schema":123}` is accepted silently, rc 0. (The other half of this entry -- "does not show which server asks" -- is **fixed**: `elicit list` has a SERVER column and `elicit show` prints `from `.) #255 | | `elicit answer key=value` types | partial | Every value reaches the server as a string, so `age=3` arrives as `"3"` for an integer field (`cli/elicit.go:119-126`). Pass JSON to avoid it. #255 | | Exit 75 when a call stops for input | partial | Holds for the first pending question on a server. While an earlier question for that same (shared) server is unanswered, later callers **block** instead of exiting 75 -- `exec` waited the full two-minute expiry, then printed a cancel result and exited **0**, which is the symptom #286 was closed for. The e2e tests all start from an empty question store, so none of them reach this. #286 (closed) | | Sampling | minimal | Declared to every upstream; answering needs an agent watching the question queue. No human review, no result validation, no error mapping. Deprecated in 2026-07-28; kept working only. #256, #210 | | Server-to-client requests across eras | partial | Works when the upstream is configured `protocol: follow`: a 2025-11-25 caller gets its own legacy session of a dual-era upstream, whose requests reach it as requests ([spec/era-probe.md](spec/era-probe.html.md#follow)). Under the default `modern` a legacy caller still shares the modern session, where a dual-era server's legacy-only push (the official suite's `test_elicitation`, `test_sampling`) answers -32601 -- the four `server-all` failures, until `scripts/conformance.sh` configures `follow`. The reverse direction -- a 2026-07-28 upstream's `input_required` reaching a legacy caller as `elicitation/create` -- already worked, and is now tested (`internal/e2e/follow_test.go`). | ## Tasks | what | state | detail | | ----------------------------------------------- | ------- | ------------------------------------------------------------------------------- | | Task persistence | absent | The store is in memory; tasks do not survive a daemon restart. #209 | | `tasks/cancel` | minimal | Forces the cancelled status instead of letting the work reach its own end. #209 | | mcpx asking an upstream to run a call as a task | absent | An upstream that requires a task fails. #209 | | `taskSupport` default for 2025-11-25 clients | partial | A tool with none declared can still be called as a task. #209 | ## Skills extension mcpx declares `io.modelcontextprotocol/skills` (SEP-2640, 2026-07-28 only) and serves its own four skills from `plugin/opencode/skills` -- each a `SKILL.md` plus whatever supporting files and subfolders sit beside it (`mcpx-basics` has a getting-started guide and an `examples/` folder of scripts) -- through `skills/list`, `skills/get`, `resources/read` and `resources/directory/read`. One part of the extension is not built and is not declared. | what | state | detail | | -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | An upstream's skills through `skills/list` | absent | mcpx answers `skills/list` with its own skills only. An upstream that declares the extension has its `skill://` files passed through as ordinary resources (under their own URIs in pass-through mode, as `mcpx:///...` otherwise), but its `skills/list` entries -- the digests and frontmatter a host verifies against -- are not relayed, so a host cannot load them as skills through mcpx. Relaying needs a new daemon route and a pool and client method for a request the upstream may or may not support, plus URI handling for the gateway's `mcpx://` rewrite; no fixture in the conformance suite serves skills, so nothing would test it today. | | `resources/directory/read` (`directoryRead`) | built | Declared as `directoryRead: true` wherever the skills extension is (2026-07-28, and not under `ExtrasOnly`, which serves no skills). Lists the direct children of any directory inside a served skill -- files with the metadata `resources/list` gives them, subdirectories as `inode/directory` -- paginated like `resources/list`; a file, an unknown URI or anything outside the skills is `-32602`. It follows the files, not a fixed layout: `TestDirectoryReadFollowsAnyLayout` covers nested, empty and binary content, and `TestDirectoryReadListsEveryDirectoryOnDisk` checks every shipped directory against the disk. All six `sep-2640-skills-directory` checks in the `server-all` leg pass. Upstreams' skill directories are not listed, for the reason in the row above. | ## Relay between hosts and upstreams | what | state | detail | | ------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | | Log messages per call | partial | A log message does not say which call it belongs to; with several calls on one upstream connection, each gets it. | | Upstream log level on legacy revisions | partial | Pinned to `info` at connect, so an upstream's debug messages never exist to relay. | | Progress and mcpx's own timeout | partial | Progress reaches the host but does not extend mcpx's per-server call timeout. | | Relay on `prompts/get` and `resources/read` | absent | Only `tools/call` relays progress and logs. | | Client capabilities to 2025-11-25 upstreams | partial | Declared once at connection; per-request narrowing reaches 2026-07-28 upstreams only. | ## Commands and settings Full table: [audit/surface.md](audit/surface.html.md). | what | state | detail | | --------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Call-scoped settings on `POST /v1/exec` | absent | `ExecService` builds its settings once under a `sync.Once` from the config file and environment (`internal/daemon/routes_exec.go:170-185`), so the `X-Mcpx-Settings` header is ignored, `mcpx daemon --` is ignored, and nothing marked `hot: true` is re-read. The scope model in `configuration.md` does not hold on the exec path. | | Daemon-scoped flags given to a client command | absent | `mcpx call --pool-call-timeout 1s …` is accepted, validated, printed back and ignored -- including when that command auto-starts the daemon. `configuration.md` names this as the failure the scope field exists to prevent, and `help call` advertises ~40 such settings. Nothing warns. #185 | | `mcpx help ` listing "usage, flags and settings" | absent (flags) | No command's help has a flags section. `help exec` never mentions `--timeout`, `--keep`, `--session`, `--export`, `--ns`, `--runtime`. The settings it does list are the same 71 for `init`, `man` and `call` alike, with nothing saying which command acts on which. #144, #147 | | `script.permissions: none` | minimal | `none`, `off` and `unsandboxed` all map to deno `--allow-all` (`internal/defaults/defaults.json:43-45`). A reader picking "none" for no permissions gets all of them. | | `logstore.queryLimit`, `stats.top` | partial | `mcpx log` and `mcpx stats` read the store in-process with their own hard-coded defaults (100, 20); the settings are read only by `GET /v1/log` and `GET /v1/stats`. The flag is listed in `help log`. | | `tasks.ttl` | partial | Applied to exec tasks only; a `/v1/call` task still gets 600000ms. | | Global flags after the command | partial | `--config`, `--profile`, `--skip-default` and `--all-profiles` are documented as global but only parse before the command: `mcpx ls --profile nope` → `flag provided but not defined: -profile`. An unknown profile before the command is accepted silently and returns the default set. | | Restarting the daemon itself | absent | `restart` replaces server processes; nothing restarts the daemon. #302 | | Natural language to script | minimal | `mcpx prompt` matches a recipe or drafts a script; no declared model source, no run path through the ceiling end to end. When nothing is produced it still exits 0. #294 | | `prompt --mode` | absent | Renamed to `--autonomy`; `--mode` is `flag provided but not defined`, recorded only in decision 0002's "Landed" note. Settings flags on `prompt` also only parse for `autonomy`, `session` and `set`. | | `mcpx.namespace` validation | partial | Checked for reserved words only. `{"namespace":"1 bad-ns"}` is accepted and listed. | | Settings being read vs mattering | guard gap | `internal/settings/consumed_test.go` proves a setting is read, not that reading it changes anything. | ## Scripts and their sandbox Full table: [audit/features.md](audit/features.html.md). | what | state | detail | | ---------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Permission profiles as a boundary | partial | A script that can reach the daemon can ask the daemon for more than its own profile allows: under `--permissions strict`, posting to `/v1/exec` with `options:{permissions:"all"}` returns 200 and writes the file. `/v1/exec` does not cap requested permissions against the caller's. | | `artifact({path})` against a denied file | partial | Under `strict`, `Deno.readTextFile` is refused but `artifact("leak.txt",{path:"…/secret.txt"})` succeeds, because the daemon does the read via `x-mcpx-path`. No test covers that header. | | `--suffix` "runs last on both paths, like a finally" | partial | On `exec` with a snippet that throws, the suffix never runs; on `run` with a file it does. Tests cover the file path only. | | `--remote` parity with local | partial | Drops the caller's environment except `--env`, drops `res.Logs` so `log.info` output disappears, resolves profiles and runtimes from the daemon's settings rather than the caller's, and skips `diagnose.preflight`. | | Generated result types from `outputSchema` | absent | `structured()` is typed `Promise` with `type ToolResult = any`; codegen never reads `outputSchema`. #216 | ## Diagnostics and the log Full table: [audit/features.md](audit/features.html.md). | what | state | detail | | ------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Failed tool calls counted as failures | absent | `"ok": err == nil` (`internal/pool/pool.go:959`) and a tool returning `isError` is not an error there. `mcpx call fake.boom` exits 1 and prints "reported an error (isError)", while the log record says `"ok":true`, `stats calls` shows ERRORS 0 / 0.0%, and `stats errors` says "No errors in the log yet." Every error rate built on the log reports zero. | | `stats servers` call counts | partial | Summed from `server.stop` records only, so they disagree with `stats calls` (5 vs 12 observed). | | Attribution by server | partial | Servers that share a pool id are all logged under one name, so calls to one appear against another. | | `diagnose` | partial | Does not check argument types (a number for a string reports "Nothing to report"), nor unknown namespaces, nor a script name that does not exist -- each exits 0 saying there is nothing to report. #111 | | `doctor` server health | partial | Never probes a server. Before `refresh`, only a server with a missing binary fails; a crashing one and an unreachable one both pass. | ## Adapters and OpenAPI Full table: [audit/features.md](audit/features.html.md). | what | state | detail | | ----------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Adapter `timeout` | absent | `"timeout":"1s"` on a 5s program returned after 5.05s. The context error is never consulted and there is no process-group kill (`internal/adapter/adapter.go:255-261`). No test. | | Adapter and API argument checking | absent | Declared parameter `type` is not enforced at call time -- `"abc"` for a number is passed through as argv. Unknown arguments are dropped silently, and a positional value starting with `-` is placed before the program's own flags with no `--` separator, so a caller can inject options. | | OpenAPI cookie parameters, required query params and bodies | absent | Cookie parameters are dropped from the schema and sent as query values; only required _path_ parameters are checked, so a missing required `q` is sent anyway and an empty body goes out as `Content-Length: 0`. | | `securitySchemes` / `security` | absent | Not referenced anywhere in `internal/openapi` or `internal/cli`; authentication is possible only through hand-written `headers`, and `mcpx api --spec` has no way to set them at all. | | APIs as namespaces in scripts | partial | Only `mcpx serve` exposes them; in `exec`, `typeof pets` is `undefined`, though adapters do appear. | ## The opencode plugin Full table: [audit/features.md](audit/features.html.md). Checked against opencode 1.18.31 with plugin types 1.15.5, by invoking the hooks under bun rather than inside a running opencode. | what | state | detail | | -------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | `instructions` option | absent | Pushes onto `output.parts`; the v1 hook type is `output: { system: string[] }`, so the system prompt comes back empty. #217 | | `remember: "permanent"` | absent | Sends `persist: true` where the daemon's field is a string, so the write fails with `cannot unmarshal bool into … .persist of type string`. | | `until-gone` remembered scope | absent | Written to the file and never read; behaves exactly like `indefinite`. | | `MCPX_HARNESS_VERSION` | absent | Read from `OPENCODE_VERSION`, which opencode 1.18.31 does not set. | | Documented discovery rung 5 ("ask the user") and the headless warning line | absent | `discover` skips rung 5; `toast()` returns early when headless and writes nothing, so the documented log line never appears. | | Nothing loads `mcpx-session.ts` | untested | `internal/e2e/plugin_test.go:32` runs `bun test plugin/opencode/mcpx/` only. That is the gap the `persist` type mismatch went through. #141 | ## Specification and the conformance matrix Full table: [audit/spec.md](audit/spec.html.md). | what | state | detail | | ----------------------------------------------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | mcpx as a 2024-11-05 server over HTTP | partial | There is no HTTP+SSE server transport. A 2024-11-05 client's opening `GET` gets 405 and a JSON-RPC error, never an `endpoint` event. `docs/protocol.md:51` and `docs/spec/transport.md:9` advertise "2024-11-05 over stdio and Streamable HTTP", a combination that revision does not have; in practice it is stdio only, and the matrix shows no gap. | | The progress MUSTs (must increase, stop after completion, active tokens only, rate limit) | **fixed** | Relayed progress is now checked before it reaches the host (`mcpclient.acceptProgress`), and the server-side cells run a real upstream that reports out of order, after completion, in a burst and after the response (`serverRelayedProgress` in `internal/conformance/utilities_test.go`). | | `sampling-deprecated-new-impls-should-not-adopt` (2026-07-28) | partial | Catalogued as "mcpx forwards; pass-through, not adoption", but the daemon originates sampling for script generation (`internal/daemon/consumer.go:589-603`) and declares the capability to every upstream that could answer. The cited test asserts the declaration exists, so it passes on the behaviour the requirement discourages. #210, #256 | | Timeout-despite-progress and `tasks/cancel` requirements | untested | The shared bodies covering them never send progress and never send a task-augmented request, so they hold only because progress currently resets nothing. A change that let progress extend a timeout uncapped would pass every cited test. #209 | | The matrix's "tested" column generally | guard gap | 102 loops register one test body for a list of requirement ids; every id in the list then reads "tested". At least two rows point at the wrong test, one of which is genuinely covered by an uncited test elsewhere. | | The `lifecycle-stdio-client-shutdown-sequence` gap (#203) | **fixed; record removed, the five cells run** | The gap says `StdioTransport.Close` "sends SIGTERM at the same moment it closes stdin". It does not: `internal/mcpclient/stdio.go:260-275` closes stdin, waits `stdinGrace`, then SIGTERM, then SIGKILL after `termGrace`. All five cells (`TestLifecycleClient` for 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25 and `TestTransportClient/2026-07-28/transport-stdio`) SKIP by default and PASS under `MCPX_CONFORMANCE_RUN_GAPS=1`. So five passing tests guard nothing and the matrix under-reports five client cells. Remove the gap, do not fix the code. | --- # Install > **Prerequisites, before the table:** a JavaScript runtime — deno > (recommended; it is the only runtime where typechecking works), bun, > or node 22.6 or later — unless you install with nix or the container, > which bring their own. `git` is recommended (without it, the `repo` > and `worktree` scopes degrade to the working directory). macOS or > Linux; on Windows, use WSL. When you are done: `mcpx doctor`. --- ## Channels The [0.1.0 release](https://github.com/developing-today/code/releases/tag/mcpx/v0.1.0) contains archives for Linux x86-64, Linux ARM64 and macOS ARM64, plus `SHA256SUMS`. Pick the channel that fits how you operate the daemon. | Channel | Command | Status | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | nix | `nix run github:developing-today/code#mcpx -- ls` to try it; `nix profile install github:developing-today/code#mcpx` to keep it | **Available** — the flake builds `pkgs/mcpx/package.nix` and exposes it as an app; the wrapper puts `git`, `deno`, `bun` and `node` on `PATH`, so a nix install is complete with no other prerequisites | | container | From the repository root, run `nix build .#packages.x86_64-linux.mcpx-container && docker load < result`. | Build the image locally with Bun as its runtime. See [the container chapter](container.html.md) for image contents. | | just the plugin | copy `pkgs/mcpx/plugin/opencode/` into `~/.config/opencode/plugin/` (the plugin README's "Install") | **Available** as a manual copy — and it is not an install of mcpx: the plugin needs **no mcpx binary on its machine**, because it finds a daemon over the unix socket or an `endpoint`; it still needs a daemon running somewhere, and as copied it exposes no tools and injects no guidance until you set `tools: true` / `MCPX_PLUGIN_TOOLS=1` (and `instructions: true` for the prompt) | | shell installer | Download the script and run the [versioned install](install.html.md#install-a-release) below. | Downloads the matching release archive, verifies its checksum and installs the binary. Supply Deno, Bun or Node for `run` and `exec`. | | agent prompt | a prompt you paste to your agent, with the `llms.txt` URL | Not yet | | pwsh (install.ps1) | `irm /install.ps1 \| iex` | **Blocked** — mcpx does not build for Windows today; WSL is the Windows answer | | rpm / deb | `dnf install ./mcpx-.rpm` | Not yet | | flatpak | — | Not recommended (decided in the release design, #1881) | | pkg | — | Not yet — and still an open question: macOS `.pkg`, FreeBSD `pkg`, or Homebrew | | docker (published) | `docker run --rm ghcr.io/developing-today/code/mcpx:0.1.0 --version` | The [registry package](https://github.com/orgs/developing-today/packages/container/code%2Fmcpx) has the `0.1.0` and `latest` tags. The [publish run](https://github.com/developing-today/code/actions/runs/43886854966) built the image and pushed both tags. | Nix caveats, stated plainly: the flake is a large monorepo flake, so installing one package from it fetches and evaluates a lot (the cost from a cold machine is unmeasured — an open question on #1878), and `x86_64-darwin` is excluded; aarch64-darwin, x86_64-linux and aarch64-linux are the supported systems. ## Install a release Download the [installer at this revision](https://github.com/developing-today/code/blob/d24c19c6e0654f2466fc98bc86e3dacb786f5067/pkgs/mcpx/scripts/install.sh). Run the following commands in a temporary directory. The first selects the script, the second selects the release, and the last reads back the installed version. ```sh curl -fsSLo install-mcpx.sh https://raw.githubusercontent.com/developing-today/code/d24c19c6e0654f2466fc98bc86e3dacb786f5067/pkgs/mcpx/scripts/install.sh MCPX_VERSION=0.1.0 sh ./install-mcpx.sh "$HOME/.local/bin/mcpx" --version ``` For a per-host binary, pass `--system` to the script. It requests elevated privileges for the copy into `/usr/local/bin` if needed. Set `MCPX_PREFIX` to select another installation directory. Omit `MCPX_VERSION` to let the script look for the latest stable MCPX release. ## Install as Choose how the daemon runs once the binary is installed. | Mode | What to do | Status | | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Just run the binary | Nothing. Any command that needs the daemon starts one (`daemon.autostart`, default true), and an auto-started daemon exits after 4 hours idle (`autostart.idleExit`) | Shipped | | Per-user | Binary in `~/.local/bin`. Configuration in `~/.config/mcpx/config.json`. | The installer uses this binary directory by default. | | Per-host | Binary in `/usr/local/bin`. Configuration in `/etc/mcpx/config.json`, the last location on the search path. | The installer accepts `--system`. | | Local host (a daemon other machines reach) | `mcpx daemon --address --port ` on that host; clients set `daemon.endpoint` / `MCPX_DAEMON_ENDPOINT` — a client with an endpoint set never autostarts a local daemon. Remember: the API is unauthenticated, the network is the access control | Shipped | | Persistent daemon | `mcpx daemon` (foreground) or `mcpx daemon --detached`; a deliberately started daemon's `daemon.idleExit` defaults to `0` — it never idle-exits | Shipped | | System service | Import the appropriate [MCPX Nix module](https://github.com/developing-today/code/tree/d24c19c6e0654f2466fc98bc86e3dacb786f5067/pkgs/mcpx/modules) and enable `services.mcpx`. | The NixOS module provides a systemd user unit. Home Manager supports a systemd user unit on Linux and a launchd user agent on macOS. The shell installer installs the binary only. | | Fallback: no daemon | Set `daemon.inline` true: servers run inside each command process. Slower, nothing pooled, nothing shared | Shipped, last resort | ## Verify ```sh mcpx doctor ``` `doctor` checks the runtime, git, the configuration chain, whether every configured server's command is actually installed, and the daemon — and each failed check says what to do about it. Then: [the quick start](quick-start.html.md). --- # Interfaces Every way into mcpx is one of two kinds. The **abstract interfaces** are the declarations everything else is generated from: one operation table, one settings registry, one command list. The **client interfaces** are the surfaces code actually drives: a generated TypeScript client, the CLI, the daemon's `/v1` HTTP API, the plugin's `DaemonClient`, and MCP itself. This page is the map. The detail lives in the pages it links to: the [CLI](cli.html.md), the [binary](binary.html.md), [scripts](scripts.html.md), and the generated [parity table](parity.html.md). ## Abstract interfaces mcpx declares each thing it can do **once**, as an operation — an `Op` in the table spread across `internal/api/ops.go` and its sibling `ops_*.go` files (81 operations at the time of writing; the generated table in [parity.md](parity.html.md) is the live count). From that one declaration come: - the `/v1` route on the daemon, - the `mcpx_` MCP tool, - a generated CLI command, for operations that have one, - a typed plugin method on `DaemonClient.ops` (`plugin/core/ops.gen.ts`, generated the same way), - the operation's entry in `/v1/openapi.json` and in the document `mcpx openapi` prints — one document now, generated from the table; the stale hand-written serve-surface document it replaced is recorded in the header of `internal/cli/openapi.go`. ``` internal/api/ops*.go one Op per operation | +----------------+----------------+ | | | /v1 route mcpx_ generated CLI (registered MCP tool command, and by hand, DaemonClient.ops held by test) method ``` One part of that diagram is deliberately not an arrow: the routes are **not** generated. They are registered by hand in the daemon, and a test (`internal/api/parity_test.go`) reads them back out and checks them against the table. Generation where it is safe, a test where it is not — the effect is the same: no surface can quietly drift from the declaration. The claim the design makes is quoted word for word at the top of [parity.md](parity.html.md): > Everything the CLI can do can be done from a plugin, can be done > over `/v1`, can be done from MCP. What enforces it today is also listed there, because the parity document is generated from the same declarations and cannot describe a surface that does not exist. Each direction is held by a named test — every route has an operation and every operation a route; every non-streaming operation is reachable as an MCP tool; every operation is reachable from the CLI; every command the binary dispatches is declared in `Commands()` and every declared one runs (`TestEveryDispatchedCommandIsDeclared`); and the plugin's operation methods are generated and exercised against a real daemon. Where an operation is privileged — stopping the daemon, for example — it is offered rather than hidden, and carries MCP annotations (`readOnlyHint`, `destructiveHint`) for a client that wants to scope on them; a caller who can reach the socket can already do these things, so hiding them would buy no safety. The CLI and the plugin both sit **on top of** `/v1`: the CLI talks to the daemon over its unix socket, and the plugin's client is an HTTP client for the same API. There is no second, private interface for insiders. Two sibling declarations work the same way, and the interface pages lean on both: - **Settings.** Each setting is declared once in the registry with its type, default, scope and aliases, and is then reachable from the config file, an environment variable and a per-command flag without being restated. The inventory is generated into [configuration.md](configuration.html.md); the environment names are generated into [environment.md](environment.html.md). - **Commands.** `Commands()` in `internal/cli/manual.go` declares every subcommand once, so help, the man page, shell completions and the generated command table in [parity.md](parity.html.md) cannot disagree about what exists. See [cli-commands](cli.html.md#cli-commands). ## Client interfaces Every way code can drive mcpx, with the smallest useful snippet for each. Pick by who is calling: a script wants the generated client, a shell wants the CLI, a harness wants `DaemonClient` or MCP, and anything else wants raw `/v1`. ### The generated TypeScript client — for scripts `mcpx client` prints the client generated from your configured servers' schemas; inside `mcpx run` and `mcpx exec` it is already installed as the globals `tools`, `log` and `emit`, with each namespace also a bare identifier. `mcpx types` shows the signatures. ```ts const pages = await tools.chrome_devtools.list_pages({}); ``` In a file of your own, import it instead: ```ts import tools from "./mcpx-client.ts"; ``` Discovery is in the same surface: scripts can call `search()` and `describe()` to find a tool and read its signature at run time rather than having every schema loaded up front. `search()` also finds saved scripts (recipes): every match carries a `kind` -- `"tool"`, with a callable, or `"recipe"`, with the script's name and placeholders -- and both kinds are ranked and paged together in one stable order (CODE-36). The contract a script runs under — for an exec snippet a final expression, otherwise stdout, is the result, `emit()` streams, a default export is the entry point — is the [scripts page](scripts.html.md#script). ### The CLI — for people, shells and CI ```sh mcpx ls mcpx search screenshot mcpx call chrome_devtools.take_screenshot '{}' ``` The CLI is a client interface, not just a person's interface: `--json` makes its output one machine-readable document, and `mcpx call . [json]` makes a single tool call with no JavaScript runtime involved at all. The whole surface is the [CLI page](cli.html.md#cli). ### `DaemonClient` and `connect()` — for harnesses and Bun/TypeScript programs The opencode plugin's client (`plugin/core/daemon.ts`) talks to the daemon over its unix socket — measured at about 0.17 ms per call against about 23 ms for spawning the binary. It is not published as a package; harness plugins vendor it, and any Bun/TypeScript program can do the same. ```ts import { connect } from "./mcpx/daemon.ts"; const { client, discovery } = await connect({ directory }); if (client) await client.call("fff", "grep", { query: "x" }, sessionID); ``` `connect()` runs the discovery ladder (which daemon, on which socket, for this directory). The client itself offers generic `raw` / `get` / `text` / `post` / `postRaw` / `putRaw` methods, named typed conveniences (`status`, `exec`, `call`, `logQuery`, `putSetting`, …), and `client.ops` — one generated method per operation, so nothing is reachable only through a hand-built URL. The plugin's own documentation is `plugin/opencode/README.md`, "Talking to the daemon directly". ### Any MCP client — for MCP hosts A host that only speaks MCP needs no plugin and no client library: point it at the daemon's `/mcp` endpoint, or have it spawn `mcpx serve --transport stdio`. mcpx is then simply an MCP server with a deliberately small tool surface — the operations above, reachable as `mcpx_` tools. The MCP pages (overview, SDK, compatibility) are the sibling half of this page set; the protocol itself is specified in [protocol.md](protocol.html.md). ### Raw HTTP on `/v1` — for curl and other languages ```sh curl --unix-socket http://mcpx/v1/health ``` Every operation in the table is an HTTP route, and `GET /v1/openapi.json` describes them all — generated from the table, so a client generator fed with it produces a client for the daemon that actually exists. Do not confuse it with `mcpx schema --format openapi`, which describes the **tools** of your configured servers, not the daemon: feeding the wrong document to a generator produces a working client for the wrong thing. --- # Landing checklist My reading of the brief, broken into items. Kept as the working list until the ship lands; each item records what was decided and why, so a disagreement has something specific to argue with. Legend: `[ ]` todo, `[x]` done, `[~]` partial, `[?]` guessed — needs a look. --- ## A. Console, from the script's perspective - [x] **A1.** The question is not "does it log" but "does a script that was written against a normal console still behave". Arguments, arity, return, throw-parity, `.name`, formatting, getters, symbol keys, subclass instances, circular values, very large values. Test the surface, not the happy path. - [x] **A2.** `Deno.stdout.write` and `Deno.stderr.write` bypass capture. This is correct — a script writing raw bytes asked for raw bytes — but it should be written down once, in the reference, not in an agent prompt. ## B. The launcher - [x] **B1.** Whole-launcher override. `--launcher ` replaces the template. `--no-launcher` means *no launcher at all*: the script is handed to the runtime directly. The brief asked for one bare-valued flag; it became two, for the reason in "Guesses worth reviewing" below (`internal/cli/commands.go:490-493`). - [x] **B2.** Placeholders in a custom launcher: `@entry`, `@globals`, `@prefix`, `@before`, `@onSuccess`, `@onError`, `@suffix`, `@import`. - [x] **B3.** Reference graph must be a DAG; a cycle is a generation-time error naming the path that closed it. - [x] **B4.** Each placeholder resolves once. A repeat is an error unless `allowRepeat` names it. ## C. String-or-file, everywhere - [x] **C1.** Every string-shaped input (`prefix`, `before`, `onSuccess`, `onError`, `suffix`, `launcher`, `prelude`) accepts inline source or a path. - [x] **C2.** Detection is by probe, not by guessing: if it resolves to an existing file, it is a file. Explicit forms `@file:`/`@text:` force it. - [x] **C3.** Both forms set *at the same level* is an error. Set at *different* levels is ordinary precedence, no conflict. - [x] **C4.** A directory means: concatenate its files, lexicographic order, shallow by default. Leading-number ordering must work, so `10` sorts after `9` — natural order, not raw byte order. - [x] **C5.** Per-kind override of whether a directory is even allowed. A prefix probably should not be a directory; default that off in plumbing. ## D. Unified configuration - [x] **D1.** One schema. A setting is declared once with type, default, pretty name, short and long description, and aliases — and is then reachable from the config file, an environment variable, and a flag, without being restated. - [x] **D2.** Flags and env vars are generated from the schema. Env is `MCPX_` derived from the dotted path; aliases are extra. - [x] **D3.** Boot order is explicit and inspectable: built-in defaults, then config files nearest-last, then environment, then flags. - [x] **D4.** Alias conflicts: two spellings of the same setting at the same precedence is an error that names both. - [x] **D5.** Cross-field validation up front — "X only means something when Y is Z" is caught before any work starts, not discovered mid-run. - [x] **D6.** `mcpx config --schema` prints the whole surface. ## E. Search paths - [x] **E1.** Config, script and log locations are each a *list* of candidates with a built-in default. - [x] **E2.** The null splice works in these lists, so a user can say `["./mine", null, "../fallback"]` and have `null` stand for the built-in. - [x] **E3.** A file where a directory was expected is accepted and means exactly that one file. ## F. The logging store - [x] **F1.** SQLite index over the JSONL, call-grained. - [x] **F2.** `mcpx log` — query, filter, follow. - [x] **F3.** `mcpx stats` — aggregate. Invent the useful ones. - [x] **F4.** Trace-chain walk: from any record back through its parents. - [x] **F5.** Rotation on age, total size, *and* line count — all configurable. - [x] **F6.** A way to inspect the store directly, including raw SQL. ## G. Validation before execution - [x] **G1.** Resolve and check every path, file and directory up front. - [x] **G2.** Type-check the generated program without running it, following imports. Deno can do this; record honestly where it cannot. - [x] **G3.** A `.ts` and a `.js` of the same name is ambiguous. Prefer `.ts`, but make that a guard with a plumbing switch rather than a silent rule. ## H. Plumbing - [x] **H1.** A `plumbing` section for internals with no ordinary reason to change. Marked clearly as unsupported. - [~] **H2.** Wherever the code has a guard or a throw, ask whether it wants a plumbing switch. No use case needed; the point is not being stuck. ## I. Commands and help - [x] **I1.** Enumerate every command, with what it does. - [x] **I2.** `--help` complete and accurate at every level. - [x] **I3.** A man page. - [x] **I4.** `mcpx ` — a bare argument that is obviously source or a script should run, not error. - [x] **I5.** Decide what remains of the exec/run distinction. ## J. Landing - [x] **J1.** Small clean commits throughout. - [ ] **J2.** PR, then review rounds. - [ ] **J3.** Final report: what was guessed, what the alternatives were, why the guess, and what was deliberately not done. --- ## Outcome Everything above is built except where marked. ### Guesses worth reviewing Each of these had a real alternative. The choice is stated so it can be argued with. **`--launcher` takes a required value, with a separate `--no-launcher`.** The brief asked for one flag that means "none" when given bare. Go implements optional-value flags only by treating them as boolean, and then `--launcher mine.ts` silently runs `mine.ts` as the script with no launcher. Two flags, no trap. The alternative -- keeping one flag and documenting that `--launcher=X` needs the equals sign -- trades a real misfire for a smaller surface. **Directory concatenation is off for phases by default.** `plumbing.sourceDirAllowed` governs it, and phases pass `AllowDir: true` while `--launcher` passes false. A launcher assembled from several files is more likely a mistake than an intention; a prefix assembled from several is plausible. **`defaults` wins over `pool`.** Two spellings of one block. The older one wins so that adding the synonym cannot change what an existing file means. The alternative -- `pool` winning as the "canonical" name -- would silently alter existing configurations. **The bare-argument heuristic is narrow.** A first argument runs if it names a file, ends in a script extension, or contains `(){};`, `=>`, `await `, `console.` or `tools.`. A bare `=` was in that set and is not any more, because a mistyped flag has one and running a typo as a program is worse than refusing it. **Percentiles are exact, not estimated.** These datasets are small enough that an estimator would only add error. **Redaction elides partial matches rather than whole values.** A variable holding several pairs is still worth seeing without the one that matters. ### Not done, and why **Full projection of the registry into every consumer.** `output.json`, `paths.state`, `paths.cache` and most of `daemon.*` still have their own paths, and two of those must: the state and cache directories say where to look for configuration, so they cannot come from configuration. `docs/story.md` names exactly which settings the registry governs rather than implying it governs all of them. **A plumbing switch for every guard.** Nine exist. The ones left alone are those where the other branch is not a coherent program -- a malformed daemon response, a socket that will not bind. A switch there offers a choice between working and not. **`mcpx exec` and `mcpx run` remain separate.** The difference is real: `exec` generates the module so a prefix shares scope and can declare bindings; `run` imports a file so a prefix can act but not declare. Merging them means picking one and losing the other. A bare argument now dispatches to whichever fits, which was the part that actually chafed. **H2 is partial by design.** Nine guards got a plumbing switch. Every `throw` in the tree was not audited one by one; the ones that were left alone are those where the other branch is not a coherent program -- a malformed daemon response, a socket that will not bind. A switch there would offer a choice between working and not. **I5, the exec/run distinction**, stayed. The difference is real and small: `exec` generates the whole module, so a prefix shares scope and can declare bindings; `run` imports a file, so a prefix can act but not declare. Merging them would mean picking one of those behaviours and losing the other. A bare argument now dispatches to whichever fits, which is the part that was actually inconvenient. --- # mcpx level-2 page map The map for the level-2 docs: the layer a person reads right after installing mcpx ("basically a more normal set of docs — a new person might assume this is all there is and won't be upset"). It assigns every one of the 30 items in the source notes to a page and a fixed anchor, records the repo material each item draws on, the issue that writes it, and which parts come from the generated reference. - Tracker: #1898. This map is part 1 of #1848; the first seven items' content was #1848 part 2, written by #4821 after #1848 closed (tracker #1898 ruling, 2026-11-03: a replacement issue, not a reopening). - Structure: Approach C from #1848 — about ten grouped pages, each item with its own fixed anchor (`page#anchor`), anchors set explicitly rather than derived from headings so a renamed heading never breaks a link. Totals: 10 pages, 30 anchors — `configuration` 4, `modes` 3, `interfaces` 2, `cli` 3, `mcp` 3, `binary` 1, `scripts` 1, `http-api` 2, `plugins` 6, `faq` 5. - Navigation order follows the notes. (#1848 open question 3 asks whether task order would be better; the notes' order stands until that is answered.) - Writing issues, in this repo's numbering: #4821 (configuration + modes; the replacement for closed #1848), #1851 (interfaces, CLI, MCP, binary, script, /v1), #1855 (plugins), #1859 (FAQ). The generated reference is #1843. (#1848's body quotes the original dezren39/nix numbering — #146/#147/#148/#149 and #144 — for the same issues.) - **Rule for generated content at level 2.** When a page needs reference data, it embeds the relevant slice generated from the same source (for example "settings where scope = client"), it does not just link to the full reference — linking would break "this is all there is". #1843 has to support filtered embeds, not only whole pages (#1848 open question 7). ## Verification (2026-10-29, HEAD `5a34fa70`) Every source path below was re-checked to exist at HEAD. Paths are relative to `pkgs/mcpx/`. Three corrections to the refs as quoted in #1848, found by that check: - The story file is `docs/story.md`; there is no `pkgs/mcpx/story.md`. - Line numbers quoted in #1848 have drifted (for example the `mcpServers` tag is now at `internal/config/config.go:190` and `SearchPathFrom` at `internal/config/config.go:713`). This map cites files, not lines, so it does not rot the same way. - `.mcpx/scripts/` does not exist at HEAD (see item 82). ## The map | Notes line | Item (verbatim) | Page `#anchor` | Source material in the repo | Written by | Generated part (#1843) | | ---------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- | | 53 | common config | `configuration#common-config` | `docs/configuration.md` "Where a value can come from", "Scope", "Hot", "Reaching them"; `internal/config/config.go` (search path); `internal/cli/manual.go` entries `config`, `settings`, `init` | #4821 | link to the settings table; no copy | | 54 | server config | `configuration#server-config` | `internal/config/config.go` (server block); `docs/story.md` "Sharing and scope", "Profiles and aliases", "Remote servers without a shim"; `docs/configuration.md` "Servers"; `internal/cli/manual.go` `servers` | #4821 | open: a JSON Schema for the file (`pool.*` rows are generated) | | 55 | client config | `configuration#client-config` | `docs/configuration.md` "Scope: who reads it"; registry rows with scope `client` and `call` (`internal/settings/registry.go`) | #4821 | the client- and call-scoped settings, filtered from the registry | | 56 | env vars | `configuration#env-vars` | `docs/configuration.md` "variable" column; `docs/environment.md`, generated from `settings.ScriptEnv()` (`internal/settings/scriptenv.go`) and held to the setters by a test; the names neither source declares, listed below | #4821 | registry names and the script environment both generated; only the names neither declares are hand-written | | 57 | client modes | `modes#client-modes` | `docs/story.md` "Running without a daemon", "One daemon, many clients"; `docs/exec.md` "Where a script runs"; `AGENTS.md` "Profiles" | #4821 | — | | 58 | transport options | `modes#transport-options` | `docs/protocol.md` §5; `docs/story.md` "What each transport costs", "Server-sent events, not WebSockets", "Lossless reconnection", "Remote servers without a shim"; `docs/dependencies.md` "Network" | #4821 | — | | 59 | server modes | `modes#server-modes` | `docs/story.md` "mcpx speaks MCP", "Sharing and scope"; `docs/protocol.md` §5 | #4821 | — | | 60 | abstract interfaces | `interfaces#abstract-interfaces` | `internal/api/ops*.go`; `docs/parity.md` | #1851 | the parity table | | 61 | client interfaces | `interfaces#client-interfaces` | `mcpx client`; `internal/codegen`; `plugin/core/daemon.ts` (`DaemonClient`) | #1851 | — | | 62 | cli | `cli#cli` | `AGENTS.md` "The loop"; `cmd/mcpx/main.go` | #1851 | — | | 63 | cli arguments | `cli#cli-arguments` | `cmd/mcpx/main.go`; `internal/settings/bind.go` | #1851 | per-command registry flags | | 64 | cli commands | `cli#cli-commands` | `internal/cli/manual.go` `Commands()` | #1851 | yes: the whole command table | | 65 | mcp | `mcp#mcp` | `docs/story.md` "mcpx speaks MCP"; `docs/protocol.md` §2–§4 | #1851 | — | | 66 | mcp sdk | `mcp#mcp-sdk` | `docs/dependencies.md`; `go.mod` | #1851 | — | | 67 | mcp compatibility | `mcp#mcp-compatibility` | `docs/protocol.md` §1, §6; `internal/mcpserver/revisions.go`; `GET /v1/protocol` | #1851 | the revision matrix | | 68 | binary | `binary#binary` | `docs/dependencies.md`; `package.nix` | #1851 | — | | 69 | script | `scripts#script` | `AGENTS.md` "Scripts", "Script contract"; `docs/story.md` "The script contract", "Named scripts"; `docs/exec.md` | #1851 | — | | 70 | /v1 | `http-api#v1` | `GET /v1/openapi.json` (`internal/api/openapi.go`); `docs/parity.md` | #1851 | yes: rendered from the OpenAPI document | | 71 | /v1 sdk | `http-api#v1-sdk` | `DaemonClient` (`plugin/core/daemon.ts`); `/v1/openapi.json` | #1851 | — | | 72 | plugins | `plugins#plugins` | `plugin/opencode/README.md` | #1855 | — | | 73 | plugin compatibility | `plugins#plugin-compatibility` | `docs/opencode-plugin.md` §1, §5 | #1855 | — | | 74 | plugin interface & config | `plugins#plugin-interface-and-config` | `plugin/opencode/README.md` "Configuration"; `docs/plugin-discovery.md`; `plugin.*` registry rows | #1855 | `plugin.*` rows | | 75 | opencode v1 plugin | `plugins#opencode-v1-plugin` | `plugin/opencode/README.md`; `docs/opencode-plugin.md` §2, §3, §6 | #1855 | — | | 76 | opencode v2 plugin | `plugins#opencode-v2-plugin` | `docs/opencode-plugin.md` §4 | #1855 | — | | 77 | vibeMcp | `plugins#vibemcp` (provisional; moves once its meaning is known) | nothing in the repo | #1855 | — | | 78 | "so why'd you get rid of all the mcp and then make one, do you like mcp or not" | `faq#do-you-like-mcp` | `docs/story.md` "# Summary", "mcpx speaks MCP" | #1859 | — | | 79 | "i mean, opencodemode is right there" | `faq#opencode-code-mode` | `OPENCODE-V2.md` (with its 2026-09-29 corrections); `docs/opencode-plugin.md` §1 | #1859 | — | | 80 | "is it safe?", no. | `faq#is-it-safe` | `AGENTS.md` "Scripts"; `internal/runner/runner.go` | #1859 | — | | 81 | "but why would you.." | `faq#why` | `ASSESSMENT.md`; `docs/story.md` opening walk | #1859 | — | | 82 | "but can i get some examples?" | `faq#examples` | `docs/story.md` walk; `mcpx recipes` (`internal/cli/manual.go`); `Examples` fields in `internal/cli/manual.go`. ⚠ `.mcpx/scripts/`, cited in #1848, does not exist at HEAD — do not cite it as a source until it does | #1859 | per-command examples | #1855 may split `plugins` into an index plus an `opencode` page. The anchors stay the same either way. ## Contradiction flags — do not copy these into any page #1848's Findings name three places where the current docs or behaviour contradict each other. They are flagged here on the pages they touch, with their state re-verified at HEAD `5a34fa70` (2026-10-29): 1. **The file key is `mcpServers`, not `servers`** — STILL TRUE. `Config.MCPServers` is `json:"mcpServers"` (`internal/config/config.go`), the same object other MCP hosts use; "servers" is the CLI command and the `/v1` resource. Touches: `configuration#common-config`, `configuration#server-config`. Both pages must show both names and say which one goes where. 2. **`mcpx init`'s starter config taught a dead `mode` key** — RESOLVED at HEAD; do not reintroduce it. When #1848 was written, `starterConfig` set `"mode": "shared"` / `"mode": "session"`, keys the loader silently drops (`mode` had split into `sharing` and `scope`). At HEAD the starter config teaches `sharing`/`scope` correctly and a test pins it (`TestStarterConfigMeansWhatItSays`, `internal/cli/commands.go`), and the top-level help's CONCURRENCY block (`internal/cli/root.go`) teaches `sharing`/`scope` too. Touches: `configuration#common-config`, `configuration#server-config`, `modes#client-modes`, `modes#server-modes`. Pages teach `sharing`/`scope`; the `mode` key and its `pooled` value must appear nowhere. 3. **The config search path is wider than anything documented** — STILL TRUE. `SearchPathFrom` (`internal/config/config.go`): `MCPX_CONFIG` alone if set; otherwise `.config/mcpx/config.json`, `.mcpx.json`, `.mcpx/config.json` and `.mcp.json` at each directory from the working directory up to `/`, then `$XDG_CONFIG_HOME/mcpx/config.json`, `~/.config/mcpx/config.json`, `~/.mcpx.json` and `/etc/mcpx/config.json`. `.mcp.json` is Claude Code's project file, so mcpx picks up a project's Claude Code servers — nothing says so in the current docs. Touches: `configuration#common-config` (the page must list the path exactly, in order). Two smaller points from #1848 that pages must also get right: - **Env vars outside the registry** (touches `configuration#env-vars`): the registry is not the only declaration there is. `settings.ScriptEnv()` (`internal/settings/scriptenv.go`) declares the environment mcpx and the plugin hand to a script — `MCPX_SESSION`, `MCPX_SESSION_ID`, `MCPX_PARENT_SESSION_ID`, `MCPX_EPHEMERAL`, `MCPX_RUN`, `MCPX_INPUT`, `MCPX_ENDPOINT`, `MCPX_SOCKET`, `MCPX_ARTIFACTS_LOCAL`, `MCPX_CWD`, `MCPX_PID`, `MCPX_ENTRY`, `MCPX_CLIENT`, `MCPX_CONFIG_PATH`, `MCPX_SCRIPT_DIRS`, `MCPX_RUNTIME` — and `docs/environment.md` is generated from it, with a test holding the two directions together (`scriptenv_test.go`). So the caller identity the plugin sets (`plugin/opencode/mcpx-session.ts`) and the names the generated client reads (`internal/codegen/emit.go`) are already declared, not hand-written. What an env-var page must add beyond the two generators is the small remainder neither declares — config selection (`MCPX_CONFIG`) and harness context — and it should link the generated page rather than copy it. - **Upstream "sse" is not the legacy SSE transport** (touches `modes#transport-options`): `POST /v1/servers` accepts `transport: stdio|http|sse` (`internal/api/ops_settings.go`), but the pool builds only a stdio transport or Streamable HTTP (`internal/pool/pool.go`, `internal/mcpclient/http.go`) whose replies may arrive as an SSE stream. Separately, the deprecated 2024-11-05 HTTP+SSE transport does have a client — `LegacySSETransport` (`NewLegacySSE`, `internal/mcpclient/sse.go`) — so the transport page must document that fallback rather than deny it, and say which paths reach it, while still not implying that `transport: sse` means an SSE-only server (#1848 open question 5). --- # MCP mcpx speaks the Model Context Protocol in both directions, and in both eras of it. As a **client** it connects to every MCP server in its configuration, so their tools are reachable without their schemas ever entering a model's context. As a **server** it offers itself — a small gateway surface over all of those servers — to any MCP host. The protocol reference is [protocol.md](protocol.html.md); this page is the map of the surface a host or a client connects to. ## MCP ### mcpx as an MCP server A host reaches mcpx's MCP surface two ways: - **Streamable HTTP**, at the daemon's `/mcp`. The daemon mounts `/mcp` on the same listeners as its [`/v1` API](http-api.html.md#v1): the unix socket and the loopback TCP port. There is no separate MCP server process and no `serve --transport http` — that command was removed, and asking for it fails with the address to use instead ([protocol.md](protocol.html.md) §5 tells the whole story). To put MCP on a network, move the daemon's listener: `mcpx daemon --port 8899 --address 0.0.0.0`, then connect to `http://host:8899/mcp`. The warning that applies to `/v1` applies here unchanged: the surface is unauthenticated, so whatever can route to the port can run tools as you. - **stdio**, via `mcpx serve`. An MCP host starts its servers by spawning a process and talking down the pipe, so something has to be spawnable; `serve` is that something, and it is a thin shim — every tool it lists is answered by the daemon, which it starts if it is not running. A host configuration looks like the one every host already knows: ```json { "mcpServers": { "mcpx": { "command": "mcpx", "args": ["serve"] } } } ``` The surface is small on purpose. Exposing every upstream tool over MCP would rebuild the problem mcpx was built to solve — hundreds of schemas in the model's context — with extra steps ([story.md](story.html.md), "mcpx speaks MCP"). What a host gets by default (`serve.mode` = `code-mode`) is the gateway: the named tools (`mcpx_exec` to run code next to the servers, `mcpx_call` for one direct call, `mcpx_search` / `mcpx_types` / `mcpx_catalog` for discovery) plus a generated `mcpx_` tool for every operation in the `/v1` table — every one of them a way to _reach_ the upstreams through mcpx, never the upstreams' own schemas pasted into the list. Prompts are offered as `_` and resources as `mcpx:///`. Two more modes widen it: `reactive` keeps a bounded working set of upstream tools, adapting as calls name new ones, and a **pass-through** server (`mcp.passthrough`, `--passthrough ` on `mcpx serve` or `mcpx daemon`) is offered as itself — its tools, prompts and resources under their own names, its results verbatim. A client can also ask for the raw surface per connection: a request to `/mcp?codemode=false` gets every upstream tool, flat, under a namespaced name (`_`), and the gateway's own tools are not on that list — the raw surface replaces the code-mode surface, it does not add to it. Calls to a raw name go to its upstream under the upstream's own name. This is the switch opencode v2 appends to a remote server's URL when the server is not configured `codemode: false`, so a v2 host's own code mode can orchestrate mcpx's pooled servers directly. Any other value, and the parameter's absence, change nothing; the switch is read from each request's URL, so one connection can be answered raw and the next through the gateway. An opencode v2 user who would rather call mcpx's own gateway tools directly — mcpx is itself a code-mode gateway, so wrapping it in v2's code mode nests one code mode inside another — opts the server out by setting `codemode: false` on it in the v2 `mcp` config: ```json { "mcp": { "mcpx": { "type": "remote", "url": "http://127.0.0.1:8899/mcp", "codemode": false } } } ``` With `codemode: false` set, v2 leaves mcpx's tools in the model's direct tool list and does not append `?codemode=false` to the URL, so every connection gets the gateway surface described above. The same field exists on a local (stdio) server entry spawned with `mcpx serve`; leave it unset (it defaults to `true`) when v2's own code mode should orchestrate mcpx's pooled servers instead. Questions flow backwards over the same connection. When an upstream tool asks something mid-call — an elicitation, a sampling request — mcpx puts the question to the client that made the call when that client said it could answer, and to its broker otherwise ([elicitation.md](elicitation.html.md)). And `subscriptions/listen`, the modern subscription stream, is accepted from a client of **any** era, each notification tagged with the subscription id that asked for it. Which methods are answered, per revision, and which result shapes are downgraded for older clients, is [protocol.md](protocol.html.md) §2 — generated claims are not repeated here because that document is where they are held to the code. ### mcpx as an MCP client Upstream, mcpx is a dual-era client of every configured server. It probes the modern era first (`server/discover`), falls back to the legacy handshake, and caches the answer per server configuration, so the probe costs one round trip rather than one per start. To a legacy server it offers `2025-11-25` and accepts anything from `2024-11-05` up; a per-server override exists (`upstream.protocol`) for a server that needs to be met on specific terms. Transports are stdio and Streamable HTTP, with the `2024-11-05` HTTP+SSE transport as the last fallback of the HTTP probe. The per-revision client rules are [protocol.md](protocol.html.md) §4. The server-initiated requests mcpx answers for its upstreams: | request | how mcpx answers | | ------------------------ | -------------------------------------------------------------------------------------------- | | `ping` | `{}` | | `roots/list` | the daemon's configured roots | | `elicitation/create` | through the broker — the question is routed to whoever can answer it, a host client included | | `sampling/createMessage` | through the broker; a decline becomes an error, because sampling has no decline result | | anything else | a `-32601` error — always answered, because silence is indistinguishable from a hung server | A modern server asks the same things by answering `input_required` instead of sending a request; mcpx resolves those through the identical function, so the two eras cannot answer the same question differently. ## The MCP SDK question "mcp sdk" names three different things. The honest answer is different for each. ### 1. Which MCP SDK mcpx uses: none mcpx is built on no MCP SDK. There is no MCP module in `pkgs/mcpx/go.mod`; the client (`internal/mcpclient`), the server (`internal/mcpserver`) and the JSON-RPC framing are mcpx's own code — about one package each, which is the point. [dependencies.md](dependencies.html.md) says so in as many words, and the dependency list stays at the handful of Go libraries there because mcpx speaks the protocol itself instead of depending on somebody else's reading of it. ### 2. Using mcpx from an MCP SDK: any of them Any official SDK client connects the way it connects to any MCP server: over Streamable HTTP to the daemon's `/mcp`, or by spawning `mcpx serve` for stdio. With the official TypeScript SDK: ```ts import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; const client = new Client({ name: "my-host", version: "1.0.0" }); await client.connect(new StreamableHTTPClientTransport(new URL("http://127.0.0.1:8899/mcp"))); const tools = await client.listTools(); const status = await client.callTool({ name: "mcpx_status", arguments: {} }); ``` (The port is the one the daemon is actually on: with the default `daemon.port` of 0 the daemon chooses one at start-up, and `GET /v1/health` reports it — see [http-api.md](http-api.html.md#v1). For stdio, swap the transport for the SDK's `StdioClientTransport` with `command: "mcpx"`, `args: ["serve"]`.) ### 3. An SDK mcpx provides for writing servers: there isn't one mcpx publishes no SDK for writing MCP servers or mcpx extensions, in any language. What exists for building on mcpx is the surfaces themselves: a server is any program that speaks MCP and is named in the configuration, and a program that wants to drive mcpx uses the [`/v1` API and its generation story](http-api.html.md#v1-sdk) or the plugin's client described there. A page that implied a supported server SDK would be promising a thing nobody maintains. ## Compatibility ### The revisions mcpx serves five revisions, in two eras, and speaks the same five upstream: | revision | era | mcpx serves | mcpx speaks upstream | | ------------ | ------ | -------------------------------------------------------------------------------- | -------------------------------------------------------------- | | `2024-11-05` | legacy | yes, over stdio and Streamable HTTP; its HTTP+SSE server transport is not hosted | when the server answers with it; HTTP+SSE as the last fallback | | `2025-03-26` | legacy | yes | when the server answers with it | | `2025-06-18` | legacy | yes | when the server answers with it | | `2025-11-25` | legacy | yes | offered on every `initialize` | | `2026-07-28` | modern | yes | probed first | The split that matters: a legacy implementation negotiates once and can send its peer a request at any time afterwards; a modern one has no handshake, restates its version on every request, and — as a server — has no channel on which to send a request of its own. Modern against legacy fails; only a dual-era implementation bridges them, and mcpx is dual-era in both directions. This table is a summary, and it knows it. The matrix lives as data in `internal/mcpserver/revisions.go` and is served by `GET /v1/protocol`; [protocol.md](protocol.html.md) §1 defers to that endpoint for the same reason this page does — a matrix in a document and a matrix in code agree on the day they are written and never again. A generated rendering of the matrix on this page is part of the docs-generation work tracked alongside this page set; until it lands, the endpoint and §1 are the sources, named here so a reader is never left trusting a copy. ### Accept liberally, send conservatively mcpx accepts any request a client's revision allows it to make sense of — `subscriptions/listen` and core `tasks/*` are answered for legacy clients that predate them — and sends nothing the client's revision never defined: every result is built in the newest shape and spelled down once, at the edge, so an older client is never handed a field it was never told about. The rule stops at removal: a method a client's revision _removed_ is answered `-32601`, because the removal is the specification naming a replacement, and answering it anyway would hide which era the server is speaking. ### Known gaps The gaps are written down in [protocol.md](protocol.html.md) §6 rather than copied here, so they cannot drift from the fixes: no OAuth on `/mcp`, tool inputs and outputs not yet validated against their JSON Schemas, a `tool` with `taskSupport: "required"` that cannot be called, and the smaller conformance items listed there. A gap named in one place is a gap somebody can close. ### Host compatibility No MCP host has a recorded compatibility result yet, so this page claims none. Any host that speaks one of the five revisions over stdio or Streamable HTTP is expected to work — that is what the conformance work in [protocol.md](protocol.html.md) holds mcpx to — but "expected" is not "tested against your host", and a host will be named here only when somebody has actually pointed it at mcpx and written down what happened. --- # Now what > You installed mcpx and ran the loop. Each link below is a question, > and every one of them is answered one level down — the level-2 pages > mapped in [the level-2 page map](level-2-page-map.html.md). --- - **Where does config go?** One `mcpServers` object, a search path that runs from the working directory up to `/etc/mcpx/config.json`, and settings that can come from a file, the environment or a flag: [configuration](configuration.html.md), and the map's `configuration` page (common, server and client config, env vars). - **How do I call mcpx from my harness, over MCP, over HTTP?** The CLI is one surface of four — the daemon also speaks MCP (`/mcp`, `mcpx serve`) and plain HTTP (`/v1/*`, OpenAPI at `/v1/openapi.json`): [interfaces](interfaces.html.md), [cli](cli.html.md), and the map's `mcp` and `http-api` pages. - **How do scripts actually work?** The script contract, named scripts, runtimes and what a script may touch: [scripts](scripts.html.md), [exec](exec.html.md), [runtimes](runtimes.html.md). - **How does the opencode plugin work?** It finds the daemon so your harness does not have to ship a binary: [plugins](plugins.html.md) and [the opencode plugin](opencode-plugin.html.md). - **Something is wrong.** `mcpx doctor` first (it says what to do about each failure), `mcpx status` for the daemon and its servers, and the skeptical questions, answered: [FAQ](faq.html.md). - **Everything, in depth.** The long version of all of it — the narrative the overview was distilled from, and the book it feeds: [the story](story.html.md) and [the compendium](compendium.html.md). --- # The opencode v2 plugin — verified API facts and implementation map Companion to [opencode-plugin.md](opencode-plugin.html.md), which sketches the v1 design and the v1→v2 mapping. That document's v2 claims came from a reading of opencode's `v2` branch; this one re-checks every fact the rewrite depends on against the **pinned** v2 source (reported version `2.0.3`) and records where the pin differs. Work item: [#1858](https://github.com/developing-today/code/issues/1858), queue task 3068. ``` created: 2026-10-29T23:05:00-05:00 status: verified facts + implementation map (core rewrite landed in PR #2489: first slice + the tools.ts slice) scope: CORE rewrite only (#1858 SET-REMAINDER is out of scope) ``` Status: verified facts + implementation map (core rewrite landed in PR #2489: first slice + the tools.ts slice) Verified against the local opencode fork checkout (`~/git/opencode`, main at `c9edb37fda`), paths below are inside `packages/`. --- ## 1. Loading: `{id, setup}` is the whole contract `core/src/plugin/module.ts:107-134` — the module schema accepts exactly two default-export shapes: ```ts { id: string, setup: (context: Context) => Promise | Cleanup | void } { id: string, effect: (context: Context) => Effect } ``` Only `default` is read (`Module = Schema.Struct({ default: ... })`). Failure to match aborts the module with _"Plugin must export a default definition with an id and an effect or setup function."_ Consequences for the port: - the `plugin/opencode/mcpx/` subdirectory workaround is unnecessary in v2, but the v1 tree keeps its layout until v2 is what runs; - helpers can be plain sibling modules in the v2 tree, and only the default export is inspected — so `export const TUNING`, `export class DaemonClient` etc. are safe to import from a shared file; - the v2 loader accepts a plugin **directory** as well as a file, so the v2 tree can be one directory whose `index.ts` holds the default export. ## 2. The context surface the port actually uses `promise/plugin.ts:26-73` (the `setup` variant of `Context`): | port need | v2 surface | | ------------------------------------------------ | ---------------------------------------------------------------------------------------------- | | daemon choice remembered across sessions | `ctx.storage.get/set/remove/scan` (Promise, `schema.Json` values) | | session id (the thing `shell.env` used to carry) | `ctx.session.hook(...)` inputs carry `sessionID`; `ctx.session.context({sessionID})` reads one | | system-prompt line | `ctx.session.hook("context", input => …)` mutating `input.system` | | opt-in tools | `ctx.tool.transform(editor => …)`, `editor.namespace(...)` + `editor.add(...)` | | tool timing | `ctx.tool.hook("execute.after", …)` — a **union on `status`** | | a line to the user | `ctx.tui`? no — server plugins get the SDK `client.tui.*` only (unchanged from v1) | | headless detection | unchanged problem; no `isMainThread` trick in v2's two-process model | `ctx.generate` (one-shot completion), `ctx.mcp.transform`, `ctx.permission.hook("evaluate")` and the TUI `select()` picker are the **SET-REMAINDER** — deliberately not used by this core. ### 2.1 `execute.after` really is a status union `promise/tool.ts:41-70`: the hook input is `{ tool, sessionID, agent, messageID, id, input }` intersected with either `{ status: "completed", result }` or `{ status: "error", … }`. So the timing record gets a real failure signal; the v1 tree only ever saw success. ### 2.2 `session.hook("context")` is the system-prompt path `promise/session.ts:25-37` — `SessionRequest` is `{ sessionID, model, system: Array, messages, options }`, and `SessionContext` adds `{ agent, tools }`. Pushing a part onto `input.system` is the direct replacement for `experimental.chat.system.transform`; no per-command hook is involved. Note the hook fires per turn, so the injected paragraph must be idempotent (append once, not accumulate). ## 3. The session environment — two corrections to the mapping table The mapping table on #1858 says `PUT /api/experimental/session/:id/environment`. Against the pin: 1. **The path is `/api/session/:sessionID/environment`** — `protocol/src/groups/session.ts:879-891`. Payload is `{ variables: Record }`, success is `204`. 2. **It replaces, it does not merge.** `core/src/session/environment.ts:18-31` keeps a `Map` and `set()` overwrites the entry; `core/src/shell.ts:262` then reads `environments.get(sessionID) ?? process.env`. That second point is load-bearing: a plugin that sends only `MCPX_*` variables would hand every shell command in that session an environment **without `PATH`, `HOME`, or anything else**. The v2 adapter must send the full environment it wants the session to have — `{ ...process.env, ...MCPX_* }`, stringified — or must not set one at all. Verified by reading the consumer, not the doc comment. The plugin reaches this route either through `ctx.serverUrl ?? http://…` + `fetch`, or (preferred, when the SDK exposes it) through the session client. The promised-domains list (`promise/session.ts:153-172`) does not include an `environment` method, so the raw HTTP call is the route the core rewrite should plan for, with a `ctx.serverUrl === undefined` fallback (embedded hosts: skip, degrade to "unknown session", exactly as v1 degrades). ## 4. `ctx.storage` replaces the remembered-daemon file `promise/storage.ts` — `get(key) => Promise`, `set(key, value)`, `remove(key)`, `scan({ prefix })`. Plugins are namespaced per plugin id by the host, so the v1 `rememberPath()` / `readRemembered()` / `writeRemembered()` trio (and the `TUNING.rememberFile` knob) map onto one key per daemon target. `until-gone` lifetime is preserved by remembering `{ target, socket, seenAt }` and dropping it when the health check fails — the same rule as today, with the file gone. ## 5. What the port does **not** need to rewrite `plugin/core/daemon.ts` is already harness-free: `discover()`, `DaemonClient`, `rank()`, `summarise()`, `readInfoFiles()`, `stateDir()` and the health checks take an `env` map and a directory and speak `/v1` over the unix socket with Bun's `fetch(url, { unix })`. v2 keeps Bun and keeps the socket, so the v2 tree imports this file unchanged. Only the rung-4 spawn (`runBin`, `askCLI`) is harness-specific: `node:child_process` still works in v2's server process, but the core rewrite should make rung 4 optional (off unless `MCPX_PLUGIN_BIN` names a binary) rather than assume it. ## 6. Implementation map (first slice) Target tree, beside the v1 files, all under `pkgs/mcpx/plugin/opencode/`: | file | contents | acceptance it satisfies | | ---------------- | ----------------------------------------------------------------------------------- | -------------------------------------------- | | `index.ts` | `export default { id: "mcpx", setup }` | loads via `{id, setup}` | | `options.ts` | the v1 `Options` type + `pluginSettings()`-declared variable names, ported verbatim | settings guard | | `session-env.ts` | first-sighting → `PUT /api/session/:id/environment` with the **full** env | once per session, no per-command `shell.env` | | `context.ts` | `session.hook("context")` appending one idempotent paragraph | system line | | `tools.ts` | `tool.transform` with namespace + `discover`/`exec`/`observe`/`daemon_*` | namespaced registration | | `timing.ts` | `tool.hook("execute.after")` recording both statuses | failures recorded | | `remember.ts` | `ctx.storage` remembered daemon | no state file | | `daemon.ts` | re-export of `../mcpx/daemon.ts` | core reuse | Tests follow the existing `bun test` style in `plugin/opencode/mcpx/*.test.ts` (`daemon.test.ts`, `ops.test.ts`, `ceiling.test.ts`), stubbing the context object: hooks, `storage` map, and a fake `fetch` for the environment route. ## 7. Open questions for the implementer - **Namespace spelling** — RESOLVED by the tools.ts slice, against the pin: `editor.namespace({ name, description })` takes an object, and `packages/core/src/tool/runtime.ts` (`effectiveName`) flattens a namespaced tool to `_` in the model's tool list. Registering name `exec` under namespace `mcpx` therefore yields `mcpx_exec` — the v1 hand-named tools survive unchanged, and the `mcp.transform` remainder work inherits the same flattening rule. - **Environment route reachability** — with `ctx.serverUrl` undefined (embedded SDK host) there is no HTTP route; decide degrade quietly vs. first-tick retry when a later hook reveals a URL. - **`context` hook idempotency** — whether the host hands the same `system` array across turns or a fresh one per request decides between "append once, guarded" and "append each turn". - **Settings guard scope** — `TestThePluginReadsNoUndeclaredSetting` scans `plugin/**/*.ts(x)`; the v2 tree must therefore read only the names in `internal/settings/plugin.go`, including `plugin.discoveryRetry`, `plugin.remember` and `plugin.annotate`. --- # The opencode plugin What it is, why each part exists, what is opencode-specific, and what happens to all of it in opencode v2. ``` id: the-opencode-plugin since: pre-release created: 2026-09-29T17:00:00-05:00 last-updated: 2026-09-29T17:00:00-05:00 status: proposed note: findings + design sketch ``` Since: pre-release · Status: proposed This document has three jobs. It records what was found comparing opencode v1 and v2 (§1–2), sketches the v1 design that follows from it (§3), and separates the parts that are about opencode from the parts that are about connecting _any_ agent harness to mcpx (§5), because the same plugin is wanted for codex, claude, pi and manus. --- ## 1. The two opencodes They are not two products. They are two revisions of one monorepo. | | "v1" | "v2" | | ----------- | ---------------------------------------------- | --------------------------------------- | | flake input | `opencode`, rev `e03db9b` | `opencode2`, rev `d0a9028` | | version | `1.18.31` (`packages/opencode/package.json:3`) | `2.0.3` (`packages/cli/package.json:4`) | | shipped app | `packages/opencode` | `packages/cli`, renamed `opencode2` | The v1 pin already contains the whole v2 codebase — `packages/core`, `packages/cli`, `packages/tui` are all there at `1.18.31`. The v2 pin has **deleted** `packages/opencode`. So the difference is which binary is built, not which source exists. Three corrections to `OPENCODE-V2.md`, which predates this: - **Code mode is not v2-only.** v1 ships `packages/codemode` and `packages/opencode/src/tool/code-mode.ts`, behind `OPENCODE_EXPERIMENTAL_CODE_MODE` (`src/effect/runtime-flags.ts:48`). With it on, MCP tools leave the model's tool list exactly as in v2. - **Both accept TypeScript** in code mode; neither rejects it. - The pinned v2 reports `2.0.3`, not `2.0.18`. And one thing that matters for anyone writing a plugin today: **v1.18.31 runs both plugin systems at once.** `PluginV2.node` is in the location service group (`packages/core/src/location-services.ts:52`), which the v1 app depends on. A well-formed v2 plugin file dropped in `.opencode/plugin/` is loaded by the v2 host and _also_ rejected by the v1 loader, which logs a complaint and carries on. Noise, not breakage. --- ## 2. What changes for a plugin ### 2.1 Loading | | v1 | v2 | | ---------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------- | | glob | `{plugin,plugins}/*.{ts,js}`, **not recursive** | `plugin`/`plugins` dirs, files **or directories** | | accepted shapes | three: structured `{id, server}`, legacy "every export is a plugin", and v2 `{id, effect\|setup}` | **one**: `{id, setup}` or `{id, effect}` | | v1 compatibility | — | **none**. No shim, no fallback | The legacy loader is why `mcpx/daemon.ts` sits in a subdirectory: v1 calls _every export of every file in the glob_ as a plugin, and one export that is not a function aborts the whole module. The glob not being recursive is what makes the subdirectory work. In v2 that workaround becomes unnecessary — only `default` is read — but the plugin itself must be rewritten, because **v1 plugins do not load in v2 at all**. ### 2.2 The four hooks mcpx uses | mcpx hook | v1 | v2 | | ------------------------------------ | --------------------------------------- | ----------------------------------------------------------------------------------------- | | `shell.env` | ✅ carries `cwd`, `sessionID`, `callID` | ⚠️ `shell.create.before` carries `command, cwd, timeout, shell, env` — **no `sessionID`** | | `experimental.chat.system.transform` | ✅ | ✅ `session.hook("context")`, push onto `event.system` | | `tool: {...}` map | ✅ un-namespaced | ✅ `tool.transform(e => e.add(...))`, namespaced and typed | | `tool.execute.after` | ✅ success only | ✅ a union on `status` — **failures are visible too** | `shell.env` is the load-bearing one: it is how a session id reaches mcpx without the agent ever seeing it. Its v2 replacement drops exactly the field that makes it work. The v2 answer is better than a workaround, though. v2 has `PUT /api/experimental/session/:id/environment` (`packages/protocol/src/groups/session.ts:786-795`), which sets a session's shell environment _once per session_ rather than once per command. That is the API v2 added for this, and it turns a per-command hook into a per-session call. ### 2.3 `$` is gone v1 hands plugins Bun's shell (`packages/plugin/src/index.ts:56-66`). In v2 `packages/plugin/src/effect/shell.ts` is seventeen lines of interface and no executor — verified directly against the pinned source. `import("node:child_process")` still works, since plugins are `import()`ed into the server process in both versions and nothing sandboxes them. But the runtime no longer _offers_ a way to run a command, and that is a clear signal about direction. mcpx's plugin uses `$` for exactly two things: `mcpx --json status` to find the daemon, and `mcpx log record` as the fallback when it cannot. **Both must stop being required.** That is what §3 is about, and v2 turns it from a performance argument into a portability requirement. ### 2.4 What a plugin can do to the user This is the part that surprised me most: **the server-side plugin API is almost UI-less in both versions.** What a _server_ plugin has is the SDK's `client.tui.*`, identical in v1 and v2: | | | | ------------------------------------------------------ | ---------------------------------------------------------------------- | | `showToast` | `{title?, message, variant: info\|success\|warning\|error, duration?}` | | `appendPrompt`, `submitPrompt`, `clearPrompt` | edit the composer | | `executeCommand` | run a command by name | | `openHelp`, `openSessions`, `openThemes`, `openModels` | fixed dialogs | There is **no generic dialog and no select** over HTTP, in either version. Real UI lives in a **separate TUI plugin**, loaded in a different realm, with its own API: | | v1 `TuiPluginApi` | v2 TUI `Context` | | -------------------- | -------------------------------------------------- | --------------------------------------------------------- | | ask a question | `DialogPrompt`, `DialogSelect` | `prompt()`, `select()` — promises | | toasts | `ui.toast(...)` | `ui.toast.show(...)` | | slash commands | `TuiCommand.slash` (deprecated, use keymap layers) | `KeymapCommand.slash` + `palette: true` | | persistent state | `kv.get/set` | `storage.store(key, {initial})`, disk-backed, live-synced | | slots | 12 host slots | 10 slots with `prepend/append/before/after/replace` | | panels, tabs, routes | routes only | panels, tabs, router | So a guided "which daemon?" flow that _selects_ rather than _types_ needs a TUI plugin, in both versions. A toast and a suggestion can come from the server plugin alone. The other route to a question is a **tool with a permission prompt**: a plugin tool calls `ctx.ask({permission, patterns, always, metadata})`, and the user sees an allow/deny. That is a yes/no channel available from the server plugin, without a TUI plugin — and `always` gives "remember this", which is most of what a daemon choice needs. ⚠️ v1's `permission.ask` **hook** is dead code: declared (`packages/plugin/src/index.ts:261`), documented, and never once invoked. Implementing it is a silent no-op. v2's `permission.hook("evaluate")` is real. ### 2.5 Calling a model | | v1 | v2 | | ------------------------ | ------------------------------------------------------ | ------------------------------------------------- | | full agent turn | ✅ `client.session.prompt` / `promptAsync` / `command` | ✅ same | | **one-shot completion** | ❌ no such route | ✅ `ctx.generate.text({prompt, model?}) → {text}` | | in-session generation | ❌ | ✅ `ctx.session.generate(...)` | | replace the model object | via the v2-style `aisdk` hooks present in the v1 tree | ✅ `aisdk.hook("language")` | This answers a question from the sampling design directly: **in v2 the plugin can answer an MCP `sampling/createMessage` cheaply**, with `ctx.generate.text`. In v1 the only way is a full agent turn, which is far too heavy for what sampling is. ### 2.6 opencode's own MCP client Relevant because mcpx is an MCP server to opencode: | | v1 | v2 | | -------------------------------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------- | | SDK | `@modelcontextprotocol/sdk@1.29.0` + a 647-line downstream patch | `@modelcontextprotocol/client@2.0.0`, one hunk | | declared client capabilities | **`roots` only** (sampling, elicitation, tasks are commented out with issue links) | `roots` + **elicitation** (form and url) | | `sampling/createMessage` | ❌ | ❌ | | protocol negotiation | ❌ fixed to the SDK's latest | ✅ `legacy \| auto \| 2026-07-28` per server | | transports | stdio, Streamable HTTP, **SSE** | Streamable HTTP, hand-written stdio. **No SSE** | | server log forwarding | ✅ | ❌ regression | | prompts/resources `list_changed` | ❌ | ✅ | | OAuth | PKCE + DCR, shared callback port | + CIMD, RFC 8707 resource binding, ephemeral callback | | execution timeout | one value, 30 s | three tiers; execution **12 h** | Consequences for mcpx: - **Neither version will ever send mcpx a sampling request**, because neither declares the capability. mcpx's sampling passthrough is for other clients. - **v2 can answer mcpx's elicitations**; v1 cannot, and will get `cancel`. Until v2, elicitation has to reach the user another way — which is what the broker, `mcpx elicit` and `/v1/elicit` are for. - v2 negotiating `2026-07-28` per server means mcpx's modern-era serving path will actually be exercised. - v2's 12-hour execution timeout makes long `exec` runs viable without tasks. ### 2.7 Process model | | v1 | v2 | | ---------------- | ------------------------------------------------------------------------------------------------ | --------------------------------- | | shape | one process, two Bun realms (worker = server, main = TUI) | two processes, HTTP/RPC between | | default network | **none** — the TUI talks to the server over an in-process fetch; a port opens only with `--port` | HTTP | | plugin isolation | none; `import()` into the realm | none; `import()` into the process | "Default network: none" is why the plugin must not assume it can reach anything over TCP, and why the unix socket matters. Bun's `fetch(url, {unix})` works in both, since plugins run under Bun in the server realm either way. --- ## 3. Design: finding the daemon without a binary See the tracking issue for the full problem statement. The short version: today the plugin runs `mcpx --json status` once per session, and if there is no `mcpx` on `PATH`, it has nothing. In v2 it will not even have `$`. ### 3.1 The ladder Each rung answers "which daemon?" and stops when it has an answer. | # | rung | cost | when it applies | | --- | ------------------------------------------------------------------ | ----------------------------------- | -------------------------------------------- | | 0 | explicit: `MCPX_DAEMON_ENDPOINT`, `MCPX_SOCKET`, or plugin options | free | configured, or remote | | 1 | cached choice for this directory, still alive | one health check | every session after the first | | 2 | **read the daemon info files** | one readdir + one health check each | **no binary needed** | | 3 | ask a live daemon to resolve the directory | one request | two or more candidates | | 4 | `mcpx --json status` in the session directory | one spawn, ~23 ms | a binary exists and rungs 2–3 were ambiguous | | 5 | ask the user | a toast, then a choice | still ambiguous | | 6 | pick the best candidate, warn, keep working | free | headless, or the user did not answer | Rung 6 is the rule the user set: **never fail because there are two.** ### 3.2 Rung 2: the info files already exist The daemon writes `daemon-.json` into its state directory with `pid`, `socket`, `endpoint`, `configPath`, `configHash`, `version` and `startedAt` (`daemon.Paths.WriteInfo`). Everything discovery needs is already on disk. Reading them needs `node:fs`, which both versions have, and no binary at all. Candidates are then filtered to those actually listening — a `GET /v1/health` over each socket, in parallel, a few milliseconds total. A pid file whose daemon is gone is not a candidate. This rung alone resolves the single-daemon case, which is almost every case, **with no `mcpx` on `PATH`**. ### 3.3 Rung 3: any daemon can answer for all of them A daemon already knows how mcpx resolves configuration for a directory. So one live daemon can answer "which socket serves `/path/to/project`?" for _any_ directory, including ones it does not serve itself: ``` GET /v1/resolve?dir=/path/to/project → { socket, configPath, configHash, running } ``` That turns an ambiguous scan into a definite answer without a binary, using a daemon that is already running. It is a small addition to the daemon API and makes rung 4 a rarity. Without it, the cheap approximation is to walk up from the session directory to the nearest `.mcpx.json` and compare it against each info file's `configPath`. That is right most of the time and wrong exactly when configuration is inherited from a parent — which is the case the fingerprint exists to handle. ### 3.4 Rung 5: asking, in ascending order of capability **a. Toast + suggestion (server plugin, v1 and v2).** On boot and on the first mcpx tool use: > mcpx: 2 daemons match this directory. Using `nix` (started 3 h ago, 4 > servers). `/mcpx-daemon` to change. Rate-limited to once per session per reason, so it cannot become noise. **b. A tool with a permission prompt (server plugin, v1 and v2).** An `mcpx_daemon_select` tool whose execution asks `ctx.ask(...)`. The user sees an allow/deny with the daemon's details and an "always" option. This is the only _interactive_ channel a v1 server plugin has, and "always" is exactly "remember this choice". **c. A real picker (TUI plugin).** v1 `DialogSelect`, v2 `select()`. Shows each candidate's start time, config path, server count and live connections, best first. After choosing, a second question offers: this session only / until it goes away / permanently in config / and optionally stop the others. **d. The guided-skill variant.** Instead of a coded walkthrough, a skill tells the agent to call `mcpx_daemon_status`, reason about which daemon fits, and then call `mcpx_daemon_select` with that candidate's index, which is what actually sets the socket. The agent proposes; the _tool_ decides. This is worth doing because it degrades correctly: the agent cannot set the wrong socket by typing a path wrong, because it does not type the path. ⚠️ **The gating idea — block every mcpx tool until a daemon is chosen — is a trap.** It converts "we guessed" into "nothing works", which is the failure mode the user ruled out. Better: proceed with the best candidate, and let every affected tool result carry one line saying which daemon answered and how to change it. ### 3.5 Remembering | scope | where | lifetime | | ------------------ | ------------------------------------------- | --------------------------------- | | this session | plugin memory | the session | | until it goes away | v2 `ctx.storage`; v1 needs a file | until that socket stops answering | | permanent | `daemon.endpoint` in the user's mcpx config | until changed | v1 server plugins have **no storage API**, so "until it goes away" means a small JSON file under the mcpx state directory. v2 has `ctx.storage`, namespaced per plugin. This is a real v1-workaround-fixed-in-v2. ### 3.6 Headless `opencode run`, CI, a GitHub Action: nobody can answer. There, rung 5 is skipped entirely and rung 6 applies — best candidate, one warning line into the log, carry on. The plugin can tell it is headless by whether a TUI client is attached. ### 3.7 Also needed for "no binary" Discovery is only half. The plugin's other `$` use is `mcpx log record`, and its opt-in tools (`mcpx_discover`, `mcpx_exec`, `mcpx_observe`) each spawn `mcpx`. Those must move onto the daemon API: | plugin feature | today | needs | | --------------- | ------------------------------ | ------------------------------------------------ | | tool timing | `POST /v1/log` ✅, no fallback | nothing; with no daemon the record is dropped | | `mcpx_discover` | `mcpx types` / `mcpx ls` | `GET /v1/types`, `GET /v1/namespaces` ✅ (exist) | | `mcpx_exec` | `mcpx exec ` | `POST /v1/exec` ✅ (exists) | | `mcpx_observe` | `mcpx log` / `mcpx stats` | `GET /v1/log`, `GET /v1/stats` ✅ (exist) | `exec` over `/v1` was the one real gap, and it has since landed as `POST /v1/exec`; the streaming-output question it raised is answered by the frames `exec.output` selects (`docs/exec.md`). --- ## 4. What v2 changes about all of this Things that become **unnecessary**: - the `mcpx/` subdirectory (only `default` is read) - hand-namespacing tool names (`tool.transform` namespaces them) - a state file for the remembered daemon (`ctx.storage`) - the `shell.env` per-command hook (session environment API, once per session) Things that become **possible**: - answering MCP sampling with `ctx.generate.text` — cheap, no agent turn - registering MCP servers per session (`mcp.transform`), so mcpx could hand opencode a _filtered_ server set rather than a hand-edited config - putting a budgeted catalog into `session.hook("context")` → `event.tools` instead of appending to the system prompt, with diffs between turns - seeing tool _failures_ in `execute.after` Things that **break**: - the plugin itself: v1 plugins do not load, so v2 needs a rewrite, not a port - `$` - `sessionID` in the shell hook - MCP SSE transport, and MCP server log forwarding (both regressions in v2) Things that are **the same**: - `client.tui.showToast` and the rest of the TUI SDK surface - no isolation; plugins run in the host's realm - Bun's `fetch(url, {unix})`, so the socket fast path survives - **one MCP connection per server per location** — the chrome-sharing problem `OPENCODE-V2.md` describes is unchanged --- ## 5. What is opencode, and what is general For porting to codex, claude, pi, manus, this is the part that matters. | concern | general | opencode-specific | | ------------------------------ | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | **find the daemon** | the whole ladder in §3. Info files, health checks, a resolve endpoint, a cached choice | where config lives; how "the current directory" is known | | **inject a session id** | _that_ mcpx wants one, to attribute calls and route elicitations | `shell.env` (v1) / session environment API (v2). Every harness has a different hook, or none | | **tell the model mcpx exists** | a short, budgeted description; never the tool schemas | `experimental.chat.system.transform` (v1) / `session.hook("context")` (v2) | | **offer tools** | `discover`, `exec`, `observe` as a minimal set | `tool()` + the map (v1) / `tool.transform` (v2) | | **record timings** | `POST /v1/log` over the socket | which hook fires after a tool call, and what it carries | | **ask the user** | that a question must have a default and a deadline | toast vs permission prompt vs TUI dialog | | **remember a choice** | session / until-gone / permanent | `ctx.storage` vs a file | | **answer sampling** | a harness with a model should answer; one without should decline | `ctx.generate.text` (v2 only) | The shape that ports: **a small core that speaks the daemon API over a unix socket, plus a thin adapter per harness.** The core is `plugin/core/daemon.ts` today, and it is already almost harness-free — it takes `$` only for the rung-4 spawn, which §3 removes. Lifting it into a harness-free `core` directory beside `opencode` once a second harness exists would make the split explicit. What each harness needs to provide its adapter: 1. a directory (to resolve which daemon) 2. a session identifier (to attribute and route) 3. somewhere to put environment variables, or a way to wrap tool calls 4. a hook after a tool call, if timings are wanted 5. a way to show a line of text, if ambiguity is to be reported 6. optionally, a way to ask a question and a way to run a model Only (1) and (2) are required. Everything else degrades. --- ## 6. Per-part reference ### `shell.env` → session id injection - **What.** Sets `MCPX_SESSION_ID`, `MCPX_CALL_ID` and friends in the environment of every shell command opencode runs; the full list, with who reads each, is generated in [environment.md](environment.html.md). - **Why.** mcpx needs a session id to attribute calls, lease stateful servers and route elicitations. Passing it through the model's context would spend tokens on something the model neither chooses nor should see. - **How.** v1: the `shell.env` hook, per command, carrying `sessionID` and `callID`. v2: one `PUT /api/experimental/session/:id/environment` per session. - **When it degrades.** No hook, no ids: mcpx attributes calls to "unknown" and leases fall back to whole-daemon scope. - **General or opencode?** The _need_ is general. The mechanism is entirely opencode's. ### The system-prompt line - **What.** A short paragraph telling the model mcpx exists and when to reach for it. - **Why.** The whole point of mcpx is that tool schemas stay out of context. The model still has to know the door is there. - **How.** v1 `experimental.chat.system.transform`; v2 `session.hook("context")`. - **When it degrades.** Without it, the opt-in tools still work when named. ### The opt-in tools - **What.** `mcpx_discover`, `mcpx_exec`, `mcpx_observe`, off by default. - **Why.** An agent that can _write a script_ against the catalog beats one that can only call tools one at a time. Off by default because each adds a tool to every request's tool list, which is exactly the cost mcpx exists to avoid. - **How.** v1 the `tool` map (watch for name collisions — it is not namespaced); v2 `tool.transform` with a namespace. ### The timing hook - **What.** One log record per opencode tool call, into mcpx's log. - **Why.** One `mcpx stats` then covers the harness and mcpx on one timeline. - **How.** `POST /v1/log` over the socket, 0.09 ms. No spawn fallback. - **When it degrades.** No daemon: the record is dropped (`plugin/opencode/mcpx-session.ts:783`). Dropping is correct — a timing is not worth 23 ms on every tool call, and certainly not worth failing one. ### The socket client - **What.** `plugin/core/daemon.ts`: find a daemon, then speak `/v1` to it. - **Why.** 0.17 ms against 23 ms for a spawn, on a path that runs for every tool call. And in v2 there is no spawn available at all. - **How.** Bun's `fetch(url, {unix})`. Node's fetch cannot do this without undici, so a Node harness uses the TCP endpoint instead. - **General or opencode?** Almost entirely general. This is the part to extract when a second harness appears. --- # Overview > mcpx puts every MCP server you have behind one command, so an agent > calls tools from the shell — and their schemas stay out of its context > until it asks for them. --- ## Why install it ### 1. Code mode: tools become shareable, reusable scripts Instead of one-off tool calls inside a chat, the agent writes a TypeScript script that calls tools as ordinary async functions. The script is a file: it can be saved, reviewed, shared and re-run. ```sh mcpx run shot-flow ``` That is `.mcpx/scripts/shot-flow.ts` — screenshot a page, click a link, wait for the load, screenshot again (the full walk is in [the story](story.html.md)). Written once by an agent that had never heard of mcpx; reusable by anyone, forever, as `mcpx run shot-flow`. More: [scripts](scripts.html.md) and the level-2 map's script page ([level-2 page map](level-2-page-map.html.md)). ### 2. Reclaim context: smarter, cheaper Tool schemas are the tax. With seven namespaces and 43 tools installed, discovery costs almost nothing: ``` $ mcpx ls Seven namespaces, 43 tools, 171 tokens ``` The agent loads signatures only for the one namespace it is about to use (`mcpx types `), so the whole screenshot task above ran in about 4,600 tokens total — schemas for 27 browser tools included only when needed, never by default. More: [the story](story.html.md) for the token evidence. ### 3. Tame MCP: one config, every surface, everything corralled - **One config.** mcpx reads the same `mcpServers` object every other MCP host reads. There is no second configuration to keep in sync. - **Share it with your tailnet.** Run the daemon on one machine and let the others talk to it: ```sh mcpx daemon --address --port 8899 MCPX_DAEMON_ENDPOINT=http://:8899 mcpx ls ``` Plainly: **the daemon's API is unauthenticated — whatever can route to the port can run tools as you.** The network is the access control; that is why the example is a tailnet address, not the open internet. - **Corral scripts, APIs and binaries.** Named scripts live in `.mcpx/scripts/`; an OpenAPI service becomes tools with `mcpx api tools --spec ` (served over MCP today); a plain command-line program becomes tools through an adapter (`mcpx adapter check` says whether each one is installed), and adapters are served by the daemon like any other server. More: [configuration](configuration.html.md). ## What it looks like ```mermaid flowchart TB subgraph clients["You and your agents"] CLI["CLI — mcpx ls | search | types | run | exec"] PLUGIN["opencode plugin — no mcpx binary needed"] MCP["MCP host — /mcp on the daemon, or mcpx serve"] HTTP["HTTP client — /v1/* (OpenAPI at /v1/openapi.json)"] end subgraph daemon["mcpx daemon — one per config, autostarts, idle-exits"] POOL["pooled MCP server processes (stdio) and remote servers (HTTP)"] EXTRA["OpenAPI specs and CLI adapters, as tools"] RUNNER["script runner: deno | bun | node subprocess"] end CLI --> daemon PLUGIN --> daemon MCP --> daemon HTTP --> daemon daemon --> POOL daemon --> EXTRA daemon --> RUNNER RUNNER -. "calls back into the daemon" .-> daemon ``` What is running on your machine, in one breath: clients (the CLI, the plugin, an MCP host, plain HTTP) talk over a unix socket or a URL to **one daemon per config**. The daemon owns the pooled MCP server processes, serves OpenAPI specs and CLI adapters as tools, and runs your scripts on a real runtime (deno, bun or node) whose tool calls come back into the daemon. Nothing else is installed and nothing runs until a command needs it: the daemon autostarts on demand and an auto-started one exits after 4 hours idle. ## Next - [Install mcpx](install.html.md) - [Quick start](quick-start.html.md) — the loop in under one screen - [Now what](now-what.html.md) — where to go after the quick start --- # Parity > Everything the CLI can do can be done from a plugin, can be done over > `/v1`, can be done from MCP. That is a claim, and this file is generated from the four declarations it is about, so it cannot describe a surface that does not exist or leave one out. Each direction is also held by a test: | Direction | Held by | | --- | --- | | every `/v1` route has an operation, and every operation a route | `TestEveryDaemonRouteIsDeclared`, `TestEveryDeclaredOpHasARoute` | | every operation that is not a stream has an MCP tool | `TestEveryNonStreamingOpIsReachableAsAnMCPTool` | | every operation has a CLI command, and the generated ones reach their route | `TestEveryOperationIsReachableFromTheCLI`, `TestEveryGeneratedCommandReachesItsRoute` | | every command the binary runs is declared, and every declared one runs | `TestEveryDispatchedCommandIsDeclared` | | every command reaches an operation, or says why it cannot | `TestEveryCommandReachesAnOperationOrSaysWhy` | | every operation has a plugin method, and they work against a real daemon | `TestPluginOpsAreGenerated`, `TestThePluginSuiteRunsAgainstARealDaemon` | | this file | `TestParityDocumentIsCurrent` | A command marked *generated* is built from the operation's declaration -- flags from its parameters, positionals for its path -- so it exists the moment the operation does. The plugin reaches every operation through `DaemonClient.ops` (`plugin/core/ops.gen.ts`, generated the same way); the named methods beside it are conveniences with typed answers. Privileged operations are offered rather than hidden. A caller that can reach the socket can already stop the daemon, so withholding the tool buys no safety and costs an agent the ability to restart a server that has wedged. What they carry instead is a description that says so and MCP annotations (`readOnlyHint`, `destructiveHint`) for a client that wants to scope on them. ## /v1 operations (96) | Operation | Route | CLI | MCP tool | Plugin | Notes | | --- | --- | --- | --- | --- | --- | | `adapters_add` | `POST /v1/adapters` | `mcpx adapter add` | `mcpx_adapters_add` | `ops.adaptersAdd()` | Privileged. | | `adapters_remove` | `DELETE /v1/adapters/{name}` | `mcpx adapter remove` | `mcpx_adapters_remove` | `ops.adaptersRemove()` | Privileged. Destructive. | | `apis_add` | `POST /v1/apis` | `mcpx api add` | `mcpx_apis_add` | `ops.apisAdd()` | Privileged. | | `apis_remove` | `DELETE /v1/apis/{name}` | `mcpx api remove` | `mcpx_apis_remove` | `ops.apisRemove()` | Privileged. Destructive. | | `artifacts_list` | `GET /v1/artifacts` | `mcpx artifact list` *generated* | `mcpx_artifacts_list` | `ops.artifactsList()` | | | `artifact_put` | `POST /v1/artifacts` | `mcpx artifact put` *generated* | `mcpx_artifact_put` | `ops.artifactPut()` | Privileged. | | `artifact_delete` | `DELETE /v1/artifacts/{id}` | `mcpx artifact delete` *generated* | `mcpx_artifact_delete` | `ops.artifactDelete()` | Privileged. Destructive. | | `artifact_get` | `GET /v1/artifacts/{id}` | `mcpx artifact get` *generated* | `mcpx_artifact_get` | `ops.artifactGet()` | | | `ask_begin` | `POST /v1/ask` | `mcpx ask begin` *generated* | `mcpx_ask_begin` | `ops.askBegin()` | | | `ask_poll` | `GET /v1/ask/{id}` | `mcpx ask poll` *generated* | `mcpx_ask_poll` | `ops.askPoll()` | | | `ask_abandon` | `POST /v1/ask/{id}/abandon` | `mcpx ask abandon` *generated* | `mcpx_ask_abandon` | `ops.askAbandon()` | Privileged. Destructive. | | `ask_answers` | `POST /v1/ask/{id}/answers` | `mcpx ask answers` *generated* | `mcpx_ask_answers` | `ops.askAnswers()` | Privileged. | | `authz_decisions_clear` | `DELETE /v1/authz/decisions` | `mcpx authz decisions-clear` *generated* | `mcpx_authz_decisions_clear` | `ops.authzDecisionsClear()` | Privileged. | | `authz_decisions` | `GET /v1/authz/decisions` | `mcpx authz decisions` *generated* | `mcpx_authz_decisions` | `ops.authzDecisions()` | | | `batch` | `POST /v1/batch` | `mcpx batch` | `mcpx_batch` | `ops.batch()` | | | `call` | `POST /v1/call` | `mcpx call` | `mcpx_call` | `ops.call()`, `call()`, `callAsTask()` | | | `call_path` | `POST /v1/call/{server}/{tool}` | `mcpx call` | `mcpx_call` | `ops.callPath()` | | | `call_history` | `GET /v1/calls/{run}` | `mcpx calls get` *generated* | `mcpx_call_history` | `ops.callHistory()` | | | `call_history_begin` | `POST /v1/calls/{run}` | `mcpx calls begin` *generated* | `mcpx_call_history_begin` | `ops.callHistoryBegin()` | | | `catalog` | `GET /v1/catalog` | `mcpx catalog` | `mcpx_catalog` | `ops.catalog()` | | | `catalog_history` | `GET /v1/catalog/history` | `mcpx history` *generated* | `mcpx_catalog_history` | `ops.catalogHistory()` | | | `chat_completions` | `POST /v1/chat/completions` | `mcpx proxy` | `mcpx_chat_completions` | `ops.chatCompletions()` | | | `client_module` | `GET /v1/client.ts` | `mcpx client` | `mcpx_client_module` | `ops.clientModule()` | | | `complete` | `POST /v1/complete` | `mcpx complete` *generated* | `mcpx_complete` | `ops.complete()`, `complete()` | | | `daemon_restart` | `POST /v1/daemon/restart` | `mcpx restart` | `mcpx_daemon_restart` | `ops.daemonRestart()` | Privileged. Destructive. | | `dashboard` | `GET /v1/dashboard` | `mcpx dashboard` | `mcpx_dashboard` | `ops.dashboard()` | | | `diagnose` | `POST /v1/diagnose` | `mcpx diagnose` | `mcpx_diagnose` | `ops.diagnose()` | | | `elicit_list` | `GET /v1/elicit` | `mcpx elicit list` | `mcpx_elicit_list` | `ops.elicitList()`, `pendingElicitations()` | | | `elicit_get` | `GET /v1/elicit/{id}` | `mcpx elicit show` | `mcpx_elicit_get` | `ops.elicitGet()` | | | `elicit_answer` | `POST /v1/elicit/{id}/{action}` | `mcpx elicit answer` | `mcpx_elicit_answer` | `ops.elicitAnswer()`, `answer()` | Privileged. | | `embeddings` | `POST /v1/embeddings` | `mcpx embeddings` | `mcpx_embeddings` | `ops.embeddings()` | | | `embeddings_export` | `GET /v1/embeddings/export` | `mcpx embeddings export` | `mcpx_embeddings_export` | `ops.embeddingsExport()` | | | `embeddings_import` | `POST /v1/embeddings/import` | `mcpx embeddings import` | `mcpx_embeddings_import` | `ops.embeddingsImport()` | | | `events` | `GET /v1/events` | `mcpx events` *generated* | none: a stream; MCP carries it as `subscriptions/listen` | `ops.events()` | Never ends; read it until you are done. | | `exec` | `POST /v1/exec` | `mcpx exec` | `mcpx_exec` | `ops.exec()`, `exec()` | Privileged. | | `feedback` | `POST /v1/feedback` | `mcpx feedback` | `mcpx_feedback` | `ops.feedback()` | | | `globals` | `GET /v1/globals.d.ts` | `mcpx globals` *generated* | `mcpx_globals` | `ops.globals()` | | | `health` | `GET /v1/health` | `mcpx health` *generated* | `mcpx_health` | `ops.health()`, `health()` | | | `intent` | `POST /v1/intent` | `mcpx prompt` | `mcpx_intent` | `ops.intent()` | | | `interactions_list` | `GET /v1/interactions` | `mcpx interactions` | `mcpx_interactions_list` | `ops.interactionsList()` | | | `interactions_get` | `GET /v1/interactions/{id}` | `mcpx interactions show` | `mcpx_interactions_get` | `ops.interactionsGet()` | | | `log_query` | `GET /v1/log` | `mcpx log` | `mcpx_log_query` | `ops.logQuery()`, `logQuery()` | | | `log_record` | `POST /v1/log` | `mcpx log record` | `mcpx_log_record` | `ops.logRecord()`, `record()` | Privileged. | | `metrics_tokens` | `GET /v1/metrics/tokens` | `mcpx metrics tokens` *generated* | `mcpx_metrics_tokens` | `ops.metricsTokens()` | | | `metrics_tools` | `GET /v1/metrics/tools` | `mcpx metrics tools` *generated* | `mcpx_metrics_tools` | `ops.metricsTools()` | | | `namespaces` | `GET /v1/namespaces` | `mcpx ls` | `mcpx_namespaces` | `ops.namespaces()`, `namespaces()` | | | `openapi` | `GET /v1/openapi.json` | `mcpx openapi` | `mcpx_openapi` | `ops.openapi()` | | | `plugin_sessions_list` | `GET /v1/plugin-sessions` | `mcpx plugin-session list` *generated* | `mcpx_plugin_sessions_list` | `ops.pluginSessionsList()` | | | `plugin_sessions_open` | `POST /v1/plugin-sessions` | `mcpx plugin-session open` *generated* | `mcpx_plugin_sessions_open` | `ops.pluginSessionsOpen()` | | | `plugin_session_close` | `DELETE /v1/plugin-sessions/{id}` | `mcpx plugin-session close` *generated* | `mcpx_plugin_session_close` | `ops.pluginSessionClose()` | | | `plugin_session_get` | `GET /v1/plugin-sessions/{id}` | `mcpx plugin-session get` *generated* | `mcpx_plugin_session_get` | `ops.pluginSessionGet()` | | | `preflight` | `POST /v1/preflight` | `mcpx preflight` *generated* | `mcpx_preflight` | `ops.preflight()` | | | `prompt_get` | `POST /v1/prompt` | `mcpx prompts` | `mcpx_prompt_get` | `ops.promptGet()` | | | `prompts` | `GET /v1/prompts` | `mcpx prompts` | `mcpx_prompts` | `ops.prompts()` | | | `protocol` | `GET /v1/protocol` | `mcpx protocol` *generated* | `mcpx_protocol` | `ops.protocol()` | | | `recipes_list` | `GET /v1/recipes` | `mcpx recipes list` | `mcpx_recipes_list` | `ops.recipesList()` | | | `recipe_remove` | `DELETE /v1/recipes/{name}` | `mcpx recipes remove` | `mcpx_recipe_remove` | `ops.recipeRemove()` | Privileged. Destructive. | | `recipe_get` | `GET /v1/recipes/{name}` | `mcpx recipes show` | `mcpx_recipe_get` | `ops.recipeGet()` | | | `recipe_save` | `POST /v1/recipes/{name}` | `mcpx recipes save` | `mcpx_recipe_save` | `ops.recipeSave()` | | | `recipe_run` | `POST /v1/recipes/{name}/run` | `mcpx recipes run` | `mcpx_recipe_run` | `ops.recipeRun()` | | | `refresh` | `POST /v1/refresh` | `mcpx refresh` | `mcpx_refresh` | `ops.refresh()` | Privileged. | | `registry_search` | `GET /v1/registry/search` | `mcpx registry search` | `mcpx_registry_search` | `ops.registrySearch()`, `registrySearch()` | | | `reload` | `POST /v1/reload` | `mcpx reload` | `mcpx_reload` | `ops.reload()` | Privileged. | | `resolve` | `GET /v1/resolve` | `mcpx resolve` *generated* | `mcpx_resolve` | `ops.resolve()`, `resolve()` | | | `resource_read` | `POST /v1/resource` | `mcpx resources` | `mcpx_resource_read` | `ops.resourceRead()` | | | `resource_templates` | `GET /v1/resource-templates` | `mcpx resources --templates` | `mcpx_resource_templates` | `ops.resourceTemplates()` | | | `resources` | `GET /v1/resources` | `mcpx resources` | `mcpx_resources` | `ops.resources()` | | | `restart` | `POST /v1/restart` | `mcpx restart` | `mcpx_restart` | `ops.restart()` | Privileged. Destructive. | | `search` | `GET /v1/search` | `mcpx search` | `mcpx_search` | `ops.search()` | | | `secret_requests_list` | `GET /v1/secret-requests` | `mcpx secrets requests` | `mcpx_secret_requests_list` | `ops.secretRequestsList()` | | | `secret_request_decline` | `DELETE /v1/secret-requests/{id}` | `mcpx secrets decline` | `mcpx_secret_request_decline` | `ops.secretRequestDecline()` | Privileged. | | `secret_request_get` | `GET /v1/secret-requests/{id}` | `mcpx secrets request` | `mcpx_secret_request_get` | `ops.secretRequestGet()` | | | `secrets_list` | `GET /v1/secrets` | `mcpx secrets list` | `mcpx_secrets_list` | `ops.secretsList()` | | | `secrets_unset` | `DELETE /v1/secrets/{name}` | `mcpx secrets unset` | `mcpx_secrets_unset` | `ops.secretsUnset()` | Privileged. Destructive. | | `secrets_set` | `PUT /v1/secrets/{name}` | `mcpx secrets set` | none: a value sent as a tool argument would sit in the model's context and transcript; the CLI reads it from standard input and OpenChamber from a password field | `ops.secretsSet()` | Privileged. | | `servers_list` | `GET /v1/servers` | `mcpx servers list` | `mcpx_servers_list` | `ops.serversList()` | | | `servers_add` | `POST /v1/servers` | `mcpx servers add` | `mcpx_servers_add` | `ops.serversAdd()` | Privileged. | | `servers_remove` | `DELETE /v1/servers/{name}` | `mcpx servers remove` | `mcpx_servers_remove` | `ops.serversRemove()` | Privileged. Destructive. | | `servers_get` | `GET /v1/servers/{name}` | `mcpx servers show` | `mcpx_servers_get` | `ops.serversGet()` | | | `session_release` | `POST /v1/session/release` | `mcpx session release` *generated* | `mcpx_session_release` | `ops.sessionRelease()` | Privileged. | | `sessions_read` | `GET /v1/sessions` | `mcpx sessions read` *generated* | `mcpx_sessions_read` | `ops.sessionsRead()` | | | `settings_list` | `GET /v1/settings` | `mcpx settings list` | `mcpx_settings_list` | `ops.settingsList()` | | | `settings_unset` | `DELETE /v1/settings/{path}` | `mcpx settings unset` | `mcpx_settings_unset` | `ops.settingsUnset()` | Privileged. | | `settings_get` | `GET /v1/settings/{path}` | `mcpx settings get` | `mcpx_settings_get` | `ops.settingsGet()` | | | `settings_set` | `PUT /v1/settings/{path}` | `mcpx settings set` | `mcpx_settings_set` | `ops.settingsSet()`, `putSetting()` | Privileged. | | `shutdown` | `POST /v1/shutdown` | `mcpx stop` | `mcpx_shutdown` | `ops.shutdown()`, `shutdown()` | Privileged. Destructive. | | `stats_query` | `GET /v1/stats` | `mcpx stats` | `mcpx_stats_query` | `ops.statsQuery()`, `stats()` | | | `status` | `GET /v1/status` | `mcpx status` | `mcpx_status` | `ops.status()`, `status()` | | | `tasks_list` | `GET /v1/tasks` | `mcpx task list` *generated* | `mcpx_tasks_list` | `ops.tasksList()`, `tasks()` | | | `task_get` | `GET /v1/tasks/{id}` | `mcpx task get` *generated* | `mcpx_task_get` | `ops.taskGet()`, `task()` | | | `task_cancel` | `POST /v1/tasks/{id}/cancel` | `mcpx task cancel` *generated* | `mcpx_task_cancel` | `ops.taskCancel()`, `cancelTask()` | | | `task_result` | `GET /v1/tasks/{id}/result` | `mcpx task result` *generated* | `mcpx_task_result` | `ops.taskResult()`, `taskResult()` | | | `tools` | `GET /v1/tools` | `mcpx tools` *generated* | `mcpx_tools` | `ops.tools()` | | | `tool_invoke` | `POST /v1/tools/{tool}` | `mcpx tool invoke` *generated* | `mcpx_tool_invoke` | `ops.toolInvoke()` | | | `types` | `GET /v1/types` | `mcpx types` | `mcpx_types` | `ops.types()`, `types()` | | | `writes_clear` | `POST /v1/writes/{server}/clear` | `mcpx writes clear` *generated* | `mcpx_writes_clear` | `ops.writesClear()` | Privileged. | ## CLI commands (75) Every command the binary dispatches, with the operations it reaches. A command that reaches none says why: those are decisions, not gaps. | Command | Operations | Notes | | --- | --- | --- | | `adapter` | `adapters_add`, `adapters_remove` | | | `api` | `apis_add`, `apis_remove` | | | `artifact` / `artifacts` | `artifacts_list`, `artifact_put`, `artifact_delete`, `artifact_get` | Generated from the operation table. | | `ask` | `ask_begin`, `ask_poll`, `ask_abandon`, `ask_answers` | Generated from the operation table. | | `authz` | `authz_decisions_clear`, `authz_decisions` | Generated from the operation table. | | `batch` | `batch` | | | `cache` | – | Reads and prunes the cache directory on this machine; no daemon is involved. | | `call` | `call`, `call_path` | | | `calls` | `call_history`, `call_history_begin` | Generated from the operation table. | | `catalog` | `catalog` | | | `client` | `client_module` | | | `complete` | `complete` | Generated from the operation table. | | `completion` | – | Text about the binary, produced by the binary. | | `config` | – | Reads the configuration files on the caller's search path; `settings` is the running daemon's view. | | `daemon` | – | Starts a daemon, which a daemon's own API cannot do. | | `daemons` | – | Reads every daemon's info file on this machine; one daemon cannot see the others. Daemons with their own state directory mirror their record into the default one, and records whose process is gone are pruned. | | `dashboard` | `dashboard` | | | `diagnose` | `diagnose` | | | `doctor` | – | Checks this machine: binaries on PATH, permissions, configuration files. | | `elicit` | `elicit_list`, `elicit_get`, `elicit_answer` | | | `embeddings` | `embeddings`, `embeddings_export`, `embeddings_import` | | | `events` | `events` | Generated from the operation table. | | `exec` | `exec` | | | `explore` | – | An interactive interface over the reads above; it consumes the API rather than extending it. | | `feedback` | `feedback` | | | `globals` | `globals` | Generated from the operation table. | | `health` | `health` | Generated from the operation table. | | `help` | – | Text about the binary, produced by the binary. | | `history` | `catalog_history` | Generated from the operation table. | | `hook` | – | Reads the resolved `hooks` setting from the configuration chain on this machine. | | `init` | – | Writes a file into the current directory. | | `interactions` | `interactions_list`, `interactions_get` | | | `log` / `logs` | `log_query`, `log_record` | | | `ls` / `list` / `namespaces` | `namespaces` | | | `man` | – | Text about the binary, produced by the binary. | | `metrics` | `metrics_tokens`, `metrics_tools` | Generated from the operation table. | | `openapi` | `openapi` | | | `plugin` | – | Plugin discovery is local: the CLI and daemon read paths.plugins and PATH on this machine, and the daemon serves each plugin as a server of its own. | | `plugin-session` | `plugin_sessions_list`, `plugin_sessions_open`, `plugin_session_close`, `plugin_session_get` | Generated from the operation table. | | `preflight` | `preflight` | Generated from the operation table. | | `prompt` | `intent` | | | `prompts` | `prompt_get`, `prompts` | | | `protocol` | `protocol` | Generated from the operation table. | | `proxy` | `chat_completions` | | | `recipes` | `recipes_list`, `recipe_remove`, `recipe_get`, `recipe_save`, `recipe_run` | | | `refresh` | `refresh` | | | `registry` | `registry_search` | | | `reload` | `reload` | | | `resolve` | `resolve` | Generated from the operation table. | | `resources` | `resource_read`, `resource_templates`, `resources` | | | `restart` | `daemon_restart`, `restart` | | | `run` | – | Resolves a script name against the caller's search path, which only the caller has; the source itself runs anywhere through `exec`. | | `schema` | – | Reshapes what `tools` and `types` return into JSON Schema, OpenAPI or MCP form; the data is those operations', the conversion is local. | | `scripts` | – | Lists the caller's script search path. | | `search` | `search` | | | `secrets` | `secret_requests_list`, `secret_request_decline`, `secret_request_get`, `secrets_list`, `secrets_unset`, `secrets_set` | | | `serve` | – | It is the MCP surface: a stdio shim over the daemon, which serves the same tools at `/mcp` itself. | | `servers` | `servers_list`, `servers_add`, `servers_remove`, `servers_get` | | | `session` | `session_release` | Generated from the operation table. | | `sessions` | `sessions_read` | Generated from the operation table. | | `settings` | `settings_list`, `settings_unset`, `settings_get`, `settings_set` | | | `skills` | – | Manages embedded agent skills. | | `stats` | `stats_query` | | | `status` | `status` | | | `stdio-proxy` | – | It is a byte pipe: it dials the daemon's unix socket on this host and copies stdin/stdout to it, which no /v1 operation can express. | | `stop` | `shutdown` | | | `supervise` | – | Runs in its own process as the re-exec target of the supervised transport; it serves no API. | | `task` / `tasks` | `tasks_list`, `task_get`, `task_cancel`, `task_result` | Generated from the operation table. | | `tool` | `tool_invoke` | Generated from the operation table. | | `tools` | `tools` | Generated from the operation table. | | `tui` | – | An interactive interface over the reads above; it consumes the API rather than extending it. | | `types` | `types` | | | `upgrade` | – | Replaces the running daemon with another binary, a decision for whoever runs the CLI rather than a tool a model can call. | | `want` | – | Local-only: appends to wantlog.jsonl under the state directory, which is never transmitted; there is no /v1 operation for it. | | `writes` | `writes_clear` | Generated from the operation table. | ## Hand-written MCP tools (12) The tools mcpx offered before the operation table existed. Where one already covers an operation, no second tool is generated for it. | Tool | Covers | Summary | | --- | --- | --- | | `batch_call` | – | Alias for mcpx_batch. | | `mcpx_batch` | `batch` | Execute one or more tools in a single turn. | | `mcpx_call` | `call`, `call_path` | Call one tool on one server. | | `mcpx_catalog` | `catalog` | Every namespace with as many tool signatures as fit a token budget. | | `mcpx_exec` | `exec` | Run TypeScript against every server at once. | | `mcpx_log` | – | Query mcpx's durable log: what ran, what it cost, what failed. | | `mcpx_namespaces` | `namespaces` | List every MCP server mcpx knows about, with tool counts. | | `mcpx_registry` | – | Search a public registry of MCP servers that are not yet configured here. | | `mcpx_search` | `search` | Find tools by name and description across every server. | | `mcpx_stats` | – | Aggregate the log: calls, servers, errors, sessions, slowest, volume. | | `mcpx_status` | `status` | The daemon, its pools and live instances. | | `mcpx_types` | `types` | Full TypeScript signatures for named namespaces, including each server's own guidance. | ## Boundaries (5) Every restriction mcpx declares, and whether anything enforces it ([decisions/0003](decisions/0003-declared-vs-enforced-capabilities.html.md)). An enforced one names the tests that try to get round it; an advisory one names the issue that will enforce it. `TestEveryEnforcedBoundaryNamesItsRefusal` holds both. | Restriction | Declares | State | Evidence | | --- | --- | --- | --- | | `transport.allowedOrigins` | a web page on an origin that is not loopback, the daemon's own address or listed in transport.allowedOrigins cannot use /v1 or /mcp | **enforced** | `TestAWebPageCannotRunCodeThroughTheDaemon`, `TestV1AndMCPAgreeOnOrigins` | | `script.permissions` | a script runs with no more than the permission profile named; a runtime with no permission model refuses a narrowed profile | **enforced** | `TestScriptPermissionsIsReachableFromEverySurface`, `TestAStrictScriptCannotReadFilesOnARuntimeWithoutPermissions`, `TestARestrictedProfileIsRefusedByARuntimeThatCannotEnforceIt` | | `elicit.confirmDestructive` | with it on, a call to a tool that may be destructive (annotated destructiveHint, or unannotated) does not run unless somebody confirms it; a remote server's annotation never clears the call (#2191) | **enforced** | `TestADestructiveCallIsRefusedWhenNobodyConfirms`, `TestConfirmDestructiveHoldsOnAColdDaemon` | | `autonomy.max` | mcpx does no more on its own than the daemon's autonomy.max allows: a prompt, a recipe run by name or a configured hook asked for above it is lowered to it and the answer says so, from /v1, the CLI, MCP and the plugin alike. It does not govern code a caller sends to /v1/exec itself | **enforced** | `TestV1CannotRaiseAutonomyAboveTheCeiling`, `TestTheCeilingCannotBeRaisedAtRuntime`, `TestTheCLICannotRaiseAutonomyAboveTheCeiling`, `TestMCPCannotRaiseAutonomyAboveTheCeiling`, `TestThePluginCannotRaiseAutonomyAboveTheCeiling`, `TestHooksFromConfigDoNotRunAboveTheCeiling`, `TestRepairCannotRaiseAutonomyAboveTheCeiling`, `TestACallerCannotRaiseAClampedSetting` | | `privileged operations (Admin)` | operations marked privileged change the daemon rather than read it; nothing checks who calls them, and every tool description and the OpenAPI document say so | **advisory** | #253 | --- # Finding the daemon without the binary What the opencode plugin does when there is no `mcpx` on `PATH`, why each rung of the ladder exists, and what was found building it. ``` id: finding-the-daemon-without-the-binary since: pre-release created: 2026-09-29T21:00:00-05:00 last-updated: 2026-09-29T21:00:00-05:00 status: implemented ``` Since: pre-release · Status: implemented Companion to `docs/opencode-plugin.md`, which records what opencode v1 and v2 offer a plugin. This one records the decisions that followed, and the things that turned out not to be true. --- ## 1. The requirement, restated The binary must not be a precondition. Two reasons, one of them forced: - a daemon may be running under launchd, in a container, or on another host, with no `mcpx` on the plugin's `PATH`; - opencode v2 removes Bun's `$` from the plugin API. `node:child_process` still works, but the runtime no longer _offers_ a way to run a command, and building on one it does not offer is building on sand. And the harder half: **never fail because there are two.** A plugin that refuses to work until the user disambiguates has converted "we guessed" into "nothing works", which is worse than the guess. --- ## 2. `GET /v1/resolve` The one new daemon endpoint. It answers "which daemon serves this directory?" for _any_ directory, from _any_ live daemon, because the answer is a function of mcpx's configuration search path and not of what the asked daemon happens to have loaded. ``` GET /v1/resolve?dir=/abs/path → { socket, endpoint, configPath, configHash, running, sources } ``` Three things were needed to make it honest. **It must not chdir.** `config.SearchPath()` walked up from `os.Getwd()`, which a server cannot change without racing every request in flight. So `SearchPathFrom(dir)` and `LoadFrom(explicit, dir)` were added and the existing functions now delegate to them. That is the only edit outside this feature's own files. **It must resolve symlinks first.** `FingerprintConfig` already resolves the files it hashes, for exactly this reason: `/tmp` is a symlink to `/private/tmp` on macOS, so a caller whose `$PWD` holds the unresolved spelling computed a different key for the same project and was told nothing was running. The directory has to get the same treatment before the walk, or the bug comes back one level up. **It must prefer the info file's socket.** The daemon key names the socket only when the state path fits in `sun_path`; beyond 100 bytes the socket moves to a private runtime directory and only the info file knows where. A resolver that trusted the key would hand out a path with nothing behind it. ### A name collision worth recording `daemon-.json` contains a field called `configHash`, and it is **not** the key in the file name. The field is `HashConfig(raw)` — a digest of the server definitions, used to invalidate the schema cache. The file name is `FingerprintConfig(sources)` — the daemon key, over every path and every byte that contributed. Two different numbers for the same daemon, under one name. `/v1/resolve` returns the _key_, because that is what identifies a daemon. Renaming the field in the info file would be the real fix; it is out of scope here and is reported rather than done. --- ## 3. The ladder | # | rung | cost | applies when | | --- | -------------------------------------- | -------------------------------- | -------------------------------------------- | | 0 | explicit endpoint or socket | free | configured, or remote | | 1 | the remembered choice, still answering | one health check | every session after the first | | 2 | the `daemon-*.json` info files | readdir + parallel health | the usual case | | 3 | `/v1/resolve` against any live daemon | one request | two or more candidates | | 4 | `mcpx --json status` | one spawn, ~23 ms | a binary exists and rung 3 was not available | | 5 | ask | a toast, a prompt, or the picker | still ambiguous, and someone is there | | 6 | best candidate, warn, carry on | free | headless, or unanswered | Rung 5 is deliberately **not** in the core. The core returns the candidates and a warning; whether anyone can be asked, and how, is the adapter's business, and it differs per harness. That keeps `mcpx/daemon.ts` free of opencode. ### Rung 2 looks in three directories, not one The info file is always in the state directory. The socket is not: too long a state path sends it to `$XDG_RUNTIME_DIR/mcpx`, and failing that to `$TMPDIR/mcpx-`. Sockets are therefore scanned in all three, and any that has no info file is still health-checked — a daemon with a deleted info file is still a daemon. A socket that is not owned by this user is skipped without dialing. The socket's permissions are the access control for the whole API; connecting to another user's would send this session's calls to somebody else's servers. ### Rung 3 stops at the first definite answer If a daemon answers and names a socket that is live and among the candidates, that is the answer. If it answers and says nothing is serving this directory, the loop stops rather than asking the next daemon: they all compute the same function, so a second opinion is the same opinion. ### Rung 0 does not fall through A named endpoint that is not answering returns _that endpoint_ with a warning, never a local daemon. Answering from the wrong machine — wrong servers, wrong credentials, possibly wrong data — is worse than answering not at all. This matches what the CLI already does (`will not start a local one`). --- ## 4. Asking, in a harness with almost no interface A v1 server plugin has `client.tui.showToast` and a few fixed dialogs. There is no generic dialog and no select over HTTP, in either version. So: - **A toast**, on boot and on first use, once per session per reason. - **One line on every mcpx tool result**, naming the daemon that answered. Cheaper than a toast and impossible to miss in a transcript. - **`mcpx_daemon_select`**, whose execution raises `ctx.ask(...)`. That is the only interactive channel a v1 server plugin has, and it is a good one: the user sees the daemon's config path, start time, version and session count in the permission metadata, and `always` is exactly "remember this". - **`mcpx-tui.tsx`**, optional, for a real list you arrow through. The tool takes an **index**, not a path. The agent reads `mcpx_daemon_status`, reasons about it, explains its recommendation, and names a number; the tool turns that into a socket. The agent cannot mistype a path it never types. This is why the guided skill beats a coded walkthrough: it degrades correctly when the agent is confused. ⚠️ v1's `permission.ask` _hook_ is dead code — declared, documented, never invoked. Nothing here is built on it. ### Detecting headless `showToast` publishes an event and returns true whether or not anyone is listening, so it cannot be asked. The process shape can: `opencode tui` runs the server in a `Worker` and the interface on the main thread, while `opencode run`, `opencode serve` and every CI invocation run the server on the main thread with nothing attached. So `isMainThread` from `node:worker_threads` is, in v1, exactly "no TUI attached". `MCPX_PLUGIN_HEADLESS` overrides it. Being wrong in the safe direction costs a toast nobody sees. Being wrong the other way would hang a headless run on a question — which is why no automatic path ever raises a permission prompt. Only `mcpx_daemon_select`, which an agent calls deliberately, asks anything. --- ## 5. Remembering | scope | where | why there | | ---------------------- | --------------------------------------- | ---------------------------------------------------- | | session | plugin memory | it should not outlive the session | | until-gone, indefinite | `$MCPX_STATE_DIR/opencode-daemons.json` | **v1 server plugins have no storage API** | | permanent | `PUT /v1/settings/daemon.endpoint` | it is a user preference, and mcpx already owns those | The file is keyed by directory, written through a rename, and read at rung 1 before the scan. `ctx.storage` in v2 replaces it exactly. The TUI picker writes the same file — it is the only channel between the two realms — so the server plugin re-reads it when its copy has gone stale. Five seconds: never would make the picker take effect only in the next session, and always would put a file read in front of every tool call. --- ## 6. What else had to stop spawning Discovery was half the problem. The rest: | feature | before | now | | --------------- | ------------------------------ | ------------------------------------------------------ | | tool timing | `POST /v1/log`, spawn fallback | `POST /v1/log`, and **drop** the record with no daemon | | `mcpx_discover` | `mcpx ls` / `mcpx types` | `GET /v1/namespaces`, `GET /v1/types` | | `mcpx_observe` | `mcpx log` / `mcpx stats` | `GET /v1/log`, `GET /v1/stats` | | `mcpx_exec` | `mcpx exec` | `POST /v1/exec`, falling back on 404 | Dropping the timing record is the right failure. A timing is not worth 23 ms on every tool call, and certainly not worth failing one. The `backend` setting (`auto`, `v1`, `cli`) makes the fallback explicit. `v1` is the honest setting for a machine with no binary: a missing daemon then reports a missing daemon, rather than a missing command. --- ## 7. What is general and what is opencode `mcpx/daemon.ts` imports nothing from opencode. It uses `fetch`, `node:fs`, `node:os`, `node:path` and `node:child_process`, and nothing else. The ladder, the info-file format, the health filtering, the ranking and the remember file are all about mcpx; `mcpx-session.ts` is the part that is about opencode. What a second harness has to provide: a directory, a session id, somewhere to put environment variables, and — optionally — a hook after a tool call, a way to show a line of text, and a way to ask a yes/no. Only the first two are required; everything else degrades. --- ## 8. Constants The Go side puts every constant in `internal/defaults/defaults.json`; this feature adds `resolve.dialTimeout`. The plugin cannot read that file — it ships as loose files copied into an opencode config directory, with no mcpx installation implied. So it has the same idea in the only form available: one `TUNING` table at the top of `mcpx/daemon.ts`, with every timeout, limit and file name in it, and each value overridable through the options a harness passes in. --- # Plugins "Plugin" means two different things in this project, and every page in this set says which one it means: | meaning | direction | exists today | | ---------------------------------------------------------------- | ------------------ | --------------------------------------------------- | | **harness plugin**: code that plugs mcpx _into_ an agent harness | a consumer of mcpx | yes: the opencode plugin, under `plugin/opencode/` | | **mcpx plugin**: an extension _of_ mcpx itself | extends mcpx | no: there is no plugin concept in the daemon at all | Nearly everything below is about the first meaning. The second gets a short status section at the end of the first section, and stays a stub until the extensibility work that designs it lands. ## Plugins ### Harness plugins: mcpx inside your agent A harness plugin is **optional**. Any harness with a shell can use mcpx through `AGENTS.md` alone: the agent runs `mcpx` commands, and mcpx needs nothing from the harness to answer them. What the harness cannot give that way is _identity_ — and identity is what the plugin adds: - **the session id**, so `session`-scoped servers persist across commands and two agents running at once lease separate server processes instead of corrupting one shared browser; - **the socket fast path**: about 0.17 ms per call over the daemon's unix socket, against about 23 ms for spawning the binary — which is why the plugin also means **no `mcpx` on `PATH` is required** for any of it (the one exception is rung 4 of daemon discovery, below, a last fallback that runs the binary only when one exists); - **optional extras**: tools offered to the model, a system-prompt line, tool timing records, and a picker for choosing between daemons. Hosts that only speak MCP need no plugin at all: point them at `mcpx serve --transport stdio` or the daemon's `/mcp` endpoint and mcpx is just an MCP server to them. Session scoping still works there, but it is mcpx's own transport session — a stable per-process key (`mcp-` for a stdio server) — not the harness's session. What those hosts do not get is _harness-session identity_: nothing ties the MCP connection to the agent session that spawned it, so two agents sharing one MCP server process share its session scope too. That identity is the trade the plugin exists to provide. ### mcpx plugins: extending mcpx Not built. There is no plugin concept in the daemon: no loading, no hooks, no extension API. The design space — Go, binary, script or remote plugins, hooks, variables — is tracked by the extensibility issues on the repository (#80, #82, #83 in the original numbering; see the issue for this page, #1855). Until that work lands, the ways to extend what mcpx can reach are the built-in ones: a command-line program becomes tools through an adapter, an OpenAPI document becomes tools through `mcpx api`, and a saved script or recipe runs by name. This section stays a stub so the word "plugin" is never left ambiguous: if a page does not say "mcpx plugin", it means the harness kind. ## Plugin compatibility Every cell cites a source or says "unknown". Nothing here is guessed, and no support is claimed before an adapter exists. | harness | plugin | how mcpx reaches it today | session id | source | | --------------------- | -------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | opencode v1 (1.18.31) | yes, `plugin/opencode/` | plugin, or shell + `AGENTS.md` | injected by the `shell.env` hook | `plugin/opencode/README.md`; `docs/opencode-plugin.md` §2, §6 | | opencode v2 (2.0.3) | no: v1 plugins do not load | shell + `AGENTS.md`, or mcpx as an MCP server in its `mcp` config | not injected; needs the v2 session environment API | `docs/opencode-plugin.md` §4; see [opencode v2 plugin](plugins.html.md#opencode-v2-plugin) below | | codex | no | shell + `AGENTS.md`; MCP | unknown | adapter design: `docs/opencode-plugin.md` §5 | | claude code | no | shell + `AGENTS.md`; MCP | unknown | adapter design: `docs/opencode-plugin.md` §5 | | pi | no | unknown | unknown | adapter design: `docs/opencode-plugin.md` §5 | | manus | no | unknown | unknown | adapter design: `docs/opencode-plugin.md` §5 | | any MCP host | not needed | `/mcp` or stdio | no harness session; mcpx derives its own transport session (`mcp-` for stdio) | `internal/cli/serve.go` | One runtime note: the portable core dials the socket with Bun's `fetch(url, {unix})`. A Node-based harness cannot use that option, so it uses `MCPX_DAEMON_ENDPOINT` and the daemon's TCP listener instead. Everything else in the core is runtime-neutral. ## Plugin interface and config There are two interfaces — plugin to harness, and plugin to daemon — and one configuration surface. ### Plugin to harness The opencode plugin uses four hooks (`docs/opencode-plugin.md` §2.2): | hook | what it carries for mcpx | without it | | ------------------------------------ | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `shell.env` | `MCPX_SESSION_ID`, `MCPX_CALL_ID` and the rest of the injected environment, per shell command | no ids: calls are attributed to "unknown" and session-scoped leases fall back to **per-call isolation** — each invocation gets its own lease keyed by its call id, so state does not persist across commands and anything stateful must happen inside one invocation | | `experimental.chat.system.transform` | the opt-in system-prompt line saying mcpx exists | the opt-in tools still work when named; the model may never reach for mcpx | | the `tool` map | the opt-in tools `mcpx_discover`, `mcpx_exec`, `mcpx_observe` | mcpx is shell-only, which is the default anyway | | `tool.execute.after` | one timing record per tool call, into mcpx's log | no harness timings; `mcpx stats` covers mcpx alone | The names are the code's names: the plugin sets `MCPX_SESSION_ID` (`plugin/opencode/mcpx-session.ts`), `MCPX_CALL_ID` and `MCPX_PARENT_SESSION_ID`, and those are the names the `session` and `parent-session` scopes read. (`MCPX_SESSION` without a suffix is a different, live variable: mcpx sets it for each script it runs. It is not the plugin's variable and must not be conflated with it.) ### Plugin to daemon The portable core, `plugin/core/daemon.ts`, imports nothing from opencode. Its `DaemonClient` / `connect()` finds a daemon by walking a ladder and stopping at the first answer (full design: [plugin-discovery.md](plugin-discovery.html.md)): | # | rung | applies when | | --- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 0 | an `endpoint` or `socket` named outright, by option or environment | configured, or remote — and it never falls back to a local daemon | | 1 | the choice remembered for this directory, still answering | every session after the first | | 2 | the `daemon-*.json` info files the daemon publishes | **the usual case; no binary needed** | | 3 | `GET /v1/resolve` against any live daemon | two or more candidates | | 4 | spawn `mcpx --json status` | a binary exists and the daemons are too old for rung 3 — the only rung that runs the binary. `backend: v1` does **not** suppress this spawn: the backend guard governs the tool-execution fallback, and discovery still spawns when no daemon is discoverable. Only `bin: ""` forbids spawning outright | | 5 | ask the user (toast, picker, or `mcpx_daemon_select`) | still ambiguous, and someone is there | | 6 | the best candidate, with a warning | headless, or unanswered — the ladder never fails just because there are two | `connect` returns `{ client: undefined }` rather than throwing: a plugin that fails to load because mcpx is not running has broken the editor for a tool the user may not even be using. ### For authors of plugins for other harnesses The core is harness-free on purpose; an adapter per harness supplies the rest. What an adapter must provide (`docs/opencode-plugin.md` §5): 1. a directory, to resolve which daemon; 2. a session identifier, to attribute and route; 3. somewhere to put environment variables, or a way to wrap tool calls; 4. a hook after a tool call, if timings are wanted; 5. a way to show a line of text, if ambiguity is to be reported; 6. optionally, a way to ask a question and a way to run a model. Only (1) and (2) are required. Everything else degrades. ### Configuration Precedence is **plugin option > environment variable > default**. Options reach the plugin only when it is named in the opencode config as a two-element array — a plugin merely dropped into the `plugin/` directory gets no options, so the environment variables are the way to configure a drop-in installation (see [opencode v1 plugin](plugins.html.md#opencode-v1-plugin)). The table below is derived from **one declared list**: the registry's `plugin.*` settings, declared in `internal/settings/plugin.go` (`pluginSettings()`), which is also what `mcpx settings` reports and what the settings tests pin against the plugin's sources in both directions. The two options that are not settings — `endpoint` and `socket`, which name a daemon rather than tune the plugin, and are read before any settings exist — are declared alongside the table, not in the registry. If an option is missing from this table, that is a bug in the table's source list, not a detail to fix in the table: `discoveryRetry` went missing from the plugin README's hand-maintained table exactly that way. | option | variable | default | effect | | ------------------------------------- | --------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `endpoint` _(not a setting)_ | `MCPX_DAEMON_ENDPOINT`, `MCPX_ENDPOINT` | — | a daemon named outright: `http://host:port` or `unix:///path`. Stops the ladder. | | `socket` _(not a setting)_ | `MCPX_SOCKET` | — | a socket named outright. Stops the ladder. | | `bin` | `MCPX_PLUGIN_BIN` | `mcpx` | the binary for rung 4. `""` forbids spawning anything. | | `binArgs` | `MCPX_PLUGIN_BIN_ARGS` | — | arguments put in front of every plugin invocation of mcpx (the case this exists for is `--config` or `--profile`). | | `backend` | `MCPX_PLUGIN_BACKEND` | `auto` | `auto` prefers the socket and spawns only as a fallback; `v1` refuses the spawn fallback for tool execution (discovery may still spawn when no daemon is discoverable — `bin: ""` is the way to forbid spawning entirely); `cli` never uses the socket. | | `discoveryRetry` _(environment only)_ | `MCPX_PLUGIN_DISCOVERY_RETRY` | `60s` | how long the plugin waits before looking for mcpx again after a failed lookup, so an editor without mcpx does not pay for a failed spawn on every keystroke. Declared in the registry, but the adapter reads it from the environment only — passing it as a plugin option is silently ignored. | | `toolTiming` | `MCPX_PLUGIN_TOOL_TIMING` | off | record opencode's tool timings into mcpx's log, so one `mcpx stats` covers both. | | `env` | `MCPX_PLUGIN_ENV` | `full` | how much session context is injected into each command's environment: `minimal`, `standard`, `full` (the lists are under [opencode v1 plugin](plugins.html.md#opencode-v1-plugin)). | | `instructions` | `MCPX_PLUGIN_INSTRUCTIONS` | off | add mcpx usage guidance to the system prompt. | | `tools` | `MCPX_PLUGIN_TOOLS` | off | offer `mcpx_discover`, `mcpx_exec` and `mcpx_observe` as tools the model can call. | | `remember` | `MCPX_PLUGIN_REMEMBER` | `session` | how long a chosen daemon stays chosen: `session`, `until-gone`, `indefinite`. | | `annotate` | `MCPX_PLUGIN_ANNOTATE` | on | add one line to each mcpx tool result naming the daemon that answered, when more than one matched. | | `headless` | `MCPX_PLUGIN_HEADLESS` | `auto` | suppress toasts, because nobody is looking at a screen. `auto` decides from the process shape. | | `daemonTools` | `MCPX_PLUGIN_DAEMON_TOOLS` | `auto` | offer `mcpx_daemon_status`, `mcpx_daemon_select` and `mcpx_daemon_forget`. `auto` offers them when `tools` is on, or when discovery found more than one daemon. | `MCPX_STATE_DIR` and `XDG_STATE_HOME` are read too, because that is where the daemon publishes its info files and where the remembered choice is kept. They are mcpx's variables, not the plugin's. The full configuration reference is [configuration.md](configuration.html.md). ## opencode v1 plugin This section is about the **harness plugin** for opencode v1 (1.18.31) — the one plugin that ships today. It lives in `plugin/opencode/`; the install and reference material is `plugin/opencode/README.md`, and the design is [opencode-plugin.md](opencode-plugin.html.md). ### What ships | file | what it is for | | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `plugin/opencode/mcpx-session.ts` | the opencode adapter: hooks, tools, toasts, and the session id. The only file opencode loads as a plugin. | | `plugin/core/daemon.ts` | the portable core: the daemon HTTP client, the discovery ladder, and the remembered-choice file. Imports nothing from opencode. | | `plugin/opencode/mcpx-tui.tsx` | optional TUI plugin: an arrow-key picker for the daemon. A different realm with a different API, installed separately. | | `plugin/opencode/skills/` | four skills: `mcpx-basics`, `mcpx-observability`, `mcpx-browser`, `mcpx-daemon`. The same directories are embedded in the mcpx binary and served over MCP, so an MCP host can load them without copying anything. | ### Install By hand, with `cp -R` — there is no packaged install, and the Nix configuration does not install the plugin: ```sh mkdir -p ~/.config/opencode/plugin cp -R mcpx-session.ts mcpx ~/.config/opencode/plugin/ # optional, and a separate artifact: the arrow-key daemon picker cp mcpx-tui.tsx ~/.config/opencode/plugin/ # skills are separate again cp -R skills/mcpx-daemon ~/.config/opencode/skills/ ``` (run from `plugin/opencode/`). `mcpx/` must stay a subdirectory: opencode v1 loads every file directly in `plugin/` and calls each of its exports as a plugin, so `daemon.ts` beside `mcpx-session.ts` would have its helpers called as plugins. The glob is not recursive, so one level down the core is only ever imported. To pass options, name the plugin in opencode's config as a two-element array; a drop-in file gets none: ```jsonc { "plugin": [["./.opencode/plugin/mcpx-session.ts", { "tools": true, "backend": "v1" }]], } ``` Every option also has the environment variable in the table under [plugin interface and config](plugins.html.md#plugin-interface-and-config), which is the way to configure a drop-in installation. ### What gets injected How much goes into each shell command's environment is the `env` option: - `minimal`: `MCPX_SESSION_ID` only. - `standard` adds what the hook is handed directly, what the plugin knew at startup, and the daemon this session settled on — `MCPX_CALL_ID`, `MCPX_PROJECT_ID`, the worktree and harness variables, and `MCPX_DAEMON_ENDPOINT`, so a shell command that runs `mcpx` talks to the same daemon the plugin does instead of walking its own ladder. - `full` (the default) adds what needs a lookup, done once per session and cached: `MCPX_PARENT_SESSION_ID`, the session title, directory, version, depth, creation time and age, and the full trace ancestry in `MCPX_TRACE_IDS`. Environment variables are not context: the model never sees them, so anything cheap goes in. The full list, with who reads each variable, is in [environment.md](environment.html.md). ### The tools With `tools: true`, the plugin offers `mcpx_discover`, `mcpx_exec` and `mcpx_observe`, each speaking the daemon API first and falling back to the binary only when there is no daemon (never under `backend: v1`). They are **off by default** because an agent with a shell can already run mcpx, and a tool definition costs context on every request whether or not it is used. Turn them on when the agent has no shell, when you want mcpx calls visible as tool calls in the transcript, or when a model keeps forgetting mcpx exists. The daemon tools — `mcpx_daemon_status`, `mcpx_daemon_select`, `mcpx_daemon_forget` — answer the which-daemon question when discovery found more than one. They gate nothing; work proceeds on the best candidate with a warning until somebody chooses. Two more options, both off by default for the same context-cost reason: `instructions` adds four lines of mcpx usage guidance to the system prompt, paid on every request for the life of the session; `toolTiming` records every opencode tool call into mcpx's log (a 0.09 ms POST over the socket; with no daemon the record is dropped, never spawned — a timing is not worth 23 ms). ### The TUI picker `mcpx-tui.tsx` adds one palette command, **mcpx: choose daemon**: each daemon's project, start time, server count and version, then how long the choice should stick. It is a separate plugin because the TUI runs in a different realm with a different API — a v1 module may export `server` or `tui`, never both — and a choice made there reaches the server plugin through the remembered-choice file. ### Interplay with opencode's own code mode None, and none needed. opencode v1 ships its own code mode behind `OPENCODE_EXPERIMENTAL_CODE_MODE`, which moves MCP tools out of the model's tool list; the mcpx plugin does not conflict with it, and the plugin needs nothing in opencode's `mcp` config — it reaches the daemon itself, over the socket. ## opencode v2 plugin **Status: not built.** This section is about the **harness plugin** for opencode v2 (2.0.3), and it is a status section, not a feature description: v1 plugins do not load in v2 at all, so the plugin needs a rewrite, not a port. The work is tracked in the repository's issues (#47 in the original numbering; see #1855), and the full design is in [opencode-plugin.md](opencode-plugin.html.md) §4 and the compendium it links. On opencode v2 today: 1. **Shell + `AGENTS.md` works**, with no session id — so `session`-scoped servers are isolated per call rather than per session. 2. **Or add mcpx as an MCP server**: `mcpx serve --transport stdio` in v2's `mcp` config. One caveat: v2 defaults MCP servers to code mode, so mcpx's own tools end up wrapped inside v2's code mode, and v2 does not recognise mcpx and turn that off for it automatically. For a remote mcpx server it instead appends `?codemode=false` to the URL (mcpx answers that request with every upstream tool, flat — see [mcp.md](mcp.html.md)), so v2's own code mode can orchestrate the pooled servers directly. To opt mcpx out of v2 code mode instead — the model calls mcpx's gateway tools directly, and no parameter is appended — set `codemode: false` on the server in v2's `mcp` config; [mcp.md](mcp.html.md) shows the concrete example. What the rewrite changes, when it happens: - **Unnecessary:** the `mcpx/` subdirectory (only `default` is read), hand- namespacing tool names, a state file for the remembered daemon (`ctx.storage` exists), and the per-command `shell.env` hook (the session environment API sets a session's shell environment once per session). - **Possible:** answering MCP sampling with `ctx.generate.text`; registering MCP servers per session, so mcpx could hand opencode a filtered server set; putting a budgeted catalog into the session context hook instead of the system prompt; seeing tool _failures_ in the after-hook, not just successes. - **Breaks:** the plugin itself, Bun's `$` (gone from the v2 plugin API — the other reason the plugin must not need the binary), `sessionID` in the shell hook (its replacement carries no session id), and MCP SSE transport. - **The same:** the TUI SDK surface, no isolation (plugins run in the host's realm), and Bun's `fetch(url, {unix})` — so the socket fast path survives the rewrite. One v1 quirk worth knowing while both versions are in use: v1.18.31 runs both plugin systems at once, so a v2 plugin file dropped into a v1 `plugin/` directory is loaded by the v2 host and rejected, harmlessly, by the v1 loader. ## vibeMcp Placeholder: what "vibeMcp" means is an open question for the user (open question 1 on #1855) — this anchor holds the name, and no meaning is guessed here until the user answers. --- # Proposals Open design questions and answers. Nothing here is committed to; the point is to make the decisions visible before they are made. Shipped work moves to [`story.md`](story.html.md) under the feature list. --- ## Answers about what exists today Before proposing anything, the current state, verified in the code. **Shared servers are started lazily and _do_ shut down.** Nothing starts at daemon boot except the schema warm, which starts each server once to read `tools/list` and lets it idle out. `ReapIdle` runs on a 30-second timer against each server's `idleTimeout` (default 5m), and a shared instance is reaped when `len(instances) > Min`, where `Min` defaults to 0. So the steady state for an unused server is zero processes, and the next call pays a cold start. **Today's `session` mode is per-script-run.** `mcpx run` mints a fresh key per invocation and releases it when the process exits. `--session ` overrides it, which means "named" already half-exists. Nothing is aware of an opencode session, a repo, or a worktree. **There are no ports.** stdio servers are pipes; only `url` servers have a port and it is theirs. The predecessor's port-assignment machinery was deleted on purpose. **Config is first-file-wins with no merge.** A project `.mcpx.json` replaces the user config entirely rather than adding to it. See below — this is wrong. **Server-provided `instructions` are parsed and discarded.** `initialize` returns an `instructions` string; `mcpx` reads it into a struct field nothing consumes. Descriptions and namespaces come only from config. **Scripts have no declared contract.** stdout and stderr both pass through, the exit code propagates, and there is no log helper, no structured return, and no entry-point convention. --- ## ~~Modes and scopes~~ — shipped ``` id: modes-and-scopes-shipped status: shipped ``` Status: shipped Built. See [Sharing and scope](story.html.md) in the feature list. The retired `mode` key is now a hard error carrying a migration hint rather than a silent default. What follows is the original proposal, kept for the reasoning. ``` impact: breaking config change ``` The current single `mode` axis conflates two independent questions. The proposal is to split them. **`sharing`** — how many callers may use one process at a time. | value | meaning | | ----------- | ------------------------------------------------------------------- | | `shared` | many concurrent callers per process; MCP multiplexes by JSON-RPC id | | `exclusive` | one caller at a time; others queue | **`scope`** — what key selects a process. One process per distinct key value. | scope | key | who computes it | | ---------------- | -------------------------------------------------- | --------------- | | `global` | constant | mcpx | | `repo` | `git rev-parse --git-common-dir` | mcpx | | `worktree` | `git rev-parse --show-toplevel` | mcpx | | `cwd` | working directory | mcpx | | `session` | `$MCPX_SESSION_ID`, else the run key | **caller** | | `parent-session` | `$MCPX_PARENT_SESSION_ID`, else `$MCPX_SESSION_ID` | **caller** | | `call` | fresh per invocation | mcpx | | `named:` | the literal string | caller | | `pid:` | the pid | caller | Today's modes become aliases, so existing configs keep working: | today | becomes | | --------- | ----------------------------------- | | `shared` | `sharing: shared`, `scope: global` | | `pooled` | `sharing: exclusive`, `scope: call` | | `session` | `sharing: exclusive`, `scope: call` | That last row is the honest mapping: today's `session` **is** per-call. ### The part mcpx cannot do alone `scope: session` needs an identifier mcpx has no way to discover. A subagent and its parent are different processes with different pids and the same cwd; only the agent host knows they differ. So the contract is an environment variable. Callers that know their session export `MCPX_SESSION_ID` and, if nested, `MCPX_PARENT_SESSION_ID`. Everything else — `repo`, `worktree`, `cwd`, `call` — mcpx computes itself and works with no cooperation. For opencode specifically that means either a plugin that adds the variable to the shell environment (v1 `shell.env`, v2 `shell.hook["create.before"]`), or an instruction telling the agent to pass `--session`. The plugin is better because it cannot be forgotten. **Recommendation for the current servers:** `chrome-devtools` at `sharing: exclusive, scope: session` once the variable exists, `scope: call` until then. Everything else stays `sharing: shared, scope: global`. ### Lifetime A scope needs a teardown rule or it leaks. | scope | released when | | ----------------------------------- | ------------------------------------------ | | `call` | the process exits (today) | | `cwd`, `repo`, `worktree`, `global` | idle timeout | | `session`, `named` | idle timeout, or `mcpx session stop ` | | `pid` | the watched pid exits | `pid:` is worth building early and is cheap: poll `kill(pid, 0)` on the existing 30-second reaper tick. It gives an agent host a way to say "this browser belongs to that process" without any protocol. --- ## Session introspection ``` id: session-introspection status: proposed depends: modes and scopes ``` Status: proposed A lease should be an addressable object. ``` mcpx session ls scope, key, server, pid, uptime, idle, calls mcpx session show mcpx session stop mcpx session rename mcpx session set --idle-timeout 30m mcpx session watch follow its calls live ``` Recorded per lease at creation: created-at, scope, key, server, instance id, child pid, creator pid, creator cwd, creator hostname, creator username, `MCPX_SESSION_ID` and parent if supplied, and the mcpx version. Recorded per attach and detach: timestamp, pid, cwd, and how it ended (released, idle, killed, pid-gone). The same data behind `mcpx --json session ls` and as a client import, so a script can look at its own lease and adjust its own timeout. --- ## Logging ``` id: logging status: proposed ``` Status: proposed Two stores, because they answer different questions. **JSONL files**, one per daemon, at `$XDG_STATE_HOME/mcpx/logs//.jsonl`. Append-only, buffered, flushed on a 200 ms tick and on shutdown. One object per line with `ts`, `level`, `server`, `instance`, `session`, `scope`, `tool`, `dur_ms`, `msg`, plus free-form fields. Cheap to write, trivially greppable, survives anything that does not `SIGKILL`. **A SQLite index** at `.../logs/index.db` with one row per _call_ rather than per log line — server, tool, session, start, duration, ok, bytes in and out. That is the table `mcpx stats` reads. Keeping it call-grained rather than line-grained is what keeps it small enough to stay fast. ``` mcpx log --since 1h --server chrome-devtools --level warn --session mcpx log --follow mcpx stats --since 24h --by server calls, p50/p95/p99, failure rate ``` Levels resolve most-specific first: per-session, then per-server, then global, from config or `MCPX_LOG_LEVEL`. **Default `info` to stderr, `debug` to file.** Erring toward more logs is right for the file and wrong for stderr — stderr is shared with the script's own diagnostics and an agent reads it. On `SIGTERM` the buffer flushes before listeners close, the same ordering fix already made for the schema cache. `mcpx stop --force` skips the flush. **Is there a standalone mode?** Today, no: every command talks to a daemon and auto-starts one. That is right for pooling, which needs a process that outlives the call. A `--standalone` flag that runs the pools in-process for a single command is worth having for CI, where a lingering daemon is a nuisance. --- ## ~~Configuration~~ — merge shipped ``` id: configuration-merge-shipped status: shipped ``` Status: shipped The chain now merges, nearest first, per server name. A project adds servers instead of hiding the user's. `mcpx config --sources` shows every contributing file and which one defined each server. One consequence worth recording: the daemon fingerprint now hashes **every** source, not just the nearest. Two projects with byte-identical local configs can still inherit different servers from different parents, and keying on the nearest file alone would have given one project the other's servers. The rest of this entry is the original proposal. ``` impact: behaviour change ``` **Merge the chain instead of taking the first file.** Today a project config hides every user-level server, which makes "add one server for this repo" impossible without copying the whole file. Proposed: walk the whole chain, nearest first, and merge by server name. A nearer file overrides a server of the same name and adds new ones; `"disabled": true` turns off an inherited one. `pool` merges key by key. `mcpx config --sources` prints the chain with provenance per server, because a merge you cannot inspect is worse than no merge. **Scripts already continue the whole chain**, nearest wins per name. That is the behaviour config should match. **`.config/mcpx` is now checked everywhere `.mcpx` is**, at higher precedence, with a warning when both exist in one directory. _(Shipped.)_ **Per-user versus global.** The daemon is already keyed to a config file, and a config file is reached through `$HOME`, so "global" means "this user's default config". A true per-host config is `/etc/mcpx/config.json`, already last on the chain. No third concept is needed; the docs should just say per-user and stop saying global. **Name collisions.** Servers aggregate by name. Two servers with the same name in different files merge; two servers with different names that map to one namespace is already a hard error that names both. **Scale.** Discovery is a map read regardless of server count. The real limit is process count, `sum(max)` across servers times the number of daemons. Proposed: a daemon-wide `maxInstances` with LRU eviction of idle leases, so a pathological config degrades into slower leasing rather than fork-bombing. --- ## The script contract ``` id: the-script-contract status: proposed ``` Status: proposed Underspecified today and worth pinning down. **Streams.** stdout is the result. stderr is diagnostics. A script that prints nothing to stdout returns nothing. **A log helper**, exported by the client, writing structured lines to stderr at a level, so script output and script logging stop competing: ```ts import { log } from "./mcpx-client.ts"; log.debug("snapshot", { bytes: snapshot.length }); log.warn("retrying", { attempt }); ``` **Returning a value.** If a module has a default export that is a function, mcpx calls it with parsed arguments and JSON-prints whatever it returns; if it does not, top-level await runs and stdout is the result. That makes a file both importable and runnable without ceremony: ```ts export function helper() { /* importable */ } export default async function main(args: string[]) { return { ok: true }; // printed as JSON } ``` `mcpx run --export ` calls a named export instead of the default, which covers "one file, several entry points". **Arguments** already arrive as `Deno.args` / `process.argv`. Proposed addition: `--json-args ''` parsed and passed as the first parameter to the entry function, so callers do not have to serialise through argv. **`mcpx run --json`** wraps the whole thing — stdout, stderr, exit code, duration, tool calls made — in one envelope for programmatic callers. --- ## Modules and libraries ``` id: modules-and-libraries status: proposed ``` Status: proposed Update (#1913): the dependency-configuration half of this area has shipped — the `deps.*` settings and `paths.deps` resolve where a script's packages come from (script specifiers, explicit request, nearest project manifest, the configuration directory's own packages, then the host), the set travels on ExecOptions as data, and the runner materialises it in the exec workdir per runtime. What remains proposed here is only the shared-code half below: a declared `lib/` and the `@lib/` import map. Scripts run on a real runtime, so imports already work: `npm:`, `jsr:`, `https:` on Deno, `node_modules` on bun and node. What is missing is a declared place to put shared code. Proposed: `.config/mcpx/lib/` beside `scripts/`, on the same upward search, and a generated import map aliasing `@lib/` to the nearest one. A project gets its own `lib` automatically; a user-level `lib` is the fallback; a project can shadow a user module by name, which is the same rule as scripts. **Isolation.** Separate import maps per project give natural isolation between projects. Within one process there is none — a script can monkey-patch anything it imports. That is inherent to running on a real runtime with no sandbox, which is a deliberate choice. If isolation ever matters more than capability, that is the argument for v2-style interpretation, not for bolting a sandbox on. **Version overrides** fall out of the import map: a project pins whatever it wants and the user-level pin is irrelevant to it. --- ## Types ``` id: types status: proposed ``` Status: proposed **`mcpx types .`** — emit one function with its argument and return types expanded recursively, plus the namespace's description. Small, obviously useful, no design risk. **Surface the server's own instructions.** `initialize` returns an `instructions` string that mcpx currently discards. chrome-devtools-mcp almost certainly explains `pageId` there. Proposed: cache it and emit it as a namespace-level doc comment in `types` output. This is the cheapest fix for the "how do I get a pageId" problem and it is nearly free. **Producer inference.** The real problem: `pageId: number` does not say to call `list_pages` first, and including every tool that mentions `pageId` is all 27. Heuristic worth trying: for a required parameter `P` of tool `T`, a _producer_ is a tool that does **not** require `P` and whose name or description contains `P`'s noun. For `pageId` that selects `list_pages`, `new_page`, `select_page` — three, not twenty-seven. Emit them as a comment: ```typescript /** Targets a specific page by ID. @see list_pages, new_page, select_page */ pageId: number; ``` It is a guess and should be labelled as one, but a wrong hint costs a few tokens and a missing hint costs a failed call and a retry. **Context-budgeted catalog.** `mcpx types` is all-or-nothing: 4,402 tokens for `chrome_devtools` whether three tools are needed or all 27. opencode v2 solves this with a **round-robin fit**, worth copying exactly: every namespace is always listed with its tool count, so nothing is invisible; each namespace's signatures are ranked cheapest first; then it loops over namespaces taking one signature each per pass until the token budget is spent. The effect is that a namespace with three small tools shows all three, while a 27-tool namespace shows as many as fit, and no single large namespace can crowd out the others. v2's budget is 2,000 tokens, which on the current servers shows 33 of 43 tools. Proposed: `mcpx catalog [--budget 2000]`, emitting one paste-ready block whose size is bounded no matter how many servers are configured. Pair it with `search` for the tools that did not fit. **OpenAPI.** `fromSpec` is v2's, and mcpx does **not** use it — there is no OpenAPI support here at all. The proposal is to build an equivalent: compile an OpenAPI 3.x document into a namespace of tools. It composes with pools exactly as an MCP server does, and it is a large amount of reach for a contained amount of code. --- ## Round-robin catalogue budgeting ``` id: round-robin-catalogue-budgeting status: proposed effort: small; the ranking already exists in a different form ``` Status: proposed `mcpx types ` is all-or-nothing. `mcpx catalog [--budget N]` would fit a paste-ready block to a token budget instead. The algorithm, which is opencode v2's and worth copying exactly: 1. List every namespace with its tool count first. Nothing is ever invisible, even at budget zero. 2. Rank each namespace's signatures **cheapest first**, where cost is `len(line)/4`. 3. Loop namespaces, taking **one signature per namespace per pass**, until the budget is spent. The rotation is load-bearing. Ranking globally by cost lets one namespace's cheap tools crowd out everything else; taking whole namespaces in turn lets a 27-tool namespace eat the budget. Per-pass rotation gives a small namespace all its tools and a large one as many as fit. **Ranking is by cost, not relevance.** There is no similarity search and no model involved: it is `sort by length`, ties broken by path. That is a deliberate difference from `mcpx search`, which _is_ relevance-ranked by substring scoring (exact 100, prefix 60, contains 40, function path 30, namespace 20, description 10) with an any-term fallback. Neither uses embeddings or an external library. **Keep whole-namespace `types` as well.** They answer different questions: `catalog` is "what is available, within a budget", `types` is "I have chosen this namespace, give me all of it". An agent that knows it needs Chrome should not be rationed. Deleting `types` in favour of `catalog --budget huge` would also make the common case require a flag. **Open question worth trying:** `mcpx catalog --budget 2000 --bias screenshot`, where a query biases which signatures win their pass. That merges the two ranking systems and may be better than either. 2026-09-27T07:00:00-05:00 ## Protocol adapters, including OpenAPI ``` id: protocol-adapters-including-openapi status: proposed effort: medium for the interface, small per adapter ``` Status: proposed A namespace is currently always an MCP server. The generalisation is an adapter interface: something that can list tools with JSON Schemas and call one. MCP is the first implementation; OpenAPI would be the second. **Yes, an OpenAPI service could be imported as a namespace.** Its operations already carry typed parameters and responses, which is exactly what the existing JSON-Schema-to-TypeScript compiler consumes, and it would inherit pooling, scoping, `types` and `run` unchanged. **MCP stays native.** Nothing about this replaces it. **Emitting an OpenAPI document per namespace** is the interesting inverse and is cheap once schemas are cached: it would let non-agent consumers — a dashboard, a test harness, another language's client generator — use the same servers without speaking MCP. Worth doing after import, not before. **Would you ever not want it available?** Two honest arguments against: - Every transport is surface area. An OpenAPI document can describe authentication, content negotiation and streaming semantics that MCP does not, and partially supporting them is worse than not offering it. - A script can already `fetch()` an HTTP API directly. The adapter buys typed signatures and pooling, which matters for a large API and is pure overhead for a small one. So: build the adapter interface, because it is the right shape regardless; treat OpenAPI as the proof that the interface is general; and do not present it as a headline. **Reordered to the bottom of the shipped-work queue.** 2026-09-27T07:00:00-05:00 ## Per-instance argument templating ``` id: per-instance-argument-templating status: proposed effort: small ``` Status: proposed Pooled instances currently get identical argv. Some servers need each instance to differ — a distinct port, profile directory, or upstream URL. ```jsonc "chrome-attached": { "command": "chrome-devtools-mcp", "args": ["--browserUrl", "http://127.0.0.1:{{alloc.port}}"], "mcpx": { "scope": "session", "max": 4, "allocate": { "port": { "range": [9222, 9299] } } } } ``` Substitutions available to `args`, `env` and `url`: `{{instance.id}}`, `{{instance.index}}`, `{{key}}`, `{{alloc.}}`, `{{tmpdir}}`. **This is not needed for Chrome as configured today.** `chrome-devtools-mcp` takes no listen port: with `--isolated` it launches its own browser with a temporary profile and an ephemeral debugging port of its own choosing. That is precisely why mcpx has no port machinery, and why the predecessor's port-assignment code was solving a problem this server does not have. It becomes necessary for `--browserUrl` / `--wsEndpoint`, where each instance must attach to a _different already-running_ Chrome. And a real allocator has to survive the time-of-check-to-time-of-use gap that sank the earlier attempt: bind the port, hold the listener, pass it down, release on start. 2026-09-27T07:00:00-05:00 ## Scope policy ``` id: scope-policy status: proposed effort: small ``` Status: proposed Scope is currently set per server and cannot be constrained or overridden. ```jsonc "pool": { "scope": "session", "scopePolicy": { "allow": ["session", "parent-session", "call"], "allowOverride": ["flag", "script"] } } ``` `allow` restricts what a per-server block may choose. `allowOverride` says who may change it at call time: `flag` for `mcpx run --scope`, `script` for a client call, `none` to pin it. A denied override is an error naming the policy, never a silent downgrade. The case for it is a shared machine or a checked-in config where one project should not be able to widen a browser's scope and start sharing state with another. 2026-09-27T07:00:00-05:00 ## Named sessions and keepalive control ``` id: named-sessions-and-keepalive-control status: proposed effort: medium ``` Status: proposed A key exists today and can be supplied with `--session`, which is already naming by another word. Missing: discovery, persistence and adjustment. ``` mcpx session ls mcpx session name name one that started anonymous mcpx session set --idle 30m mcpx session stop mcpx session show ``` Naming an anonymous session is the interesting one, because an ephemeral key is currently torn down when its caller exits. Naming must flip that bit: a named session outlives its creator by definition. **Per-scope keepalive defaults.** One `idleTimeout` for everything is wrong, because the scopes have different natural lifetimes: | scope | default | why | | --------------------------- | ------- | -------------------------------- | | `global` | 30m | expensive to lose, cheap to hold | | `repo`, `worktree` | 15m | tracks a working session | | `cwd` | 10m | narrower, more of them | | `session`, `parent-session` | 10m | agent turns have gaps | | `pid` | none | released when the pid exits | | `call` | none | released when the caller exits | Overridable in config per server, and at runtime per session. 2026-09-27T07:00:00-05:00 ## Health-based and webhook reaping ``` id: health-based-and-webhook-reaping status: proposed effort: small for health, medium for webhooks ``` Status: proposed **Health check.** A server that has wedged without exiting currently occupies its slot until idle timeout. `"health": { "url": "...", "interval": "30s", "expect": 200 }` would reap on a failing probe. MCP already defines `ping`, so the first version should use that rather than HTTP — it needs no configuration and works for every server. **Webhook.** Two directions, and they are different features: - _Outbound_: mcpx notifies a URL on lifecycle events. This is just the event stream with an HTTP sink and is easy. - _Inbound_: something tells mcpx to reap. That is a control API needing authentication, and `mcpx session stop` over the existing socket already does the job for anything local. Recommendation: ping-based health first, outbound events second, inbound webhooks only if a concrete need appears. 2026-09-27T07:00:00-05:00 ## Structured logging ``` id: structured-logging status: proposed effort: medium supersedes: the earlier "Logging" entry ``` Status: proposed Consolidates the whole logging intake. **Nothing here exists yet**; the daemon prints unstructured lines to stderr and scripts have no logging helper at all. ### Records One record type everywhere, emitted by daemon and scripts alike. Go's `slog` is the model, and its `slog.Handler` interface is the right seam for formats. Every record is **enriched** by the daemon with ambient context the caller did not have to supply: session id, parent session, scope, resolved key, server, instance, tool, pid, cwd, config path, mcpx version, session start, script start, elapsed. A script logs `log.info("done")` and the record that lands has all of it. ### Templates A message keeps both forms: ```ts log.info("status: {status}", { status: "ok" }); ``` ```json { "ts": "...", "level": "info", "msg": "status: ok", "template": "status: {status}", "status": "ok" } ``` `msg` interpolated for humans, `template` preserved for grouping records that differ only in values. That is what makes "how often did this line fire" answerable. Named `{placeholders}` over `%s` because they map onto the attributes without positional ambiguity — the same choice Serilog and structlog make. A bare string with no attributes is still wrapped into the same shape, so there is one record type and no second path. ### Formats `--format` on every command that emits records: | format | shape | | ---------------- | ----------------------------------------- | | `json` | one object per line | | `json-pretty` | indented, for reading | | `logfmt` | `ts=… level=… msg=…` | | `text` (default) | `HH:MM:SS LEVEL msg key=value` | | `compact` | `LEVEL msg`, attributes interpolated only | | `bare` | message only | `text` interpolates the template and appends attributes not consumed by it. `compact` and `bare` drop the timestamp. ### Everything as JSON `--json` already exists on several commands and should exist on all of them, with every human table having a JSON counterpart. Scripts should get the same: `mcpx run --json` wrapping stdout, stderr, exit code, duration and the tool calls made. ### Storage JSONL per daemon under `$XDG_STATE_HOME/mcpx/logs/`, buffered and flushed on a tick and at shutdown, plus a SQLite index of one row **per call** rather than per line. Call-grained is what keeps `mcpx stats` fast; line-grained would not. Default `info` to stderr, `debug` to file. More logs to the file is right; more to stderr is not, because an agent reads stderr. 2026-09-27T07:00:00-05:00 ## Harness integration and installation ``` id: harness-integration-and-installation status: proposed effort: large; several independent pieces ``` Status: proposed Consolidates the distribution intake. ### Division of labour Three things a harness needs, and they should not be bundled: 1. **Instructions** — the `AGENTS.md` text. Any harness that reads a markdown instructions directory can use it with no code. 2. **Session identity** — exporting `MCPX_SESSION_ID` and `MCPX_PARENT_SESSION_ID` into the shell environment. This genuinely needs a plugin, and it is what makes `scope: session` work. 3. **Tool surface** — optional. A harness could expose `mcpx` as a tool rather than relying on shell access. Only (2) requires code. Keeping them separate means a harness with no plugin support still gets most of the value. ### Avoiding double-injection If a plugin injects instructions _and_ an instructions file exists, the text lands twice. The plugin should look for a marker — a known first line in the file — and skip injection when it finds one. Detection beats configuration because it cannot drift. ### Install command ``` mcpx install opencode|opencode2|claude|codex [--dry-run] [--platform nix|nix-flake|darwin|darwin-brew] mcpx install --list ``` Writes instructions, plugin and config edits for that harness. **Hash-matching is the important part**: record a hash of what was written, and on the next install update the file only when it still matches. A user-modified file is reported, never overwritten. Daemon-side auto-update of harness configs is listed in the intake and should be declined, or made strictly opt-in. A background process editing another tool's configuration is surprising in a way that is hard to debug. ### Documents - An install document fetchable with curl. - A **setup document written for an agent** — different text, assuming tool access and no human. `mcpx setup-prompt` emits it. This is the genuinely novel piece: the artefact is a prompt, not a script. 2026-09-27T07:00:00-05:00 ## Packaging and service management ``` id: packaging-and-service-management status: proposed effort: medium ``` Status: proposed A nix flake package exists. Missing: NixOS module, darwin module (one existed and was dropped when the package moved into the nix repo), Homebrew formula, and a plain installer for non-nix systems. **Service installation.** `mcpx service install|uninstall|status` writing a launchd plist or systemd user unit. **Never with sudo.** The daemon is a per-user process owning per-user MCP servers; a system-wide unit would run servers as the wrong user and share state between users. A user-level unit needs no elevation, and an installer that asks for a password to do something that does not require one teaches a bad reflex. **Autostart.** Both, and they already coexist: any command starts a daemon on demand today, and a service unit only means the schema cache is warm before the first agent asks. Keep on-demand as the supported path so that nothing _requires_ installation. 2026-09-27T07:00:00-05:00 ## Transport, addressing and scale ``` id: transport-addressing-and-scale status: proposed effort: small for addressing, unknown for the rest ``` Status: proposed **What exists today.** The daemon serves HTTP over two listeners: a unix socket at `$XDG_STATE_HOME/mcpx/daemon-.sock` for the CLI, and `127.0.0.1` on an **ephemeral** port for generated script clients, because `fetch()` over a unix socket is not portable across deno, bun and node. The port is chosen by the OS, so there is nothing to collide with, and it is published in a daemon record file. Not stdio, not named pipes. **Multiple daemons already run**, one per config fingerprint, each with its own socket. `mcpx daemons` lists them. **Addressing.** `--server` accepting `example.com`, `example.com:8008`, `:42` or a unix path would let the CLI drive a remote daemon. The blocker is not parsing but authentication and trust, which loopback currently provides for free. Worth specifying before building. _Correction, 2026-10-30: the remote half of this was specified and built — as an identity transport, not raw addressing. Since #1967 the daemon can embed a Tailscale node (tsnet, `internal/daemon/transport_tsnet.go`) and be reached by its tailnet identity (a MagicDNS name) from another network, with the tailnet providing exactly the authentication and trust this entry named as the blocker. Generic internet addressing (`example.com:8008` and friends) remains unbuilt and unendorsed._ **Load.** Untested beyond 12 concurrent runs. Discovery is a map read and should be flat; the interesting limits are process count and the reaper's O(instances) sweep. A benchmark should come before any optimisation. **Go versus Rust.** No reason to move. The workload is process supervision and JSON, where the runtime is idle most of the time and goroutines map onto the problem directly. Rust would buy a smaller binary and no GC pauses, neither of which is a constraint here, at the cost of a rewrite and harder async process handling. Revisit only if profiling finds something the GC is responsible for. 2026-09-27T07:00:00-05:00 ## Name ``` id: name status: proposed effort: none, but it gets more expensive every week ``` Status: proposed `mcpx` reads as "MCP extended" and is already in the docs, the binary, the config key and the environment variables. Alternatives worth a moment: `xmcp` (same idea, scans worse aloud); `mcpsh` (says "shell", which is the actual pitch); `tsx`-adjacent names (taken); `conduit`, `broker`, `switchboard` (descriptive, generic, unsearchable). Honest assessment: `mcpx` is fine and the rename cost only grows. The one argument for changing is that the tool's distinguishing feature is _shell access to MCP_, and `mcpsh` says that. Not worth the churn unless it is decided before anything publishes. 2026-09-27T07:00:00-05:00 ## Parity tracking ``` id: parity-tracking status: proposed effort: small, ongoing ``` Status: proposed opencode v2 is the closest comparable and moves fast. A short table in [`OPENCODE-V2.md`](https://github.com/developing-today/code/blob/main/pkgs/mcpx/OPENCODE-V2.md) listing each capability and whether mcpx has an equivalent, reviewed per release, is cheap and prevents drift being noticed only when it is expensive. Other systems worth reading for concepts rather than parity: Claude Code's skills and hooks, Codex's sandboxing, and the several MCP-adjacent efforts that expose tool catalogues as code. The specific thing to look for is how each keeps a large tool surface out of context, because that is the problem this tool exists to solve. 2026-09-27T07:00:00-05:00 ## Extra discovery paths ``` id: extra-discovery-paths status: proposed effort: small ``` Status: proposed Config and scripts are searched upward from the working directory, then the user directory. Missing: a way to add directories to that chain. ``` --override-paths [,...] tried before everything --fallback-paths [,...] tried after everything MCPX_OVERRIDE_PATHS / MCPX_FALLBACK_PATHS ``` Two flags rather than one plus an ordering rule, because the two uses are genuinely different. An override is "for this invocation, use these"; a fallback is "if nothing local matches, look here too" — a shared team directory, for instance. Collapsing them into one list with a position argument makes every call site state a position it does not care about. Accepting files and not just directories lets a single script be injected without building a directory around it. **Aliasing a file to a different name** was raised alongside this and is probably the wrong shape. Shadowing already resolves name conflicts by precedence, and `mcpx scripts` already shows what is shadowed. An alias adds a second mechanism for the same job, and a second place to look when a name resolves to something unexpected. The case it would uniquely solve — wanting _both_ of two same-named scripts — is better served by naming one of them differently, which the author controls. 2026-09-27T08:00:00-05:00 ## Better tool search ``` id: better-tool-search status: partial and --explain are in; typo tolerance (on #1904's shared near-miss matcher) and concept similarity remain proposed effort: small to large depending on how far it goes note: slice 1 shipped 2026-10-30 (#1923) — tags, word-splitting/stemming ``` Status: partial and --explain are in; typo tolerance (on #1904's shared near-miss matcher) and concept similarity remain proposed Search scoring today: exact 100, prefix 60, tag 50, contains 40, a split/stemmed name word 40, function path 30, namespace 20, description 10, all terms required with an any-term fallback. It is fast and has no dependencies, and it fails on typos and on concepts that share no substring with the tool name. `mcpx search --explain` prints the per-term breakdown behind a hit's score, and `--tag ` filters on config tags exactly (server `tags`, inherited by its tools, plus per-tool `toolTags`). Three tiers, in increasing cost: **Tags.** Cheap, exact, and author-controlled. `"tags": ["browser", "visual"]` per server, and `mcpx search --tag browser`. Also lets a config author fix a bad match without touching the server. **Typo tolerance.** Levenshtein distance ≤ 2 against tool and namespace names only, applied after exact scoring returns nothing. Tool names are short and few, so this is microseconds and needs no index. `screenshto` finds `take_screenshot`. **Concept similarity.** The expensive one. Either an embedding model — a new dependency, a download, and a cache to invalidate — or a hand-built synonym table, which is cheap but needs curating. Worth deferring until tags and typo tolerance are in and still insufficient. Recommended order: tags, typos, then reassess. Most "I could not find the tool" cases are probably vocabulary, and tags fix vocabulary directly. 2026-09-27T08:00:00-05:00 ## Types improvements ``` id: types-improvements status: proposed effort: small each ``` Status: proposed Beyond `mcpx types .`: - **`--no-instructions`** to omit server guidance. _Shipped_ — `fff` returns 3,768 characters of it, which more than doubles that namespace's output. - **`--depth N`** to control how far nested object types expand. Deeply nested schemas are most of the cost of a large namespace. - **`--only [,...]`** for several tools without the whole namespace. - **Output-type rendering.** `outputSchema` is fetched and ignored; every tool currently returns `Promise`. Rendering it would make results typed rather than `any`. - **`--format ts|json|markdown`**, since the underlying model is structured and only the rendering is TypeScript. 2026-09-27T08:00:00-05:00 ## mcpx as a server ``` id: mcpx-as-a-server status: proposed effort: medium ``` Status: proposed _Correction, 2026-10-30: the re-export proposed here is still the open part — but "remote daemon" itself is no longer unbuilt. Since #1967 the daemon can embed a Tailscale node (tsnet, `internal/daemon/transport_tsnet.go`) and be reached by its tailnet identity, and the settings registry ships the client half (`daemon.endpoint`, `daemon.address`). What remains proposal is the code-mode MCP server / OpenAPI endpoint re-export above, not remote reachability as such._ Distinct from importing or emitting OpenAPI: this makes mcpx itself something other tools connect _to_. **As an MCP server.** mcpx already aggregates servers, pools them and caches their schemas. Re-exporting that as one MCP server would let a harness with no shell access reach everything through a single connection, with pooling and scoping applied underneath. Two shapes, and they are different products: - _Passthrough_: every underlying tool re-exported under its namespace. Simple, and reintroduces exactly the context problem mcpx exists to avoid. - _Code-mode_: two tools, `search` and `run`, where `run` takes a script. This is what opencode v2 does internally, and it keeps the context win. The second is the interesting one, and it makes mcpx usable from Claude Desktop or anything else that speaks MCP but cannot run a shell. **As an OpenAPI endpoint.** The daemon already serves HTTP with a stable shape. Publishing an OpenAPI document for it, and optionally binding beyond loopback, would let non-MCP consumers use the same pooling. **Security.** Everything today is loopback plus a `0600` unix socket, which is why there is no authentication. Binding wider needs a token at minimum, scoped per client, plus a decision about whether a remote caller may name a `cwd` — which currently determines `repo` and `worktree` keys and would otherwise be a way to reach another user's instances. Recommendation: build the code-mode MCP server first, loopback only, no authentication. Treat remote binding as a separate proposal with its own threat model. 2026-09-27T08:00:00-05:00 ## MCP protocol coverage ``` id: mcp-protocol-coverage status: proposed effort: medium, several independent pieces ``` Status: proposed mcpx implements `initialize`, `tools/list`, `tools/call`, `resources/list`, `resources/read` and `ping`. The protocol defines more, and opencode v2 implements most of it. Meeting parity means, roughly in order of value: - **`instructions` from initialize.** _Shipped._ It was being parsed and discarded; `fff` alone returns 3.7 KB of tool-selection guidance. - **`prompts/list` and `prompts/get`.** Servers ship reusable prompts nobody can currently see. - **Progress notifications.** A long tool call is opaque today. The protocol has `notifications/progress`; surfacing it would let a script show progress. - **Cancellation.** `notifications/cancelled` is sent on timeout, and an incoming one stops the question it names (docs/protocol.md §4.1). - **`tools/list_changed`.** Servers announce catalogue changes; mcpx caches schemas until told to refresh, so it can be wrong until `mcpx refresh`. - **Sampling.** Servers can ask the client to run a model. Requires a model binding mcpx does not have and may never want. - **Roots.** Tells a server which directories it may touch. Cheap, and pairs naturally with `worktree` scope. - **Elicitation.** Servers ask the user a question mid-call. Needs a UI story for a tool with no UI; probably means failing the call with a clear message. - **OAuth.** Required by some hosted servers. The largest single piece. 2026-09-27T08:00:00-05:00 ## Chrome and stateful-server ergonomics ``` id: chrome-and-stateful-server-ergonomics status: proposed effort: small each ``` Status: proposed Chrome is the hardest server to drive well and the lessons generalise. **`pageId` discovery.** The concrete failure: `click` requires `pageId` and its description says only "Targets a specific page by ID". Note that `close_page` _does_ say "Call list_pages to list pages" — so the information exists in some schemas and not others, which is exactly the inconsistency a host should paper over. Chrome returns **no** `instructions`, so the instructions work does not fix this. Producer inference is the remaining answer. **Per-server prelude.** A config-supplied snippet prepended to a namespace's `types` output, so a user can state a convention the server does not. Half a day, fixes `pageId` immediately, and is a general escape hatch for every server with bad descriptions. **Recipes.** A named script shipped per server — `mcpx run chrome:screenshot ` — turning the common sequence into one call. The generated flow from the story is already most of one. **`--pageIdRouting`** is on by default and documented as being for concurrent sessions, which suggests Chrome expects several agents against one instance. Worth measuring against pooling before assuming pooling is required; pooling gives real isolation, but if routing is sufficient for a caller who does not mind sharing cookies, `sharing: shared, scope: session` may be cheaper. **Generalises to:** any server whose required identifiers come from another call. A prelude and a recipe are the two cheap answers, and both are server-agnostic. 2026-09-27T08:00:00-05:00 ## Log context and enrichment layering ``` id: log-context-and-enrichment-layering status: proposed effort: small ``` Status: proposed Enrichment happens in one place today: the runner folds a fixed map (session, cwd) into every record arriving from a script. That is enough for the values mcpx knows at launch and nothing else. Two gaps. **~~A script cannot bind context.~~** Shipped as `log.with`. What remains open is whether bindings should propagate without being passed, which on Node would mean `AsyncLocalStorage` and on Deno has no equivalent; a hidden global is the likely alternative and is worse than an argument. Original text follows. Every call repeats what does not change: ```typescript log.info("scanned {file}", { file, run: runId, phase: "scan" }); ``` Wanted: `const scoped = log.with({ run: runId, phase: "scan" })`, matching slog's `Logger.With`. Bound attributes merge under per-call ones, so a call can still override. **Go-side context does not reach records.** slog passes a `context.Context` into `Handler.Handle`, which is exactly the seam for request-scoped values, but nothing is read from it. A daemon handler could stash the session, the resolved scope key and the server name in the context once, and every record below it would carry them without being told. Proposed layering, outermost first, each merging under the next: 1. daemon context (server, scope, instance) 2. runner enrichment (session, cwd, entry) 3. script `log.with` bindings 4. per-call attributes The rule that makes it predictable is that the innermost wins, because it is the most specific statement about this one record. 2026-09-27T21:00:00-05:00 ## Reserved attribute names ``` id: reserved-attribute-names status: partial note: shipped (collision handling), proposed (the rest) ``` Status: partial A rendered record flattens attributes next to `ts`, `level`, `msg` and `template`. A user attribute with one of those names used to be dropped silently; it is now renamed to `attr.`, so nothing is lost. What remains open is whether mcpx should _own_ a namespace instead. An underscore prefix (`_kind`, `_session`) or a dotted one (`mcpx.session`) would make the boundary obvious and remove the renaming rule entirely. The argument against is that every record then carries punctuation for a collision that almost never happens, and `jq '.level'` becomes `jq '."mcpx.level"'`. Current view: renaming is the better trade while the reserved set is four names. If it grows -- a log store will want `id`, `run`, `seq` -- revisit, because at that point the collisions stop being hypothetical. 2026-09-27T21:00:00-05:00 ## ~~Level filtering in the script~~ — shipped ``` id: level-filtering-in-the-script-shipped status: shipped ``` Status: shipped The script now knows the threshold and returns before encoding. Measured at 0.026 microseconds per filtered call, against 0.10 for the previous encode-and-write. Source capture moved to a per-level setting at the same time, defaulting to warn and above. The original proposal follows. ``` effort: small ``` A script serialises and writes every record; the threshold is applied in Go. `log.debug()` in a loop therefore costs a JSON encode and a write even when nothing will be printed. Fix: pass the active level to the script as `MCPX_LOG_LEVEL` (already passed for other reasons) and have the client return early below it. About five lines, and it makes debug logging free to leave in. The same argument applies harder to source capture, which costs ~4.9 us per call: checking the level first means an unprinted debug record costs nothing rather than a stack trace. 2026-09-27T21:00:00-05:00 ## Layered script prefixes ``` id: layered-script-prefixes status: partial note: shipped (list + null splice), rejected (ancestor indexing) ``` Status: partial `mcpx exec` generates a whole file, so it can wrap a snippet in lines from configuration. The question was how a nearer config should combine with a farther one. **Shipped: a list whose elements are strings or null.** A null splices in whatever the setting inherited, at that position: ```jsonc "script": { "prefix": ["import { h } from '@lib/h.ts';", null] } ``` A list with no null replaces outright. On the command line the marker is `-`: `--prefix - --prefix 'const X = 1;'` keeps the configured lines and adds one. This is one concept doing both jobs. Inheritance is explicit and local: you can read a single file and know whether it extends or replaces, without knowing what is above it. **Rejected: integers addressing ancestors.** The idea was `0` for the current inherited value, `1` for the parent's, `2` for the grandparent's. It is rejected because the number means nothing without the chain: - Chain depth varies by where a config was found. The same file has different ancestors in a repo, under `~/.config`, and under `/etc`. - Moving a directory silently changes what `2` refers to. - It cannot be read locally. `["mine", 2]` is unresolvable without reconstructing every file above it, which is the opposite of what a config should require. - The case it uniquely serves -- "skip my parent but take my grandparent" -- has not come up, and if it did, naming the thing wanted would be clearer than counting hops to it. Null covers extend-or-replace, which is the distinction people actually make. **Corrected: prefixes _do_ apply to file scripts, for effects rather than bindings.** The first version rejected them outright, which conflated two claims. A prefix cannot _bind_ anything inside a module, because ESM gives it its own scope. It can perfectly well _act_ before and after one, because mcpx already generates a launcher around it. So the launcher imports the module **dynamically**: ```typescript const script = { path, name, args, export }; // runs first, for real const mod = await import("./user.ts"); ... finally { } // runs even when the body throws ``` A static import would be hoisted and evaluate the module before any prefix line whatever the source order, which is why the dynamic form is required rather than merely tidier. Prefix lines see `script` (path, name, args, export). Suffix lines also see `result` (ok, value, error, ms), and run in a `finally`, so cleanup happens on the failure path too. Both can set globals the script will read, which is the monkeypatching seam. What remains impossible is a prefix declaring a `const` the script can see. That is ESM, not a limitation worth fighting, and the tests assert it stays impossible so nobody comes to depend on an accident. A snippet is different: `mcpx exec` generates the whole file, so its prefix shares scope and _can_ declare bindings the snippet uses. 2026-09-27T22:30:00-05:00 ## Launcher as a template with placeholders ``` id: launcher-as-a-template-with-placeholders status: proposed effort: medium ``` Status: proposed The launcher is a `fmt.Sprintf` with five named phase slots. That is enough for "run something here", and not enough for "reorder this" or "wrap the entry in my own try". The next step is a real template. Proposed: the launcher ships as a template file with named placeholders, and configuration may both fill them and reference them: ``` @globals @before @prefix @import @entry @onSuccess @onError @suffix ``` A phase body could then say `@prefix` to splice another phase in, which is the mechanism behind the interesting cases: running a prefix twice, or moving the import after a guard. Two rules make it safe: - **References form a DAG.** A cycle is rejected at generation time with the path that closed it, not discovered as a hang. - **Each placeholder resolves once.** Referencing one twice is an error unless `allowRepeat` names it, because the common case of a double reference is a mistake, and the rare deliberate one should have to say so. Also wanted, and cheap: a `minimal` mode that emits the module import and nothing else -- no globals, no console capture, no phases -- for a script that wants the runtime and none of the harness. The argument for doing this at all is that a launcher which is only half-configurable invites someone copying it out and maintaining a fork. The argument against doing it _now_ is that five named phases have not yet been shown insufficient. 2026-09-28T01:00:00-05:00 ## Structured stack traces ``` id: structured-stack-traces status: shipped ``` Status: shipped `Error.prepareStackTrace` is V8-specific and not in any standard, and was verified to work in Deno, Node and Bun. It hands back CallSite objects instead of a formatted string, so frames arrive as data: ```json { "function": "boom", "file": ".../script.ts", "line": 9, "column": 22, "async": false } ``` Parsing the string form was the alternative and is strictly worse: it loses the async and native flags, and breaks on any path containing the characters the format uses as delimiters. One trap worth recording. **V8 memoises whatever `prepareStackTrace` returned the first time `.stack` is read.** Asking for frames destroys the string; asking for the string destroys the frames. Both are wanted -- the string for a human, the frames for a query -- so frames are captured and the string is rendered from them. The first two attempts at this each lost one form, and a test now asserts both survive. `captureFrames(skip, limit)` and `errorFrames(err)` are exposed to scripts. 2026-09-28T01:00:00-05:00 ## Defaults as an embedded layer ``` id: defaults-as-an-embedded-layer status: shipped ``` Status: shipped Every default now lives in `internal/defaults/defaults.json`, embedded with `go:embed`, and is printable with `mcpx config --defaults`. Before this they were four `const` blocks in four packages plus two literals in a ticker. That is the arrangement where "what is the idle timeout" takes a grep across the tree and still misses one -- which is exactly what happened: a test asserting no package redeclares a default timeout found a five-minute literal in the daemon's save ticker that three readings had walked past. `internal/defaults` is a leaf with no mcpx imports, so `logging` can read it without depending on `config`. Parsing happens in a variable initialiser rather than `init()`, because Go evaluates package variables first and the `init()` version silently handed out zero values. `DisallowUnknownFields` is set, so a misspelled key in defaults.json is a startup panic instead of a zero value discovered three layers down. 2026-09-28T02:00:00-05:00 ## Console fidelity ``` id: console-fidelity status: shipped ``` Status: shipped All 25 of Deno's console members are handled. The ones with a level become that level, `log` still reaches stdout, `trace` carries structured frames, `clear` resets indentation without erasing a durable log, and the devtools markers (`profile`, `profileEnd`, `timeStamp`) become file-only records rather than vanishing. Two fidelity details that a test caught rather than review: - **Names are preserved.** `console.info.name` is still `"info"`. Five methods had been assigned directly instead of through the helper that sets it. - **Messages use the runtime's own inspect**, so `console.info({a:1})` reads `{ a: 1 }` exactly as it would have unwrapped. The JSON form is redundant -- the structured value is already in `args`. `console.createTask()` throws when called bare. So does Deno's. The test compares against the unwrapped console rather than asserting nothing throws, because matching the original includes matching its failures. 2026-09-28T02:00:00-05:00 ## Protocol methods still missing ``` id: protocol-methods-still-missing status: implemented note: audited 2026-09-29, method by method against all three schemas ``` Status: implemented An earlier audit assembled a feature list from the specification's index page and probed a few URLs. That was not good enough: doing it properly -- diffing every `method:` literal in `schema.ts` for `2025-06-18`, `2025-11-25` and `2026-07-28` against what mcpx sends and serves -- found more. Still missing, in rough order of what would be noticed: **`resources/subscribe` / `unsubscribe` / `notifications/resources/updated`.** A client watching a resource for changes. Present in every revision. mcpx declares `subscribe: false`, so it is honest, but a server publishing live data cannot tell mcpx when it changes. **`resources/templates/list` when serving.** mcpx _consumes_ templates from upstream servers and does not offer them onward, so a templated resource becomes invisible one hop down. **`sampling/createMessage`.** A server asking the client to run a model completion. mcpx is not a model host, so the honest implementation is a pass-through to whatever is driving it -- the same shape elicitation uses. Worth building when something asks. _Shipped, then found unreachable: `sampling` was never declared, because the handler was installed after the handshake that declares capabilities. Fixed 2026-09-29, with roots, which the same ordering had broken._ **`notifications/elicitation/complete`** (`2025-11-25`+). A url-mode elicitation finishing out of band. Without it, a server that sends somebody to a browser has no way to say the flow completed, and the caller waits for the TTL. **`subscriptions/listen` and `notifications/subscriptions/acknowledged`** (`2026-07-28`). The modern revisions generalised subscriptions into one mechanism. This is also the answer to "can a client subscribe to the daemon", which mcpx currently has no way to do at all. **`tasks/*`** (`2025-11-25` core, an extension in `2026-07-28`). Long-running work with polling and durable handles. An extension now, so optional by definition, but it is what a genuinely slow tool should use. **`notifications/roots/list_changed`.** mcpx declares `listChanged: false`, so nothing is promised, but a root set that can change is more useful than one fixed at startup. 2026-09-29T00:30:00-05:00 ## Suggested order Shipped since this document was written: sharing/scope split, pid-scoped lifetime, realpath-canonical keys, `.config/mcpx` lookup, named scripts, path globals. 1. ~~Server `instructions` surfaced in `types`.~~ **Shipped.** Worth recording that it did _not_ do what it was ranked first for: Chrome returns no instructions, so `pageId` is untouched. It turned out valuable for a different reason — `fff` returns 3.7 KB of tool-selection guidance that was being thrown away. 2. ~~`mcpx types .`, plus a per-server prelude.~~ **Shipped.** 17,851 to 923 characters for one tool, and the prelude states where a `pageId` comes from, which is what instructions failed to supply. 3. ~~Config merge with `--sources`.~~ **Shipped.** 4. ~~Script contract: `log`, default-export entry, `run --json`.~~ **Shipped.** 5. ~~Structured logging.~~ **Shipped**, minus the on-disk store and `mcpx log` / `mcpx stats`, which still want a JSONL file and a call-grained index. 6. ~~`mcpx catalog --budget`.~~ **Shipped**, with `--bias`. 7. Named sessions, `mcpx session ls`, per-scope keepalive. 8. Scope policy. 9. Harness integration and `mcpx install`. 10. Packaging and `mcpx service install`. 11. Ping-based health reaping. 12. Producer inference for parameter hints. 13. Per-instance argument templating and allocation. 14. Protocol adapter interface, then OpenAPI import, then OpenAPI emit. Deliberately unscheduled: remote addressing, Rust, rename. --- # Protocol: every revision, both directions ``` id: protocol-every-revision-both-directions since: pre-release created: 2026-09-29T20:00:00-05:00 last-updated: 2026-09-30T16:00:00-05:00 status: standard tags: area:protocol description: what each revision defines, what mcpx accepts, what it sends, and why there is one HTTP server rather than two. ``` Since: pre-release · Status: standard mcpx speaks all five revisions of MCP and sits in the middle of two of everything: two eras, two directions, two mechanisms for the same question. The rules that hold it together are short, and this document is mostly the table that falls out of them. The per-revision detail and its tests are in [`spec/`](spec/index.html.md); what the specification itself asks, independent of mcpx, is [`spec/server-obligations.md`](spec/server-obligations.html.md) and [`spec/client-obligations.md`](spec/client-obligations.html.md). **Accept liberally, send conservatively.** A server implementing a method beyond what the negotiated revision defines is not violating anything — it withholds nothing the revision requires, and a client that reached for the method would otherwise be told mcpx cannot do a thing it can. Sending is the opposite: a field, a notification or a server-initiated request that the peer did not negotiate _and_ did not declare is a lie about what was agreed, and the failure is silent. Either the peer ignores it, or it rejects the frame, and nothing says which. So mcpx accepts `tasks/*` from a 2025-06-18 client and `subscriptions/listen` from a legacy one — and it will not put `structuredContent` in front of a 2025-03-26 client, will not stamp `resultType` on a reply to anything but 2026-07-28, and will never send `elicitation/create` to a client that did not declare `elicitation`. **The rule stops at removal** (§2.1): a method a revision _removed_ is method-not-found to a peer on that revision. Since the first version of this page, every sentence in it has been checked against a schema validator (`internal/mcpspec`, the five official schemas, strict mode) and the official conformance suite ([`spec/official-suite.md`](spec/official-suite.html.md)). Several were wrong, and the corrections are why this is increment 3. --- ## 1. The revisions | | era | handshake | version carried | mcpx serves | mcpx speaks upstream | | ------------ | ------ | ------------ | ---------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------- | | `2024-11-05` | legacy | `initialize` | once | yes, over stdio and Streamable HTTP; its HTTP+SSE server transport is not hosted | when the server answers with it; HTTP+SSE as the last fallback | | `2025-03-26` | legacy | `initialize` | once | yes | when the server answers with it | | `2025-06-18` | legacy | `initialize` | once | yes | when the server answers with it | | `2025-11-25` | legacy | `initialize` | once | yes | offered on every `initialize` | | `2026-07-28` | modern | none | `_meta`, every request | yes | **probed first** | Which revision defines which feature, generated from the same `FeatureMatrix()` table `GET /v1/protocol` reports: | feature | `2026-07-28` | `2025-11-25` | `2025-06-18` | `2025-03-26` | `2024-11-05` | | --- | --- | --- | --- | --- | --- | | `initialize` | — | ✓ | ✓ | ✓ | ✓ | | `discover` | ✓ | — | — | — | — | | `resultType` | ✓ | — | — | — | — | | `inputRequired` | ✓ | — | — | — | — | | `structuredContent` | ✓ | ✓ | ✓ | — | — | | `resource_link` | ✓ | ✓ | ✓ | — | — | | `audio` | ✓ | ✓ | ✓ | ✓ | — | | `toolAnnotations` | ✓ | ✓ | ✓ | ✓ | — | | `completions` | ✓ | ✓ | ✓ | ✓ | — | | `title` | ✓ | ✓ | ✓ | — | — | | `icons` | ✓ | ✓ | — | — | — | | `elicitation` | ✓ | ✓ | ✓ | — | — | | `elicitationURL` | ✓ | ✓ | — | — | — | | `elicitationComplete` | — | ✓ | — | — | — | | `tasks` | — | ✓ | — | — | — | | `tasksExtension` | ✓ | — | — | — | — | | `extensions` | ✓ | — | — | — | — | | `cacheable` | ✓ | — | — | — | — | | `resourceSubscribe` | — | ✓ | ✓ | ✓ | ✓ | | `subscriptionsListen` | ✓ | — | — | — | — | | `loggingSetLevel` | — | ✓ | ✓ | ✓ | ✓ | | `batch` | — | — | — | ✓ | — | The split is the thing everything else follows from. A legacy implementation negotiates once and can send its peer a request at any time afterwards. A modern one has no handshake, restates its version and capabilities on every request, and — as a server — has no channel at all on which to send a request of its own. The matrix is unforgiving: modern against legacy fails, legacy against modern fails, only a dual-era implementation bridges them. mcpx is dual-era in both directions. Upstream, mcpx probes modern first and remembers the answer: the 2026-07-28 versioning page makes era "a property of the server", and prescribes that order for a dual-era client. The era is cached per server configuration, in memory and in `/upstream-eras.json`, so the probe costs one round trip per configuration rather than one per start. It used to probe legacy first, on the argument that nearly every server is legacy; the cache removed the cost that argument was about. [`spec/era-probe.md`](spec/era-probe.html.md) has the order, the fallbacks and the cache. Downstream, `Oldest` is 2024-11-05: what a request that declared nothing is spelled for, because every shape that revision defines is understood by everything newer. Guessing downward is recoverable; guessing upward hands a peer a frame it cannot parse. A _headerless_ Streamable HTTP request, though, is judged as 2025-03-26 (`Headerless`): 2024-11-05 has no Streamable HTTP, so nothing arriving on `/mcp` can be a 2024-11-05 request that omitted the header, and the later transport pages say to assume 2025-03-26. ### 1.1 When revisions conflict: `spec.precedence` and `spec.lenient` (#307) Most differences between revisions are settled by the revision the peer states. Where two revisions require incompatible behaviour and the peer's version does not settle it, two settings decide ([`configuration.md`](configuration.html.md)): - **`spec.precedence`** — the revisions in the order their rules win, first wins. Default: every revision mcpx serves, newest first (`2026-07-28,2025-11-25,2025-06-18,2025-03-26,2024-11-05`). A partial list is completed with the rest, newest first. **`--mcp-spec `** / `MCPX_MCP_SPEC` (`spec.first`) moves one revision to the front. - **`spec.lenient`** — revisions mcpx does not hold strictly. Empty by default: every revision is strict. An unknown revision in any of the three is refused with the list of valid ones. The daemon reports the effective policy under `spec` in `GET /v1/protocol`; `mcpx settings` shows each setting and where it came from. Code consults it through `internal/spec` (`First`, `Strict`, and the predicates `AtOrAfter`, `Before`, `Only`, `Between`). Two behaviours consult it today: | behaviour | default | changed by | | -------------------------------------------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------- | | progress `message` relayed to a 2024-11-05 client (whose schema has no such field) | **sent** | stripped only when 2024-11-05 is first _and_ strict: `--mcp-spec 2024-11-05` | | a request from a 2026-07-28 upstream server (that revision has none; its stdio page says the client MUST NOT answer) | **dropped** | answered when `spec.lenient` includes `2026-07-28` | Each other conflict in [`spec/revision-conflicts.md`](spec/revision-conflicts.html.md) carries a disposition there — peer-settled, precedence-governed, a recorded reading, or undisposed with its open question named. Only the precedence-governed ones are decided by these settings. `internal/mcpserver/revisions.go` holds the floors, ceilings and removals as data, and `GET /v1/protocol` serves them. A matrix in a document and a matrix in code agree on the day they are written and never again, so the document defers to the endpoint. --- ## 2. mcpx as a server What a host connected to mcpx gets, over `mcpx serve` (stdio) or the daemon's `/mcp` (Streamable HTTP). ### 2.1 Methods | method | defined in | mcpx accepts | mcpx answers | | -------------------------------------------------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `initialize` | legacy | legacy peers | the version asked for if mcpx speaks it, otherwise the latest legacy version it speaks — a result, not an error, as every legacy lifecycle page requires | | `server/discover` | 2026-07-28 | always | `supportedVersions` (newest first), `capabilities`, `instructions`; `serverInfo` in `_meta`; `ttlMs`/`cacheScope` | | `ping` | legacy | legacy peers | `{}` | | `tools/list` | all | always | paginated (`mcp.pageSize`), opaque cursor, a deterministic order | | `tools/call` | all | always | §2.3 and §3; an unknown tool is `-32602` | | `prompts/list`, `prompts/get` | all | always | not found is `-32602`; an upstream failure `-32603` | | `resources/list`, `resources/read`, `resources/templates/list` | all | always | binary contents as `blob`; not found is `-32002` (legacy) or `-32602` (2026), both with `data.uri` | | `resources/subscribe`, `resources/unsubscribe` | legacy | legacy peers | `{}`, always; subscribes upstream where the owning server can deliver, and otherwise publishes a warning event (§4.3) | | `subscriptions/listen` | 2026-07-28 | **any** era | an acknowledgement, then only the notifications the filter asked for, each tagged with the subscription id | | `completion/complete` | all | always | forwarded to the server that owns the `ref`, as `/v1/complete` does, with `context.arguments`; a 2024-11-05 upstream is asked without a capability (that revision had none); unknown ref `-32602`, upstream failure `-32603` | | `logging/setLevel` | legacy | legacy peers | `{}`; sets the level of upstream log messages relayed to this connection (§4.4) | | `tasks/get`, `tasks/list`, `tasks/result`, `tasks/cancel` | 2025-11-25 core | **any** legacy peer | the core shapes; `tasks/list` is connection-scoped, while an unbound task is reachable by its id | | `tasks/get`, `tasks/update`, `tasks/cancel` | 2026-07-28 extension | modern peers that declared `io.modelcontextprotocol/tasks` on the request; `-32021` with `data.requiredCapabilities` (HTTP 400) otherwise | the extension's shapes; `tasks/list` and `tasks/result` are `-32601`, as the extension says | | `skills/list`, `skills/get` | skills extension (SEP-2640) | always, unless the server offers only contributed tools | mcpx's own skills (`plugin/opencode/skills`, embedded at build), each file at `skill://mcpx//` and also listed and readable as a resource; an unknown URI is `-32602`. Upstreams' skills are not relayed: [in-name-only.md](in-name-only.html.md#skills-extension) | | `resources/directory/read` | skills extension, `directoryRead` | wherever `skills/list` is | the direct children of a directory inside one of mcpx's skills: files as `resources/list` lists them, subdirectories as `inode/directory`; paginated. A file or an unknown URI is `-32602` | | `notifications/cancelled` | all | always | cancels the request it names — its context, and so its upstream call — and withholds the reply | Two rows are the "accept liberally" rule doing visible work: `subscriptions/listen` from a legacy client and core `tasks/*` from any legacy client. mcpx answers both. It **declares** neither outside the revision that defines it, because a declaration is a promise about the revision in force. **The rule stops at removal.** Offering a client a method its revision never had withholds nothing. Answering one its revision _removed_ is different: the removal is the specification naming a replacement, and 2026-07-28 requires method-not-found — "If the server does not implement the requested RPC method, it MUST respond with `404 Not Found` and a JSON-RPC error with code `-32601`". The 404 is load-bearing rather than decorative: it is how a dual-era client tells a modern server from a legacy endpoint that simply is not there. So `initialize`, `ping`, `logging/setLevel`, `resources/subscribe` and `resources/unsubscribe` are `-32601` to a 2026-07-28 peer and unchanged for every older one. `internal/mcpserver/revisions.go` holds the list as `removedIn`, keyed to the same feature ceilings the rest of the matrix uses. mcpx answered all of them to everyone until the official suite scored it (#250). **Tasks, per era.** 2025-11-25 core tasks are client-directed: a `task` field on `tools/call`, `{task}` back at once, `tasks/result` blocks. mcpx honours the field from any legacy client. The 2026-07-28 extension is server-directed and forbids the other way: the `task` field is ignored, and a client that declared `io.modelcontextprotocol/tasks` on the request gets a `CreateTaskResult` (`resultType: "task"`, `ttlMs`, `pollIntervalMs`). Which calls become tasks follows the tool's `execution.taskSupport`: a task-supporting tool's call is a task once it has run 250 ms, one that declared nothing only after `protoMessages.taskAfter`, and a `required` one is `-32021` to a client without the extension. `tasks/get` inlines the result. Questions a task-supporting call asks at once go inline as `input_required` on the original request, before any task exists; ones it asks later park the task in `input_required` with `inputRequests`, answered through `tasks/update`. A legacy task shows `input_required` while one of its questions is out, and the question carries the related-task `_meta`, as does the `tasks/result` response. A legacy task-augmented call to a tool that declares no `execution.taskSupport` is refused `-32601`, as 2025-11-25 asks: of mcpx's own tools only `mcpx_call` and `mcpx_exec` declare `"optional"` (to 2025-11-25 clients only; 2026-07-28's `Tool` has no `execution`). A 2026-07-28 client that names tasks in a `subscriptions/listen`'s `taskIds` gets the ones it can see back in the acknowledgement, then `notifications/tasks` on that stream -- the task's current state at once, then every change, each the `DetailedTask` `tasks/get` would answer. [`spec/messages.md`](spec/messages.html.md#tasks) has the rest. **Task IDs and visibility.** Task IDs contain 128 random bits and are designed to be unguessable, but possession of an ID is the access handle: anyone who learns an unbound task's ID can retrieve it. An unbound task is never included in legacy `tasks/list`. That method lists only tasks owned by the current identified connection; a connection without an identity gets an empty list. A client that needs its legacy tasks to be listable must provide an identity when it starts them. The 2026-07-28 extension has no `tasks/list` method, so clients retrieve those tasks by ID. This is an access model, not an additional authorization check. The daemon's `/v1/tasks` endpoints use the same daemon-wide store, not MCP's per-connection list filter: `GET /v1/tasks` lists the store, and `GET /v1/tasks/{id}` or `/result` retrieves by ID. Treat those IDs as bearer handles there too. **Unknown tools are a protocol error.** `tools/call` naming a tool mcpx does not have is `-32602` ("no tool named …"), as every revision's tools page lists it. It used to be an `isError` result, which told the model to retry a call that could never work (#284). ### 2.2 Capabilities mcpx declares | capability | `2026-07-28` | `2025-11-25` | `2025-06-18` | `2025-03-26` | `2024-11-05` | | --- | --- | --- | --- | --- | --- | | `tools.listChanged` | false for mcpx's own list (fixed when the server is built); true in pass-through mode when the connection can push | false for mcpx's own list (fixed when the server is built); true in pass-through mode when the connection can push | false for mcpx's own list (fixed when the server is built); true in pass-through mode when the connection can push | false for mcpx's own list (fixed when the server is built); true in pass-through mode when the connection can push | false for mcpx's own list (fixed when the server is built); true in pass-through mode when the connection can push | | `resources.subscribe` | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | | `resources.listChanged` | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | | `prompts.listChanged` | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | true when the connection can push | | `completions` | ✓ | ✓ | ✓ | ✓ | — (the revision has no such capability; the method is answered anyway) | | `logging` | — (the level travels in each request's `_meta`) | ✓ | ✓ | ✓ | ✓ | | `tasks` (core) | — | ✓ | — | — | — | | `extensions["io.modelcontextprotocol/tasks"]` | ✓ | — | — | — | — | | `extensions["io.modelcontextprotocol/skills"]` | `{"directoryRead": true}`, where skills are served | — (declared where skills are served) | — (declared where skills are served) | — (declared where skills are served) | — (declared where skills are served) | - **`tools.listChanged` is false unless mcpx passes tools through.** mcpx's own tool list is fixed when its server is built. It used to be declared and fed by upstream tool changes, which are not changes to _this_ list: a client re-listed on every one and got the same tools back. In pass-through mode (`--passthrough`) the list _is_ the upstreams', so an upstream's `tools/list_changed` is relayed -- unsolicited to a legacy client, and on a `subscriptions/listen` that asked for `toolsListChanged` to a modern one. - **`logging` is declared to legacy clients.** The capability means "this server sends log messages": mcpx relays its upstreams' `notifications/message` to a client that set a level, during that client's calls (§4.4, #212). 2026-07-28 has no such capability. - **"Can push"** is a property of the connection, not of the server. A stdio connection can. A legacy HTTP session can, through its GET stream (which used to be missing, so both were declared and never delivered). A legacy POST outside a session cannot, and gets neither. A 2026-07-28 client receives these only on a `subscriptions/listen` stream, which is its own request's response, so any transport that can stream a response can deliver them. - **Core `tasks` only to 2025-11-25, `extensions` only to 2026-07-28.** Both were sent to both; 2025-11-25's schema has no `extensions` field, and the extension's SEP says a server must not keep advertising core tasks under a revision that has the extension. ### 2.3 Result shapes, and what is downgraded Everything is built in the newest shape and spelled down once, at the edge, in `downgrade()`. An upstream's `tools/call` result (through `mcpx_call` or a pass-through tool) and `prompts/get` result are carried as the upstream sent them -- `isError`, every content block, `structuredContent` and `_meta` -- with resource URIs rewritten to ones `/mcp` can read; listed tools, resources, templates and prompts keep their optional fields. Building several shapes and choosing between them is how the shapes drift apart. | carried | defined from | to an older client | | ---------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | | `structuredContent` | 2025-06-18 | removed, and rendered into the `content` array as text — the data survives, in a vocabulary the client has | | `resource_link` block | 2025-06-18 | becomes an embedded `resource` with a `text/plain` label naming the URI, which keeps the URI machine-readable where text would not | | `audio` block | 2025-03-26 | a text block describing it, for 2024-11-05 | | `_meta` on listed tools, resources, templates, prompts and read contents; `annotations.lastModified` | 2025-06-18 | stripped | | tool `annotations`, the `completions` capability | 2025-03-26 | stripped for 2024-11-05 | | `title` | 2025-06-18 | stripped | | `icons` | 2025-11-25 | stripped | | `resultType` | 2026-07-28 | removed — sending it says mcpx is speaking a revision it is not | | `ttlMs`, `cacheScope`, `serverInfo` in `_meta` | 2026-07-28 | removed; `serverInfo` travels in the `initialize` result instead | | `inputRequests` / `requestState` | 2026-07-28 | never sent; a legacy client is asked on the wire instead | | `elicitationId` | 2025-11-25 | never sent to 2026-07-28 (it used to leak through `inputRequests`); minted for a 2025-11-25 url-mode question an upstream sent without one | A revision that defines all of them pays nothing: the function returns the result untouched. An older one gets a copy, never an edit, because a task's stored result is handed out more than once and rewriting it in place would downgrade it permanently for whoever reads it next. **The 2026-07-28 envelope.** Every modern result carries `resultType` (`complete` unless it is `input_required` or `task`) and `_meta["io.modelcontextprotocol/serverInfo"]`. The cacheable ones carry the REQUIRED `ttlMs` and `cacheScope`: `public` for `server/discover`, `tools/list`, `prompts/list` and `resources/templates/list`, which follow configuration rather than the caller; `private` for `resources/list`, which includes the caller's own session artifacts, and `resources/read`. The ages are `protoMessages.listMaxAge` (1m) and `protoMessages.readMaxAge` (0s). An `input_required` result carries no hints — it is an interim answer. The strict schema sweep (`internal/mcpserver/schema_sweep_test.go`) validates every frame mcpx sends against each revision's `schema.json` and rejects a property the revision never defined. It is how the discover shape, the missing cache hints, the listen acknowledgement's shape, `extensions` sent to 2025-11-25 and a `uri` where `resources/templates/list` needed `uriTemplate` (in every revision) were found. [`spec/messages.md`](spec/messages.html.md) has the per-revision list. ### 2.4 Transport and identity The rules are in [`spec/transport.md`](spec/transport.html.md); what matters for the rest of this page: - **stdio runs requests concurrently**, each under its own context, so a `notifications/cancelled` can be read while the request it names is running, and cancelling it reaches the upstream call. Notifications and `initialize` stay in line. At EOF, requests in flight get `transport.stdioDrain` to answer. - **Streamable HTTP, legacy**: only `initialize` mints `Mcp-Session-Id`; an unknown or terminated session is 404; `DELETE` ends one; a session has a GET stream for what mcpx pushes; within a session a dropped connection is not a cancellation, and `notifications/cancelled` is. - **Streamable HTTP, 2026-07-28**: `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` are required and must agree with the body (`-32020`, 400); a missing `_meta` is `-32602` (400); the HTTP status is a function of the error code; closing the stream is cancellation; no sessions, none minted, none echoed. - **`Origin`** is validated on every request: loopback, the daemon's own address and `transport.allowedOrigins`; anything else is 403. - **Who a request is from** is decided per connection ([`spec/identity.md`](spec/identity.html.md)): `_meta["dev.mcpx/session"]` if the client names one; otherwise the process on stdio, the `Mcp-Session-Id` on a legacy HTTP session, and nothing — its own per-request scope — for a 2026-07-28 request. Every `/mcp` client used to share the daemon's pid and cwd, and so one stateful instance and one set of artifacts. #### MCP over ssh An MCP host that can only spawn a process gets a remote daemon the same way the CLI does: with ssh as the transport and no streamable-HTTP endpoint to configure. ```json { "mcpServers": { "mcpx": { "command": "ssh", "args": ["buildbox", "mcpx", "serve", "--transport", "stdio"] } } } ``` `mcpx serve` on the remote host is a stdio shim over the daemon **there**, so the tool calls, elicitations and artifact bytes all belong to that daemon. No port is opened and the only credential is the ssh one. For a client that sets a daemon endpoint instead, `ssh://buildbox` is the shorter form and the client starts ssh itself — see [`remote.md`](remote.html.md). --- ### 2.5 Pass-through: upstreams under their own names By default mcpx is a gateway: a small tool set (`mcpx_call`, `mcpx_exec`, discovery), prompts as `_`, resources as `mcpx:///`. `mcp.passthrough` (`--passthrough ` on `mcpx serve` and `mcpx daemon`, `MCPX_MCP_PASSTHROUGH`) names a configured server -- or several, comma-separated, `--passthrough demo,tasks` -- whose surface is offered **as itself** instead: - `tools/list` carries its tools under their own names, ahead of the gateway's; `tools/call` on one of them is forwarded and its result returned verbatim — images, audio, embedded resources, `structuredContent` and `isError` intact; a JSON-RPC error the upstream answers with is relayed as that error, not turned into an `isError` result. Its `execution.taskSupport` is carried on `tools/list` and decides whether a call runs as a task ("Tasks, per era", §2.1). Its questions reach the calling client exactly as `mcpx_call`'s do (§3), with the upstream's own `inputRequests` keys where it asked in a 2026-07-28 result. - `prompts/list` names its prompts without the prefix; `prompts/get` returns the upstream's result verbatim. - `resources/list`, `resources/templates/list` and `resources/read` use its own URIs, as do subscriptions and `completion/complete` refs. An `mcpx://` URI still reaches every other server and mcpx's artifacts. - **Its declaration, not mcpx's.** A 2026-07-28 client's `clientCapabilities` go to the upstream with the call, narrowed from mcpx's own: mcpx never declares to the upstream a capability its client did not (a tool that needs sampling is refused rather than run on mcpx's say-so). An upstream JSON-RPC error — `-32021` with its `requiredCapabilities`, `-32602` for a name it does not know — is returned as that error, HTTP 400 included, not as a tool result with `isError`. - **Names it does not list.** A `tools/call` for a name that is neither the upstream's listed tool nor a gateway tool is forwarded; the upstream says whether it exists. A server may answer to diagnostic or hidden tools it does not list. - **Roots.** A `roots/list` the upstream asks in an `input_required` round is put to a client that declared `roots`, as an elicitation is; for one that did not, mcpx answers with its own configured roots. - **Several upstreams** are merged into one surface. A tool or prompt name two of them offer is refused -- `tools/list` or `prompts/list` fails with an error naming both -- rather than handed to either, since the loser would be unreachable under the name the client was shown. A bare resource URI goes to the first upstream, in the order given, that lists it as a resource or offers a template it falls under; one none of them lists goes to the first. - **Collisions with the gateway:** the upstream wins. A gateway tool whose name the upstream also uses is neither listed nor callable over MCP (it stays on the CLI and `/v1`). The upstream is the server in this mode, and a client must be able to call every name `tools/list` shows and get that tool. Every other server stays reachable through the gateway tools. Not carried over: a pass-through tool's `outputSchema`, `title` and `annotations` (the daemon's catalogue keeps name, description, input schema and `execution` only). The upstream's progress and log messages during a call are relayed (§4.4). `scripts/conformance.sh` runs the official suite's own fixture server this way, merged with `internal/testsupport/taskmcp`, mcpx's fixture for the suite's tasks-extension scenarios, which the suite's server does not define. ## 3. A server asks a question This is the part with two mechanisms for one thing, and the reason the rest of the design is shaped the way it is. When mcpx proxies a call and the upstream server elicits or samples, the question becomes a row in the broker: an identity, a deadline, a routing decision (`docs/elicitation.md`). What the broker could not do alone is ask **mcpx's own client** — the agent or editor that made the call, which is very often the only thing that knows the answer. It does now, native-first and broker-backed (`proto.native`). The broker remains the store and the fallback; the client is asked first when it said it could answer. ### 3.1 Which client gets asked | the client declared | version | what happens | | ------------------------- | ---------------------- | ------------------------------------------------------------- | | nothing | any | broker only | | `elicitation` | 2024-11-05, 2025-03-26 | broker only; those revisions have no elicitation | | `elicitation` | 2025-06-18 | asked, form mode only, `mode` and `elicitationId` stripped | | `elicitation` (any shape) | 2025-11-25, 2026-07-28 | asked in form mode; a url-mode question stays with the broker | | `elicitation.url` | 2025-11-25, 2026-07-28 | asked in either mode | | `sampling` | any | asked for `sampling/createMessage` only | Declaring one is not declaring the other. A sampling-only client is never sent an elicitation, and vice versa. Anything mcpx may not send this client is left with the broker and its default audience, so nothing is lost by a client's narrowness — it just does not get to answer. The gates are narrower than a bare declaration: from 2025-11-25 a client that declared only `url` is never sent a form (form needs the `form` key, and `{}` remains the form-only declaration), and `sampling` is read for sub-capabilities — a tools-carrying question is refused whole when the client did not declare `sampling.tools` (never stripped and degraded), and `includeContext` is dropped when it did not declare `sampling.context` ([`internal/mcpserver/conn.go`](https://github.com/developing-today/code/blob/main/pkgs/mcpx/internal/mcpserver/conn.go) `CanElicit`, `CanSampleTools`, `CanSampleContext`). **Why a non-declaring 2026-07-28 client never gets `-32021` for a tool that asks.** 2026-07-28 `basic/index` says a server "MUST NOT rely on capabilities the client has not declared" and "if processing a request requires a capability the client did not include ... MUST return" `-32021` (`MissingRequiredClientCapabilityError`). The error is conditional on _requiring_ the capability, and mcpx never does: a question it may not send the client goes to the broker, which is a durable queue answerable by any consumer (`mcpx elicit`, `/v1`, the plugin, a human) whether or not one is listening when it is asked -- there is no state in which the broker has no audience, only one in which nobody has answered yet, which ends in the question's own timeout. mcpx also cannot know in advance: whether an upstream tool elicits is decided by the upstream mid-call, so a pre-dispatch `-32021` would be a guess. The official suite's `sep-2575-server-rejects-undeclared-capability` assumes a fixture tool (`test_missing_capability`) that mcpx does not publish, and so does not test this path (#252 item 1). The extension's own methods are different: `tasks/get`, `tasks/update` and `tasks/cancel` from a client that did not declare `io.modelcontextprotocol/tasks` answer `-32021` with `data.requiredCapabilities` (HTTP 400), because there the capability is the whole request; so does a `subscriptions/listen` asking for task notifications without it. The message is rewritten to name the originator: _"github (via mcpx) asks: which repository?"_. A client asked "are you sure?" with no idea who is asking cannot answer it. ### 3.2 Legacy: a request on the wire The server sends `elicitation/create` while the client's `tools/call` is still open, and waits. **Over stdio** this is straightforward — the pipe is the session, it stays open for the life of the process, and mcpx's own receive loop routes inbound frames by shape rather than by id. Requests run on their own goroutines, so the answer can arrive while the request that asked is blocked on it. **Over Streamable HTTP** it is not, and this is the part worth recording. The POST is the only channel, and it is the thing waiting for the answer. So: 1. mcpx issues `Mcp-Session-Id` on `initialize`. 2. A request that has to ask turns its POST response into an event stream — lazily, so a request that asks nothing still gets a plain JSON object — and writes `elicitation/create` as an SSE frame. 3. The client answers with a **separate POST** carrying the same session header, whose body is a JSON-RPC response. mcpx routes it to the request waiting on that session and answers `202`. 4. The original stream carries the final result and closes. A request that asks nothing but is slow — a pass-through call waiting out `pool.callTimeout` on an upstream that went quiet — also becomes an event stream once it has been silent for `transport.sseKeepAlive`, carrying a comment each interval until the answer, when the client's `Accept` offered `text/event-stream`. Before, such a POST got no bytes at all, not even headers, for up to two minutes, and a client or proxy with an idle timeout gave up on a call that was still running. The stream carries no event ids: mcpx does not offer SEP-1699 resumption, and an id would promise a replay it cannot make. A legacy POST outside any session cannot be asked anything: its answer would arrive on a POST nothing can route back. Its questions stay with the broker. That is the reason `Conn` exists: a subscription filter, a push function and a client's declared capabilities used to live on the `Server`, which was correct while stdio was the only transport and wrong the moment one server answered several HTTP clients — those fields decide _whose_ client gets asked a question. Server ids are negative on the wire. JSON-RPC only requires uniqueness within a direction, but several clients key one table by id, and they would otherwise see mcpx's request answer their own. ### 3.3 Modern: a result the client retries A 2026-07-28 server has no connection to send a request on. It answers `resultType: "input_required"` with a map of `inputRequests` and an opaque `requestState`; the client answers each and sends the **same request again** with `inputResponses` and the state attached. Only `tools/call`, `prompts/get` and `resources/read` may do this. `inputResponses` sent on a request that resumes nothing — a client that knows what will be asked and answers up front — are held until the upstream asks, and given to the questions whose keys they match. Keys that match nothing are ignored, as SEP-2322 asks of information a server does not recognise. Which means the call has already returned by the time the answer exists. The upstream call therefore cannot be tied to the client's request — if it were, there would be nothing left to resume. It runs as a daemon task (`internal/tasks`, the same store `/v1/call`'s task option uses, collectable from the same `/v1/tasks/{id}`), and questions are correlated to it. The returned ID is a 128-bit unguessable bearer handle; anyone with access to the daemon API who learns it can retrieve the task. **`requestState` is signed and bound to the request.** The specification says the client must treat it as opaque, and that it SHOULD be tamper-evident and bound to the originating method and parameters, an expiry and — where there is one — the principal. mcpx's is `base64(payload).HMAC-SHA256` under a key generated per daemon process and never persisted, carrying the call id, a binding (the method and a SHA-256 of the parameters without `_meta`, `inputResponses` and `requestState`) and an expiry (`proto.stateTTL`). A token that verifies but was issued for another request is refused with a message that says so — the difference between a confused client and somebody replaying matters to whoever reads the log. It used to be bound to the connection: an `Mcp-Session-Id`, which 2026-07-28 does not have. mcpx minted one on `server/discover` to have something to bind to, a conformant client never sent it back, and every such client got "still asking for input after 8 rounds" within milliseconds. Binding to the request needs nothing from the transport. mcpx has no authenticated principal to add, so a state is replayable by anyone who holds it, on the same request, within its TTL. ### 3.4 Correlation: which call asked? A question arrives on a _connection_, not on a call. The server sends `elicitation/create` down the same pipe it is answering `tools/call` on, and nothing in the frame says which call it belongs to. What mcpx knows is that one pooled instance serves one scope key. So a question arriving on `(server, key)` belongs to whatever is calling on `(server, key)`, and the pool now tells the handler which key the connection serves. When two calls share a key — which a `shared` server allows — the attribution is genuinely ambiguous. mcpx makes none, and the question goes to the broker. Guessing would hand one client's credential prompt to another client, and that is not a trade worth making for a convenience. The rule is one comparison. The ask table holds the upstream requests a call _owns_; the pool counts every upstream request in flight on the key, whoever made it (`/v1/call`, exec, the CLI, the plugin). A call owns a question when all the table's entries on the key are its own **and** their number equals the pool's count — nobody else is on the connection. Until #229 the table alone decided, and an interruptible call sharing a key with somebody's ordinary `mcpx call` was handed that caller's question. One window remains: an entry is registered an instant before its request is counted, so a stranger's question arriving in exactly that instant can still be misattributed. **A script** (`mcpx_exec`) is one call that makes many. It runs as an interruptible call too (`/v1/ask` kind `exec`), and its run id is chosen and registered _before_ the script starts. The generated client sends that id as `X-Mcpx-Run` on every `/v1/call`, so each upstream call the script makes joins the table as a member of the run. A question on a key whose in-flight calls all belong to one run is that run's — including calls the script makes in parallel. Two runs, or a run and anyone else, on one key: ambiguous, broker. When the run ends (finished, timed out, abandoned) its membership is removed everywhere, so a straggling upstream call killed with the script cannot pin a question to a call nobody polls; that question stays with the broker. A script that asks more than `proto.askRounds` questions in one legacy request is abandoned like any other call — scripts that elicit in a loop hit it first. The script's own `exec.timeout` (120s) is usually shorter than `proto.askTimeout` and a person answering eats into it; set `timeoutSec` on the tool call for a script that expects to ask. ### 3.5 Bounds - `proto.askTimeout` (10m) — how long one client request may be held. A legacy client is blocked for all of it, so it has to sit inside whatever that client's own timeout is. A modern one is not blocked at all. - `proto.askRounds` (8) — how many times one call may come back asking. A server that never stops asking is broken or adversarial. For a 2026-07-28 client each round is a new request, so the count rides in the signed `requestState` and holds across the retries; it used to restart at zero on every one (#201). - `proto.stateTTL` (30m) — how long a `requestState` may be resumed with. - `proto.askTTL` (15m) — two clocks for a parked `/v1/call`: the waiting deadline (a call still waiting for an answer after 15m is cancelled) and, once the call finishes, how long its result is kept, measured from when it finishes. - `pool.callTimeout` pauses while a question is pending on the instance (#229). It used to kill a call while a person was answering it, which made the three settings above promises the pool did not keep. The precedence of all five timeouts is written down in `internal/pool/budget.go`. A caller may request a shorter value for a single call (`--pool-call-timeout`, carried as a call setting): the daemon clamps the request to its own configured value, so a call may lower the bound but never raise it (#1864). Against `exec.timeout`: that bounds a whole script run, this bounds one upstream call inside it -- the run's total work is capped by `exec.timeout`, each call within it by the (possibly per-call) `pool.callTimeout`, and whichever is tighter for a given call is the one that fires. The pool's execution watch keeps the configured value; the per-call request bounds the call it was made on only. - The question's own deadline is `elicit.ttl` in `defaults.json` (120s; a built-in, not a user setting). Expiry answers `cancel`, never `decline`: dismissed without choosing is not the same as refused. A call the client stops waiting for — it cancelled, or its connection went — keeps running as a task, and its questions keep their deadlines. The result can still be collected from `/v1/tasks/{id}` by ID; nothing interrupts the upstream call. That is deliberate for work somebody may come back for, and it is also why cancellation does not reach an interruptible call (§6). --- ## 4. mcpx as a client What mcpx sends upstream, and what it will accept from a server. | | | | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | era | modern probed first (`server/discover`), legacy on fallback; the answer cached per server configuration ([spec/era-probe.md](spec/era-probe.html.md)) | | per-server override | `protocol: prefer-discover \| prefer-initialize \| force-discover \| force-initialize \| follow`, over `upstream.protocol` (default `prefer-discover`); the old names `modern`, `legacy`, `force-modern`, `force-legacy` and others are accepted as aliases ([spec/era-probe.md](spec/era-probe.html.md#values)); `follow` adds a legacy session for legacy callers ([spec/era-probe.md](spec/era-probe.html.md#follow)) | | legacy version | `2025-11-25` offered; `2024-11-05` .. `2025-11-25` accepted; anything else and mcpx disconnects | | modern version | `2026-07-28` | | declared to servers | `elicitation.form` and `roots` always; `elicitation.url` and `sampling` only when the corresponding handler is installed — in the daemon always, and it answers (`internal/mcpclient/modern.go` `capabilities`) | | transports | stdio, Streamable HTTP, and HTTP+SSE (2024-11-05) as the last fallback of the HTTP probe, remembered in the era record | | stdio shutdown | close stdin, wait `stdioShutdown.stdinGrace` (2s, a built-in default) for the server to exit, then `SIGTERM` the process group, wait `stdioShutdown.termGrace` (3s), then `SIGKILL` — every revision's stdio SHOULD (#203 LV-39; it used to `SIGTERM` at once) | | headers | legacy: `MCP-Protocol-Version` is the negotiated version, omitted on `initialize` and up to 2025-03-26; modern: `Mcp-Method`, `Mcp-Name`, `Mcp-Param-*` for `x-mcp-header` parameters, never a session id | The per-revision rules — headers, `x-mcp-header`, `resultType`, cancellation, pagination, `subscriptions/listen`, resumption, the GET stream — are in [spec/client.md](spec/client.html.md). The official suite's client leg passes every non-auth scenario ([spec/official-suite.md](spec/official-suite.html.md)). The probe used to be the other way round, and it did not matter which way, because mcpx read `protocolVersions` from `server/discover` where the schema says `supportedVersions`. mcpx could not connect to any real modern server. Its own server made the same mistake, which is why mcpx talking to mcpx passed every test. ### 4.1 Server-initiated requests mcpx answers | request | mcpx answers | regardless of era | | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | `ping` | `{}` | yes | | `roots/list` | relayed to the host client whose call raised the question when it declared `roots`; otherwise mcpx's configured `daemon.roots` (empty only when none are configured) | yes | | `elicitation/create` | through the broker, or `{"action":"cancel"}` when nothing can answer; a mode that was not declared for the revision in use is refused | yes | | `sampling/createMessage` | through the broker; a decline becomes an error, since the specification has no decline result for sampling | yes | | anything else | `-32601`, but **always answered** — silence is indistinguishable from a hung server | yes | Always answered, unless the server withdraws the question first: a `notifications/cancelled` naming a request still being answered ends the handler's context (so a question relayed to the host is withdrawn too) and no response is sent. The reason, if given, goes to the daemon log as a `server.warning`. A cancellation naming anything else is ignored. A modern server asks the same three things by _answering_ `input_required`, and mcpx resolves them through the identical function. One function is what stops the two eras answering the same question differently. ### 4.2 Notifications mcpx listens to `notifications/message`, `notifications/progress`, `notifications/cancelled`, `notifications/{tools,resources,prompts}/list_changed`, `notifications/resources/updated`, `notifications/elicitation/complete`. From a legacy server they arrive unsolicited (on the standalone GET stream, over HTTP). A 2026-07-28 server sends them only on a `subscriptions/listen` stream, so mcpx opens one per upstream connection, with a filter built from what the server declared and the URIs somebody subscribed to, and reopens it when it ends. Messages and progress go to `/v1/events`; a list change drops the cached schema. `notifications/tasks/status` (2025-11-25) is received and dropped — mcpx polls task state rather than tracking it. A request from a 2026-07-28 server is not answered: that revision has no server-to-client requests (a server asks through `input_required` results), and the stdio transport page says the client MUST NOT respond (#200). With `2026-07-28` in `spec.lenient` it is answered like a legacy server's (§1.1). ### 4.4 Progress, log messages and trace context, relayed (#212) During a `tools/call` that reaches an upstream, mcpx carries what the host asked for through to the server doing the work, and what that server sends back to the host: - **Progress.** A host's `_meta.progressToken` is replaced upstream by a token of mcpx's own (`mcpx-`, unique on that upstream connection, which two hosts' tokens are not), and each `notifications/progress` for it is sent to the host with the host's token restored. Only progress for a call still in flight is passed on: a token nobody asked for, or one whose response is in, is dropped. A report that does not exceed the last one passed on is dropped, so the host never sees progress go backwards; once progress reaches `total` nothing more is sent; and reports for one token are passed on no more often than every 20 ms (`mcpclient.ProgressMinInterval`), except the final one. A `message` goes to every host by default; it is removed for a 2024-11-05 host only when 2024-11-05 is first in `spec.precedence` and strict (`--mcp-spec 2024-11-05`), since that revision's schema has no such field (§1.1). - **Log messages.** A 2026-07-28 host's `_meta` `logLevel` is sent upstream (or the daemon's own level, if more verbose); a legacy host's level is the one it set with `logging/setLevel`. Upstream `notifications/message` at or above that level are sent to the host. No level, no messages. A log message names no request, so one arriving while a host has several calls in flight on the same upstream connection goes to each of them. - **Trace context.** `traceparent`, `tracestate` and `baggage` in `_meta` are passed upstream unchanged. Over Streamable HTTP these go on the call's own response stream, which becomes `text/event-stream` only when something is relayed; over stdio, as notifications. Between `mcpx serve` and the daemon the call carries a `relay` object on `/v1/call` (answered as `application/x-ndjson` when anything was relayed, plain JSON otherwise) or `/v1/ask` (collected by the polls as `notifications`). `mcpx call` and `mcpx exec` send no relay and print only the result. Messages and progress still reach `/v1/events` as before. Not yet: progress does not extend mcpx's own call timeout (CODE-13), and prompts/get and resources/read relay nothing. ### 4.3 Resource subscriptions, end to end (#241, #247) mcpx declared `resources.subscribe` to its own clients and never subscribed upstream, so `notifications/resources/updated` never flowed: a capability declared and not delivered. Now a client subscribing to `mcpx:///` -- by legacy `resources/subscribe` (stdio, or Streamable HTTP with the update on the GET stream) or by `resourceSubscriptions` on a 2026-07-28 `subscriptions/listen` -- makes the daemon subscribe `` on the server that owns the namespace, with whichever mechanism that server's era has. - **The lifetime is a `/v1/events` stream.** `mcpx serve` hears the daemon's events over `GET /v1/events?uri=mcpx://...`; a stream naming a resource in mcpx:// form (or bare with `server=`) _is_ a subscription to it, held until the stream closes. So a listen stream ending, a connection ending, a legacy unsubscribe (which replaces the connection's stream), or `mcpx serve` crashing all release it without a separate call that could be missed, and a stream that reconnects to a restarted daemon subscribes again by reconnecting. The stream's first event, `resource.watching`, says what was subscribed and why anything was not. - **Counted per URI across every client.** The upstream sees one connection, mcpx's, and one `resources/unsubscribe` from it would end the updates for everyone. The first watcher subscribes; the last one unsubscribes (`internal/pool/watch.go`). - **Instances.** One holding a subscription is not idle and is not reaped. A newly started instance is given every subscription still wanted, and one that ends while its subscriptions are wanted -- `mcpx restart`, a crash -- is replaced at once, since nobody else would start it and the updates would stop without a word. A replacement that fails to start is the pool's ordinary start failure; the next call to that server retries and resubscribes. - **A server that does not declare `resources.subscribe`** is never sent a subscription (that would be asking for an undeclared capability). mcpx keeps declaring `resources.subscribe` itself -- it is one capability over many servers, and it does support the mechanism -- and is honest per resource instead: the listen acknowledgement's `resourceSubscriptions` lists only the URIs whose updates will arrive, which is what the acknowledgement exists to report. A legacy `resources/subscribe` for such a URI -- or for one no configured server owns, like a bare `test://x` -- **succeeds** and delivers nothing (#251). A subscription is a standing interest, not a lookup: the spec does not require the resource to exist or its updates to be deliverable, and the legacy revisions have no way to say "agreed, but nothing will come". Refusing with `-32602`, as #247 first did, broke clients that subscribe before they know (the official suite's `server-resources-subscribe` and `-unsubscribe` among them). The reason is not lost: the daemon publishes a `server.log` event at level `warning` ("no updates will be delivered for <uri>: <reason>"), visible on `/v1/events`. Honesty stays where the protocol has a mechanism for it, the listen acknowledgement. Only agreed URIs' updates are ever sent on a stream. - **Absolute-path URIs.** A listing drops a leading `/` when it namespaces (`/abs/doc` is listed as `mcpx://demo/abs/doc`). The daemon resolves the inner part against the server's own resource list to recover `/abs/doc`, and `events.Filter` compares URIs without a leading `/`; before, the two forms never matched. ### 4.4 Generic requests `Client.Request` and `Pool.Request` send any method. Before them the typed helpers were the only way to the wire, and anything outside that set had no path at all — which is why `POST /v1/complete` answered from cache with `"upstream": false`. Not because the server could not complete: because nothing could ask it. `Complete` now forwards `completion/complete` to the server, which knows the _values_ an argument may take where mcpx knows only the names it has cached. A server that never declared `completions` is not asked — a well-behaved one answers method-not-found and the rest answer something unpredictable, so the declaration is the only thing worth trusting — and the reply says `"source": "cache"` with the reason. --- ## 5. One HTTP server The daemon served `/v1` on a unix socket and a loopback port. `mcpx serve --transport http` was a **separate process** serving `/mcp`, `/v1/tools/*`, `/v1/call//`, `/health` and `/openapi.json`. Two HTTP servers, two overlapping `/v1` prefixes, and which one a caller reached decided which half of the API existed — with no way to tell from the outside. Now: | was | is | | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `serve --transport http` → `/mcp` | the daemon mounts `/mcp` on its own listeners (`proto.mcpPath`, `proto.serveMCP`) | | `serve --transport http` → `/v1/tools/` | `POST /v1/tools/{tool}` in the ops table | | `serve --transport http` → `/v1/call//` | `POST /v1/call/{server}/{tool}` in the ops table | | `serve --transport http` → `/health` | `GET /v1/health`, which already existed | | `serve --transport http` → `/openapi.json` | `GET /v1/openapi.json`, which already existed, and which now describes the per-tool paths the second server used to publish alone | | `serve --transport stdio` | unchanged | `serve --transport http` is **removed**, and asking for it fails with the address to use instead. A command that fails without saying where the thing went costs somebody an afternoon. The daemon package cannot import the CLI — the dependency runs one way, and inverting it to put the two servers together would be a worse cure than the disease. So the CLI builds the handler and the daemon mounts it: `Server.MCP`, `Server.MCPPath`, `Server.MCPTool`. Three fields. **stdio stays**, and stays a thin shim. It is inherent rather than a choice: an MCP host starts its servers by spawning a process and talking down the pipe, so something has to be spawnable. Everything else the daemon already had — a socket, a port, a lifetime, pooled servers kept warm between calls — and giving MCP a second copy of all of it bought nothing. To put MCP on a network: `mcpx daemon --port 8899 --address 0.0.0.0`, then `http://host:8899/mcp`. The warning about an unauthenticated API binding beyond loopback applies to `/mcp` exactly as it applies to `/v1`, and for the same reason: whatever can route to the port can run tools as you. ### Why not an extra listener An `--mcp-addr` on the daemon was the obvious alternative, and it is one address away from what `--port` already does. The reason not to is that the two surfaces are not separable: `/mcp` calls `/v1` for everything, the MCP tools are _generated_ from the `/v1` ops table, and a deployment that exposed one without the other would be exposing half a program. One listener, one access-control decision. --- ## 6. What is still missing Named, because a gap nobody wrote down is a gap somebody rediscovers. - **Cancelling an interruptible call stops it, on both paths.** On a direct call, `notifications/cancelled` (stdio, legacy HTTP session) and a closed stream (2026-07-28 HTTP, sessionless legacy) cancel the upstream request. A call on the ask path runs as a daemon task (§3.5), and a `notifications/cancelled` naming its request now cancels that task through the task cancel path (`/v1/ask/{id}/abandon`, the task store's `Cancel` -- the same `Cancel` `/v1/tasks/{id}/cancel` reaches). A transport that dies without a cancellation is not read as one: the task keeps running and can still be collected from `/v1/tasks`. - **Progress does not extend mcpx's own call timeout.** It is relayed to the host (§4.4), so a host's timeout can reset on it; the daemon's per-server `callTimeout` still cannot. - **`-32021` for a tool that asks** is deliberately not raised (§3.1); whether the broker fallback discharges the MUST is #252 item 1. - **Tasks.** `notifications/tasks/status` is dropped; mcpx never task-augments a call upstream, so a tool with `taskSupport: "required"` cannot be called; an extension task never reaches `input_required` (#209). - **Authorization.** No OAuth client and no OAuth on `/mcp` (#253). The per-server `auth` block (bearer, basic, header, query, env) is applied to every connection (#240); `type: oauth` is refused with a message, since the flow is not implemented. - **Validation.** Tool inputs and outputs and elicitation answers are not checked against their JSON Schemas (#254); sampling results are relayed unreviewed (#256); elicitation storage is readable by any local user and never pruned (#255). - **Smaller conformance gaps**: an invalid cursor restarts at page one instead of `-32602`, `mcpx://` URIs are built without percent-encoding, no rate limits, annotations shown as trusted, and the rest of #257. - **url-mode elicitation raised by mcpx itself.** The pass-through works; mcpx never starts one of its own. - **One attribution window** (§3.4): an entry is registered an instant before its request is counted. 2026-09-30T16:00:00-05:00 --- # Public Go client for /v1 (`pkg/client`) `pkgs/mcpx/pkg/client` is the public Go client for the mcpx daemon's /v1 API (#1877, rung 1). Its calls are derived at run time from the daemon's operation table (the `Ops` function in `internal/api`) — method, path, and parameter placement come from the table, never from hand-written per-operation code — so the client cannot drift from the daemon the way a hand-maintained client would. ## The API One client, two call shapes, and the table itself for callers who need to know what exists before calling. The signatures below are generated from the Go source; the prose around them is the chapter: | signature | what it is | | --- | --- | | `type ArgError struct` | ArgError reports an argument that does not fit the operation's declared parameters: an undeclared name, a missing required parameter, or a value outside a declared enum. It is a client-side refusal — no request was sent. | | `type Client struct` | Client talks to one mcpx daemon over HTTP at its /v1 base endpoint, for example http://127.0.0.1:7432 (the daemon's loopback endpoint, as reported by the health operation). | | `type HTTPError struct` | HTTPError is a non-2xx answer from the daemon, with the daemon's error envelope decoded. Body keeps the raw answer for the routes whose failure payload is itself information. | | `type Option func(*Client)` | Option configures a Client. | | `Invoke[T any](ctx context.Context, c *Client, name string, args map[string]any) (T, error)` | Invoke is Call with the answer as a return value, for callers that prefer generics over an out parameter. | | `New(baseURL string, opts ...Option) *Client` | New builds a Client for the daemon at baseURL. The trailing slash is optional; operation paths from the table are appended to it. | | `Operation(name string) (api.Op, bool)` | Operation looks one operation up by its table name (for example "task_get"). The second result is false for a name the table does not declare. | | `Operations() []api.Op` | Operations returns the daemon's /v1 operation table: every operation Call can reach, with its declared parameters. The list is the table itself, so it is current by construction. | | `WithHTTPClient(hc *http.Client) Option` | WithHTTPClient replaces the HTTP client, for callers that need a custom transport (a unix-socket dialler, a test round-tripper, TLS). | | `WithToken(token string) Option` | WithToken sets the bearer token sent on every request, matching the daemon's Authorization: Bearer convention. An empty token sends no header, which is the loopback daemon's usual case. | | `(*ArgError).Error() string` | Error reports the operation, parameter, and reason the call was refused for. | | `(*Client).Call(ctx context.Context, name string, args map[string]any, out any) error` | Call performs the named operation with the given arguments and, when out is non-nil, decodes the JSON answer into it. Arguments are keyed by the parameter names the table declares; where each travels is the table's business, not the caller's. | | `(*Client).CallRaw(ctx context.Context, name string, args map[string]any) ([]byte, error)` | CallRaw performs the named operation and returns the raw answer body. A non-2xx answer is an *HTTPError. | | `(*HTTPError).Error() string` | Error reports the daemon's message for a non-2xx answer, or the raw body when it is not that shape. | `ErrUnknownOperation` is the package-level sentinel `Call` returns (wrapped) when it names an operation the table does not declare. It is a variable, not a callable, so it stays in this prose rather than in the generated list above. ## An example The shape of real use, from the package's own tests (`pkg/client/client_test.go`), which drive it against a test daemon: ```go c := client.New(srv.URL, client.WithToken("test-token")) var task struct { Status string `json:"status"` } if err := c.Call(ctx, "task_get", map[string]any{"id": "t 1/2"}, &task); err != nil { // *client.ArgError names a bad argument, *client.HTTPError a // refused call, and an error wrapping client.ErrUnknownOperation // means the name is not in the table at all. return err } ``` ## Who calls it Nothing in this repository does — yet. The CLI, the daemon and the plugin each reach the operation table in-process; `pkg/client` is the rung of #1877 that exists for callers outside the module: embedders who want the daemon's API as a library surface instead of a subprocess. That is also why the derivation rule matters more than any one signature: an outside caller pinned to the table inherits new operations as the daemon declares them. ## Stability promise The package is **pre-1.0: public but unstable**. Within the pre-1.0 period the exported surface may change in any release — signatures may be renamed, reshaped, or removed without a deprecation period, and callers must expect to adjust on upgrade. The derivation rule is the stable part: as long as an operation is declared in the table, the client reaches it by its table name. ## Not in this rung C ABI / c-shared / c-archive builds, WASM (wasip1), and the `unix://` MCP transport are separate rungs of #1877 and are not part of this package. --- # Quick start > The whole loop, in under one screen: check the machine, add one > server, look, search, read the types, call a tool. --- ```sh mcpx doctor # runtime, config, daemon: what is missing and how to fix it mcpx servers add fs -- npx -y @modelcontextprotocol/server-filesystem /tmp mcpx ls # namespaces, tool counts, state mcpx search directory # find a tool by name or description mcpx types fs # TypeScript signatures for this one namespace mcpx exec 'emit(await fs.list_directory({ path: "/tmp" }))' ``` That is the loop from [`AGENTS.md`](https://github.com/developing-today/code/blob/main/pkgs/mcpx/AGENTS.md), and it is the whole product in miniature: 1. **`ls` before anything.** Discovery is a separate, cheap step from use — run it whenever; it starts nothing. 2. **`search`, then `types` for one namespace only.** Signatures are loaded on demand, never all of them: loading everything is the failure mode mcpx exists to prevent. `mcpx types fs.list_directory` loads a single tool, cheaper still. Tool names come from the server — if `list_directory` is not what `types` shows, `types` is right. 3. **`exec` (or `run`) does the work.** Inside a snippet, every namespace is a bare identifier and results arrive unwrapped. A named, saved version of the same idea is a script: `mcpx run ` runs `.mcpx/scripts/.ts`. Every command above is real: verified against `internal/cli/manual.go` (`Commands()`, the list behind `mcpx help`) and the dispatch table in `internal/cli/dispatch.go` at the commit this page was written. The server example is the one `mcpx servers --help` itself uses; it needs `npx` (node). With only deno or bun, find a first server that needs nothing extra instead: `mcpx registry search `, then `mcpx registry add --write`. Do not start with `mcpx init`: it writes a starter config whose servers are placeholders, so the first `ls` after it shows an error row. Add a real server first, as above. ## Make it an agent tool The quick start above is a person at a shell. The step that makes mcpx an *agent* tool is one of: - give your agent [`AGENTS.md`](https://github.com/developing-today/code/blob/main/pkgs/mcpx/AGENTS.md) — the loop, the script contract and the secrets rules, in the file agents already read; or - install the opencode plugin — see [install](install.html.md#channels), "just the plugin" — and turn on what you want it to do: the plugin ships with `tools` and `instructions` **off**, so a bare copy gives your agent neither callable tools nor prompt guidance. For tools, name the plugin in config with options (`["./.opencode/plugin/mcpx-session.ts", { "tools": true }]`, or set `MCPX_PLUGIN_TOOLS=1`); for the usage paragraphs, `instructions: true` or `MCPX_PLUGIN_INSTRUCTIONS=1`. See [plugins](plugins.html.md#opencode-v1-plugin) for the full option list. ## Next [Now what](now-what.html.md) — config, surfaces, the plugin, and what to do when something is wrong. --- # Release runbook How `docs/story.md` stays true. `README.md` is a symlink to it, so this is the first thing anyone reads about mcpx. The file has two halves and they have different rules. ## The two halves **Above `` is the story.** One agent, one prompt, one script, with the exact bytes it saw. It is the whole interface in one read. It is _closed by default_: fix it, do not grow it. **Below the marker is the feature list.** It is _open by default_: any commit that lands on `main` may edit an entry or add one. It grows forever and that is fine, because nobody reads past the part that answers their question. ## Rules for the story Change it only to: - correct something that is now false — a flag renamed, output changed, a measured number that has moved; - replace a quoted block whose source changed. Every fenced block in the story is real output or a real file. Re-run the command, paste the result. Do **not** add a new capability to the story. A new capability gets an entry below the marker. The story stays one prompt long. Extending the story needs explicit sign-off from the repository owner. If a change would make the walk longer or add a second scenario, open it as a question first. When a quoted block changes, verify it rather than editing by hand: ```bash mcpx ls mcpx search screenshot click mcpx types chrome_devtools | head -20 mcpx scripts mcpx run shot-flow ``` The instruction file quoted in full is `AGENTS.md`. If that file changes, the quote and the line-by-line breakdown after it both change. ## Rules for the feature list Ordering is meaning. Roughly: 1. **Core** — what mcpx is for. Zero-context discovery, pools, the client. These change rarely and are read first. 2. **Standard** — shipped, supporting. Scripts, config, ops, packaging. 3. **Proposed** — wanted, not built. Everything under the `## Proposed` rule. New shipped work goes after the last `standard` entry unless it is genuinely core. New wants go under `## Proposed`. Within a release, append in merge order. ### Entry format A small addition can be a heading and two links: ```markdown ### feat(a11y): support for Teletypewriter #123 2026-10-02T11:30:00-05:00 ``` Anything larger opens with a key block: ```markdown ## Session-isolated process pools ​` created: 2026-09-25T18:30:00-05:00 last-updated: 2026-09-27T05:05:00-05:00 id: session-isolated-process-pools since: pre-release status: core tags: area:pools, area:concurrency description: one sentence, present tense, what it does ​` Prose, examples, the reasoning that is not obvious from the code. 2026-09-27T05:05:00-05:00 ``` Required keys: `created`, `last-updated`, `id`, `since`, `status`, `description`. Optional: `owner`, `creator`, `tags`, `dek`, `note`, `editors-note`, `links`. `increment` is retired (removed in the #1865 migration). It counted commits inexactly; `changed` below counts recorded changes of meaning, exactly. ### History metadata: `id`, `since`, `changed` Every section carries a stable ID, frozen from the heading's slug the day the metadata landed, so links never break when a heading is reworded: - `id` — the section's ID, first key in the block. - `since` — the first release containing the section: a version (`0.2.0`), or `unreleased` for work not yet released, or `pre-release` for everything that predates the first release (the migration sentinel; no release has shipped). - `changed` — the section's recorded history, one list item per change: ```markdown changed: - 0.2.0 (2026-11-02): idle exit is now a setting ``` Headings without a key block use the compact comment form, directly under the heading: ```markdown ``` A change is recorded per PR as one fragment file, `docs/changes/.md`: ```markdown sections: pools, pools-lifetime kind: Changed summary: idle exit is now a setting ``` `kind` is a Keep a Changelog kind (`Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`). At release time `stamp` folds fragments into the named sections' `changed` lists and deletes them. An edit that changes no meaning (typos, reflow, link repair) needs no fragment: mark the PR with the `docs:trivial` label or a `Docs-Trivial: yes` trailer. `status` also accepts the closed-proposal values `shipped`, `implemented` and `rejected` (used by `proposals.md`); a status that needs more words becomes a vocabulary `status` plus a free-text `note` key. The tool is `tools/docs-history` (one Go program, `render` / `stamp` / `check` on a single parser; not part of the shipped binary). `render` emits the `since` marker and one closed-by-default `
` history per heading whose subtree has history — its own entries in full, then one line per descendant change grouped by release — and with `--agent` the agent-twin form (no disclosures, a since/status line and a history link per section). It also speaks the mdBook external-preprocessor protocol on stdin/stdout. `tags` are Datadog-style: bare tags (`area:pools`) and key-value labels (`platform:nix`, `cost:context`). Reuse existing keys before inventing one — current keys are `area`, `platform`, `cost`. `status` is one word: | status | meaning | | ------------------------- | --------------------------------------------------------- | | `core` | mcpx is not mcpx without it | | `standard` | shipped and supported | | `candidate` | shipped, may still change shape | | `alpha` / `beta` | shipped behind a flag or unstable | | `proposed` | wanted, not built. Say so in the prose too | | `partial` | some of it works; the entry says which part | | `deprecated` | works, will be removed. Link the replacement | | `broken` | known broken, not yet removed | | `retired` | removed. Struck through, or moved to `docs/archive.md` | | `shipped` / `implemented` | closed proposal: built (proposals, document-level blocks) | | `rejected` | closed proposal: decided against | **Every top-level entry ends with its `last-updated` timestamp on its own line**, RFC 3339 with offset. It duplicates the key block on purpose: the key block is for machines, the trailing line is for whoever is scrolling. ### Removing things Never delete an entry. Either strike the heading through: ```markdown ## ~~Old thing~~ ``` and set `status: retired` with a note pointing at the replacement, or move the whole entry to `docs/archive.md` and leave a one-line stub linking to it. Heavy refactors move the old text to the archive too. The archive is append-only and has no ordering rules. ## Per-commit Any commit that lands on `main` and changes behaviour: 1. Edit or add the entry below the marker. 2. Set `last-updated`, update the trailing timestamp, and add a change fragment naming the section IDs you changed (`docs/changes/.md`), or mark the PR trivial (`docs:trivial` label / `Docs-Trivial: yes` trailer). CI runs the docs-history `check` on PRs touching `docs/**`. 3. If it changed something the story quotes, re-run the command and paste the real output. 4. If it changed `AGENTS.md`, update the quote and the breakdown. A commit that only changes behaviour covered by an existing entry does not need a new one; it needs that entry updated. ## Per-release 1. Run the docs-history `check` (see Checks): every entry touched since the last release must carry a change fragment or a trivial marker, and every `since` must be valid. 2. Re-run the story's commands and diff against what is quoted. This is the real check — the story is the only part that can silently rot. 3. Move anything now `retired` into `docs/archive.md`. 4. Promote `proposed` entries that shipped: change `status`, move them up into the shipped run, set `created` to when the work landed rather than when it was first wanted. 5. Run `stamp` with the release version and date (`go run ./tools/docs-history stamp --version X.Y.Z --date YYYY-MM-DD docs/*.md`): it replaces `since: unreleased`, folds the fragments into `changed` lists and deletes them. Commit the stamped docs, then tag that commit — the tagged tree is the stamped tree. 6. Re-read the first screen. If the first thing a newcomer sees is no longer the most important thing, reorder. ## Checks ```bash cd pkgs/mcpx gofmt -l . go vet ./... go test ./... -count=1 -timeout 25m MCPX=./bin/mcpx scripts/stress.sh # concurrency, leaks, orphans MCPX=./bin/mcpx scripts/bench.sh # latency, against lootbox (cd ../.. && nix build .#mcpx) # unit suites in the sandbox ``` The docs-history check (duplicate IDs, bad `since` values, fragments naming unknown sections, and — with `--diff` — prose changes with no fragment and no trivial marker): ```bash go run ./tools/docs-history check docs/story.md docs/proposals.md git diff origin/main...HEAD -- docs/ > /tmp/docs.diff go run ./tools/docs-history check --diff /tmp/docs.diff docs/story.md ``` `README.md` must stay a symlink to `docs/story.md`: ```bash test -L README.md && readlink README.md # -> docs/story.md ``` --- # Reaching a daemon on another machine The daemon speaks HTTP on a unix socket, and every client surface — the CLI, scripts, the TUI, MCP — goes through the same client. Which means a daemon on another machine is a transport question, not a feature: point `daemon.endpoint` at it and everything works there. Three routes exist, in order of how much setup they need. ## 1. `ssh://` — nothing to set up ```sh export MCPX_DAEMON_ENDPOINT=ssh://buildbox mcpx ls mcpx tui ``` ### Fleet laptop to the VM From the fleet NixOS laptop, set the endpoint for just one command: ```sh MCPX_DAEMON_ENDPOINT=ssh://user@100.99.113.103 mcpx ls ``` This discovers the VM's MCP servers through its existing mcpx daemon. To make a real MCP call, use the same endpoint with `mcpx exec`, for example: ```sh MCPX_DAEMON_ENDPOINT=ssh://user@100.99.113.103 \ mcpx exec 'console.log(await tools.codedb.status({}))' ``` The laptop must already have `mcpx` installed and an SSH identity authorized for the VM's `user` account; no mcpx token, new credential, port opening or daemon reconfiguration is involved. `ssh -T -o BatchMode=yes user@100.99.113.103 mcpx stdio-proxy --help` is a useful transport preflight. The daemon stays on its Unix socket, and SSH provides the access boundary. The client runs your own `ssh` binary (`ssh -T -o BatchMode=yes buildbox mcpx stdio-proxy`) and speaks the daemon's HTTP API through it. Your ssh agent, `ssh_config`, `known_hosts`, jump hosts and `Match` rules are the access control, because it is literally your ssh doing the connecting. Nothing listens on the remote host beyond the daemon's own unix socket, and no mcpx credential exists to leak. Details worth knowing: - The remote socket path is resolved **by the remote process**, from mcpx's own paths and configuration file there. The client makes no assumption about the remote filesystem layout. - `?bin=/path/to/mcpx` names a remote mcpx that is not on `PATH`: `ssh://buildbox?bin=/opt/mcpx/bin/mcpx`. - `?sock=/run/user/1000/mcpx/daemon.sock` picks a specific remote daemon, for a host running more than one. - `user@` and `:port` work as in any ssh target: `ssh://user@buildbox:2222`. - `BatchMode=yes` is set, so ssh never stops to ask for a password or a passphrase: an HTTP request has no terminal to answer on. Load the key in your agent, or use a key with no passphrase. - A remote endpoint is **never** auto-started. If nothing answers, the error names the host and the exact remote command that was tried; start the daemon there with `ssh buildbox mcpx daemon` (or `mcpx daemon --detached`). - Server-sent events (`/v1/events`, `mcpx log --follow`) stream over the same tunnel; there is no separate event path. `mcpx stdio-proxy` is the remote half and is a normal command: it dials the local daemon socket and copies stdin/stdout to it. Running it by hand is the quickest way to check a host: ```sh ssh buildbox mcpx stdio-proxy --sock /run/user/1000/mcpx/daemon.sock ``` ## 2. `ssh -L` — forward the socket itself For tools that cannot run `ssh` themselves, or when you want one tunnel for many shells, forward the unix socket as a local socket: ```sh ssh -N -L /tmp/buildbox-mcpx.sock:/home/you/.local/state/mcpx/daemon.sock buildbox & export MCPX_DAEMON_ENDPOINT=unix:///tmp/buildbox-mcpx.sock mcpx status ``` The forward is a plain byte pipe, so it is the same thing the `ssh://` transport does, just started by you instead of by the client. The remote path must be the socket the daemon there is actually using — `mcpx status --json` on the remote host prints it (`socket`). `ssh -L` also works in the other direction of convenience: `-L 127.0.0.1:8065:127.0.0.1:8065` forwards the daemon's loopback TCP port, for a remote daemon started with `daemon.address` widened or a container that serves TCP. Prefer the socket: it is the same filesystem permission check as being there. ## 3. `ssh -R` — a daemon behind NAT The two routes above dial out from the client, which fails when the daemon's host cannot be reached at all. Reverse the direction instead: the daemon's host connects out to a host that is reachable, and publishes the socket there. On the daemon's host (behind NAT), forward its socket to a socket on the public host: ```sh ssh -N -R /tmp/team-mcpx.sock:/home/you/.local/state/mcpx/daemon.sock public-host ``` Then, anywhere that can reach `public-host`: ```sh ssh -N -L /tmp/mcpx.sock:/tmp/team-mcpx.sock public-host & MCPX_DAEMON_ENDPOINT=unix:///tmp/mcpx.sock mcpx ls ``` Or, with no local forward at all, use `ssh://` from the middle host, since the socket is already there: ```sh ssh public-host MCPX_DAEMON_ENDPOINT=unix:///tmp/team-mcpx.sock mcpx ls ``` `ssh -R` needs `AllowStreamLocalForwarding` (the default) on the server, and `StreamLocalBindUnlink=yes` in the forwarding client's `ssh_config` to replace a stale socket after a dropped connection. ## 4. `mcpx serve` over ssh — MCP to a remote daemon An MCP host that cannot set an endpoint can spawn ssh instead of mcpx: see the MCP-over-ssh form in [`protocol.md`](protocol.html.md#24-transport-and-identity). The short version: ```json { "mcpServers": { "mcpx": { "command": "ssh", "args": ["buildbox", "mcpx", "serve", "--transport", "stdio"] } } } ``` That runs `mcpx serve` on the remote host, so the daemon there is the one answering — again with no port and no credential beyond ssh. ## 5. `tsnet://` — a daemon with a tailnet identity A daemon can join a tailnet as a node in its own right (#1967): it embeds a Tailscale node in the daemon process (tsnet), so it is reachable by its MagicDNS name from any other node on the tailnet — from another network, with no port forwarded and no public address. mcpx stays a pure-Go, `CGO_ENABLED=0` binary; the node is a library compiled in, not a sidecar to install. - The daemon's tailnet name is the `daemon.tsnet.hostname` setting. Its node keys live in a state directory on the daemon's machine, so the name survives restarts. - The Tailscale auth key comes from the `TS_AUTHKEY` environment variable — never from a setting, on purpose: a credential that cannot be written into a config file cannot leak into a settings dump or a log either. - The listener serves on port 80, and a client names the daemon as a `tsnet://` endpoint (`tsnet://`). The client builds its own tsnet dialer, so reaching the daemon needs no system Tailscale install on the client side. - Startup waits for the node to authenticate and reach Running, bounded by the `daemon.tsnetUpTimeout` setting: a daemon whose key has expired or been revoked fails its startup honestly instead of reporting success while its identity route never joins the tailnet. ## What a remote endpoint is not - It is not a second authentication layer. **The daemon API is unauthenticated**; who may reach it is who may reach the host and the socket. `ssh://` inherits exactly the ssh access you already grant. - It is not a shared filesystem. Scripts and artifacts sent to a remote daemon travel as bytes; a caller's `{path}` is uploaded, not made visible to the daemon, because an ssh tunnel never proves shared-disk access. See [`exec.md`](exec.html.md#the-store). - It is never started from here. Local autostart does not apply, by design: answering from a local daemon when the remote one is unreachable would be worse than failing. --- # The door Worker at mcpx.security.cab mcpx normally lives on one machine: the daemon listens on loopback and a unix socket, and every local client reaches it there. The door Worker is the one public way in. It is a Cloudflare Worker, served only at `mcpx.security.cab`, that stands in front of the laptop's mcpx daemon, checks who is calling, decides how much of mcpx that caller may see — that decision is the `ns` selector, below — and proxies what survives to the bridge on the laptop. It is the self-hosted replacement for a vendor's metered remote relay, built for [#13657](https://github.com/developing-today/code/issues/13657) on the shape of the Desktop Commander door ([#13404](https://github.com/developing-today/code/issues/13404)). The Worker is not part of the Go module. Its source is `pkgs/mcpx/worker/`: | File | What it is | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `src/index.ts` | the router, the `/mcp` bearer check and the proxy to the bridge door | | `src/oauth.ts` | the OAuth 2.1 authorization server: discovery, registration, `/authorize`, `/token` | | `src/filter.ts` | the `ns` selector: request gating and response filtering at the JSON-RPC layer | | `wrangler.toml` | the Worker definition: name `mcpx`, compatibility date `2025-09-15`, `workers_dev` off, the plain variables and the `OAUTH_KV` binding | | `config.json` | the `cf` tool's view of the same deployment: worker `mcpx`, the single route `mcpx.security.cab`, `workersDev: false` | | `test/` | vitest suites for the filter, the OAuth server, the proxy and the promote step | | `README.md` | the Worker's own operational readme; this chapter is its book form | ## The door chain ```text AI client -> https://mcpx.security.cab/mcp (the bare / is the same door) this Worker: OAuth bearer or machine bearer checked here; the ns selector is computed here, once, and nowhere else -> https://mcpx-link.security.cab/mcp (the bridge door, BRIDGE_BASE) a Cloudflare Access application with a service-token-only policy; the Worker presents its Access service token on this leg -> the sandbox-link Cloudflare Tunnel -> http://localhost:8932 on the laptop -> the mcpx bridge proxy on 127.0.0.1:8932 -> the mcpx daemon's /mcp endpoint, found through the daemon's state descriptor ``` Three boundaries, three different credentials, and no credential crosses a boundary it was not issued for: - The caller's bearer — an OAuth access token this Worker issued, or the machine bearer — is checked at the public door and then _removed_. The bridge leg carries the Worker's own Access service token (`CF-Access-Client-Id` / `CF-Access-Client-Secret`) instead, and any Access headers the caller sent are stripped. - The daemon itself is loopback-only and unauthenticated; it trusts its only caller, the local bridge proxy. This door is therefore the daemon's security boundary, which is why the filtering below lives here and not in the daemon — until daemon-side authentication lands ([#13659](https://github.com/developing-today/code/issues/13659)). - Only `/mcp` (and its bare-path twin `/`) is proxied. The daemon's `/v1/*` API is never proxied and has no public path. One gap in the chain as recorded: the Worker's own readme and source describe the bridge proxy on `127.0.0.1:8932` and the `mcpx-link` tunnel ingress, but no unit or ingress rule defining either exists in this repository's home configuration — the only bridge defined there is the Desktop Commander bridge on `127.0.0.1:8931`. Treat the laptop half of the chain as asserted by the Worker, not yet as described by the deployment configuration. ## Routes Every route the router in `src/index.ts` serves, and nothing else — any other path is a 404 with a JSON `not found` body: | Route | Method | What answers | | ------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `/healthz` | any | `{"ok": true, "service": "mcpx"}`, no authentication | | `/.well-known/oauth-protected-resource` | any | the RFC 9728 protected-resource document: resource `https://mcpx.security.cab/mcp`, this Worker as its authorization server, scope `mcpx` | | `/.well-known/oauth-protected-resource/mcp` | any | the same document | | `/.well-known/oauth-authorization-server` | any | the RFC 8414 authorization-server document: the `/authorize`, `/token` and `/register` endpoints, `code` response type, `authorization_code` and `refresh_token` grants, PKCE `S256` only | | `/register` | POST (405 otherwise) | dynamic client registration, RFC 7591 | | `/authorize` | GET and POST (405 otherwise) | the approval page and the approval decision; the one path behind Cloudflare Access | | `/token` | POST (405 otherwise) | authorization-code exchange and refresh-token rotation | | `/mcp` | any | the gated, filtered proxy described below | | `/` | any | exactly `/mcp`: same gate, same proxying; the upstream path is always `/mcp` | ## Who may call: the authentication model Hosted MCP clients — Claude, ChatGPT — connect from their own servers and cannot pass a Cloudflare Access login at `/mcp`. So `/mcp` itself takes a bearer token, and Access guards only the human leg of the OAuth flow: - **OAuth access tokens.** A client registers itself at `/register` (public clients only: `token_endpoint_auth_method` must be `none`, and every redirect URI must be https, or http on a loopback host). It sends its user to `/authorize` with a PKCE `S256` challenge. `/authorize` sits behind a Cloudflare Access application scoped to `mcpx.security.cab/authorize` whose policy admits the owner's Google identity only — and the Worker does not take Access's word for it: before rendering the approval page it verifies the Access JWT itself (RS256 against the team JWKS from `ACCESS_TEAM_DOMAIN`, the audience `ACCESS_AUD`, the issuer, the expiry, and the owner email held in the `OWNER_EMAIL` constant in `src/oauth.ts`). Approving mints a single-use authorization code, good for 10 minutes; `/token` exchanges it — code verifier checked, code consumed on _any_ attempt, successful or not — for an opaque access token good for 1 hour and a refresh token good for 30 days. Refreshing rotates: the presented refresh token dies whatever happens next, and a fresh pair is issued. - **The machine bearer.** The owner's own tooling skips OAuth and sends a static bearer instead (fleet secret `mcpx.machine-bearer`, staged into the Worker as the `MACHINE_BEARER` secret). The comparison is constant-time (`timingSafeEqual` in `src/oauth.ts`). - **State.** Everything OAuth lives in the `OAUTH_KV` namespace. Clients are stored in the clear under `client:` (they hold no secret); pending approvals under `pending:` for 10 minutes; codes and tokens are stored only under the SHA-256 of the presented value — `code:`, `at:`, `rt:` — never in the clear. Revoking a client is an operation on that namespace: delete its `at:` and `rt:` entries, and its `client:` record. - **Refusal.** `/mcp` without a valid bearer is a 401 whose `WWW-Authenticate` header points at the protected-resource document — that header is what sends a hosted client into the OAuth flow. The single scope is `mcpx`; there are no per-client scopes, which is exactly the gap the `ns` selector fills, next. ## The `ns` selector The upstream daemon offers this door no per-client hooks, so the Worker polices exposure itself, on requests _and_ responses. Enforcement is a pure function of the request's selector and the message: nothing is keyed to `Mcp-Session-Id`, and a client cannot widen its own exposure mid-session except by choosing a wider selector on the next request. The client picks the selector with the `ns` query parameter on `/mcp` (or `/`). The router computes it exactly once, in `resolveFilterSelector` (`src/filter.ts`), strips `ns` before proxying — the bridge and the daemon never see it — and hands the selector to the gate and the filter. Any caller `codemode` parameter is dropped the same way: only the code-mode surface is offered. | `ns` | Profile | Selected set | What it means | | --------------------- | -------------- | ------------ | ------------------------------------------------------------------------------------------------ | | absent | `conservative` | empty | discovery only: see the catalogue, call nothing | | `a,b` | `selected` | `{a, b}` | discovery, plus calls into exactly namespaces `a` and `b` | | `*` | `full` | — | no filtering at all: the whole daemon, as a local client would see it | | empty, or only commas | `selected` | empty | still enforced as an empty set; an empty selector never silently widens to the discovery profile | ### What each profile may do The discovery tools are `mcpx_namespaces`, `mcpx_catalog`, `mcpx_types` and `mcpx_search`. The selected profile adds exactly two dispatch tools, `mcpx_call` and `mcpx_batch`. `mcpx_exec`, `mcpx_tool_invoke` and every other `mcpx_*` extra are never exposed by the conservative or selected profiles — not in listings, and not by calling them directly. - **`tools/list`** responses are filtered to the profile's tool set. - **`tools/call`** requests are gated _before_ anything reaches the bridge; a refused call never touches the daemon: - `mcpx_namespaces`, `mcpx_catalog` and `mcpx_search` are allowed in both profiles. The `mcpx_namespaces` _response_ is filtered to the selected set (empty under conservative); `mcpx_catalog` and `mcpx_search` responses are metadata and pass unfiltered — a known v1 limitation, below. - `mcpx_types` is allowed only when the caller names a namespace list and every entry is in the selected set. With no list the upstream would list every namespace's types, so the call is refused — which means the conservative profile, whose set is empty, refuses `mcpx_types` even though it lists it. - `mcpx_call` (selected only) resolves its `namespace` / `tool` arguments with mcpx's own dotted-name rule — a dotted name splits on the first dot, from either argument — and is allowed only when the resolved namespace is in the set. - `mcpx_batch` and its alias `batch_call` (selected only) are all-or-nothing _as a tool call_: every item must resolve to a namespace in the set, and no item may target a gateway tool (any `mcpx_*` name, or `batch_call`). One bad item refuses the whole batch call. - Everything else is refused, in both profiles. - **JSON-RPC batches** — an array body, as distinct from the `mcpx_batch` tool — are gated element by element. Allowed elements go upstream; each refused element gets its own error object, and the two halves are merged back into one response (as appended SSE events when the upstream answer is a stream). If _every_ element is refused, the door answers itself and nothing is called upstream at all. - **Prompts and resources.** `prompts/list` and `resources/list` responses drop entries whose `mcpx:///…` URI is outside the selected set, and `prompts/get` / `resources/read` for such a URI are refused. URIs that are not `mcpx://` URIs pass. - **Everything else passes**: `initialize`, `ping`, notifications and any other method are proxied untouched; list-shaped answers are filtered on the way back instead. - **Responses** are filtered in whichever framing the upstream used — plain JSON or SSE `data:` lines — and re-emitted in the same framing. The full profile is the exception: its response streams through untouched. ### Refusal shape A refused call is not an HTTP error. The door answers HTTP 200 with a JSON-RPC error object: ```json { "jsonrpc": "2.0", "id": 1, "error": { "code": -32602, "message": "not exposed by this door's selector" } } ``` (`-32602` and that message are the `NOT_EXPOSED_ERROR` constant in `src/filter.ts`; the `id` is the refused message's own id.) A body that is not JSON-RPC the gate can police — unparseable, or carrying no `method` at all — is forwarded untouched; the gate fails open on shape and closed on meaning. ## Configuration and secret reference Every load-bearing name below is spelled as it appears in `wrangler.toml`, `src/index.ts` or `src/oauth.ts`. Secret _values_ appear nowhere in the repository; only their names do. Plain variables (`[vars]` in `wrangler.toml`): | Name | Value in the repository | What it is | | -------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | `BRIDGE_BASE` | `https://mcpx-link.security.cab` | the bridge door; the proxy's upstream, always at path `/mcp` | | `ACCESS_TEAM_DOMAIN` | `snowy-sun-58a9.cloudflareaccess.com` | the Access team domain hosting the JWKS the Worker verifies `/authorize` assertions against | | `ACCESS_AUD` | the audience string in `wrangler.toml` | the audience of the Access application scoped to `/authorize`; an assertion for any other audience is refused | Bindings and secrets: | Name | Kind | What it is | | ---------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------- | | `OAUTH_KV` | KV namespace binding (id in `wrangler.toml`) | all OAuth state: clients, pending approvals, hashed codes and tokens | | `ACCESS_CLIENT_ID` | per-version Worker secret | the Access service token's client id for the bridge door | | `ACCESS_CLIENT_SECRET` | per-version Worker secret | its secret; with the id, presented as `CF-Access-Client-Id` / `CF-Access-Client-Secret` on the bridge leg | | `MACHINE_BEARER` | per-version Worker secret | the static bearer the owner's machine clients present at `/mcp` | Where the values live, by name only: | Store | Names | | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | fleet secrets | `cloudflare.access.mcpx-link-client-id`, `cloudflare.access.mcpx-link-client-secret` (the bridge-door token), `mcpx.machine-bearer`, `cloudflare.api-token-mcpx-worker` (the scoped deploy token), `cloudflare.tunnel.sandbox-link-token` (the tunnel the bridge door rides) | | GitHub environment `mcpx-production` | `MCPX_WORKER_CF_TOKEN`, `BRIDGE_ACCESS_CLIENT_ID`, `BRIDGE_ACCESS_CLIENT_SECRET`, `MACHINE_BEARER` | | Worker version secrets | `ACCESS_CLIENT_ID`, `ACCESS_CLIENT_SECRET`, `MACHINE_BEARER` — uploaded per version by the publish workflow, from the environment secrets | Fixed in code, not configuration: the issuer and resource (`https://mcpx.security.cab` and `…/mcp`), the scope `mcpx`, the owner email (`OWNER_EMAIL`), and the lifetimes — code and pending approval 600 seconds, access token 3600 seconds, refresh token 30 days. ## Failure shapes | Symptom | Where it comes from | Meaning | | -------------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 401 `{"error": "unauthorized"}` with a `WWW-Authenticate` resource pointer | `/mcp` gate | no bearer, or neither an unexpired OAuth token nor the machine bearer | | 404 `{"error": "not found"}` | the router | the path is not one of the routes above | | 405 `{"error": "method not allowed"}` | `/register`, `/authorize`, `/token` | wrong method for the endpoint | | 500 `{"error": "bridge credentials are not configured"}` | `/mcp`, after the bearer check | the deployed version carries no `ACCESS_CLIENT_ID` / `ACCESS_CLIENT_SECRET`; the door refuses rather than proxying unauthenticated to the bridge | | HTTP 200 with JSON-RPC `-32602` | the filter gate | the selector does not expose that call; nothing reached the daemon | | OAuth `invalid_grant` from `/token` | the token endpoint | unknown, expired or already-consumed code; a code whose client, redirect URI or PKCE verifier does not match; an unknown, expired or rotated-out refresh token. Codes and refresh tokens are consumed on the attempt, so a failed exchange cannot be retried with the same material | | OAuth `invalid_client_metadata` / `invalid_redirect_uri` from `/register` | registration | a non-JSON body, a client asking for a token-endpoint auth method other than `none`, or redirect URIs that are not https / loopback http | | OAuth `unsupported_grant_type` from `/token` | the token endpoint | a grant other than `authorization_code` or `refresh_token` | | an HTML error page from `/authorize` (403, or 400) | the authorization endpoint | 403: no verifiable Access assertion for the owner — the request did not come through the Access application as the owner. 400: unknown client, unregistered redirect URI, a response type other than `code`, a missing or non-`S256` PKCE challenge, or a scope outside `mcpx`; on POST, an expired or already-used approval nonce | | a redirect to the client with `error=access_denied` | `/authorize` POST | the owner pressed Deny — a completed flow, not a failure | | the upstream's own status and body | the proxy | once a request passes the gate, upstream answers — including its errors, its `Mcp-Session-Id` header and its SSE streams — pass back untouched, subject to response filtering | ## Operations **Tests.** The Worker has its own suite, independent of the Go module: `npm test` (vitest) and `npm run typecheck` in `pkgs/mcpx/worker/`. The `mcpx-worker-tests.yml` workflow runs them on pushes and pull requests that touch the directory. **Publishing** is a two-step versions flow, modelled on the desktop-commander and id-mail publisher–promoter pairs, and uploading never moves traffic by itself: 1. _Publish_ — `mcpx-worker-publish.yml`, manual dispatch on `main` with `confirm_upload`: tests, a credential-free dry run, then `upload-version.mjs` creates a Worker version with the version secrets file. The run emits a provenance artifact (`mcpx-worker-upload--`) naming the version, its tag (`mcpx--run--attempt-`) and the baseline it was built against. 2. _Promote_ — `mcpx-worker-promote.yml`, manual dispatch naming the publish run and attempt, with `confirm_promotion`: `verify-upload-run.mjs` vouches that the run was a successful manual publish on `main`; `promote.mjs` checks the live deployment still matches the manifest baseline (or already serves exactly this version, an idempotent no-op) and deploys that one version at 100%. As of this chapter's writing the publish step is the known break in the chain: the workflow has failed on `main` ([#13754](https://github.com/developing-today/code/issues/13754)) because the Worker does not yet exist on the Cloudflare account — a versions upload cannot be a Worker's first deployment ([#13770](https://github.com/developing-today/code/issues/13770)). Until a first full deployment exists, treat every "live" statement in this chapter as describing the code's behaviour, verified by its test suite, not a probed endpoint. **Revocation and rotation.** Revoke an OAuth client by deleting its `at:` / `rt:` entries (and its `client:` record) from `OAUTH_KV`. Rotate the machine bearer or the bridge service token in fleet secrets, update the `mcpx-production` environment from them, and publish + promote a new version — the Worker-side values are per-version secrets, so rotation is a deployment, not an edit. **Client setup.** Hosted clients add the custom connector `https://mcpx.security.cab/mcp` and are walked through registration, the Access sign-in and the approval page on first connection. Header-capable clients (Claude Code, Cursor, other mcpx clients) send `Authorization: Bearer ` and choose their exposure with `?ns=` on the URL. ## The related work, in order The door's own items, in the order they should be worked — the same shape as the programme's issue map, narrowed to this Worker: | Order | Issue | What it is | Depends on | | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | 1 | [#13770](https://github.com/developing-today/code/issues/13770) — mcpx Worker does not exist on the Cloudflare account | the publish workflow cannot upload a first version; a first full deployment has to happen before the versions flow can run | nothing in code; it is an account/deployment step | | 2 | [#13754](https://github.com/developing-today/code/issues/13754) — main CI failure: mcpx worker publish workflow | the recorded `main` failure of that publish step | #13770 resolved, then a green publish + promote run | | 3 | [#13657](https://github.com/developing-today/code/issues/13657) — public endpoint at mcpx.security.cab with OAuth/Google-SSO front door and machine bearer | the door's specification and acceptance list: discovery documents, registration, authorize/token behaviour, machine-bearer access from outside, `/` ≡ `/mcp`, the 401 shape, the service-token-only bridge door, the pipeline proven end to end | the implementation (#13697, closed) and a live deployment (order 1–2) to check the acceptance list against | | 4 | [#13659](https://github.com/developing-today/code/issues/13659) — per-user/per-key authentication in the daemon | moves authentication into the Go daemon and resolves each identity to a CapabilityCeiling / PolicySession; the `ns` selector then _maps onto_ a ceiling instead of being enforced by Worker-side filtering | #13657's door as the interim boundary; its own design record first. Does not block the door | | — | [#13697](https://github.com/developing-today/code/issues/13697) — public front-door Worker with OAuth and selector enforcement | the implementation of #13657, including this Worker's source and tests — **closed** | — | | — | [#13404](https://github.com/developing-today/code/issues/13404) — self-hosted Desktop Commander MCP endpoint | the proven pattern this door mirrors: Worker front door, Access gate, laptop bridge (covered in the fleet book) | — | Dependency map, in words: #13404 proved the shape; #13697 built the mcpx door from it for #13657; #13770 blocks #13754's workflow, and both block the live half of #13657's acceptance; #13659 is the follow-on that retires this chapter's central assumption — that exposure policy lives in the proxy — once the daemon can hold it itself. The Google identity behind the `/authorize` Access application rests on the Access Google OAuth client recorded in [#12417](https://github.com/developing-today/code/issues/12417). ## Disagreement rulings (register #13965, items M2–M6) Where the Worker's wording and the code disagreed, the code won. Each ruling below cites the evidence it rests on; M1 needed no ruling (it was settled: manifest registration, `pkgs/mcpx/docs/compendium.manifest.json:1197`). - **M2 — the laptop half of the door chain is asserted, not configured. Ruling: the chapter says so, and keeps saying so.** `pkgs/mcpx/worker/README.md:24-25` and `src/index.ts:18` describe a bridge proxy on `127.0.0.1:8932` reached through the `sandbox-link` tunnel — but no unit, service or ingress rule defining either exists in `home/`, `pkgs/mcpx/modules/` or `pkgs/mcpx/daemon/` (grep for `8932` across those trees is empty). The only bridge this repository's home configuration defines is the Desktop Commander bridge on `127.0.0.1:8931` (`home/common/default.nix`, `desktop-commander-bridge`). The chapter's door-chain section records the laptop legs as asserted by the Worker, not as described by the deployment configuration, and the Operations section treats every live statement as code behaviour verified by the test suite, not a probed endpoint. - **M3 — "transparent" is a property of the full profile only. Ruling: the chapter now says exactly that.** `src/index.ts:26` and `:140` call the `/mcp` proxy "transparent", but in the conservative and selected profiles the door gates request bodies (`gatewayCallAllowed`, `src/filter.ts:122`) and filters responses (`filterMcpResponse`); only the full profile short-circuits both (`selector.mode === "full"` returns at `filter.ts:127`, and the response streams through untouched). The chapter's `ns` selector section names the full profile as the exception whose response "streams through untouched". The source comments keep the word in its narrow sense — the proxy adds no framing of its own — and the code wins where the two could be read apart. - **M4 — the #8299 cite stands. Ruling: #8299 is related, and the alignment target is #13659's own choice.** `README.md:127` says daemon-side auth lands "aligned with #8299". #8299's scope is role definitions as first-class world configuration whose definition shape includes the capability ceiling — the same `CapabilityCeiling` / `PolicySession` model the id book records as shipped (`pkgs/id/book/concepts/capabilities.md:51`, `id_caps::mcp_policy`). And #13659's own scope text names "#8299 and neighbors" as the work the daemon auth aligns with. There is no mis-citation to repair; the chapter keeps pointing at #13659, and the question of what #8299 delivers belongs to #13659's design record, not to this chapter. - **M5 — the door route lives in `config.json`, not `wrangler.toml`. Ruling: recorded in the source table.** The `mcpx.security.cab` route exists only in `pkgs/mcpx/worker/config.json:1` (whose `routes` array names the door); `wrangler.toml` defines no route — grep for `route` in that file is empty. The chapter's source table describes `config.json` as "the `cf` tool's view of the same deployment" and `wrangler.toml` without any route claim, which matches the code. - **M6 — `mcpx_types` is listed but uncallable under the conservative profile. Ruling: recorded as intended behaviour, with the one genuinely open question named.** `mcpx_types` is in `DISCOVERY_TOOLS` (`src/filter.ts:30`) so every non-full profile lists it, but the call path refuses it unless the caller is `selected` _and_ names an in-set namespace list (`src/filter.ts:134`; the "leaks out-of-set names" comment at `:137-139` states the reason). Listing-without-calling under conservative is therefore deliberate, not an oversight — the same shape as catalog/search metadata being visible but uncallable — and the chapter's selector section already records the consequence ("the conservative profile ... refuses `mcpx_types` even though it lists it"). The open decision, stated here and not smuggled in: whether the conservative `tools/list` _should_ advertise a tool that profile can never call is undecided — no commit message, test name or review comment in the Worker's history (`020967e2131` is the sole authoring commit) records the intent. If that ever matters, file it as its own issue; this chapter will not guess. ## Limitations, stated once - `mcpx_catalog` and `mcpx_search` responses are unfiltered metadata: under the conservative and selected profiles a caller can learn that namespaces outside its set exist, though it cannot call into them. - The flat (non-code-mode) surface is not offered; a caller's `codemode` parameter is dropped. - The selector is chosen by the caller, not assigned to the caller: any holder of a valid bearer can ask for `?ns=*`. The selector is an exposure control for well-behaved clients, not an authorization boundary between callers — that boundary is #13659's work. - The daemon behind the bridge is unauthenticated by design; the door is the boundary, and nothing else may be given a path to the bridge. --- # MCPX research and implementation plan MCPX lets clients discover a tool, inspect its interface and call it through one gateway. Tool search answers which operation to invoke. Atlas searches documents after the caller selects its search tool. The two rankings have different inputs, permissions and feedback. [Commands](cli.html.md) · [Integration contracts](program/interop.html.md) This program covers the client, daemon, server pool and consumers. The chapters distinguish proposed behavior, implemented interfaces, runtime observations and the evidence required for completion. An open tracker can contain a merged implementation. A named test proves that a check exists; an execution result also requires the commit, venue, non-skipped assertion and outcome. [Program tracker](https://github.com/developing-today/code/issues/13264) · [Published coverage audit](coverage.html.md) ## Implementation order | Slice | Prerequisite | Acceptance and release condition | | ------------------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Payment refusal | Confirm the profile resolver and its error path. | A loopback 402 makes one request to the first model provider and zero to the second. A recoverable 503 still advances. Preserve refusal visibility as a distinct caller contract. [#13544](https://github.com/developing-today/code/issues/13544) | | Docs and configuration | Use a common source revision for generated rows and the public book. | Every registered setting maps to one named probe or exemption. Resolve actual internal links in staged HTML and agent Markdown under the deployment base. Compare all public book roots after publishing. [Effect probes](program/settings.html.md) · [Publication audit](program/publication.html.md) | | Server ownership | Match the effective declaration to its supervisor and negotiated protocol era. | Same-name instances retain distinct sentinels after upgrade. Removing one leaves its neighbor callable. An interrupted mutation is never silently replayed. [Onboarding](program/lifecycle.html.md) · [Hosted deployments](program/hosted.html.md) | | Policy and audit | Bind identity at ingress and carry it through dispatch and nested calls. | A denial produces zero upstream calls and a payload-free decision record. A revoked grant fails before queued execution. [Policy](program/policy.html.md) | | Fleet, Atlas, ID and harnesses | Use the same enforcement point for each transport, proxy and code-mode path. | Each participating client supplies an attributable allowed call and denial. Verify corpus filtering at Atlas and capability attenuation at ID. Record missing receipts individually. [Interop](program/interop.html.md) | | Libraries and model operations | Pin public contracts, actual consumers and fallback behavior. | Compare version pairs on the same operation fixture and prove that cancellation and repair preserve the caller's operation budget. [Libraries and models](program/libraries-models.html.md) | ## Maintaining the evidence The [issue map](program/issue-map.html.md) records membership, dependencies, status and evidence separately. Check the latest claim before changing a shared component. The [maintenance epic](https://github.com/developing-today/code/issues/12459) owns recurring reliability work. The [platform tracker](https://github.com/developing-today/code/issues/1900) retains references from the predecessor repository. Keep the repository name on those references when reconstructing dependencies. At [d24c19c6e065](https://github.com/developing-today/code/tree/d24c19c6e0654f2466fc98bc86e3dacb786f5067) all 241 published setting paths matched 236 named-probe rows and five exemptions. The 236 rows refer to 225 distinct test functions. The [pinned inventory](settings-d24c19c.csv) includes declared defaults, provenance documentation, environment names, function definitions and written reasons. Winning values belong to an individual running process. For each implementation, save the Fleet handle, commit, runner, non-skipped assertions and outcome. Use the same fixture for an unchanged neighbor, a refused operation or a fallback as appropriate. Distinguish a merge, passing checks and observed deployment. Update the relevant reference in the same change that alters a command, flag, setting, transport or route. [Verification venues](program/runtime.html.md) · [Deploying this book](deploying.html.md) --- # Server onboarding and process ownership **Proposed contract.** An operator needs to know three separate things about an upstream: what was declared, what was admitted and what is ready. Normalize each supported authoring surface into a validated, namespaced declaration before spawning a process or connecting. Keep a stable server ID independent of its display name and an immutable generation for its effective configuration. Record source and override provenance by field. Configuration inspection and health output expose reference names, credential availability and generation only. | Declaration source | Validation before admission | Acceptance oracle | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | | Stdio process | Executable and argument vector, cwd, explicit environment inheritance and per-server overrides, required credential references | Child fixture observes exactly the specified cwd, arguments and named inputs. A sentinel from an unrelated server is absent. | | Adapter around a CLI | Parser/adapter identity and version, executable provenance, bare-name policy, cwd and process contract | Fixture in an explicit cwd succeeds. Disallowed bare command and missing cwd fail before launch. | | Remote MCP URL | Canonical URL, allowed protocol revisions, authorization audience, runtime version expectation and transport | Fixture identifies protocol era, returns capability snapshot and identity, can reject a credential for the wrong resource. | | OpenAPI-derived server | Spec identity and digest, permitted operation IDs, server URL and auth reference | Refresh of the same spec preserves tool identities. Duplicate operation IDs or new write operations cannot acquire permission from naming. | | Plugin | Plugin version, configured adapter, resulting tool namespace and ceilings | Collision with another server is a validation error. An update cannot widen authority. | | Registry find | Publisher/namespace, pinned manifest version and source; resolve into one of the declarations above | Rediscovery does not silently change executable, endpoint or pinned version. Deletion/deprecation has a visible status. | For credential references declare the source explicitly when possible. Preserve existing precedence for pre-existing declarations after verifying the resolver. Reject missing required references before swapping. Give only the named child its resolved inputs. For change detection, record an in-process credential generation supplied by the resolver. Never persist a verifier derived from a low-entropy secret. A restart that loses a memory-only grant must fail with a named unsatisfied requirement; unattended reconnect requires a separately authorized resolver. Redact command arguments and URLs that may contain credentials from logs. **Reconcile.** Validate the entire desired generation before making any routing change. Reuse unchanged live attachments. Stage independent replacements, negotiate protocol/credentials, fetch capabilities, apply policy and validate health. Commit the routing/catalog generation atomically, then drain the retired instance within its configured budget. If concurrent start is unsafe for an exclusive process, mark the pending restart explicitly, drain, stop, replace and restore the prior declaration if replacement fails. Report that server's downtime and any uncertainty about its in-flight operations. A removal first denies new calls, invalidates disclosure and subscriptions for that namespace, drains or terminates old attachments, and drops affinity state. A compare-and-swap at commit prevents overlapping reloads from presenting a mixed catalog. Removals and permission reductions take precedence over retaining an older candidate on failure. **Ownership during a front-end restart.** Use the decision recorded in #1384, one separate supervisor process per stdio instance, re-executing the same binary. The supervisor is a byte pump that owns that child's process, pipes, and bounded raw output while unattached. Framing and partial-frame handling remain in the daemon's StdioTransport reader. If the buffer overflows, the supervisor reports dropped bytes on attach. Treat the protocol stream as discontinuous and outstanding requests as indeterminate, reset the stream when it cannot be safely resynchronized, and never pass a partial frame as a reply. The front end owns RPC correlation, client authentication, ceilings and attribution. A frontend crash can preserve the process and still lose an outstanding call's result. The supervisor fences an old epoch before accepting writes from its replacement. An ID used by two clients must remain distinct throughout handoff. Isolate the per-instance supervisors from the front-end service's kill-on-stop lifecycle and provide an instance-private socket namespace. Verify adopted supervisor identity, generation and ownership before any reap; a stale PID or another daemon's state directory is insufficient evidence. Under systemd the front-end socket can use Accept=no and be passed to the matching service. Socket activation preserves queued incoming connections, not established application streams or child state. In inline mode arbitrate direct launches through a per-instance ownership mechanism and positively identify the instance in readiness responses. A CLI targeting SSH or tsnet must never bootstrap an unrelated local daemon after a remote failure. **Migration.** The body of #9963 identifies Drew's adoption of per-instance supervisors on October 27. It gates supervised-by-default on Phase 2's attach path and retains direct-child FD takeover as a legacy fallback. The #9962 Phase 2 tracker is closed completed. See the pinned source reconciliation below for the implemented portions of Phase 3 and the deliberate opt-in pause. Phase 3 tests must include both startup scan branches (adopt configured instance and reap verified orphan), status naming a protocol refusal, restart through the supervisor, and Darwin exemptions reduced to legacy-handoff tests only. Drain and retire old supervised frontends by epoch. For pre-upgrade children that cannot be attached with verified framing and ownership, drain to a scheduled restart. A downgrade to a frontend with an unsupported supervisor protocol must refuse attachment and preserve the working generation. Do not start a second copy of an exclusive upstream. Handle host reboot separately from frontend restart. Persist only sanitized, versioned metadata required for supported reconnect paths, use atomic replacement and restrict file permissions. For values that are themselves bearer credentials or authorize a session on their own, hold them in memory; cold-start reauthentication may be required. | Fault to inject | Observable pass condition | | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Kill old frontend before/after epoch commit, with a blocking stdio test call | Upstream seen once, same process nonce/open count, only the elected epoch can forward frames; lost outcome classified explicitly. | | Kill a single instance supervisor with requests pending | An affected generation becomes unavailable and outstanding outcomes are marked unknown. An independent upstream remains usable. Replacement never reissues an ambiguous write. | | Concurrent reload, removal and reconnect | At most one admitted generation for new work. Removed namespace disappears from discovery and cannot receive a new invocation through a stale handle. | | Simultaneous inline commands with daemon absent, delayed readiness, and startup error | Single launch winner, each waiter receives same instance identity or causal error, bounded wait and deterministic probe of poll intervals. | | Two daemon instances on one host | Distinct supervisor socket, activation listener, persistence and tsnet state; stopping or reloading A leaves B's test call and process nonce unchanged. | | Tailnet control unavailable; SSH channel reconnects | Per-listener readiness names the failed reach. Local healthy listener remains usable if permitted by declared startup policy. No privilege or target changes during reconnect. | | Oversized JSON, per-event SSE overflow, unbounded sequence of legitimate small events, compressed response | Exact-boundary message accepted; bound+1 rejected with a classified event, response body closed, next independent call succeeds. Long-lived streams bounded per decoded frame with backpressure and cancellation, finite responses bounded in total after decoding; body/header/idle limits reported by their own stage. | **Transport observability.** Report instance, frontend epoch, supervisor generation, protocol revision and listener health, successful discovery time, reason for degraded state, calls accepted/completed/denied/indeterminate, buffered bytes/high-water mark and server restart count. Aggregate over the same call records used for audits. Harmless protocol discovery/list/ping probes require explicit documented behavior per upstream. A costed tool invocation is never the default liveness probe. Separate reachability, authentication, discovery compatibility and operation-specific availability. ## Current supervision boundary A clean default change depends on a socket key for a _pool instance_. A name-only key cannot distinguish two instances for the same server. Pin the configured namespace, pool scope, instance slot and negotiated era for the duration of the child. During migration, adopt a legacy name-only socket only if exactly one live instance can own it. Quarantine an ambiguous match without redirecting a second namespace to it. Preserve the old listener until the new attachment handshake and exclusive ownership succeed. The negative control is two same-name instances returning different sentinels through the same frontend restart. [Current socket key](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/mcpclient/supervised.go#L179) · [Phase 3 tracker](https://github.com/developing-today/code/issues/9963) --- # Hosted servers, protocol revisions and release channels The official MCP site names 2026-07-28 as current. For this revision, Streamable HTTP uses a POST per request, does not define protocol sessions or GET/Last-Event-ID redelivery, and uses response-stream closure to signal cancellation. Previous handshake-based versions have a different contract. The following branches belong in lifecycle code and the book. The [active laptop service](program/runtime.html.md) reported version 0.1.0. Its store output differs from the CLI output; the source commits associated with both binaries are unknown. The existing era-probe chapter already specifies per-server mode, cache and lane handling. Issue #1414 already restricts persisted state to legacy streamable HTTP and proposes reusing the takeover restore path. The restart versus explicit-end split landed in [PR #10755](https://github.com/developing-today/code/pull/10755). Verify both branches on the current release and add failure coverage for interrupted calls. [MCP versioning](https://modelcontextprotocol.io/docs/2026-07-28/learn/versioning) · [Current Streamable HTTP](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http) · [2025-11-25 transport](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports) | Negotiated or selected upstream binding | Restart/deploy behavior | Acceptance oracle | | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 2026-07-28 HTTP | Discover supported versions, send revision and matching per-request metadata, re-establish subscriptions when appropriate. For interrupted mutation record uncertainty; cancellation cannot undo a committed side effect. | Current-revision fixture sees no GET-resume, legacy session header or DELETE and no duplicate mutating invocation. Recognized modern 400/404 are handled by error code without an era fallback. | | Legacy session-capable Streamable HTTP (2025-11-25 example) | Scope previous session affinity to instance/server, canonical endpoint, credential principal, protocol revision and compatible generation. Try a harmless request first. Session 404 requires fresh initialization, optional replay is GET + cursor for the exact previous stream; clear invalid affinity on endpoint/principal change. On retirement request DELETE where supported, accepting 405 as unsupported. | Fixture logs original and fresh initialization, valid cursor confined to its stream, correct cleanup, zero duplicate write POSTs during session loss. | | Legacy separate HTTP+SSE transport | Reconnect and negotiate new connection under the declared compatibility policy. | Fresh connection advertised; client sees explicit loss of pending response, resubscribes only authorized subscriptions. | | No mutual protocol version | Reject candidate at compatibility check, leave previous admitted route active where its authority is still valid. | Existing consumer continues using pinned generation, refused candidate visible in status. | **Deployments.** For a hosted upstream store the declared URL, registry origin/publisher/name/version, expected release identity or digest, supported protocol range and compatibility requirement for stored data. Distinguish registry evidence, operator-supplied deployment evidence, and self-reported server information in inspection output. An immutable manifest can still point at mutable code behind a stable URL. An observed version is not certified by an unsigned serverInfo response. Use a dedicated version URL or provider deployment evidence joined to a signed release record for strong pinning. Credential selection must bind to the approved resource at each endpoint; deny an unapproved origin introduced by redirect or discovery. Canary using a test principal with a minimal ceiling. Verify protocol discovery, expected tool/schema fingerprint, a curated read-only smoke call when expressly permitted, and denial of a prohibited tool before route promotion. Reverse the local routing generation if the old target remains independently addressable and compatible. Changing the declared version label for the same mutable URL cannot roll back the server. A provider rollback creates a new deployment and needs its deployment owner/credentials and compatibility evidence. A Worker rollback does not roll back bound data; a binding deletion or Durable Object class change may make it impossible. Refuse a downgrade requiring data recovery until the operator supplies a compatible release or a separately approved recovery. [Cloudflare rollbacks](https://developers.cloudflare.com/workers/versions-and-deployments/rollbacks/) · [MCP Registry FAQ](https://modelcontextprotocol.io/registry/faq) **Cold shutdown intent, #1414 Phase 3.** The explicit restart/end split already landed in [PR #10755](https://github.com/developing-today/code/pull/10755). The open tracker calls for a [current-main done check](https://github.com/developing-today/code/issues/1414#issuecomment-7071764863). The following extends the verification contract. An explicitly planned frontend restart retains eligible legacy session records until the successor checks generation and principal; permanent removal/stop performs a bounded DELETE and clears the affinity. Distinguish host termination with unknown intent in status and choose the documented operator policy; never guess removal from SIGTERM alone. Cap retained record lifetime by upstream expiry when known and a configurable local retention budget. Keep `savedAt` distinct from last successful reuse. Verify takeover refreshes the same persisted structure without writing headers or access tokens. Include reboot, expired record, stale config, changed principal and denied reconnect in the matrix. Display counts of fresh, resumed, forgotten, rejected and cleanup-deferred sessions; classify 401/403 as authorization findings and require the authorized resolver before retry. A test fixture acknowledges an invocation then drops its response; assert the invocation was never blindly replayed. Check newest #1414 comments for recorded answers before implementing any policy. **OAuth.** Treat a client calling MCPX /mcp and MCPX calling each upstream as independent grant relationships. Use resource metadata discovery, scope and audience validation for the negotiated authorization profile. Reauthentication and refresh are scoped to the resource and principal; do not forward incoming bearer tokens to upstream services. Expose status through credential-reference name, reason and required action, never token value or OAuth callback data. Build the issue's conformance matrix with a dated profile, inbound/outbound role, scenario, expected wire/event outcome and evidence. Cannot infer any conformance count from the issue number alone. [MCP authorization, 2025-11-25](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) **Release-channel gate.** Derive promised OS, architecture, package format, channel and exact install invocation from the book. For every advertised tuple require a publish owner, immutable release locator/digest, compatibility metadata and supported smoke venue. In clean dispatched environments, resolve the published channel, verify artifact identity, install to an isolated prefix, report version and run a harmless isolated discovery exchange. Test the previous release locator as downgrade target. Track publish failure separately from entitlement or runner failure. Until owner and actual assets are verified, mark unsupported channels explicitly in the chapter. No CNAME, login or billing changes are prerequisites for these dry probes. **Implementation order.** First pin the issue definitions, current source, release artifacts, owner and live listener inventory. Record both protocol-era fixtures and in-flight duplicate-execution oracle. Then add compatibility-aware read-only discovery, generation diff/status, supervisor attach protocol and crash fixtures, and finally canary rollout per server. Run lifecycle tests through Fleet on a venue supporting Unix sockets and child process lifetimes. Run an isolated systemd venue for cgroup/socket activation and controlled tailnet for multi-instance hostname/deadline behavior. Record run/ref/oracle per fixture; a venue failure is classified independently. ## Release evidence The [v0.1.0 release](https://github.com/developing-today/code/releases/tag/mcpx%2Fv0.1.0) contains Linux x86-64, Linux AArch64 and Darwin AArch64 tarballs plus SHA256SUMS. The outstanding channel in [#1881](https://github.com/developing-today/code/issues/1881#issuecomment-7082903753) is the GHCR image under [#9900](https://github.com/developing-today/code/issues/9900). The presence of a dispatch input shows that publication can be requested. The independent acceptance criterion is that the named registry digest can be pulled and the packaged binary reports the expected version. Do not recut the release to update the install chapter. --- # Effect probes and test venues **Evidence snapshot.** The published coverage audit records a binary built from `0d29cdad5cf`. The accompanying census issue independently reports that the results still held at `1310027fd1f`. Its binary schema and source registry agree on 241 settings (193 public, 48 plumbing), and its issue author reports 253 source literals with 12 in tests. At `d24c19c6e065` the [source-linked inventory](settings-d24c19c.csv) accounts for all 241 paths: 236 named probe entries and five exemptions. The five remaining exemptions motivate the fixture proposals below. Three other paths gained probes on November 23. Their entries describe the intended observable behavior; each passing-run claim requires its own execution receipt. [Published audit](https://developing-today.github.io/code/coverage.html) · [Census correction #13420](https://github.com/developing-today/code/issues/13420) · [PR #13345](https://github.com/developing-today/code/pull/13345) · [PR #13370](https://github.com/developing-today/code/pull/13370) · [PR #13361](https://github.com/developing-today/code/pull/13361) · [#8473](https://github.com/developing-today/code/issues/8473) The book’s generated configuration inventory identifies the values below. “Hot” indicates the inventory’s reload designation. These are defaults, independent of the laptop’s effective configuration. [Configuration](https://developing-today.github.io/code/configuration.html) | Path | Default | Scope | Hot | | ---------------------- | ------------ | ------ | --- | | daemon.inlineStartPoll | 20ms | client | no | | daemon.tsnet.hostname | empty string | daemon | no | | daemon.tsnetUpTimeout | 30s | daemon | no | | http.streamBufferInit | 65,536 bytes | client | no | | embeddings.wasmPath | empty string | daemon | yes | | plugin.instructions | false | plugin | no | | plugin.disabledTools | empty list | plugin | no | | protoTasks.cancelGrace | 5s | daemon | no | ### Evidence required for a ratchet change At the implementation ref, capture the registry’s canonical path, aliases, type, units, accepted range, source precedence, computed/default value, effect ID or exemption reason, probe location and owning issue. Preserve dynamic or environment-dependent defaults as expressions. Redact secret-bearing defaults and resolved values; provenance needs only the source class and public setting path. Link the existing probe table to actual executable test names and venue results. Aliases must point to a canonical setting. The inventory should fail if a probe points to a missing test or two paths silently exchange exemptions. Compare the exemption _set_ at base and head alongside the pinned count. Consider existing historical exemptions only. A switch of membership at constant count must fail review. Each replacement drives the real parser, resolver and consumer with two values, holds all other inputs fixed, and checks an observable at the effect boundary. Record the fixture ID, route, Go toolchain, ref, test name, values (synthetic), oracle, timestamps and exit result. Verify the oracle discriminates an ignored setting by running with the consuming line using the same value for both cases in a disposable checkout, or an equivalent effect-negative control. A successful default case alone provides no evidence of wiring. Retire the exemption and decrement EffectExemptionPin in the same PR after the qualifying run. Reconcile the three formerly exempt paths with the landed test IDs; preserve Drew’s restriction on any new implementation touching them. | Setting | Proposed fixture and effect oracle | Failure to distinguish | | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | daemon.inlineStartPoll | Enter the normal CLI inline fallback with a fresh socket/lock/config. Exercise the in-process start path. Use a gated readiness collaborator at the actual readiness check and timestamp each attempted check while the daemon remains unready. Keep normal parser and retry loop intact. Observe readiness attempts at the peer, relative to the first attempt. Select widely separated valid poll intervals; with the long interval, no subsequent attempt occurs in the observed window, while the short interval yields repeated attempts. Release both, require the same successful CLI response and one inline start per invocation, and verify cleanup. Establish timer jitter bounds using same-venue calibration. If the pinned version allows, run a separate simulated-clock loop test for exact deadlines. | End-to-end startup latency includes unrelated scheduling and initialization. A missed observation, starved host or control that cannot complete yields an inconclusive venue result. | | daemon.tsnet.hostname | Point two fresh tsnet nodes, one case per desired name, at an isolated local coordination service. Intercept registration at that service and assert the actual advertised hostname for each case. A peer confirms the daemon handles a benign MCP request. Isolate state directories so persisted node identity cannot mask the result. Bind control, relay and peer services to local-only test interfaces and disable public fallback; pass no user key. | Printing a daemon configuration or comparing a locally chosen DNS alias fails to prove the name was advertised. Use registration as the oracle to avoid dependency on DNS-name collision suffixes. | | daemon.tsnetUpTimeout | Hold the local control service at the same pre-up barrier in two fresh processes. The short configured budget must produce the documented deadline outcome at the tsnet boundary before release. The larger budget must still await bring-up and become reachable after release. Require a healthy immediately released control. Use monotonic timestamps, separate startup and test watchdog, observe cancellation/cleanup; identify actual failure policy for other daemon transports at the checked ref. | Global daemon timeout, connection refusal, unavailable control server, or a timeout preceded by fixture failure cannot give a green probe. | | http.streamBufferInit | Define the resource as initial byte capacity reserved by the real streaming reader. Keep max, chunks and response fixed and vary init. Use the newStreamScanner production helper introduced in PR #11430, and a recording io.Reader directly below it. With max fixed above both inits, supply input sufficient to force the initial Read, and capture len(p) at that first read for each init. Cover both client event and op-stream consumers driving the real settings through the end-to-end harness; if a recording reader wrapper requires injection, include a full-path client test with an equivalent production allocation observable. In each case assert identical output, the changed resource observation and the same documented oversize error. Assert min(init,max) when init exceeds max per merged #11430; document whether framing counts toward max. Classify a deterministic resource oracle as such in the registry if the current behavioral-probe contract cannot express it. | A successful stream, a config echo, aggregate heap statistics, kernel packet sizes or trace output computed from a setting prove no allocation effect. Keep pin intact until the reviewed contract accepts the replacement. | | embeddings.wasmPath | Read the embedding loader’s actual import/export names, input encoding, numeric types, output dimension, memory ownership and release/error protocol before specifying fixture bytes. Commit a tiny deterministic model and readable source, generation recipe, toolchain and digest. Derive A/B fixture models that invert two non-collinear tool vectors relative to a fixed query. Use isolated daemon/index caches, a fixed synthetic catalog and queries with no lexical match; hold tie-breakers fixed. Run through normal semantic discovery and require the opposite top tool in each case. Disable remote fallback or configure a rejecting local endpoint that counts zero requests. Add invalid export/shape control with the production loader’s documented error or explicitly observed fallback. | A Wasm file merely loading or any ordered list returning can pass while keyword search or a cached vector supplied the answer. Do not commit an external model or require a regeneration compiler for routine builds. | | plugin.instructions — landed elsewhere; brief hold | Inspect the existing plugin consumer and the eleven sibling fixtures. Run the normal plugin hook with a synthetic harness session and captured outbound instruction blocks. With the bool false and true, require the known plugin instruction block present/absent. Assert unrelated harness instructions still arrive. Assess repeated hook calls and distinguish current session from a fresh session according to the existing reload contract. | Inspecting the resolved option or a debug log cannot establish what the harness passed on. Use this to review the separately delivered probe. | | plugin.disabledTools — landed elsewhere; brief hold | Use two synthetic sibling tools and a fresh plugin session for each configuration. Capture the tool registrations or advertisement that the harness actually consumes. Change the disabled set and require only that named tool to disappear while its sibling remains usable. If the source separately promises invocation blocking, call the real dispatch path and verify denial before the fixture receives a request. | Tool visibility and authorization are different effects. If this flag controls discovery only, keep authorization in the daemon-ceiling suite. Use this to review the separately delivered probe. | | protoTasks.cancelGrace — landed elsewhere; brief hold | Establish the actual grace transition in the task owner first. Run a synthetic cooperative task that acknowledges cancellation promptly but blocks exit behind a gate. Drive cancellation over the public protocol, bracket the documented grace expiry with two settings, release the task at the same logical point and observe its terminal state and whether it actually continued working. Record cancellation acknowledgement separately from termination, and ensure exactly one terminal transition and no worker remains. Prefer a fake-clock owner test for exact boundary plus a public-path end-to-end check with generous margins. | A quick cancellation RPC response does not prove grace changed backend behavior. Pin the expected terminal statuses to the checked implementation; do not presume an OS process receives a signal. Use this to review the separately delivered probe. | The proposed local-tailnet fixture has upstream support: tsnet.Server exposes ControlURL, and testcontrol.Server implements ServeHTTP and exposes registered Node state. Check both against the version in mcpx’s go.mod. Go’s testing/synctest is useful for in-process deadline tests; its documentation advises keeping network and external processes out of its bubble. The real reader uses bufio.Scanner as confirmed by [merged PR #11430](https://github.com/developing-today/code/pull/11430). Go documents that the larger of the configured max and the initial buffer capacity governs token size, so preserve the production clamp below the scanner and cover its equal and greater cases. Sources: [tsnet](https://pkg.go.dev/tailscale.com/tsnet#Server), [testcontrol](https://pkg.go.dev/tailscale.com/tstest/integration/testcontrol#Server), [synctest](https://pkg.go.dev/testing/synctest), [Scanner.Buffer](https://pkg.go.dev/bufio#Scanner.Buffer). ### Dependency and verification sequence 1. Keep the runtime feature ledger distinct from the settings exemption pin. The original #8465 body names CLI embeddings, feedback, proxy, scripts and skills. Reconcile its current ledger entries to a complete suite at the chosen ref before picking a remaining command. #8469 originally lists 18 HTTP/transport rows, while the audited current pin contains only http.streamBufferInit from that family. Likewise #8471 originally lists 26 model-AI rows; embeddings.wasmPath is the remaining registry exemption from that family. Removing a feature-ledger exemption requires an observed row from its declared test. Newest claims and open PRs govern work assignment. [CLI #8465](https://github.com/developing-today/code/issues/8465) · [HTTP #8469](https://github.com/developing-today/code/issues/8469) · [Model #8471](https://github.com/developing-today/code/issues/8471) · [Corrections #13420](https://github.com/developing-today/code/issues/13420) 2. Dispatch fixture preflights and selected suites at the PR ref on a GitHub-hosted runner through Fleet. Record the runner, handler, toolchain, command, named tests actually run, fixture capability, SKIP count, test duration and result link. A missing prerequisite has a venue outcome and leaves the product result unset. Do not infer end-to-end success from a smoke check. Reuse the same Fleet session for a focused follow-up where available. [Testing policy](https://developing-today.github.io/code/testing.html) · [Remote subset #13386](https://github.com/developing-today/code/issues/13386) 3. Start the resource-observation and deterministic Wasm fixtures independently. The inline and paired tailnet probes can land independently when their venues discriminate the effects. A laptop fallback needs an identified missing prerequisite and records the ref and exact route. Use the dedicated mcpx package to investigate its check phase. The merged deployment change (#12757) removed aggregate target realization. [Sandbox exclusions #2686](https://github.com/developing-today/code/issues/2686) · [Deploy check-phase wedge #12738](https://github.com/developing-today/code/issues/12738) 4. Record the reasons and names for each outstanding exemption in the book inventory at the same SHA as the binary surface and suite evidence. Keep held, claimed, venue-blocked, inconclusive, failed and verified evidence separate. Check issue comments again immediately before merge. ### Test venue matrix | Verification | First route and oracle | Scope and blockers | | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Resource and Wasm | Fleet GitHub-hosted Linux; real client stream reader, real catalog + isolated Wasm loader; report named tests with enabled subtests | Avoid live model APIs and external runtimes. Wasm fallback to subword is documented; the inversion oracle must positively exclude fallback. [Book](https://developing-today.github.io/code/configuration.html) | | Inline start, tailnet | Fleet GitHub-hosted Linux with private namespace or isolated per-test state. Check process cleanup and exclusive socket/config ownership; use dedicated private control+peer for tsnet. | Cannot run against a shared remote daemon. #13386 proposes per-test needs (localFS, ownsDaemon, perTestConfig) and fail-closed opt-in to shared-daemon tests. [#13386](https://github.com/developing-today/code/issues/13386) | | Nix sandbox/CI parity | Verify current external subreaper behavior and actual suite exits in the focused Linux builder. Both suites were restored in merged #12069 | #2686 reports leaked descendants and env assertions sensitive to stdenv. #12738 describes a separate idle go-test process with no children. Do not infer same root cause. [#2686](https://github.com/developing-today/code/issues/2686) · [#12738](https://github.com/developing-today/code/issues/12738) | | Python support suites | Explicitly execute spec parity, test seed and shard-packer suites in a named test job; record three distinct selections/exit results, reconcile test-suite-registry rows | #10330 names test_spec_parity.py, test_mcpx_test_seed.py and test_e2e_shard_packer.py. Registry metadata alone cannot establish execution. [#10330](https://github.com/developing-today/code/issues/10330) | | Runtime and architecture | Deno-free host must first prove Deno absent and bun/node present, then run both and the runtime=auto path. Linux ARM64 should execute the binary e2e subset in its intended nightly tier. | These complement the five targeted effects. #13393 reports unrelated basic unit/lint failures and gives specific run IDs; attach separate current reruns before attributing failures to new probes. [#13387](https://github.com/developing-today/code/issues/13387) · [#13388](https://github.com/developing-today/code/issues/13388) · [#13393](https://github.com/developing-today/code/issues/13393) | ### Second-pass disposition at the captured REST snapshot The following issue states come from open issue search, and merge information comes from PR search with each issue number in the body. A merged flag proves repository disposition. The run results quoted in PR bodies are author-reported unless a run was inspected separately. A later open issue can preserve a verification requirement after its code has landed. | Work item | Repository disposition | Remaining test or decision | | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | CLI running group #8465 | Open. #11240 merged the embeddings, feedback, proxy, scripts and skills exercises and deleted all five feature-ledger exceptions. The author records a 60s daemon idle-exit artifact in short filtered runs. | Obtain a complete green suite at the chosen ref and inspect its recorded CLI feature rows. Replacing any one row with an exemption should trigger the stale-exemption rule. Leave the five exercises in place. [Issue](https://github.com/developing-today/code/issues/8465) · [Merged PR](https://github.com/developing-today/code/pull/11240) | | HTTP settings #8469 | Open, labelled blocked and assigned. #11307 covered 14 of 18 tracked settings. #12413 supplied the three idle-connection effects and reports a full e2e/guard pass in 1,172.503s. The only remaining path is streamBufferInit. #11308 recorded the scanner-capacity/max interaction and was closed on November 17. | Merged [#11430](https://github.com/developing-today/code/pull/11430) clamps the initial capacity to max in newStreamScanner for the client event and op streams. Validate the resource oracle with max fixed and sufficient. A change to streamBufferMax observes another setting. Prior probes held init at 64 bytes for this reason. [Issue](https://github.com/developing-today/code/issues/8469) · [14 effects](https://github.com/developing-today/code/pull/11307) · [3 effects](https://github.com/developing-today/code/pull/12413) · [Ceiling report](https://github.com/developing-today/code/issues/11308) | | Model settings #8471 | Open, parked/in review. #12725 merged and changed the last wasmPath ledger exception to a reasoned exemption without a tracking reference. The audit still lists it among the five. | Treat the real Wasm fixture as the outstanding effect. Scan by canonical setting path across registries and ledger files. A search solely for the issue number now gives a misleading empty set. [Issue](https://github.com/developing-today/code/issues/8471) · [Merged PR](https://github.com/developing-today/code/pull/12725) | | Script venues #10330 | Open. #11761 merged a spec-parity step and mapped the existing seed/packer invocations to mcpx-test.yml. A CI receipt for the new step was pending in that PR body. | Inspect actual steps and logs for the three suite names and exit status on the same ref, including whether previous job failure skipped their steps. A registry row and successful local test have different evidentiary roles. [Issue](https://github.com/developing-today/code/issues/10330) · [Merged PR](https://github.com/developing-today/code/pull/11761) | | Nix builder #2686 and deploy #12738 | #2686 open/blocked and labelled assigned. [#12069](https://github.com/developing-today/code/pull/12069) restored e2e/settings to the Linux check phase under external tini -s, preserving cli/conformance/defaults exclusions at that commit. The previous in-binary child reaper stole exit statuses. #12738 open/in review. #12757 merged November 23, decoupling CLI build from realization of all 14 target outputs; deployment of a missing target now realizes that target’s derivation. The author explicitly leaves the mcpx check-phase stall unresolved. | Use the existing lazy-target tests to preserve deploy isolation. Inspect the stuck Go driver's process state and wait site on a bounded single-package sandbox run. Distinguish a driver blocked before any test starts from leaked subprocesses after e2e. A Go test timeout alone cannot bound the first case. [Sandbox issue](https://github.com/developing-today/code/issues/2686) · [Deploy issue](https://github.com/developing-today/code/issues/12738) · [Merged PR](https://github.com/developing-today/code/pull/12757) | | Hosted e2e venues #1983, #13386, #13387, #13388 | All four open in the issue snapshot. [#13394](https://github.com/developing-today/code/pull/13394) merged the mcpx development shell; its [Fleet run](https://github.com/developing-today-forks/fleet/actions/runs/45200506277) reported tool versions via nix develop .#mcpx. A distinct bare-container incident [#13189](https://github.com/developing-today/code/issues/13189) reports bun absent in a dispatched OpenChamber run. Preserve the distinction between shell preflight and an actual passing suite. #13386 identifies the remote-daemon smoke as a status round trip. #13387 says the existing package wrapper brings Deno onto PATH; #13388 calls for a second Linux architecture in tier 2. | Count named assertions executed with the remote daemon in a separate environment. Make an undeclared-needs test ineligible. For the no-Deno leg verify PATH inside the actual subprocess before checking bun/node. On ARM64, assert target architecture inside the running test binary. [Parent](https://github.com/developing-today/code/issues/1983) · [Remote](https://github.com/developing-today/code/issues/13386) · [Deno-free](https://github.com/developing-today/code/issues/13387) · [ARM64](https://github.com/developing-today/code/issues/13388) | | Nightly failure #13393 and main breakage #13349 | Open. #13393 records the November 22 unit guard TestNoPackageRedeclaresADefault plus lint; its environment jobs passed on the cited run. #13349 records a distinct workflow and commit, 5c8e163, with lint, test and both OS stress legs listed. | Extract the first substantive error separately for each SHA, job and platform. Confirm the unit guard fails on a genuine duplicated configured default and passes once only the intended owner declares it. Treat a skipped dependent step separately. Keep the two incident receipts distinct. [Nightly](https://github.com/developing-today/code/issues/13393) · [Nightly run](https://github.com/developing-today/code/actions/runs/45038359692) · [Main breakage](https://github.com/developing-today/code/issues/13349) · [Main run](https://github.com/developing-today/code/actions/runs/45181183106) | | macOS stress #3016 | Open, labelled blocked and assigned. The report gives a concrete historical macOS shuffle seed and nightly run ID. | Capture per-test output and identify the actual failing test before dispatch. Reuse the cited seed on the necessary macOS venue for that subset, then compare with a same-ref full nightly receipt. A later Linux pass or a re-roll supplies different evidence. [Issue](https://github.com/developing-today/code/issues/3016) · [Historical run](https://github.com/developing-today/code/actions/runs/41190148229) | The rendered configuration chapter’s setting table headers are setting, kind, default, scope, hot, flag, variable and governs. Its rows identify the effects in prose, but they do not carry the verified probe identifiers, exemption reasons and venue results required by this programme. The published coverage page’s statement about an exemption-reason table warrants a scoped correction. Add the effect mapping once in the generator, cross-link it to provenance inspection, and reuse the generated region in the reference chapter. [Rendered configuration](https://developing-today.github.io/code/configuration.html) · [Published audit](https://developing-today.github.io/code/coverage.html) ## Wasm embedder selection and reload The latest #8471 checkpoint parked task 20152 after replacing its final runtime-ledger exemption line with a reasoned settings exemption. PR #12725 merged. On November 23 the issue remained open with both parked labels, and the open-PR search for `wasmPath` returned zero. The registry still had five exemptions. The tracker decision and the missing product probe are separate facts. [Checkpoint](https://github.com/developing-today/code/issues/8471#issuecomment-7088142178) · [Merged PR](https://github.com/developing-today/code/pull/12725) · [Effect map](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/settings/effect.go#L287) Use a synthetic in-tree module with a reviewable WAT source beside its small reproducible Wasm binary. Export one linear memory and `embed(i32 pointer, i32 UTF8ByteLength) -> i32 outputPointer`. Its optional allocator may return 64. Reserve output at byte 4096 and return a 384-float vector with component zero equal to the input's first byte, component one equal to its UTF-8 byte length and all others zero. Use two short literal inputs with unequal byte lengths, including one multibyte code point. No model weight, network, compiler or credential is needed during the test. The oracle must read vectors from the ordinary API, since an absent export, embed error or missing module can silently activate the built-in fallback. [Wasm ABI](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/catalog/embeddings.go#L193) · [Fallback](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/catalog/embeddings.go#L282) · [API](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/routes_embeddings.go#L37) | Case | Input and observable pass condition | | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Cold counterfactual | Start separate isolated daemons with identical configurations and explicit Wasm backend, varying only the configured path. Two exact synthetic vectors from the configured fixture must differ from the baseline vectors for the same texts. Assert item order, indexes and all 384 values. | | Reload | Keep PID and server identity constant. Switch from one valid fixture to a second with a distinguishable sentinel, then repeat the same two inputs. Require second-fixture values if the daemon reports a live change. A separate new-daemon request supplies the cold-start control. | | Ratchet | Add a named `EffectProbes` entry, the e2e path-to-name mirror and a real function reference for the discriminating probe. Remove exactly this map exemption and lower the pin by one only when the replacing test lands. Inspect current ledger before editing. #12725 already removed the old runtime-ledger exemption line. | | Venue | Dispatch the focused settings/e2e packages on a plan runner with the repository's MCPX devshell. Record the ref, job URL, exact test names and non-skipped assertions. Run the full e2e guard through Fleet for runtime-ledger coverage. The application and build sandbox are unnecessary for this design review. | The registry marks the path hot. The production call to `Registry.UseSettings` occurs at daemon construction, while the runtime settings hook handles pool changes. Verify API results and cached catalog vectors independently. If the reload test fails, describe that outcome on the existing tracker before selecting restart-required semantics or live engine replacement. A live replacement needs to install a complete engine generation, invalidate affected derived vectors and close the old runtime only after its last active call. [Setting contract](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/settings/wire.go#L358) · [Construction](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/server.go#L303) · [Runtime update](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/routes_settings.go#L253) --- # Enforcing client ceilings and recording tool calls The daemon already carries a principal in request context and records authorization decisions for declared operations. At revision `1f9bc15391ca`, the operation authorizer answers yes. The route wrapper calls it when the principal exists and then invokes the handler. A pattern without an operation-table row registers the handler directly. Existing bearer checks, write controls, rate limits and harness permission hooks have distinct purposes. Implementing per-client ceilings requires a decision that can prevent dispatch for every relevant entry point. Inventory all operation patterns, dynamic tool calls, code execution, background work, adapters and proxy entry points first. Each must either reach the decision point or have an explicit, testable public or internal classification. [Authorizer](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/api/principal.go#L116) · [Route wrapper](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/authz.go#L105) ## Identity, delegation and compatibility Bind the principal to a verified transport identity or a credential issued for this gateway. Unix peer identity identifies an OS account and does not automatically distinguish two agents running under that account. Keep harness, seat, session and downstream audience separate. A client-supplied session label can correlate requests but cannot widen a grant. The accepted elicitation decision binds the operation to the owner and original request. A future multi-principal elicitation path requires a superseding decision, authenticated presenter, nonce, expiry and replay rejection. Until then refuse a claimed identity change and preserve the owner-bound path. [Elicitation decision 0007](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/docs/decisions/0007-elicitation-identity.md) Start with an operator-owned policy keyed by trusted identity or verified issuer/subject. Resolve a versioned snapshot. Include namespace and tool allowlists, operation modes, sensitivity ceiling, corpus grants, rate, concurrent calls, token/resource budget, and revocation epoch where applicable. Server manifests may describe operations. A manifest or unverified tool annotation must never grant itself new permissions. A delegated grant can only narrow the parent grant. Intersect the user's grant, client ceiling, requested operation, server constraints and remaining budget. Make restrictive outcomes explicit when required metadata is absent. Preserve existing deployments through a documented owner-equivalent migration profile. Introducing an unidentified remote caller must not silently select that profile. Apply the same effective grant to catalog, search, types and execution. In particular filter the candidate catalog before scoring and recheck the selected target immediately before invoking it. Bind a decision to the resolved server generation and tool identity so a reload or alias change cannot redirect a previously authorized operation. At enqueue record the requested operation and principal; at dequeue recheck expiry, revocation and current policy before upstream I/O. Reserve budgets before concurrent dispatch and release or settle once. After a lost reply, record an unknown outcome and reconcile rather than retrying a side effect automatically. Enforcement in Atlas remains necessary because MCPX cannot filter hidden rows correctly after upstream ranking. [Atlas acceptance](https://github.com/developing-today/code/issues/8625) · [ID capability evaluator](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/id/crates/id-caps/src/mcp_policy.rs#L757) ## Audit and feedback Assign a logical call ID before policy evaluation and an attempt ID per downstream attempt. Persist the minimal decision record with trusted principal reference, operation, canonical target identity, policy revision, server generation, decision and reason, timestamp, attempt outcome, elapsed time, sent/received byte counts and accounting status. Use monotonically measured durations; record unknown counters as unknown. Denied-before-dispatch has zero upstream attempts. An interruption after sending a write can have one attempt and an unknown outcome. Keep a durable start/decision association where attribution is required; a crash reconciler can classify incomplete attempts without inventing success. Configure retention and restrict access per record class. Availability versus fail-closed behavior during audit storage failure requires an explicit policy and a test. The interaction store has a different purpose. At the pinned revision it records raw interaction material on some call paths, and feedback actually influences semantic ranking. Existing direct-call capture stores `server:tool`, proxy capture assigns the offered tool list to `ToolsUsed`, and semantic ranking passes a generated function identity to a SQL lookup using substring matching. A tool offered to a model is not evidence that the model used it. Define separate fields for offered, requested and executed tools. Resolve them to an exact stable ID, with server-generation provenance and source spelling retained for migration. Use structured equality for scoring. When a legacy identity is ambiguous, leave its historical feedback visible to its owner but exclude it from updates to a different tool. Preserve existing history without copying raw queries or responses into the new decision stream. [Direct capture](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/server.go#L1308) · [Proxy capture](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/routes_proxy.go#L304) · [Ranking](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/registry.go#L2105) · [Store lookup](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/logstore/feedback.go#L411) Use this one metadata stream for per-server call counts, refusals by reason, latency distributions and the live dashboard. Distinguish distinct calls, attempt counts and active clients in aggregates. Scope feedback access and statistics by the viewer's grant and suppress cross-client data when necessary. Keep raw payload capture independently controlled, with explicit retention, access and deletion semantics. Restrict telemetry payload fields at the producer and serialize an allowlisted projection. Log redaction after ingestion cannot provide this guarantee. ## Model, prompt and administrative operations Model resolution already supports ordered profiles and per-attempt timeout/budget handling. Apply one shared operation budget across profile candidates, repair and hooks. Distinguish missing configuration, transient provider failure, payment refusal and uncertain result after a partial stream. The fleet requires HTTP 402 to stop this generation before another provider is called. The public outcome should identify the reason without including provider response bodies. Preserve existing success and 503 handling when introducing this narrow fix. Prompt hooks already support advisory and proposed changes. Keep generated scripts and proposed outcomes reviewable. A natural-language request for administration must map to a declared operation, validated arguments and the same authorizer used by direct calls. Human confirmation binds to the exact operation and snapshot. [Model profiles](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/model/resolve.go#L186) · [Hook proposal semantics](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/execsvc/prompt_hooks.go#L168) · [Administration by intent](https://github.com/developing-today/code/issues/1931) ## Verification sequence | Fixture | Required observation | | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | Narrow and wide grants through two different transports | Same rights give the same decision. Spoofing a harness label leaves rights unchanged. A disallowed call makes zero upstream requests. | | Queued task followed by grant revocation | Claim can still complete its bookkeeping. Dispatch is refused before an upstream write. The rejection links to the original logical call. | | Declared tool replaced during reload | A stale tool or generation is revalidated before I/O. An unrelated server remains available. | | Wide Atlas query followed by an identical restricted query | Restricted results cannot disclose excluded data or reuse an ineligible cached result. Correlated records identify both policy decisions. | | Tools with adjacent names and one positive direct-call rating | Only the rated identity's feedback multiplier changes. Merely offering either tool produces no execution signal. | | HTTP 402 plus a second loopback provider | One request reaches the refusing provider and zero reach its successor. A separate 503 fixture continues to demonstrate the declared retry behavior. | | Cancelled or disconnected write | Audit reports attempt count and unknown or reconciled outcome. Dashboard statistics never report a guessed success or a second execution. | These are release criteria. The checked source establishes the existing behavior and reference points, without supplying runtime receipts for the proposed controls. --- # Connecting Fleet, Atlas, ID and agent harnesses MCPX helps an agent find a tool by its description and call it through the gateway. Atlas searches the user's corpus after an authorized caller selects its search tool. Indexing Atlas documents into the shared MCPX catalog would change both the disclosure boundary and the unit of retrieval. Keep tool descriptions and corpus chunks in their respective indexes. As of source revision `1f9bc15391ca`, the hosted Atlas Worker offers one MCP search tool. The Worker routes it through the same executor as REST and describes a fixed hosted-per-user identity and personal ceiling. Registering that URL gives agents a route. It does not identify the four harnesses independently. [Worker](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/atlas-search/worker/src/mcp.ts#L2) · [Cross-client acceptance #8625](https://github.com/developing-today/code/issues/8625) ## Fleet routing and identity For the pass-through proposed in #10390, resolve the endpoint in this order: explicit override, configured service endpoint, then the standard local endpoint. Resolve the credential for the selected endpoint and audience independently. Return an error when no matching credential is available. An explicit endpoint override must never redirect a credential resolved for the default host. Names of grants and endpoints are suitable diagnostics. Header values and URL query strings need to stay out of diagnostic output. Apply the same route checks to the raw-operation form. Preserve exit codes, structured refusals, request IDs, stdin and cancellation across the CLI boundary. [Fleet surface #10389](https://github.com/developing-today/code/issues/10389) · [Endpoint resolution #10390](https://github.com/developing-today/code/issues/10390) The existing Fleet search client deliberately signals service failure to its caller for a visible standalone fallback. Keep that behavior for callers already entitled to standalone search. An MCP-scoped delegation authorizes only its declared route and corpora. A timeout, denial or unknown identity cannot implicitly authorize a filesystem search. For a multi-hop gateway path record the immediate principal and effective delegated scope at each hop. Intersect permissions again when expanding a fan-out. Include a visited-gateway set and a hop limit. When several destinations expose the same display name, return stable qualified identities. A partial read result should enumerate failed destinations within the caller's visibility. A fan-out mutation requires separately authorized target operations with a per-target outcome. [Fleet client](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/fleet/crates/fleet-search/src/client.rs#L11) · [Aggregation #10393](https://github.com/developing-today/code/issues/10393) · [Delegation #10405](https://github.com/developing-today/code/issues/10405) ## Atlas acceptance across harnesses Perform acceptance with synthetic documents at two sensitivity levels in two distinct corpora. Give OpenClaw, OpenCode, OpenChamber and Muse independently attributable caller identities. For each lane retain the asserted grant, the gateway decision, the Atlas decision, the permitted chunk and its source reference, and the trace ID. Prove corpus and sensitivity constraints inside Atlas's candidate queries before scoring. Reuse an identical query first with the wider grant and then with the narrower one on the same warm service. The restricted caller must receive no restricted hit, snippet, count, suggestion or cache metadata derived from the wider result. A denied call at MCPX must have zero downstream requests. An Atlas-side refusal must remain distinguishable in the gateway outcome. The capability model can serve four agent clients acting for one owner without adding tenant administration. Drew retains the separate product decision in #12900 thread 2 concerning future service load and result handling. Partition caches by the effective disclosure scope and policy revision or bypass sharing until a safe key exists. Keep diagnostics free of corpus content. The existing hosted identity establishes the baseline, while the four successful positive and negative lane receipts establish acceptance. [Atlas reference](https://developing-today.github.io/code/atlas/reference/mcp.html) · [Decision #12900](https://github.com/developing-today/code/issues/12900) ## ID authority and nested code execution ID already exposes policy evaluation as a library. Its PolicySession verifies advertised definitions, observes frames, evaluates named actions, produces an owner summary and verifies its audit. The bridge tests demonstrate real library call sites. A deployed network endpoint that maps worlds or apps into MCPX namespaces is a separate delivery. Start with one world and a deterministic synthetic action. Pin the tool definitions, verify the world and app grant at invocation, record the ID policy outcome, and preserve revocation on world exit. An ID refusal must propagate unchanged in substance through the gateway. Reverse traffic to external tools must pass the gateway's ceiling as well as ID's authority check. [PolicySession](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/id/crates/id-caps/src/mcp_policy.rs#L613) · [Bridge test](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/id/tests/mcp_spike_e2e.rs) · [ID MCP reference](https://developing-today.github.io/code/id/reference/mcp.html) For nested code mode, treat each nested tool call as an operation under the inherited grant. The ability to execute a script does not itself grant access to every namespace available to the daemon. Pin discovery to the same identity and revision as invocation. Respect an upstream's code-mode setting and define one boundary that translates arguments, deadlines, structured results and cancellation. Test self-recursion, A-to-B-to-A, refusal inside a nested call, and a write whose upstream response is lost. Record the last as an uncertain outcome and reconcile using a durable operation identity where the upstream supports one. [Code-mode interop #1940](https://github.com/developing-today/code/issues/1940) ## Harness adapters and shared libraries The OpenCode v2 adapter and the harness-independent TypeScript daemon client already exist. Keep host UI, local discovery and consent prompting in the adapters. Keep operation shapes, error handling and ranking semantics in shared code. Generate or check the four harness skills against the same supported operation list, help output, and cancellation and consent fixtures. Require an actual session in each host before claiming it supports a given workflow. Retire the deployed v1 integration only after its deployed consumer is ported and rollback has been exercised. [Shared client](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/plugin/core/daemon.ts) · [OpenCode v2](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/plugin/opencode/v2) · [Skill sources](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/plugin/opencode/skills) · [Remaining dependency #2841](https://github.com/developing-today/code/issues/2841#issuecomment-6943099429) The Go client exposes typed invocation around the daemon API. Its test calls task_get with a path parameter, which gives an executable example of argument encoding. Operations currently returns a slice of an internal API type. Before promising a stable library ABI, expose a nameable public operation descriptor and specify compatibility for fields, errors, option defaults, cancellation and unknown operations. Keep offline catalog and settings evaluation independent of daemon dialing, secret resolution and process startup. A C or Wasm host should own explicit handles with bounded lifetimes. Run identical allocation, cancellation and refusal vectors against each binding before offering cross-language parity. [Public client](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/pkg/client/client.go#L77) · [Call-site example](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/pkg/client/client_test.go#L111) · [Embedding #1877](https://github.com/developing-today/code/issues/1877) --- # Public libraries and model operations **Evidence.** The published reference reports 14 documented Go symbols and identifies one real consumer of `pkg/client`: its test exercises the daemon operation `task_get`. The chapter reports no production caller within the repository at its census. The plugin's production path is separate. Its Bun-first `plugin/core/daemon.ts` discovers the endpoint and reuses the connection, and `plugin/core/ops.gen.ts` generates method bindings from the operation table. The parity table, for example, maps `chat_completions` to `ops.chatCompletions()`. This is evidence of the published design and test, not proof of today's deployed clients. [Public Go client](https://developing-today.github.io/code/public-client.html) · [Coverage](https://developing-today.github.io/code/coverage.html) · [HTTP API](https://developing-today.github.io/code/http-api.html) · [Parity](https://developing-today.github.io/code/parity.html) **First release boundary.** Keep the existing Go module's pre-1.0 promise. A caller constructs `client.New` with a transport, calls `Call`, `CallRaw`, or `Invoke[T]`, handles argument errors, unknown operations and HTTP failures, and can inspect `Operations`/`Operation`. The compiled client and the running daemon can come from different commits. “Generated from the same table” ensures consistency at build time; a newer client can still ask an older daemon for an absent operation. Contract fixtures should cover current/current, older/current and current/older. Distinguish local argument validation, unavailable server operations, and remote refusal in each result. The documented lookup methods return `api.Op` from an internal package. Compile a _separate module_ that lists, filters and passes operation records to another function. If that caller needs the type name, expose a public alias or descriptor while preserving existing methods. [Go client](https://developing-today.github.io/code/public-client.html) · [Go module compatibility](https://go.dev/doc/modules/version-numbers) | Surface | Suggested public contract | Acceptance evidence | | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Daemon client | Retain `/v1` operation names, declared parameter placement, injection of HTTP transport and named errors. Check server discovery or handle unknown operations when versions diverge. | Derive a tiny external caller from the real `pkg/client/client_test.go` task lookup with an ID containing a space and slash. Check decoded result, encoded path and distinct refusal. Publish the source permalink and verification ref. | | Offline Go embedding | Publish narrow read-only facades only when a concrete consumer is checked. Catalog ranking accepts an immutable inventory and query. Settings resolution accepts explicit layers and an environment lookup supplied by the host, and returns provenance. Policy evaluation takes verified caller context and policy revision; its output is a decision, not a portable authorization token. | Same fixtures through the daemon and an in-process host produce equivalent ranked matches, resolved public values and decision reasons. Fixture detects unsolicited network, daemon startup or environment lookup outside the supplied inputs. The component committing an action reauthorizes it. | | Fleet and ID | Start with a wire call through the existing enforcing gateway. If an actual offline Rust deployment needs it, compare a shared test corpus, a process boundary and a C/Wasm binding for that specific operation. Avoid maintaining two writable policy engines. | Record actual source-symbol callers in each project before claiming integration. Demonstrate cancellation, denied write and mixed-version behavior. | | Plugin core and adapters | Keep discovery/ranking, daemon transport and generated operations shared. Each adapter owns host session propagation, consent UI and cancellation. Inject transport where Bun's Unix fetch is unavailable. | Fake host adapter tests verify session identity is preserved; one actual host invocation demonstrates transport and cancellation. The published v2 chapter identifies `discover`, `DaemonClient`, `rank`, `summarise`, `readInfoFiles`, and `stateDir` in the core. [Existing implementation map](https://developing-today.github.io/code/opencode-plugin-v2.html) | | C ABI/Wasm | Separate ABI major from module and daemon version. Use opaque handles, explicit buffer ownership, tagged errors, bounded inputs, explicit cancellation and documented concurrency. Bind only operations a host needs. For a component build, a WIT world declares imports/exports. Keep `wasip1` and WIT component support as distinct targets. | Cross-language vectors for success, short output buffer, unknown major, cancellation, released handle and concurrent shutdown. Verify the guest has only its declared capabilities. Route pure operations through identical fixtures as Go. [WIT](https://component-model.bytecodealliance.org/design/wit.html) | | mcpx upstream of mcpx | Assign each gateway a stable local identity. Intersect the verified incoming delegation with local grants at each hop. Maintain a bounded traversal context and reject repeat identities. A forwarded claim needs authenticated provenance. | A→A and A→B→A stop before the repeated call. Parallel A→B and A→C remain independent. A caller cannot manufacture a more privileged origin by supplying traversal metadata. | ## Model resolution, prompt, proxy, repair, hooks and administration **Existing behavior.** The book already documents the `Generate` method of the `Provider` interface in `internal/model`, named `model.providers`, ordered `model.profiles`, explicit credential variable names, `model.budget`, `model.timeout`, and per-attempt timeout. The configured provider defaults to `none`. The configuration chapter adds an important qualification: explicit model/provider requests and the legacy scripting provider's environment or installed-CLI discovery can select generation when the request permits it. The old `repair.provider` and `repair.model` settings mentioned in a fleet file are reported as unregistered. The behavioral oracle for “no model” must count every attempted outbound call and CLI spawn. Reading `model.provider` alone cannot prove it. [Configuration](https://developing-today.github.io/code/configuration.html) · [Consumer](https://developing-today.github.io/code/consumer.html) **One resolution path.** For every model-consuming operation, resolve the ordered candidates from the existing provider/profile configuration and explicit request. Intersect with caller sensitivity ceiling, eligible plan endpoints, total deadline and remaining quota. Require explicit eligibility for the selected route, including plugins, compatible remote endpoints and legacy CLI providers. Resolve credential references only after eligibility and keep values in process. Expose configured profile ID, selected provider/model, configuration revision, selection reason and measured or unknown usage. A 402 terminates model work for that request. A subsequent candidate is eligible after an unstarted or known-safe failure only within the same authorization, quota and deadline. Once a streamed response is partially delivered, retain partial status and stop. Mark usage unresolved if a provider never delivered the final usage frame. [OpenAI streaming reference](https://developers.openai.com/api/reference/resources/chat) | Entry | Contract and retained implementation | Named oracle | | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Prompt and sampling | Keep `mcpx prompt` → `POST /v1/intent`. The distinct `POST /v1/prompt` renders an upstream MCP prompt. Resolve recipes first. Return a proposal by default; preserve explicit run clamped by `autonomy.max` and the caller's authority. MCP sampling remains a compatibility adapter for peers that advertise it, with the initiating identity's budget and consent. The July 2026 revision deprecates sampling with a minimum twelve-month transition. | Deterministic recipe with eligible paid-looking mock endpoints produces zero model requests. When run is clamped to propose, the expected file or other side effect is absent, and `requested`/`clampedBy` records the change. Refusal or 402 preserves a deterministic response with the reason. [Consumer](https://developing-today.github.io/code/consumer.html) · [MCP sampling](https://modelcontextprotocol.io/specification/2026-07-28/client/sampling) | | Proxy | `mcpx proxy`, `mcpx_chat_completions`, and the plugin op target the declared `POST /v1/chat/completions` operation. Publish a matrix for request body fields, tool-call chunks, streaming, cancellation, upstream status, and unsupported features. Preserve direction and role of each message. Route model eligibility through the same resolver and refusal rules. | A fixture splits tool arguments across chunks, returns a midstream failure, cancels before final usage and emits a 402. Inspect frames and upstream call counters. No cross-provider replay once output escaped. Mark exact supported shapes against the checked binary. [Parity](https://developing-today.github.io/code/parity.html) | | Admin by intent | Complete the machine-readable operation inventory first. Filter the operations and allowed arguments by verified identity. A sentence selects a declared operation and produces a preview with normalized arguments, effect, required authority and any consent. The same validator, dispatcher and audit handle CLI and approved intent. Revalidate the preview's target and policy revision before committing. Ambiguity yields choices. | Compare CLI and intent execution using a single fixture with a side-effect counter. Unrecognized operation, revoked grant, stale operation revision or missing required argument yields zero changes. Both successful entry points record the same canonical operation ID. Book describes `x-mcpx-admin` as a classification; verify enforcement in the pinned binary before allowing admin execution. [HTTP API](https://developing-today.github.io/code/http-api.html) | | Repair | Retain the accepted autonomy ladder `off/advise/ask/propose/apply/run`. Proceed from diagnostics and deterministic near misses to explanation, consent, proposed artifact, retry or reinterpretation only under the recorded ceiling. Bound all repair attempts by the original deadline and quota. An ambiguous completion of a write requires a target-supported idempotency key or a reconciliation check before replay. | Deterministic typo returns a nonexecuted proposal under propose ceiling. Unknown write completion makes exactly one upstream invocation. Every candidate is checked against the original identity and namespace. [ADR 0002](https://developing-today.github.io/code/decisions/0002-autonomy-dial.html) | | Exec hooks | Preserve ADR 0001's five script phases and `observe`. Structured success/error hooks complete before the single result/error frame; suffix follows it. The published exec chapter describes advisory model-backed hooks. The November 23 source also implements a proposal at success/error, with disallowed control keys dropped and reported; the book needs a correction. Apply sensitivity and budget before expanding and sending `@source`, `@calls`, `@error` and other placeholders to a provider. A hook that cannot obtain advice emits an unavailable outcome and preserves the original execution result. | Successful and failing scripts each produce one final outcome and ordered suffix/end. A denied advice request makes zero provider calls, and a failed post-hook never reruns the tool. An injected placeholder containing restricted fixture text is absent from the provider capture and telemetry. [Exec contract](https://developing-today.github.io/code/exec.html) · [ADR 0001](https://developing-today.github.io/code/decisions/0001-hook-vocabulary.html) | **Order for implementation.** Check current source, newest comments and ownership on #1877, #1861, #1891, #1925, #1927, #1929, #1931 and #1940. Pin an operation-table, public-symbol and provider-path inventory first. Add the external-client test and offline mock-provider denial tests before shipping new bindings or widening hook effects. Measure actual caller needs before promoting an internal package. Keep the existing plugin settings holds out of every patch. These are proposed acceptance cases. No test, deployment or code ownership is implied by this chapter. ### Second pass against pinned source The following observations use the November 23 archive at `4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a`. They measure reading the implementation, not a live daemon. [Repository snapshot](https://github.com/developing-today/code/tree/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx) - **Go client provenance.** Scanning all 1,051 regular files ending in `.go` in the pinned monorepo archive found zero occurrences of the full import path `github.com/developing-today/code/pkgs/mcpx/pkg/client`. The same-package test actually calls `task_get` with `t 1/2` against an `httptest.Server`; use that as the external-caller fixture. The production OpenCode client is TypeScript. [Test](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/pkg/client/client_test.go#L100) - **A 402 currently advances a model profile.** The HTTP adapter formats any non-2xx as a plain error containing the upstream body. The profile router appends every unsuccessful attempt and advances. Its per-profile token budget caps each attempt's requested tokens separately; it is not a meter of plan eligibility or the profile's cumulative spending. The existing positive-control test makes a 503 advance to the second fake provider. The raw chat proxy separately forwards upstream HTTP status and body and has one upstream for its request. [HTTP adapter](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/model/openai.go#L123) · [Profile router](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/model/resolve.go#L201) · [Positive control](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/model/model_test.go#L299) - **Feedback has two working consumers.** The dashboard reads interactions and posts score/notes. Its stats tabs request the daemon's stats route. The semantic ranker uses separate execution and retrieval multipliers on the combined keyword/vector score. There is a concrete join defect for ratings: the call path stores `server:tool`, proxy-injected tool names use `namespace__function`, and rank lookup uses `namespace.function`. The store uses substring matching over serialized tool names. Even with the same spelling, similarly named tools can borrow one another’s scores. A proposed correction is to store source-native, exact tool identities separately from display names, settle aliases when the call/catalog mapping is still available, and match exact identity. Read old rows using their known source format only when their lookup is unambiguous. Keep unresolved historical records visible without using them to weight a tool. Test a custom namespace, one tool whose name prefixes another, and an unrelated caller-supplied proxy function. One trace's feedback must affect only its identified tool. [Call producer](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/server.go#L1299) · [Proxy](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/routes_proxy.go#L108) · [Lookup](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/registry.go#L2105) · [SQL](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/logstore/feedback.go#L411) · [Dashboard](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/dashboard/dashboard.html#L923) - **Minimize what feedback retains independently of ranking.** Given a state directory, registry initialization attempts to open `feedback.db`. The synchronous tool handler records serialized arguments and successful results for non-dry-run calls. The proxy stores the user query and up to 1 MiB of the upstream reply. The source branches contain no recording-consent check. A bounded copy still contains content. Keep trace ID, stable tool identity, scores and duration for local ranking and stats. Offer optional content capture only with explicit scope, short retention, and the authorized reader’s access; a secret-bearing scope suppresses content before the store, logs and dashboard receive it. Treat historical rows according to access policy on read. Deleting or migrating existing user data is a separate operation. For the oracle, send distinct synthetic markers through call and proxy, verify absence in all retained fields under metadata-only mode, and verify the rating still moves the intended tool's score. [Initialization](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/registry.go#L240) · [Tool history](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/server.go#L1308) · [Proxy history](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/daemon/routes_proxy.go#L291) - **Hook docs and skill parity.** The v2 plugin has an actual `{id, setup}` entry point. The OpenCode 2 skill points to the v1 session plugin path, including its config fragment. The four named per-harness skill directories exist. The published plugin chapter lists four different generic skills. The e2e script example test enumerates only the generic basics directory. Compare adapter-specific installation snippets against each actual export, keep host-specific bootstrapping explicit, and have one shared fixture check discovery, type lookup and a permitted invocation from each advertised route. Preserve the existing v2 options and holds. Also amend the exec chapter's “only advise” statement using the accepted propose restriction and existing tests. No new feature code is needed for that correction. [v2 entry](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/plugin/opencode/v2/index.ts#L235) · [v2 skill](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/plugin/opencode/skills/mcpx-opencode2/SKILL.md#L12) · [Examples](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/e2e/skill_examples_test.go#L11) · [Hook validation](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/execsvc/hooks.go#L187) · [Completed #11141](https://github.com/developing-today/code/issues/11141) **Acceptance contract for [#13544](https://github.com/developing-today/code/issues/13544).** At the pinned revision, a plan-only request that encounters a payment wall can reach the next model account. Introduce a typed payment-required error containing the provider name. Return it before reading the upstream billing body. In the shared profile resolver, use `errors.As` on generation errors before appending the failure and continuing. Keep deterministic intent fallback and other caller behavior. The change stops fallback within this generation; it does not guarantee plan eligibility for the first provider or suppress separate generations begun by another hook. The mock regression exercises two loopback providers with no credentials. Its oracle is one request to the first, zero to the second, recoverable typed failure, and no upstream billing body in user diagnostics. Preserve the existing 503 fallback test. The focused model-router change is tracked in [#13544](https://github.com/developing-today/code/issues/13544) and [PR #13548](https://github.com/developing-today/code/pull/13548). An independent API acceptance decision remains: the intent handler currently converts a generation refusal into a no-model response. Preserving the terminal billing decision and reporting its reason to callers are separate contracts. --- # Auditing the rendered book The audit starts from the sidebar script actually referenced by the live home page. It records the URL, status, Last-Modified and SHA-256 for each linked chapter. All 114 distinct linked pages returned 200 with the same Last-Modified, November 23 at 15:51:27 UTC. The count uses unique linked chapter targets, including subchapters. An independently defined count of lines or headings in source SUMMARY.md could differ. A request to each of `/code/`, `/code/fleet/`, `/code/atlas/`, and `/code/id/` returned 200 and the HTML title named the expected book. [Sidebar](https://developing-today.github.io/code/toc-6eaa30d6.js) · [MCPX](https://developing-today.github.io/code/) · [Fleet](https://developing-today.github.io/code/fleet/) · [Atlas](https://developing-today.github.io/code/atlas/) · [ID](https://developing-today.github.io/code/id/) | Surface | Independent published count | What the evidence establishes | | -------------------- | -------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Typed settings | 241 distinct paths, 48 marked plumbing and 193 remaining | Each row includes kind, default, scope, hot status, flags and env names. There are 246 distinct MCPX-prefixed variable names. The chapter documents resolution as default, file, environment, flag, runtime and shows how to inspect the winner. The printed rows omit named per-setting probes, individual exemption reasons and resolved-value traces. [Configuration](https://developing-today.github.io/code/configuration.html#every-setting) | | Exemptions | 5 names in the coverage paragraph | The published snapshot lists `daemon.inlineStartPoll`, `daemon.tsnet.hostname`, `daemon.tsnetUpTimeout`, `http.streamBufferInit` and `embeddings.wasmPath`. The generated row schema itself contains no effect column. The [source-linked inventory](settings-d24c19c.csv) lists the five reasons and the named probe for each of the other 236 settings. Test results require execution receipts. [Coverage](https://developing-today.github.io/code/coverage.html#settings-and-environment) | | Commands | 75 distinct command rows | Parity supplies the operation mapping, and the CLI chapter groups the commands in six groups. Forty-two command-local flag spellings are named as having only the generated reference in the coverage snapshot. The 270 distinct spelling tokens in the configuration flag cells include aliases. Coverage's 215 is the setting-flag subset of its recursive help dump. Comparing these denominators requires recording each command a spelling binds to. [Parity](https://developing-today.github.io/code/parity.html#cli-commands-75) · [CLI](https://developing-today.github.io/code/cli.html#cli-commands) · [Flags](https://developing-today.github.io/code/coverage.html#flags) | | Operations and tools | 96 declared operation rows, 12 gateway-tool rows | The coverage chapter separately reports 94 printed OpenAPI paths and 109 operations. An audit should record HTTP method and path separately from named operations or live tool instances. [Parity](https://developing-today.github.io/code/parity.html#v1-operations-96) · [API coverage](https://developing-today.github.io/code/coverage.html#the-v1-api) | | Go API | 10 signature or symbol table rows | Several names share rows. Coverage reports 14 exports. The public client chapter documents pre-1.0 signatures, a stable operation-name derivation rule, a package-test example and the absence of in-repo production call sites at its snapshot. Preserve that distinction when adding a Fleet or ID integration example. [Public client](https://developing-today.github.io/code/public-client.html#the-api) | | Remote access | 5 numbered operator recipes | These cover ssh dispatch, local/reverse socket forwarding, MCP-over-SSH, and tsnet. This chapter alone cannot enumerate the frontend and upstream transports and every build/platform registration. [Reaching a daemon](https://developing-today.github.io/code/remote.html) | ### Confirmed deployment regression After checking content anchors against the 114 served chapters, six distinct relative, same-site targets were outside the TOC. The compendium manifest and TypeScript example returned 200. Four URLs returned 404. There were 33 link occurrences on 31 distinct source pages. Each corresponding directory index returned 200. The table gives one referring chapter for each distinct missing target. All content fragments on targets in the 114-page set resolved. The scan covered anchors within main content, without running JavaScript or enumerating all image or asset requests. | Example referring page | Literal href | Current HTTP result | Existing 200 destination | | ---------------------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------- | | [Comparison chapter](https://developing-today.github.io/code/compare/chapter.html) | `README.html` | `/code/compare/README.html` → 404, 30 occurrences across 29 pages | [Comparison index](https://developing-today.github.io/code/compare/index.html) | | [History](https://developing-today.github.io/code/compare/history.html) | `../decisions/README.html` | `/code/decisions/README.html` → 404 | [Decisions index](https://developing-today.github.io/code/decisions/index.html) | | [Home example](https://developing-today.github.io/code/home-example.html) | `home-example/README.html` | `/code/home-example/README.html` → 404 | [Example index](https://developing-today.github.io/code/home-example/index.html) | | [Protocol](https://developing-today.github.io/code/protocol.html) | `spec/README.html` | `/code/spec/README.html` → 404 | [Specification index](https://developing-today.github.io/code/spec/index.html) | ### Source-backed extension to the existing gate 1. **Record semantic IDs and source evidence.** At each checked ref, emit command paths with visibility and aliases, flag IDs keyed by defining command plus scope, and the settings registry with conditional defaults, scope, accepted resolution layers, named probe or specific exemption. Join probe declarations to a separate result carrying test name, dispatch handle, platform, input SHA and oracle. Do not treat a test name as evidence of an executed test. Extract frontend and upstream transport registrations by direction and public Go declarations and methods by package/receiver/signature under the supported tags. Populate the checked inventory from code and the released binary's isolated help/schema paths. Keep historical snapshots as historical rows. 2. **Bind IDs to the operator reference.** Require a published chapter and valid section anchor, or an explicitly owned named gap. A shared table-level anchor is acceptable if the row identifies the subject; an arbitrary mention in an archive is insufficient. Pair the subject with its relevant meaning, such as flag owner, accepted setting layers or restart effects. Render per-setting named probe/exemption details adjacent to the existing registry-generated reference. Derive provenance examples from synthetic config in an isolated environment. Add no live secret values or live paths to the book. 3. **Check base-to-head changes.** Compare sets and behavioral signature fields per semantic ID. Added or changed entries update their current section in that change, and deleted entries remove or mark superseded the public reference. Keep corrections on archived chapters with scope/date/replacement. Preserve existing placement, docs-twins, command registration and effect-ratchet tests. Compare severity and identity of known gaps so exchanging one gap for another with the same count fails. 4. **Run the negative controls remotely.** A new flag on an existing command, a shadowed inherited flag, a new conditional default at the same setting path, a changed public method receiver, removal of a chapter from SUMMARY and a README link to a missing rendered file must each produce the corresponding diagnostic. Capture both the documentation build receipt and the published verification. The coverage chapter itself discloses a remaining size warning in its search-index build; require the actual runner's warning stream before declaring the zero-warning criterion met. [Existing gates](https://developing-today.github.io/code/coverage.html#the-gates-that-hold-this) Two additional cross-checks belong in the working queue. The landing page advertises a 0.1.0 download, while Install describes several tag-driven channels as waiting for their first tag. Verify the actual tag, release asset/checksum and registry publication for each platform before changing the claimed channel. Separately reconcile the Install chapter’s system-service row with the Nix module and distinguish the installer-created unit from a Nix-provisioned service. Those product states require source and release receipts. [Home page](https://developing-today.github.io/code/) · [Channels](https://developing-today.github.io/code/install.html#channels) ### Follow-up pass on the agent-facing site A subsequent publication supplied Last-Modified values of 15:56:36–37 UTC. The alternate Markdown URL advertised by each of the 114 chapter HTML files resolved to its canonical `.html.md` URL. All 114 returned 200, nonempty `text/markdown` and no HTML fallback. After typographic normalization the first headings matched for 113. The intentional home override starts “mcpx — for agents.” Both MCPX discovery documents returned 200. `llms.txt` was 9,846 bytes and `llms-full.txt` was 2,479,076 bytes. The 114 primary discovery links cover every sidebar chapter. The four sibling-root checks and their four explicit custom 404 documents showed the expected book titles; HEAD returned 200 for 68 distinct resources referenced under the site's `/code/` mount. [Agent home](https://developing-today.github.io/code/index.html.md) · [Discovery](https://developing-today.github.io/code/llms.txt) · [Full text](https://developing-today.github.io/code/llms-full.txt) **Following links inside those twins fails.** A Markdown-token scan of the 114 fetched bodies found 488 link occurrences on 80 pages that point at source-style same-site Markdown paths. GET on all 97 distinct referenced paths returned HTTP 404. Every one matched an actual 200 canonical twin, using `.html.md` for ordinary chapters and `index.html.md` for directory README chapters. The coverage twin links to `./configuration.md`; the published page is `configuration.html.md`. In `llms.txt`, line 37 includes one further stale link in the copied description of the OpenCode v2 chapter. Its primary chapter link works. This result counts Markdown links to chapters under the site's mount. Fragments on proposed replacement links still need checking. [Coverage twin](https://developing-today.github.io/code/coverage.html.md) · [Actual Configuration twin](https://developing-today.github.io/code/configuration.html.md) · [Actual comparison index twin](https://developing-today.github.io/code/compare/index.html.md) At archived source commit `4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a`, the Nix recipe rewrote links that escape the documentation source tree in the working copy and left internal links to mdBook. It then ran `docs-twins emit` and `docs-twins check`. The twin generator already had the directory-README-to-index rule for its own output paths. The original internal links are present in `compare/chapter.md:145`, `compare/history.md:17`, `home-example.md:40` and `protocol.md:18`. Verify these points against the integration ref. The repair can use the bound source-chapter-to-served-page map in both output formats. Rewrite links in document nodes, preserve relative scope/query/fragment and leave examples untouched. Extend the staged artifact checker to actual Markdown content links, copied descriptions and HTML content links. Add fixtures for nested directories, README targets, fenced examples, fragment-only links and external URLs. Include an HTTP receipt after deployment. [Nix recipe](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/docs.nix#L110) · [Twin mapping](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/tools/docs-twins/main.go#L66) The audit screened the 114 published main elements for effect-probe, exemption and pin language, and examined all table headers mentioning tests, probes, exemptions, effects or oracles. Coverage and Glossary describe the scheme. No registry-wide path-to-test mapping appeared in those tables. The earlier source archive yields 232 declared probe paths and eight explicit exemptions at its own pin; its two maps cover 240 of the current 241 published paths, with `adapters.allowBare` absent from the older mappings. The [versioned inventory](settings-d24c19c.csv) records the later comparison and keeps declared probes separate from run receipts. [Earlier source](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/internal/settings/effect.go) · [Glossary](https://developing-today.github.io/code/glossary.html) · [Published reference](https://developing-today.github.io/code/configuration.html#every-setting) The same token-and-GET check on `llms-full.txt`, resolving URLs at that file's own served location, found 375 links to 108 distinct source-style Markdown targets under `/code/`; all returned 404. The compendium text itself returned 200, 17,087 bytes. At the earlier archive ref, `generate` saves the same chapter content in the individual twin and concatenates it unchanged into a root-level file. `buildLLMS` reuses the first prose line in a new context. `runCheck` verifies equality with regenerated bytes and presence of the discovery links. It lacks a navigation check. Rebase chapter-internal links for the individual twin and again for a root-level aggregate, or emit absolute site-prefix-aware canonical links in generated Markdown; include these aggregate cases in acceptance. [Full text](https://developing-today.github.io/code/llms-full.txt) · [Generation](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/tools/docs-twins/main.go#L197) · [Check](https://github.com/developing-today/code/blob/4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a/pkgs/mcpx/tools/docs-twins/main.go#L347) The Pages fix landed in PR #13190 at 10:30:58 UTC on November 23. PR #13225 closed without merging. PR #13288 subsequently added the Atlas deployment at 12:56:22 UTC. An operator following the history should refer to the merged fix. [Staging fix](https://github.com/developing-today/code/pull/13190) · [Parallel submission](https://github.com/developing-today/code/pull/13225) · [Atlas integration](https://github.com/developing-today/code/pull/13288) A second source revision, `7310a95730791e66da98f7b0e13865930058a516`, closes the path-membership gap. Its `EffectProbes` map has 233 named probe paths and its `EffectExemptions` map has eight. Their union equals the 241 independently extracted published setting paths, including `adapters.allowBare`. The inventory cites the source line for each. Subsequent issue #13420 records three probes landed in PRs #13345, #13370 and #13361, taking the pin to five. The 16:07 UTC REST branch receipt identified main as `d24c19c6e0654f2466fc98bc86e3dacb786f5067`. Inspection of the subsequent [pinned source archive](https://github.com/developing-today/code/blob/d24c19c6e0654f2466fc98bc86e3dacb786f5067/pkgs/mcpx/internal/settings/effect.go) verified all 241 rows, including 225 distinct functions for the 236 named probe entries. PR #13413 merged at 15:36:58 UTC as `a65cc931a9604502841864b55ea20ebbba424384`. [Pinned effect map](https://github.com/developing-today/code/blob/7310a95730791e66da98f7b0e13865930058a516/pkgs/mcpx/internal/settings/effect.go) · [Census corrections](https://github.com/developing-today/code/issues/13420) · [Merged audit](https://github.com/developing-today/code/pull/13413) --- # Laptop runtime and verification venues ## The active service on November 23 At 17:58–18:00 UTC on November 23, the AMD user unit `mcpx.service` was enabled, active and running. Its MainPID owned the listening Unix socket. A read-only `GET /v1/status` against that socket returned the same PID and version 0.1.0. Only the version, PID and pool name/live/tool count were projected. This procedure starts no daemon and executes no upstream tool. The unit's running executable and the user profile's CLI resolved to different Nix store outputs, both labelled 0.1.0. The corresponding source commits are unknown. The repository declaration at `1f9bc15391ca` has 16 server names. The running unit reported the 15 names below. Atlas appears in the declaration and was absent from this unit's status. This observation narrows #8625's readiness gate. The follow-up below identifies which configuration the unit selected. Private config contents were not collected. [Declaration](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/home/common/mcpx-settings.nix) · [Status handler](https://github.com/developing-today/code/blob/1f9bc15391ca1c2efa639463a6369392456c27e5/pkgs/mcpx/internal/daemon/server.go#L994) · [Atlas acceptance](https://github.com/developing-today/code/issues/8625) | Status measure | Observed result | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Names in the active unit | antigravity, chrome-devtools, cloudrun, codebase-memory, codedb, codex-connectors, context7, deepwiki, desktop-commander, fff, fff-nix, fff-worktree, gopls-mcp-server, mcp-server-neon, sequential-thinking | | Live instances | All 15 pools reported zero at sampling time. Idle pool state alone cannot establish an outage. | | Tool metadata | 14 pools reported a positive tool count. mcp-server-neon reported zero. No call or readiness probe established upstream health. | | Next Atlas acceptance step | Identify the daemon actually selected by each harness and compare its status with the declared server list before attempting any authorized per-client fixture. | ## Which configuration reached the service After the 18:06 UTC service restart, the active unit still reported 15 configured command-backed servers. The Atlas route returned HTTP 404. The service and the default configuration resolved to the same Nix store configuration. Its symlink timestamp was 02:25:41 UTC. The source commit adding Atlas was recorded at 03:06:29 UTC. This ordering and the observed server list explain why restarting the frontend alone did not load Atlas: the selected configuration generation predates the source change. The evidence applies to the observed unit. A different daemon or harness may select a different configuration. [Declaration commit](https://github.com/developing-today/code/commit/0e0d85e6f238224e963845dffc1157ee64c7375a) · [Atlas acceptance](https://github.com/developing-today/code/issues/8625) Once an authorized configuration activation installs the intended generation, verify the unit reads that generation and exposes the Atlas namespace. Then collect the four independent client-fixture receipts, including identity, denial, audit and source attribution. A running unit or visible namespace satisfies only the first part. ## CI and release receipts The newest completed `mcpx-test.yml` run returned by the main-branch workflow query was a failed manual dispatch at `4518255b08f8`. Its predecessor was cancelled. The November 22 schedule also failed. A venue claim needs the specific job, commit and asserted behavior. [November 23 failed dispatch](https://github.com/developing-today/code/actions/runs/45227606720) · [Cancelled dispatch](https://github.com/developing-today/code/actions/runs/45227033087) · [November 22 scheduled run](https://github.com/developing-today/code/actions/runs/45038359692) The release API lists three v0.1.0 archives, Linux x86-64, Linux AArch64 and Darwin AArch64, plus SHA256SUMS. It records publication at 19:14:13 UTC on October 30. This receipt covers the GitHub release channel. GHCR publication remains a distinct acceptance check. [Release](https://github.com/developing-today/code/releases/tag/mcpx%2Fv0.1.0) · [Container publication](https://github.com/developing-today/code/issues/9900) --- # MCPX issue map This dated map covers open application and platform issues, adjacent families and broader search matches. Each row links to its own live issue. The working order follows the engineering dependencies and existing owners. ## Current membership After filing, the same queries returned **24 app issues**, **44 platform issues**, **16 in both**, and **52 distinct labelled issues**. The broad search returned 130 open matches versus 124 before filing; the blocked-label search remained at 18. Six issues entered broad membership and none left. [App query](https://api.github.com/search/issues?q=repo%3Adeveloping-today%2Fcode+is%3Aissue+is%3Aopen+label%3Aapp%2Fmcpx) · [Platform query](https://api.github.com/search/issues?q=repo%3Adeveloping-today%2Fcode+is%3Aissue+is%3Aopen+label%3Aepic%2Fmcpx-platform) | Added issue | Scope | Next action | | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------- | | [#13544](https://github.com/developing-today/code/issues/13544) MCPX model profiles must stop on HTTP 402 payment refusal | app/mcpx | Run the two-provider 402 oracle through Fleet and retain 503 fallback coverage. | | [#13568](https://github.com/developing-today/code/issues/13568) mcpx book: repair broken internal links in published HTML, Markdown twins and llms text | adjacent | Gate HTML, Markdown twins and aggregate text on resolved staged links. | | [#13572](https://github.com/developing-today/code/issues/13572) mcpx docs: show the effect probe or exemption beside each setting | adjacent | Join the generated inventory to the declared probe or exemption and its source reference. | | [#13573](https://github.com/developing-today/code/issues/13573) mcpx: match semantic feedback to exact tool identities across call and proxy paths | app/mcpx | Test exact identity and historical feedback lookup. | | [#13575](https://github.com/developing-today/code/issues/13575) mcpx: reconcile hot embeddings.wasmPath updates with the active embedder and cached vectors | app/mcpx | Test hot embedder selection and cache invalidation with disposable fixtures. | | [#13577](https://github.com/developing-today/code/issues/13577) mcpx: separate decision audit metadata from retained feedback payloads | app/mcpx | Specify authorized audit and feedback fields, then check synthetic marker visibility. | **After the membership snapshot.** At 18:11:44 UTC on November 23, [#13544](https://github.com/developing-today/code/issues/13544) closed after [PR #13548](https://github.com/developing-today/code/pull/13548) merged at [b853df8e7cdb](https://github.com/developing-today/code/commit/b853df8e7cdbf26b8f5e0ed7dab4254c0e1f6e19). The [Fleet verification](https://github.com/dezren39/fleet/actions/runs/45233809469) passed the focused package and the 402 oracle: one attempt to the refusing provider and zero to its successor. The census above records membership at query time. ## Baseline before the publication recheck The November 23, 2026 GitHub REST search returned **20** open issues labelled app/mcpx and **44** labelled epic/mcpx-platform. **16** appeared in both, giving **48** unique labelled issues. The two-page open search for mcpx returned **124** unique issues, including **18** with status/blocked. The publication recheck above captures the six new matches. [Application](https://api.github.com/search/issues?q=repo%3Adeveloping-today%2Fcode+is%3Aissue+is%3Aopen+label%3Aapp%2Fmcpx) · [Platform](https://api.github.com/search/issues?q=repo%3Adeveloping-today%2Fcode+is%3Aissue+is%3Aopen+label%3Aepic%2Fmcpx-platform) · [Mention search](https://api.github.com/search/issues?q=repo%3Adeveloping-today%2Fcode+is%3Aissue+is%3Aopen+mcpx) Native blocked-by edges, program checklist membership, queue ownership and human approval gates have different meanings. The native edge column reports the direct API result at collection time. A latest-comment link provides an inspection starting point. Re-read all relevant claim and release comments, check the live queue and inspect open PRs before starting or merging. ### Filed follow-ups | Issue | Queue receipt | | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | | [#13573](https://github.com/developing-today/code/issues/13573) mcpx: match semantic feedback to exact tool identities across call and proxy paths | 21396 | | [#13575](https://github.com/developing-today/code/issues/13575) mcpx: reconcile hot embeddings.wasmPath updates with the active embedder and cached vectors | 21397 | | [#13577](https://github.com/developing-today/code/issues/13577) mcpx: separate decision audit metadata from retained feedback payloads | 21398 | - [Published update on #9963](https://github.com/developing-today/code/issues/9963#issuecomment-7109706347) - [Published update on #8471](https://github.com/developing-today/code/issues/8471#issuecomment-7109710583) - [Published update on #13264](https://github.com/developing-today/code/issues/13264#issuecomment-7109712554) The concurrent implementation PRs are [#13548](https://github.com/developing-today/code/pull/13548), [#13571](https://github.com/developing-today/code/pull/13571) and [#13588](https://github.com/developing-today/code/pull/13588). Follow each PR for its verified ref, checks and merge state. ## Relationships and current decisions The baseline working map includes 129 open rows from the original survey and adjacent work. The 130 figure above counts broad search matches at the later recheck. Direct blocked-by lists returned no dependencies on all 58 checked endpoints. A status/blocked label can therefore convey a real human or environment gate absent from GitHub’s dependency graph. Recheck the distinction before treating an issue as runnable. [Dependency example](https://api.github.com/repos/developing-today/code/issues/9963/dependencies/blocked_by) | Parent | Native children, including closed | | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [#1900](https://github.com/developing-today/code/issues/1900) | [#1892](https://github.com/developing-today/code/issues/1892), [#1885](https://github.com/developing-today/code/issues/1885), [#1887](https://github.com/developing-today/code/issues/1887), [#1889](https://github.com/developing-today/code/issues/1889), [#1891](https://github.com/developing-today/code/issues/1891), [#1893](https://github.com/developing-today/code/issues/1893) (closed) | | [#8993](https://github.com/developing-today/code/issues/8993) | [#8822](https://github.com/developing-today/code/issues/8822), [#12459](https://github.com/developing-today/code/issues/12459) | | [#8625](https://github.com/developing-today/code/issues/8625) | None recorded | | [#1891](https://github.com/developing-today/code/issues/1891) | [#1904](https://github.com/developing-today/code/issues/1904) (closed), [#1923](https://github.com/developing-today/code/issues/1923) (closed), [#1927](https://github.com/developing-today/code/issues/1927), [#1902](https://github.com/developing-today/code/issues/1902) (closed), [#1933](https://github.com/developing-today/code/issues/1933) (closed), [#1936](https://github.com/developing-today/code/issues/1936) (closed), [#1925](https://github.com/developing-today/code/issues/1925), [#1929](https://github.com/developing-today/code/issues/1929), [#1931](https://github.com/developing-today/code/issues/1931) | | [#1892](https://github.com/developing-today/code/issues/1892) | [#1888](https://github.com/developing-today/code/issues/1888) | The updated program census and generator/workflow issues are closed. The five-exemption baseline remains the basis of probe planning. [Census issue](https://github.com/developing-today/code/issues/13420) · [Generator issue](https://github.com/developing-today/code/issues/13422) · [Tracker annotation](https://github.com/developing-today/code/issues/13264#issuecomment-7106905821) | Work item | Existing issue and scope | Next verification | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Supervised stdio | [#9963](https://github.com/developing-today/code/issues/9963) and [#1384](https://github.com/developing-today/code/issues/1384) own the default change. PR #11343 made supervision opt-in. | Verify distinct sockets and children for two instances of the same configured name across a restart before changing the default. Keep the Darwin parity check. | | Wasm embeddings | [#8471](https://github.com/developing-today/code/issues/8471) and merged PR #12725 concern the effect exemption. | A deterministic embed-exporting fixture must distinguish the selected Wasm model, fallback and a stale cache. Verify hot reconfiguration separately on the same daemon PID. | | Feedback identity | [#1936](https://github.com/developing-today/code/issues/1936) closed after the original feedback feature. | Verify that scoring one direct invocation affects the matching semantic candidate, including legacy spellings. Include a neighboring name and an offered but uninvoked tool. | | Decision records | [#13264](https://github.com/developing-today/code/issues/13264) owns the per-client audit design. | Specify metadata available to an audit reader separately from retained feedback payloads. Use synthetic data for consent and refusal tests. | | Atlas | [#8625](https://github.com/developing-today/code/issues/8625) requires four independent harnesses. | Verify identity, pre-ranking filtering and audit evidence for each harness. [#12900](https://github.com/developing-today/code/issues/12900) retains the separate product decision on future multi-client demand. | ## Verification venues and main failures | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------- | ----------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [#13349](https://github.com/developing-today/code/issues/13349) main-broken: developing-today/code mcpx @5c8e163 — basic: lint | adjacent | status/needs-triage | Unchecked | See issue | Claimed by agent-next-21-local, task 21325. Focused Fleet run 45201909155 passed; PR #13371 remains draft for the #3016 stress gate. [Holder update](https://github.com/developing-today/code/issues/13349#issuecomment-7105342992) | | [#13393](https://github.com/developing-today/code/issues/13393) ci(mcpx): nightly mcpx-test basic legs red on main — unit TestNoPackageRedeclaresADefault + lint | adjacent | — | Unchecked | See issue | Use nightly run artifacts to separate the defaults guard and lint findings. | | [#12738](https://github.com/developing-today/code/issues/12738) build: nix build .#deploy wedges in mcpx check phase (go test idle, no test binary); registry build realizes every target package | adjacent | status:in-review | Unchecked | See issue | The deploy registry decoupling merged Nov 23. Verify the deploy CLI builds independently and distinguish any mcpx package hang. [PR #12757](https://github.com/developing-today/code/pull/12757) | | [#2686](https://github.com/developing-today/code/issues/2686) mcpx: e2e and settings suites cannot run in the nix build sandbox (checkPhase exclusions) | app, platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/2686#issuecomment-7057911361) | The Linux tini wrapper and restored settings/e2e checks merged Nov 21. Confirm a current Nix run and its remaining exclusions. [PR #12069](https://github.com/developing-today/code/pull/12069) | | [#3016](https://github.com/developing-today/code/issues/3016) mcpx nightly stress failure | app, platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/3016#issuecomment-7103382143) | This gates PR #13371/#13349. Retrieve the seed and daemon-state guard failure at both OSes; record matching follow-up run after coordinating with the holder. [Related holder update](https://github.com/developing-today/code/issues/13349#issuecomment-7105342992) | | [#10471](https://github.com/developing-today/code/issues/10471) mcpx CI over budget (rolling) | app | status/done | None recorded | [Read](https://github.com/developing-today/code/issues/10471#issuecomment-6940528876) | Recompute the median across five eligible runs. Reconcile the open issue with its done label. | | [#1983](https://github.com/developing-today/code/issues/1983) mcpx testing: environments -- nix flake, container, local, remote -- as CI matrix entries | app | — | None recorded | [Read](https://github.com/developing-today/code/issues/1983#issuecomment-7105346276) | The local devShell merged. Coordinate #13386–#13388 for remote-safe assertions, no-Deno and arm64 evidence. [PR #13394](https://github.com/developing-today/code/pull/13394) | | [#13386](https://github.com/developing-today/code/issues/13386) test(mcpx): remote-safe e2e subset — per-test needs selection + remote runner leg | adjacent | — | Unchecked | See issue | Select explicitly remote-safe tests. Count assertions executed against a separate daemon; check cleanup. | | [#13387](https://github.com/developing-today/code/issues/13387) ci(mcpx): e2e-no-deno leg — real bun and node paths with no Deno on PATH | adjacent | — | Unchecked | See issue | Remove Deno from PATH in the test venue and require Bun and Node execution receipts. | | [#13388](https://github.com/developing-today/code/issues/13388) ci(mcpx): e2e-host-linux-arm64 leg (tier 2) | adjacent | status:in-review | Unchecked | See issue | Check plan runner availability before scheduling a Linux arm64 leg. | | [#1985](https://github.com/developing-today/code/issues/1985) mcpx testing: CI workflow skeleton -- init, matrix, final job; triggers, concurrency, caching, checkout | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1985#issuecomment-6942137203) | Compare actual workflow graph, triggers, caches and terminal check with the imported plan. | | [#1987](https://github.com/developing-today/code/issues/1987) mcpx testing: extended platforms -- which artifacts ship static; alpine, scratch, distroless, flatpak, Fedora, Windows tiers | app, platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1987#issuecomment-6942058060) | Tie each claimed supported platform to a shipped binary and an execution target. | | [#1905](https://github.com/developing-today/code/issues/1905) mcpx testing: integration tests for every feature, across environments | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1905#issuecomment-6941708776) | Associate each coverage class with a venue, a named oracle and run evidence. | | [#13168](https://github.com/developing-today/code/issues/13168) fleet-command container: dispatched nix develop/build commands fail out of the box (3 stacked env defects) | adjacent | — | Unchecked | See issue | Reconcile three Fleet-command environment defects with #13193 and #13198. Classify an environment failure separately from an MCPX suite failure. | | [#13193](https://github.com/developing-today/code/issues/13193) fleet dispatch: nix develop commands fail in the fleet-build container (nix config / build-users-group / homeless-shelter purity) | adjacent | — | Unchecked | See issue | Check Fleet container Nix configuration, build-user group and home-directory purity through the owning issue before assigning MCPX tests to that venue. | ## Programme and book records | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------- | ----------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | [#13264](https://github.com/developing-today/code/issues/13264) mcpx program — full-investigation prompt: design completion & build-out for the MCP gateway | adjacent | status:in-review | None recorded | [Read](https://github.com/developing-today/code/issues/13264#issuecomment-7106905821) | Publish the research chapters, current issue map, ownership checks and landed verification receipts here. | | [#1888](https://github.com/developing-today/code/issues/1888) mcpx docs: the book -- overview, manual and compendium (tracker) | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1888#issuecomment-7105989842) | Inspect the chapters and audit delivered by PR #13413 before extending coverage. | | [#1890](https://github.com/developing-today/code/issues/1890) mcpx docs: site platform -- generator, GitHub Pages, subdomain, agent markdown (tracker) | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1890#issuecomment-6941790541) | Verify the published root and child books against the deployed Pages staging tree. | | [#1894](https://github.com/developing-today/code/issues/1894) mcpx docs: level 1 -- the 30-second layer: home, overview, quick start, install (tracker) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1894#issuecomment-6941772575) | Gate every install route on release artifact or registry evidence (#1881/#9900). | | [#1892](https://github.com/developing-today/code/issues/1892) mcpx: design a comprehensive docs and testing strategy | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1892#issuecomment-6941501027) | Connect the surface inventory, book corrections and actual verification venue to the docs change gate. | | [#12459](https://github.com/developing-today/code/issues/12459) epic(mcpx): maintenance | app | — | None recorded | [Read](https://github.com/developing-today/code/issues/12459#issuecomment-7076523795) | Use the maintenance home to link recurring work and deduplicate regressions. | | [#8993](https://github.com/developing-today/code/issues/8993) epic: mcpx — one canonical MCP gateway and server parity | adjacent | — | Unchecked | See issue | Reconcile native child membership with the body's dated lineage exception. | | [#1900](https://github.com/developing-today/code/issues/1900) mcpx: the backlog build-out — every theme, in one order, with the disagreements between them (super tracker) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1900#issuecomment-6941644026) | Resolve migrated issue numbers through relocation records before importing historical references. | | [#8822](https://github.com/developing-today/code/issues/8822) mcpx dedup — one canonical mcpx source in developing-today/code (shipped — tracking home) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/8822#issuecomment-6934404617) | Keep the shipped dedup record as a tracking home and verify genuinely outstanding follow-ups individually. | ## Effect probes and response bounds | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------- | ----------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [#8469](https://github.com/developing-today/code/issues/8469) mcpx coverage burn-down: settings (http-transport family) with no effect probe | app, platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8469#issuecomment-7080977779) | The latest note attributes the remaining exception to scanner capacity and records a packet defect. Decide the accepted allocation oracle or setting contract before moving the pin. [Triage](https://github.com/developing-today/code/issues/8469#issuecomment-7080977779) | | [#8471](https://github.com/developing-today/code/issues/8471) mcpx coverage burn-down: settings (model-ai family) with no effect probe | app, platform | status:in-review, status/parked | None recorded | [Read](https://github.com/developing-today/code/issues/8471#issuecomment-7088142178) | Preserve the exemption until a real embed-exporting Wasm fixture supplies a vector oracle. Separate hot-reload behavior from cold construction. | | [#8472](https://github.com/developing-today/code/issues/8472) mcpx coverage burn-down: settings (plugin family) with no effect probe | app, platform | status:in-review | None recorded | [Read](https://github.com/developing-today/code/issues/8472#issuecomment-7104015125) | #13420 records the two formerly held plugin exceptions as covered elsewhere. Reconcile the ledger and issue state. | | [#8465](https://github.com/developing-today/code/issues/8465) mcpx coverage burn-down: CLI commands (running group) with no integration-test exercise | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/8465#issuecomment-7107915391) | Running-group coverage changes merged Nov 17. Compare with the current ledger before proposing any additional command test. [PR #11240](https://github.com/developing-today/code/pull/11240) | | [#4375](https://github.com/developing-today/code/issues/4375) Design: read it bounded — one response-read contract for mcpx's outbound calls | app, platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/4375#issuecomment-7022311044) | Inventory outbound readers. Verify exact-limit, one-byte-over, cancellation and cleanup separately. | | [#8242](https://github.com/developing-today/code/issues/8242) mcpx: evaluate in-house deterministic simulation approaches (Antithesis declined) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/8242#issuecomment-6974115077) | Use seeded scheduling or replay seams for restart and reconnect faults, within plan quota. | ## Lifecycle, transports and releases | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------- | --------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [#1384](https://github.com/developing-today/code/issues/1384) design(mcpx): a supervisor that owns each stdio child's pipes — replace the takeover handoff for stdio | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1384#issuecomment-7022323317) | PR #10767 merged. The Darwin check under #9963 conflicted with a later generic 4/4 closure suggestion; reconcile the actual acceptance evidence. [Substantive triage](https://github.com/developing-today/code/issues/1384#issuecomment-6935307231) · [Closure proposal](https://github.com/developing-today/code/issues/1384#issuecomment-7022323317) | | [#9963](https://github.com/developing-today/code/issues/9963) mcpx: Phase 3 of #1384 — supervised stdio by default + lifecycle hygiene | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/9963#issuecomment-7071719776) | Isolate sockets per real child instance before enabling supervision by default. Repeat the Darwin done check. | | [#1414](https://github.com/developing-today/code/issues/1414) design(mcpx): resume upstream HTTP sessions after a cold restart — persist the resumable session state | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1414#issuecomment-7071764863) | Phase 3 landed in PR #10755. Verify restart skips DELETE and explicit end sends DELETE on current main, then reconcile the open issue. [Merge receipt](https://github.com/developing-today/code/issues/1414#issuecomment-6917634957) · [Done-check request](https://github.com/developing-today/code/issues/1414#issuecomment-7071764863) | | [#1887](https://github.com/developing-today/code/issues/1887) mcpx: surfaces -- reaching the daemon over ssh and the browser, and keeping what you reached (tracker) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1887#issuecomment-6941521449) | Keep socket, SSH and remote invocation behavior tied to transport-specific evidence. | | [#1884](https://github.com/developing-today/code/issues/1884) mcpx: one convention for renewing TTLs -- touch-on-read, not a renew endpoint per resource | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1884#issuecomment-6941333308) | Compare TTL/touch behavior per resource before changing generic renewal semantics. | | [#9900](https://github.com/developing-today/code/issues/9900) mcpx release: GHCR container channel never published — push denied on v0.1.0 run, publish path now dispatch-only | platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/9900#issuecomment-7071720451) | Check package permissions and dispatch-only publishing. Require pull-by-digest and smoke evidence. | | [#1881](https://github.com/developing-today/code/issues/1881) mcpx: release.yaml, release artifacts and the install channels the docs will promise | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1881#issuecomment-7082903753) | Reconcile shipped assets, installer and registry availability with channel promises. | | [#8017](https://github.com/developing-today/code/issues/8017) mcpx github failover: daemon call-path wiring + live activation (follow-on to #7948) | platform | status/blocked, queue/blocked, status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/8017#issuecomment-7072715898) | Verify activation and ownership before touching failover. Use a fixture for soft and hard refusals. | | [#8809](https://github.com/developing-today/code/issues/8809) mcpx parity: GitHub / Atlassian / Datadog MCP server logins (Drew-gated OAuth/PAT) | platform | status/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8809#issuecomment-7082949415) | Interactive provider logins belong to Drew. Track acceptance per provider by name. | | [#8810](https://github.com/developing-today/code/issues/8810) One-command local agent CLI via this VM's mcpx — needs Drew's OS / call-method / auth answers | platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8810#issuecomment-7080836682) | Recover recorded OS, call method and auth decisions before prototyping. | | [#1943](https://github.com/developing-today/code/issues/1943) mcpx docs: a custom subdomain for the site (DNS, CNAME, HTTPS) | platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/1943#issuecomment-7082950606) | Keep the current host until Drew authorizes a specific CNAME action. | ## Identity, event records and integrations | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------- | ----------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [#7843](https://github.com/developing-today/code/issues/7843) mcpx conformance: user-identity - design how elicitation state binds identity (or refuses to) before implementing (split of #1957) | app, platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/7843#issuecomment-6944923532) | Read the elicitation decision and verify refusal on unknown or mismatched principals. | | [#1957](https://github.com/developing-today/code/issues/1957) mcpx: smaller conformance gaps -- user identity, annotation trust, rate limits, cursors, URI encoding, prompt validation, restart, invalidation | app, platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1957#issuecomment-7072854244) | Link each remaining conformance gap to an assertion and a decision. | | [#1950](https://github.com/developing-today/code/issues/1950) mcpx: OAuth authorization for remote servers and for /mcp (61 conformance rows) | platform | status:in-review | None recorded | [Read](https://github.com/developing-today/code/issues/1950#issuecomment-7091321065) | Verify client and resource-server OAuth separately against the actual conformance matrix. | | [#8625](https://github.com/developing-today/code/issues/8625) atlas memory slice 3: MCP query surface over the unified Atlas index (mcpx namespace) (#8567) | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8625#issuecomment-7092385655) | Capture identity, ceiling and audit receipts for OpenClaw, OpenCode, OpenChamber and Muse. | | [#10389](https://github.com/developing-today/code/issues/10389) Design mill: one fleet surface for OpenCode, OpenChamber, ID, and mcpx | adjacent | status/triaged | Unchecked | See issue | Preserve the protected fleet design and validate the gateway delegation contract. | | [#10390](https://github.com/developing-today/code/issues/10390) Design mill pass 1: fleet subcommands for the four tools — pass-through, endpoint + credential resolution | adjacent | — | Unchecked | See issue | Verify endpoint and credential resolution on a real pass-through verb. | | [#10393](https://github.com/developing-today/code/issues/10393) Design mill pass 4: MCP everywhere — fleet MCP via mcpx, namespaces, fan-out, remote graph | adjacent | — | Unchecked | See issue | Specify scoped discovery, fan-out loop detection and partial failures. | | [#10405](https://github.com/developing-today/code/issues/10405) Design mill supplement: middle-road fleet MCP, ID graph publication, transitive capability purity | adjacent | status/triaged | Unchecked | See issue | Require attenuation and provenance across remote graph hops. | | [#10394](https://github.com/developing-today/code/issues/10394) Design mill pass 5: embedding research — ID and mcpx inside fleet | adjacent | status/triaged | Unchecked | See issue | Compare real call-site needs before expanding the Go/FFI surface. | | [#1861](https://github.com/developing-today/code/issues/1861) mcpx: a harness-free plugin core, with adapters for codex, claude code, pi, manus | platform | status:to-do | None recorded | [Read](https://github.com/developing-today/code/issues/1861#issuecomment-6941297634) | Verify common discovery and identity behavior with two thin harness adapters. | | [#1858](https://github.com/developing-today/code/issues/1858) mcpx: port the opencode plugin to opencode v2 (a rewrite, and several things get better) | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1858#issuecomment-6941316844) | Coordinate the sole recorded SET-REMAINDER, v1 retirement, after #730 ports the deployed copy. [Latest substantive account](https://github.com/developing-today/code/issues/2841#issuecomment-6943099429) | | [#2841](https://github.com/developing-today/code/issues/2841) mcpx opencode v2 plugin: implement the #1858 SET-REMAINDER items (1)-(5) | app, platform | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/2841#issuecomment-6943099429) | Latest substantive note records items 1–4 landed. Only v1 retirement remains, blocked by the deployed plugin port under #730. [Decision](https://github.com/developing-today/code/issues/2841#issuecomment-6943099429) | | [#1940](https://github.com/developing-today/code/issues/1940) mcpx and opencode code mode: nested code mode, ?codemode=false, and what a harness expects of mcpx_exec | app, platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1940#issuecomment-6941980679) | Exercise nested code-mode opt-out, authority intersection and correlation end to end. | | [#1877](https://github.com/developing-today/code/issues/1877) mcpx: embedding mcpx -- a public Go API, the C ABI, WASM, and mcpx as its own upstream | platform | status:to-do | None recorded | [Read](https://github.com/developing-today/code/issues/1877#issuecomment-6941290837) | Version the Go contract with real consumers before advancing the C/WASM ABI. | | [#1885](https://github.com/developing-today/code/issues/1885) mcpx: extensibility -- plugins, hooks, tool sources, embedding (tracker) | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1885#issuecomment-6941327071) | Route extension operations through the declared API and check authority at invocation. | ## Model, runtime and intent | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | | [#1891](https://github.com/developing-today/code/issues/1891) mcpx: the AI layer and search -- where a model comes from, and everything that would use one (tracker) | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1891#issuecomment-6941469427) | Deliver deterministic discovery, validation and declared operations independently of optional models. | | [#1925](https://github.com/developing-today/code/issues/1925) mcpx: where the model comes from — a provider layer mcpx owns, model profiles, and life after MCP Sampling's deprecation | adjacent | status/blocked, queue/blocked, status:to-do, status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1925#issuecomment-6952888469) | Compare provider/profile behavior to the current decision record. Preserve no-spend behavior. | | [#1927](https://github.com/developing-today/code/issues/1927) mcpx: checking, refusing and repairing a request — a graded ladder from deterministic diagnostics to rewrite-and-run | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1927#issuecomment-7071763754) | Return deterministic diagnostics first. Evaluate authorization again after any repair. | | [#1929](https://github.com/developing-today/code/issues/1929) mcpx: lifecycle hooks on exec — prePrompt/postPrompt/onError as one declared list, script or prompt, with a declared effect | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1929#issuecomment-6976065024) | Define hook deadlines, cancellation and side-effect boundaries for each exec stage. | | [#1931](https://github.com/developing-today/code/issues/1931) mcpx: administration by intent — finish the operation surface, then route a sentence to a declared operation | platform | — | None recorded | [Read](https://github.com/developing-today/code/issues/1931#issuecomment-6935816108) | Map intent to a declared operation, preview inputs and enforce normal authorization. | | [#1889](https://github.com/developing-today/code/issues/1889) mcpx: runtimes, languages and dependencies -- what runs a script, in what language, with which packages (tracker) | platform | status/triaged | None recorded | [Read](https://github.com/developing-today/code/issues/1889#issuecomment-6941350711) | Specify runtime selection and dependency planning independently. | | [#1911](https://github.com/developing-today/code/issues/1911) mcpx: how the JavaScript runtime is chosen, what each does with TypeScript, and an automatic validate/compile step | platform | status/parked | None recorded | [Read](https://github.com/developing-today/code/issues/1911#issuecomment-6942914703) | Exercise runtime choice and typechecking across installed runtimes before changing the parked state. | | [#1915](https://github.com/developing-today/code/issues/1915) mcpx: resolve a script's import graph statically and prepare missing dependencies | platform | status:in-review | None recorded | [Read](https://github.com/developing-today/code/issues/1915#issuecomment-7097481848) | Review open work and verify an import graph with dynamic and unavailable dependencies. | ## Adjacent programme dependencies | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------- | ----------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | [#1868](https://github.com/developing-today/code/issues/1868) mcpx: faster CLI and exec -- no self-socket, lazy schemas, a typecheck default | adjacent | — | Unchecked | See issue | Measure startup, schema retrieval and typechecking on the same fixture. | | [#1850](https://github.com/developing-today/code/issues/1850) Event store: one table for every statistic, from any source | adjacent | — | Unchecked | See issue | Reconcile event-store schema and stats consumers with the gateway call record. | | [#1822](https://github.com/developing-today/code/issues/1822) Audit: socket activation as the default pattern for laptop services | adjacent | status/in-progress | Unchecked | See issue | Compare mcpx unit behavior with the laptop socket-activation audit. | | [#8866](https://github.com/developing-today/code/issues/8866) ci: PR workflow runs cancelled en masse before finishing (PR #8858 runs, 2026-11-12); one mcpx run stuck queued | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8866#issuecomment-7082715656) | Confirm whether the reported queue/cancellation incident affects a current route. | | [#10357](https://github.com/developing-today/code/issues/10357) Design: automatic context propagation — every fleet action carries its origin | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/10357#issuecomment-7072378657) | Propagate non-secret origin and correlation across Fleet and MCPX. | | [#13241](https://github.com/developing-today/code/issues/13241) Atlas program — full investigation, next-steps design & build-out (program tracking) | adjacent | status:in-review | Unchecked | See issue | Coordinate cross-client acceptance with the Atlas programme owner. | | [#8983](https://github.com/developing-today/code/issues/8983) epic: Atlas program — unified search and memory index over every corpus | adjacent | — | Unchecked | See issue | Keep corpus retrieval and sensitivity checks under the Atlas programme. | | [#730](https://github.com/developing-today/code/issues/730) OpenCode 2: validate .opencode config against the v2 schema and port the v1 plugins | adjacent | status:in-review, status/triaged | Unchecked | See issue | Check OpenCode configuration and plugin compatibility at the owning surface. | ## Additional search matches | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------- | ------------------------ | | [#24](https://github.com/developing-today/code/issues/24) Dependency Dashboard | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#902](https://github.com/developing-today/code/issues/902) impl(dns-registry): recurring DNS backup job, renewal/cost tracking, dashboard view of the domain register | adjacent | status/parked | Unchecked | See issue | Track in owning program. | | [#1067](https://github.com/developing-today/code/issues/1067) id: F12.10 fair scheduling and per-account quotas | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#1071](https://github.com/developing-today/code/issues/1071) id: idea — native TUI client (ratatui) on the shell contract | adjacent | status/triaged, status/idea-tracked | Unchecked | See issue | Track in owning program. | | [#1352](https://github.com/developing-today/code/issues/1352) Program tending: scheduled care for roadmaps, epics, projects, and stalled PRs | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#1377](https://github.com/developing-today/code/issues/1377) chore(fleet): scope tailnet policy for the laptop opencode serve endpoint (amd-6:443) | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/1377#issuecomment-7071902812) | Track in owning program. | | [#1752](https://github.com/developing-today/code/issues/1752) nixos: bring Grist, Kaneo, Pad, ready-for-agent in as flake services — the last hand-run PM servers | adjacent | — | Unchecked | See issue | Track in owning program. | | [#2179](https://github.com/developing-today/code/issues/2179) Machine pool: onboard additional machines as fleet job nodes and redesign placement around a pool | adjacent | status:in-review, status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/2179#issuecomment-7096223703) | Track in owning program. | | [#2380](https://github.com/developing-today/code/issues/2380) id: keyset/authorization log — device keys, revocation, bindings as signed records (identity substrate) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#2490](https://github.com/developing-today/code/issues/2490) unify(quota-plane): one quota read path — server endpoint, CLI, and aggregator gatherer must share the direct credential-store read | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#3286](https://github.com/developing-today/code/issues/3286) OpenCode 2 (#730 WS2 remainder): plugin-array v2 verdict pass + subtask2 decision | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5724](https://github.com/developing-today/code/issues/5724) Daily codebase innovation & maintenance | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5765](https://github.com/developing-today/code/issues/5765) Epic: deployment architecture — services layer + deploy tool (tracking) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5767](https://github.com/developing-today/code/issues/5767) deploy tool: Cloudflare target class — generalize the `-deploy` apps to all Workers | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/5767#issuecomment-7073010965) | Track in owning program. | | [#5790](https://github.com/developing-today/code/issues/5790) design: versioning for a monorepo whose apps deploy individually — derived versions, per-app tags + repo date tag, survey of schemes (WS-H) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5864](https://github.com/developing-today/code/issues/5864) id: design: D1 journal fit (design + spike) (from #5681) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5961](https://github.com/developing-today/code/issues/5961) id: research: permission-prompt precedents — Play Store, Android/iOS runtime permissions, OAuth scopes, extension permissions, TCC/portals | adjacent | — | Unchecked | See issue | Track in owning program. | | [#5983](https://github.com/developing-today/code/issues/5983) Docs migration: hatch-personal/hatch/darwin-nix → code canonical home (tracking) | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/5983#issuecomment-6918195332) | Track in owning program. | | [#6167](https://github.com/developing-today/code/issues/6167) OpenClaw: post-fix follow-ups — activation queue behind #6156, memory-wiki, channel completion menu, gateway-death alerting | adjacent | — | Unchecked | See issue | Track in owning program. | | [#6582](https://github.com/developing-today/code/issues/6582) Design: validate it where you read it — one validated-and-bounded contract for the fleet proxy's frame and peer values | adjacent | status/triaged | Unchecked | See issue | Track in owning program. | | [#7011](https://github.com/developing-today/code/issues/7011) investigate: CPU/memory load over time + parallelism sweet spot on the sandbox VM | adjacent | status/parked | Unchecked | See issue | Track in owning program. | | [#7030](https://github.com/developing-today/code/issues/7030) fleet-stalling: Drew's expedite set has no active worker | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#7079](https://github.com/developing-today/code/issues/7079) Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried | adjacent | status/in-progress, status/parked | Unchecked | See issue | Track in owning program. | | [#7297](https://github.com/developing-today/code/issues/7297) Unowned PR batch from branch disposition (2026-11-07) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#8030](https://github.com/developing-today/code/issues/8030) Daily codebase innovation & maintenance | adjacent | — | Unchecked | See issue | Track in owning program. | | [#8220](https://github.com/developing-today/code/issues/8220) home-resolution contract: disposition the os.homedir() surface against #5762 | adjacent | status/blocked, queue/blocked | None recorded | [Read](https://github.com/developing-today/code/issues/8220#issuecomment-6976760871) | Track in owning program. | | [#8324](https://github.com/developing-today/code/issues/8324) Scheduled Suggestions — developing-today/code | adjacent | — | Unchecked | See issue | Track in owning program. | | [#8824](https://github.com/developing-today/code/issues/8824) Routine-task architecture redesign — one merged job, time-based sections, todo allowlists (shipped — tracking home) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#8976](https://github.com/developing-today/code/issues/8976) epic: main-broken — main-branch CI failure reports | adjacent | — | Unchecked | See issue | Track in owning program. | | [#9068](https://github.com/developing-today/code/issues/9068) impl(pm-stack): design-spawn backfill — native parenting of sub-design tracking issues + spawn rollup | adjacent | status/parked | Unchecked | See issue | Track in owning program. | | [#9196](https://github.com/developing-today/code/issues/9196) PM Stack & Fleet orchestration — priority, dispatch, and work-item lifecycle (design mill) | adjacent | status:to-do | Unchecked | See issue | Track in owning program. | | [#9335](https://github.com/developing-today/code/issues/9335) pm-stack decision sets v2: rich questions, event log, submit API + activity webhook/hook | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#9399](https://github.com/developing-today/code/issues/9399) Program: pool & effort system — effort tiers per pool, OpenChamber category pools, granular stats store (design mill) | adjacent | status/parked | Unchecked | See issue | Track in owning program. | | [#9592](https://github.com/developing-today/code/issues/9592) Daily codebase innovation & maintenance | adjacent | status/triaged | Unchecked | See issue | Track in owning program. | | [#10077](https://github.com/developing-today/code/issues/10077) Daily codebase innovation & maintenance | adjacent | status/triaged | Unchecked | See issue | Track in owning program. | | [#10105](https://github.com/developing-today/code/issues/10105) watchdog: reopen issues the bot wrongly closes on merges | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#10395](https://github.com/developing-today/code/issues/10395) Design mill pass 6: fork upkeep — upstream merges + feature-gap analysis (OpenCode, OpenChamber) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#10511](https://github.com/developing-today/code/issues/10511) Daily codebase innovation & maintenance | adjacent | status/triaged | Unchecked | See issue | Track in owning program. | | [#10724](https://github.com/developing-today/code/issues/10724) laptop keyring stays locked after daemon restart — Secret Service consumers (agy) blocked until manual unlock | adjacent | status/parked | Unchecked | See issue | Track in owning program. | | [#10880](https://github.com/developing-today/code/issues/10880) Daily codebase innovation & maintenance | adjacent | — | Unchecked | See issue | Track in owning program. | | [#11177](https://github.com/developing-today/code/issues/11177) impl: release workflow for per-app version tags — who/what cuts the tags and how 'tested' is attested (follow-on to #5790 §5) | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#11321](https://github.com/developing-today/code/issues/11321) Daily codebase innovation & maintenance | adjacent | — | Unchecked | See issue | Track in owning program. | | [#12133](https://github.com/developing-today/code/issues/12133) Scheduled Suggestions — developing-today/code | adjacent | — | Unchecked | See issue | Track in owning program. | | [#12236](https://github.com/developing-today/code/issues/12236) fleet agent: put every lane on the intake ladder (follow-ups to #12227) | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#12280](https://github.com/developing-today/code/issues/12280) fleet: ready PRs are left unmerged (20 open; the merge sweep has filed nothing since 2026-11-17) | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#12768](https://github.com/developing-today/code/issues/12768) deploy: register the PM-stack services (aggregator, projector, tunnel, ready-for-agent) as deploy targets | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#13272](https://github.com/developing-today/code/issues/13272) fleet program: full investigation, next-steps design & build-out prompt | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#13306](https://github.com/developing-today/code/issues/13306) impl(deploy): the release verb — tag cutting, attestation, and the untagged-release refusal (#11177 implementation) | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#13404](https://github.com/developing-today/code/issues/13404) Self-hosted Desktop Commander MCP endpoint: Worker front door, Access gate, laptop bridge | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#13506](https://github.com/developing-today/code/issues/13506) Rename sensitivity ladder identifiers in code to canonical public/internal/private/sensitive (aliases/migration, not a blind swap) | adjacent | status:in-review | Unchecked | See issue | Track in owning program. | | [#13497](https://github.com/developing-today/code/issues/13497) Roadmap: files for fleet and atlas, and the platform makes roadmap changes itself | adjacent | — | Unchecked | See issue | Track in owning program. | | [#13481](https://github.com/developing-today/code/issues/13481) mcpx: full-suite health on main blocks #8465 close condition (conformance/daemon/defaults/e2e/execsvc/sdnotify) | app | — | None recorded | [Read](https://github.com/developing-today/code/issues/13481#issuecomment-7109479480) | Track in owning program. | | [#13459](https://github.com/developing-today/code/issues/13459) impl(backups): mesh leg — laptop-local DBs → Turso backup homes (inventory + appropriateness line) | adjacent | — | Unchecked | See issue | Track in owning program. | | [#13337](https://github.com/developing-today/code/issues/13337) fleet-build runner: vitest worker SIGSEGV on pkgs/id/web screen-codec.test.ts (pre-existing on main) | adjacent | status:in-review, status/triaged | Unchecked | See issue | Track in owning program. | ## New or cross-program search matches | Issue | Scope | Status labels | Native blocked by | Latest comment | Next action | | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------- | ----------------- | -------------- | ------------------------------------------------------------------------------------------------- | | [#13577](https://github.com/developing-today/code/issues/13577) mcpx: separate decision audit metadata from retained feedback payloads | new filing | — | Unchecked | None | Triage the documented synthetic acceptance oracle and check current claims before implementation. | | [#13575](https://github.com/developing-today/code/issues/13575) mcpx: reconcile hot embeddings.wasmPath updates with the active embedder and cached vectors | new filing | — | Unchecked | None | Triage the documented synthetic acceptance oracle and check current claims before implementation. | | [#13573](https://github.com/developing-today/code/issues/13573) mcpx: match semantic feedback to exact tool identities across call and proxy paths | new filing | — | Unchecked | None | Triage the documented synthetic acceptance oracle and check current claims before implementation. | ## Refresh Run the linked searches with per_page=100, follow every page, reject incomplete results, and deduplicate by issue ID. Walk native sub-issues under #1900, #8993 and #8625. Refresh each owned issue’s dependencies/blocked_by endpoint and newest comments. Imported issue bodies can refer to the old dezren39/nix numbering. Reconcile those through migration records before assigning a dependency. --- # High-level roadmap This chapter is mcpx's section of the whole-project priority list: the merged census of record for the Code Book programme. The full merged list, ordered across the whole project, lives in the [Code Book](https://developing-today.github.io/code/code/); the programme is tracked on [#13905](https://github.com/developing-today/code/issues/13905). The ordering logic is stated once there and summarised here: execution substrate first (nothing else lands without a trustworthy queue, build capacity, and transport), then the physical substrate, then the data substrate, then search intelligence, then the ID platform build-out, then the gateway, PM and fork surfaces, then the record itself. Within a tier, dependency order wins; ties break on leverage. One item is mcpx's own and is given in full below. The remaining mcpx-assigned items belong primarily to another book; they appear as one-line entries at the end, each linking to the primary book's high-level roadmap chapter. This book previously carried its programme in its trackers rather than in a roadmap chapter; the [MCPX research and implementation plan](program/overview.html.md) carries the implementation order and acceptance conditions, and the [MCPX issue map](program/issue-map.html.md) carries membership, dependencies, status and evidence issue by issue. This chapter cross-references both rather than duplicating them. Statuses are as of the 2026-11-23 census unless a later read is named. Timing is taken from the census record: where the record has no timing, this chapter says so rather than projecting a date. ## 25. mcpx completion — supervisor, session resume, config tail, embedding surface - **Type:** problem. - **Description:** Finish the MCP gateway: a supervisor owning every stdio child's pipes for its whole life (replacing the takeover handoff), cold-restart session resume completed, the settings effect-probe exemption tail burned to zero, and the embedding/API surfaces (Go API, C ABI, WASM, mcpx as its own upstream) decided. - **Status:** in flight, close on several fronts. The daemon, roughly 50 commands and 252 settings are live; this book is the largest in the project (84 chapters, roughly 288k words) and is the Pages root. Atlas→mcpx integration is live: the laptop's mcpx carries the `atlas` remote server. The supervisor design ([#1384](https://github.com/developing-today/code/issues/1384)) and Phase 3 supervised stdio by default ([#9963](https://github.com/developing-today/code/issues/9963)) have merged PRs, with the acceptance check owned by [#13264](https://github.com/developing-today/code/issues/13264); the issue map records that PR #11343 made supervision opt-in and that the default change still requires verifying distinct sockets and children for two instances of the same configured name across a restart. Session resume ([#1414](https://github.com/developing-today/code/issues/1414)) has phases 1–2 landed; the Phase 3 DELETE question is open. OAuth for remote servers ([#1950](https://github.com/developing-today/code/issues/1950)) landed 2026-11-23 (PR #12869). - **The exemption tail, with its counting rule stated:** the programme census counted exactly 8 settings — 5 unheld/unclaimed, and 3 flag-held (`plugin.instructions`, `plugin.disabledTools` via [#8472](https://github.com/developing-today/code/issues/8472); `protoTasks.cancelGrace` via [#8473](https://github.com/developing-today/code/issues/8473)). This book's own pinned inventory tells the later story: at `d24c19c6e065` all 241 published setting paths matched 236 named-probe rows and five exemptions, as recorded in [Effect probes and test venues](program/settings.html.md) and the [MCPX research and implementation plan](program/overview.html.md). The two counts use different snapshots — the census counted the flag-held settings in the tail, the pinned inventory counts exemptions remaining after probes landed on November 23 — and the tail's direction is the same in both: shrinking to zero. - **Most related:** [#13264 mcpx programme tracker](https://github.com/developing-today/code/issues/13264) · [#1900 backlog super-tracker](https://github.com/developing-today/code/issues/1900) · [#1384 supervisor design](https://github.com/developing-today/code/issues/1384) · [#9963 Phase 3: supervised stdio by default](https://github.com/developing-today/code/issues/9963) · [#1414 session-resume design](https://github.com/developing-today/code/issues/1414) · [#1877 embedding mcpx](https://github.com/developing-today/code/issues/1877) · [#1950 OAuth for remote servers](https://github.com/developing-today/code/issues/1950) · [#1940 code-mode interop](https://github.com/developing-today/code/issues/1940) · fleet-MCP design-mill passes #10389/#10390/#10393/#10405 (all open at census). - **Timing:** the exemption-tail shrink log is dated per setting (2026-11-17 → 2026-11-23, the #8467–#8474 chains); 11 sibling plugin exemptions cleared 2026-11-23. [#1950](https://github.com/developing-today/code/issues/1950) OAuth landed 2026-11-23 (PR #12869). The programme tracker [#13264](https://github.com/developing-today/code/issues/13264) was filed 2026-11-23T12:39Z. No completion date in record; nothing has missed against one — the tail is reprioritised by gates, not dates: the three flag-held exemptions move only under their item-specific approvals, and the supervisor default waits on the restart verification named in the [MCPX issue map](program/issue-map.html.md). - **Ordering rationale:** mcpx is the tool gateway every agent already uses daily, so its reliability items outrank its expansion items; it sits in Tier 5 of the merged list because Tiers 0–4 are its dependencies, not its dependents. ## Cross-linked items — primary in another book Each entry is one line: the item as this book consumes it, linking to the primary book's high-level roadmap chapter, where the item is given in full. - **12. Atlas↔ID integration — search runs across the core system** — the MCP surface both sides share runs through mcpx. [Atlas high-level roadmap](https://developing-today.github.io/code/atlas/design/high-level-roadmap.html) - **14. Atlas as a multi-client search service** — per-client ceilings are enforced here, and the `atlas` server is live in mcpx today. [Atlas high-level roadmap](https://developing-today.github.io/code/atlas/design/high-level-roadmap.html) - **22. Dynamic Android platform and the shells programme** — harness adapters are the agent-side shells of the same contract. [ID high-level roadmap](https://developing-today.github.io/code/id/design/high-level-roadmap.html) - **27. OpenCode / OpenChamber forks programme** — the mcpx opencode plugin v2 ([#1858](https://github.com/developing-today/code/issues/1858), remainder [#2841](https://github.com/developing-today/code/issues/2841) blocked) and the harness adapters are mcpx's stake. Primary in the PM book; programme coordination on [#13905](https://github.com/developing-today/code/issues/13905), PM-BOOK tracker [#13900](https://github.com/developing-today/code/issues/13900). - **28. Fleet secrets, CA and quota plane** — per-client ceilings are the mcpx-facing design question of the quota plane. [Fleet high-level roadmap](https://developing-today.github.io/code/fleet/development/high-level-roadmap.html) - **29. Design-register burn-down (AUDIT-7)** — the mcpx families are the [#1384](https://github.com/developing-today/code/issues/1384)/[#9963](https://github.com/developing-today/code/issues/9963) acceptance line above. Primary in the PM book as the cross-project register; audit umbrella [#13871](https://github.com/developing-today/code/issues/13871). - **30. The books and Spaces themselves** — this chapter is the mcpx book's deliverable under the Code Book programme, [#13905](https://github.com/developing-today/code/issues/13905); this book is the Pages root the other books join. The merged list lives in the [Code Book](https://developing-today.github.io/code/code/). --- # Research and incidental findings ``` created: 2026-11-01T01:30:00-05:00 last-updated: 2026-11-14T07:00:00-06:00 increment: 2 status: draft tags: area:docs, area:compendium, topic:research description: what was learned while building mcpx, and while doing anything else in this repository, collected by topic and tagged with its provenance so it is not lost in session transcripts. First slice of #1871: the section outline, the seed findings that already exist in the repository, and the harvesting process. Second slice: the standalone Nix section and the Containers and CI harvest, with the placement answer recorded in the Nix section. ``` Status: draft This chapter is the compendium's research chapter (#1871). It holds research and incidental findings — things learned while building mcpx, and while doing anything else in this repository — filed by topic so they survive the sessions that produced them. Findings that live inside feature entries stay there as the source of truth; this chapter excerpts them with a citation (the answer to open question 5 on #1871, applied: excerpt, never copy-and-fork). Every finding here carries a provenance tag, per the quality bar below: - **measured** — a number or behaviour produced by running something, with the environment named in the source. - **read-from-source** — read in code, docs, or a specification in this repository. - **reported** — someone else's claim, cited: an external article, another project's documentation, or a statement in an issue. Reported findings are not verified here and must not read like measurements. Sections with no seed yet are outline only: the heading exists so the next harvest has somewhere to put things, and says so rather than padding. ## AI and LLMs - **The cost model of zero-context discovery.** Listing servers costs ~171 tokens, a search ~61, and `types` 675–4,402 per namespace — the numbers behind progressive discovery: a client should not pay for every tool definition up front. _(measured — `docs/story.md`, "Zero-context discovery")_ - **Switch to progressive discovery at 1–5% of the context window**, and do not mutate the `tools` array mid-conversation: it invalidates the provider's prompt cache. _(reported — modelcontextprotocol.io, MCP client best practices, as cited on #1871)_ - **Models write code better than they call tools**, Cloudflare argues, because tool-call tokens are synthetic training data while code is what models were trained on. This is the argument behind Code Mode. _(reported — blog.cloudflare.com/code-mode, as cited on #1871)_ ## Harnesses - **What is opencode's and what is general.** `docs/opencode-plugin.md` separates the opencode plugin surface (v1 vs v2) from the parts that apply to any harness; `OPENCODE-V2.md` corrects the record where the first draft blurred them — opencode v1 ships code mode behind `OPENCODE_EXPERIMENTAL_CODE_MODE`. _(read-from-source — `docs/opencode-plugin.md`, `OPENCODE-V2.md`)_ - **The harness knows what the agent does not.** Session state, statistics, and affordances live in the harness; an agent that assumes them instead of asking gets them wrong. The opencode session statistics are the worked example. _(read-from-source — `docs/story.md`, "The harness knows what the agent does not" and "Statistics from opencode")_ - **`AGENTS.md` is the cross-harness instruction file**: the same file is read by the harnesses this repository is used from, which is why fleet rules live there and not in one tool's config. _(read-from-source — `AGENTS.md` at the repository root and in `pkgs/mcpx`)_ - **A harness-free core is a design constraint, not an accident** (#48): codex, claude code, pi, and manus must all be able to drive the same core. _(read-from-source — `docs/story.md`; issue #48)_ ## Plugins Since: unreleased - **A plugin can connect without the binary.** The connection ladder and `GET /v1/resolve` let the opencode plugin find or start a daemon instead of assuming one is installed (#44, fixed in #53). _(read-from-source — `docs/plugin-discovery.md`)_ - **The plugin logs over the socket** (#36), so plugin diagnostics land where the daemon's do instead of in a file nobody opens. _(read-from-source — `docs/plugin-discovery.md`; issue #36)_ - **Plugin install is a README, not a package step.** _(read-from-source — `plugin/opencode/README.md`)_ ## Token providers The outline assumes both readings of the term (open question 1 on #1871): model providers, and the credential/OAuth providers that hand out tokens. - **Model providers are maintained as patches.** This repository patches opencode for provider behaviour (Copilot business support, Copilot compaction, OpenAI response-id caching) and keeps skills for maintaining those patches across opencode updates. _(read-from-source — #1871 seed list. Harvest note, 2026-11-01: the three patch files the issue names are no longer at the repository root on `main`; the patches' current home needs naming here by whoever next touches the opencode patch set.)_ - **Credential placeholders keep secrets out of config files and descriptions, but stdio servers receive them through the environment. Generated scripts inherit that environment unless variables are unset or the run uses `-i`; do not treat this as isolation from code you execute. _(read-from-source — `docs/story.md`, "Credentials"; `internal/runner/dispatch.go:693–705`)_ ## Cloudflare - **Code Mode mechanics.** The Worker Loader API runs generated code in isolates; `fetch()`/`connect()` throw inside it; bindings hide API keys from the generated code. Shared with #153 — the design treatment lives with the design, this is the finding. _(read-from-source — `docs/story.md`; issue #153)_ ## The TypeScript ecosystem - **Node runs TypeScript by stripping types, and only erasable syntax survives.** Node v24.20.0 type stripping rejects a file with an `enum`; constructor parameter properties failed too, which is why the generated client uses plain fields. _(read-from-source — `ASSESSMENT.md` bug 3; `docs/story.md`, "Runtime portability")_ - **Runtime detection order is deno, then bun, then node** (`script.runtime`, `--runtime`, `MCPX_SCRIPT_RUNTIME`). Versions at the time of the seed: Deno 2.9.6, Bun 1.3.11. _(read-from-source — `docs/story.md`, "Runtime portability"; the runtime comparison itself belongs to #101 and `docs/runtimes.md`)_ - **`--typecheck` is `deno check`, Deno only**: ~80 ms on repeat, ~400 ms for a new program (#79). _(measured — as recorded on #1871; `docs/story.md`)_ - **Constructing a TypeScript compiler per request was lootbox's memory problem** — the `ts-morph` lesson behind the current design. _(read-from-source — `ASSESSMENT.md`)_ ## SSE - **Server-sent events, not WebSockets.** SSE is plain HTTP, `EventSource` reconnects on its own, and WebSocket upgrades are mishandled by middleboxes — the reasoning behind mcpx's remote transport. _(read-from-source — `docs/story.md`, "Server-sent events, not WebSockets")_ - **Lossless reconnection** is a protocol property, not a client hope: the stream carries what a reconnecting client needs to resume without a gap. _(read-from-source — `docs/story.md`, "Lossless reconnection")_ ## Sockets and TCP - **What each transport costs.** Spawning `mcpx status` took 23.12 ms; a unix-socket keep-alive round trip 0.17 ms (135× cheaper); TCP loopback keep-alive 0.65 ms. The daemon-and-socket design is priced by these numbers. _(measured — `docs/story.md`, "What each transport costs")_ - **macOS `sun_path` is 104 bytes.** Deep state directories produced socket paths that failed with `bind: invalid argument`. _(read-from-source — `ASSESSMENT.md` bug 4)_ - **`localhost` is not `127.0.0.1`.** It resolved to IPv6 only while the compiled build bound `127.0.0.1`, so the client dialled an address nothing listened on. _(read-from-source — `ASSESSMENT.md`)_ ## RPC and WebSockets - **JSON-RPC framing needs no dependency** — it is standard library, which is why it appears in the dependency audit as a deliberate non-dependency. _(read-from-source — `docs/dependencies.md`)_ - **Lootbox's WebSocket.** The predecessor system used a WebSocket RPC channel (`lootbox.config.json`: `serverUrl: ws://127.0.0.1:9420/ws`) — the contrast case for the SSE choice above. _(read-from-source — #1871 seed list)_ ## MCP Since: unreleased - **Two protocol eras.** The protocol has a before and an after, and a client has to speak to both; "What 2026-07-28 actually asks of a client" is the checklist. _(read-from-source — `docs/story.md`, "Two protocol eras")_ - **The revision matrix** — every revision in both directions, plus what is still missing — lives in `docs/protocol.md` and is excerpted, not copied, here. _(read-from-source — `docs/protocol.md`)_ - **The sampling bug: it did not work, and nothing said so.** Capabilities are declared in the handshake, but the handler was installed after it, and every test called the passthrough directly — so sampling was advertised, broken, and green in CI at the same time. _(read-from-source — `docs/story.md`, "Sampling")_ - **The elicitation bug came first** — the same shape, earlier. _(read-from-source — `docs/story.md`, "Elicitation"; `docs/elicitation.md`)_ - **`mcpx doctor` found a bug immediately** — a diagnostics command earns its keep the first time it runs against a real installation. _(read-from-source — `docs/story.md`, "mcpx doctor")_ - **Remote servers without a shim**: Streamable HTTP makes `mcp-remote` unnecessary for remote servers. _(read-from-source — `docs/story.md`, "Remote servers without a shim")_ - **Which registry.** The official registry publishes an OpenAPI spec; HAPI is not open source and returns 404. Registry choice is a licensing and availability decision before it is a technical one. _(read-from-source — `docs/story.md`, "Which registry")_ ## OpenAPI and REST - **Specifications as tools: two things easy to get wrong.** A relative server URL must resolve against the document's location, and only read methods are exposed by default. _(read-from-source — `docs/story.md`, "Specifications as tools")_ - **The specification described the wrong thing**: the first spec described mcpx's own ten tools, not the hundreds it fronts. _(read-from-source — `docs/story.md`, "Specifications as tools")_ - **One ops table generates the routes, the MCP tools, and the OpenAPI document** (`internal/api/ops*.go`), so the three cannot drift apart. _(read-from-source — `internal/api/`)_ ## OAuth - **OAuth for remote servers is `status: proposed`**, not built; the credential story that exists today is in "Credentials". _(read-from-source — `docs/story.md`, "OAuth for remote servers" and "Credentials")_ ## Command line - **Command-line programs as servers**: a CLI with a daemon behind it is a server with a command-line client, and should be designed like one. _(read-from-source — `docs/story.md`, "Command-line programs as servers")_ - **Derived flag names surprise people**: `daemon.leaseTTL` becomes `--daemon-lease-ttl`. _(read-from-source — `docs/cli.md:142–146`)_ - **Accepted-and-ignored flags are bugs**, even when accepting them is deliberate-looking (#74, fixed by #75). _(read-from-source — issues #74, #75)_ - **Help coverage once drifted from the dispatch table** (historical): `man`, `completion`, `serve`, `openapi`, `adapter`, `registry`, and `api` were once dispatched by `cmd/mcpx/main.go` but undeclared in `internal/cli/manual.go`, so help, the man page, and completions did not list them. All seven are declared now, and `TestEveryDispatchedCommandIsDeclared` holds the declaration and the dispatch table equal in both directions, so the gap cannot reopen silently. _(read-from-source — `docs/cli.md`, “once dispatched but undeclared”; `internal/cli/manual.go`)_ ## Containers and CI - **Static Go builds: `CGO_ENABLED=0` is a behaviour change on Linux, and nearly free.** `os/user` and `net` pull in libc only under cgo; with cgo off, pure-Go `os/user` reads `/etc/passwd` instead of NSS and the pure-Go resolver ignores `nsswitch.conf`. The measured cost was nothing: a fully static linux binary within ~100 bytes of the cgo build (14 811 298 against 14 811 401) that still runs `exec`, verified `not a dynamic executable` under `ldd`. The policy that came out of it (#1987): the artifacts that ship as a bare binary ship static, and `package.nix` sets `env.CGO_ENABLED = "0"`. On macOS, since Go 1.20, `net` and `os/user` use the system libraries without cgo, so the flag changes nothing there. _(measured — `docs/container.md` section 4)_ - **Where image size goes: `git` outweighs the runtime.** In the retired Debian prototype (historical measurements, linux/arm64, not the current Nix image), `debian:bookworm-slim` plus `git` with `--no-install-recommends` cost a 105 MB apt layer — more than bun at 79.4 MB — because Debian's `git` depends on perl outright. Dropping git took the image from 413 MB to 288 MB of disk usage. _(measured — `docs/container.md` section 5)_ - **`actions/setup-go` in a monorepo needs `cache-dependency-path`.** Without it, setup-go looks for `go.sum` at the repository root, logs "Restore cache failed: Dependencies file is not found" on every run, and never restores a cache. Every setup-go step in the mcpx workflow now passes `cache-dependency-path: pkgs/mcpx/go.sum`, with the reason in the comment above it. _(read-from-source — `.github/workflows/mcpx.yml` setup-go steps; fixed in #182)_ - **Test daemons must be stopped the way they record themselves.** Plain `stop` recomputes the socket path from the environment, which a long state path moves elsewhere, so e2e daemons once survived for hours (#52). The fix stops daemons through the info files they write (`stop --all` builds its client from the daemon's own record), and the e2e harness sets a short idle exit as a backstop for anything that escapes cleanup entirely. _(read-from-source — `internal/cli/client.go`; `internal/cli/stopall_test.go`; `internal/e2e/e2e_test.go`; #52, harvested in #182)_ ## Nix This section is standalone by design: it does not need to mention the project the book belongs to, and most entries below do not. **Placement, recorded so the question does not reopen:** this section lives in this book (open question 2 on #1871, answered). The note that commissioned the chapter scoped it that way — the compendium "can have an entire section on nix that is a hundred pages and doesnt mention mcpx at all" — and the seeds are this repository's Nix findings, harvested alongside the Containers and CI seeds they were recorded with. If a repository-wide book ever exists, this book links to it then; there is no pre-emptive split. **Go on Nix.** - **`vendorHash` repair is a workflow job, because the bot cannot do it.** Renovate can bump `go.mod` but cannot compute the vendored-tree hash, so every Go dependency bump used to break the Nix build and merge silently. The workflow's `vendorhash-repair` job runs only on bot branches: it blanks `vendorHash` in `package.nix`, reads the `got: sha256-...` line from the failed build, commits the repaired hash back to the bot branch, and fails the PR if the build still does not pass. A human changing dependencies deliberately gets no repair — they see the failure and fix it themselves. _(read-from-source — `.github/workflows/mcpx.yml`, `vendorhash-repair` job)_ - **The sandbox test list is computed now, not listed.** The seed form of this finding was an explicit package list in `package.nix`: `subPackages = [ "cmd/mcpx" ]` confines `go test` to a package with no tests, so `checkPhase` listed the internal packages by hand and a new package was untested in the sandbox until someone added it. The current form inverts the default: `checkPhase` computes every package with test files, minus a `checkExclude` list whose every entry needs a comment saying why it cannot run in the sandbox, with `internal/buildcheck` enforcing both halves. The lesson survives the inversion: a Nix sandbox runs only the tests the derivation says it runs, so say it in a way a new package cannot silently fall out of. _(read-from-source — `package.nix`, `checkPhase` and the comment above it; seed form on #1871)_ - **Pure-Go SQLite keeps the derivation free of a C toolchain.** `modernc.org/sqlite` is a pure-Go translation of SQLite rather than a binding; the usual cgo driver would require a C toolchain in the derivation, break cross-compilation (no Linux binary from a Mac), and fail `CGO_ENABLED=0` builds outright. _(read-from-source — `docs/dependencies.md`, "Why this driver"; `package.nix` comment at the dependency)_ **Wrapping and generated artefacts.** - **`wrapProgram --suffix PATH`, so behaviour does not depend on the calling shell.** The installed binary is wrapped with git, deno, `bun-bin` and nodejs appended to PATH. Git is the load-bearing one: the `repo` and `worktree` scopes degrade to `cwd` — silently weaker — when git is missing, so the wrapper makes its presence a property of the package, not of the caller's environment. _(read-from-source — `package.nix`, `postInstall`; `docs/dependencies.md`, "External programs")_ - **The man page and shell completions are generated by the just-built binary in `postInstall`** — the man page, the Markdown reference tree, and the bash/zsh/fish completions all come from the binary's own declarations at install time. "A man page maintained separately is wrong within two releases" is the reason recorded in the source. _(read-from-source — `package.nix`, `postInstall`)_ **Beyond one package: this repository.** - **One flake carries the whole estate.** This repository's `flake.nix` is a nix-darwin + NixOS + home-manager flake: the nix-darwin input, `machines/`, `nixos/`, `modules/`, `home/`, and a `pkgs/` tree of custom packages (dozens, from `bun-bin`-style runtime pins to whole tools) all build from the one flake. A finding about "the Nix setup" here is a finding about that monorepo flake, not about any single package in it. _(read-from-source — `flake.nix`; `pkgs/`)_ - **Homebrew is the flake's macOS escape hatch, recorded as a seed.** The seed names the nix-darwin Homebrew layer — brews, casks and `masApps` for what Nix does not package — as part of this section's territory. Harvest note, 2026-11-14: no Homebrew declaration was found in `home/`, `machines/`, `modules/` or `nixos/` on current `main`, so the layer's current home needs naming here by whoever next touches the darwin configuration; the seed stands as recorded. _(reported — #1871 seed list)_ - **Patching a fork from the flake, and keeping the patches alive.** This flake does not patch its opencode input with loose patch files: the `opencode` flake input is the maintained fork (`developing-today-forks/opencode`), the openchamber input follows the same opencode so there is one opencode source in the whole module chain, and the `flake-inputs-update` workflow bumps, validates and merges those inputs daily. The patch-maintenance skills the seed names (`update-opencode`, `fix-opencode-patches`) belong to that fork-and-update workflow; the three root-level patch files an earlier harvest named are no longer on `main` (see Token providers above). _(read-from-source — `flake.nix`, opencode input; `.github/workflows/flake-inputs-update.yml`; seed on #1871)_ - **Renovate on a flake: delegate what a workflow owns.** Renovate runs against this repository, but its `renovate.json` disables the nix manager for the opencode and openchamber flake inputs, because the dedicated `flake-inputs-update` workflow owns them. Two bots racing the same pin produce broken bumps; one owner per input is the rule the config records. _(read-from-source — `renovate.json`)_ - **The justfile is the human entry point.** The repository root `justfile` imports `root.just` and per-package recipe modules (`mod id 'pkgs/id/justfile'`), so the commands a person runs day to day are just recipes over the flake, not memorised `nix` invocations. _(read-from-source — `justfile` at the repository root)_ **macOS findings.** - **The temp-dir sweep eats worktrees, silently.** The per-user temp directory `/var/folders/.../T/` is swept by the OS; a sweep destroyed ~3,000 tracked files across several active worktrees in a single session, while `git status` kept reporting a clean tree from a stale fsmonitor index. Worktrees belong on durable storage, never under `/var` — the "pre-approved" temp path is a permission, not a durability promise. _(read-from-source — `doc/platform/worktrees.md`; seed on #1871)_ - **Platform-only tests cut both ways.** Two tests once passed only on macOS (#35, as recorded on #1871). The current tree carries the inverse in the open: the Nix `checkPhase` names twenty Linux-only takeover/handoff tests that the darwin run skips by name, because they exercise `/proc` and systemd mechanics darwin does not have. A named skip list with the reason attached is how a platform-only test stays a fact instead of becoming a surprise. _(reported — #1871 seed list, #35; read-from-source — `package.nix`, `darwinSkip`)_ ## Harvesting: how findings get here Approach C from #1871, in force for this chapter: 1. **Intake.** Anything learned that is not about the change at hand — a verified surprise, a measured cost, a behaviour read in someone else's source — is filed as an issue (or a comment with a link) under the `research` label, not buried in a session transcript or a PR body. A finding stays an issue until it is written up here, so nothing is lost in between. `docs/ideas.md` states the same discipline for design questions: an answer that only exists in a conversation is lost. 2. **Entry format.** A finding written up here is an excerpt plus a citation, in the entry style the runbook uses (created / last-updated / status / tags / sources / checked), with the finding-specific statuses `verified`, `measured`, `read-in-source`, `reported`, `hearsay`, and `superseded`. The tags in this file's key block are the chapter's; a finding's own topics go in its section placement and its citation. 3. **Harvest.** A per-release step moves labelled items into this chapter as entries and closes the issues with a link to the section that took them. Excerpt, do not move: a finding inside a feature entry keeps that entry as its source of truth and is cited from here. 4. **Supersede, never silently edit.** When a finding turns out wrong, it is struck through or marked `superseded` with a link to what replaced it. The history is the audit trail (#150). ## Quality bar for an entry From #1871, applied to every seed above: - **Sources.** Every claim has at least one: a file with a section or line, a commit, an issue, or an external URL with the date it was read. - **Measurements.** A measurement carries its environment (machine, OS, runtime and tool versions) and the command that produced it — re-run the command, paste the result. - **Provenance.** Say how it is known: reproduced, read in source, read in docs, or someone said so. Never let hearsay read like a measurement. - **Dates.** Every entry is dated; a re-check updates the date. The seed harvest above was checked against `main` on 2026-11-01. - **Standalone.** Where possible an entry is readable without mcpx context. That is the point of the Nix section. --- # Script runtimes, permission profiles and presets `mcpx run` and `mcpx exec` hand the generated program to a JavaScript runtime. This page covers which runtime runs it, what it is allowed to do, and how to bundle mcpx's own flags under a name. Every setting named here is in [configuration.md](configuration.html.md) with its flag and variable. ## Choosing a runtime `script.runtime` (`--runtime`, `MCPX_SCRIPT_RUNTIME`) is one of: | Value | Meaning | | -------------------------------- | -------------------------------------------------------------------------------------------------------- | | `auto` (default) | the first entry of `script.runtimeOrder` that is installed **and** can enforce the permissions asked for | | `deno`, `bun`, `node` | that binary on `PATH` | | a name under `script.runtimes` | the declared binary, with the declared kind | | a path or another name on `PATH` | accepted when its basename, without an executable extension, is `deno`, `bun` or `node` | Binaries are resolved with Go's `exec.LookPath`, so `PATHEXT` is honoured on Windows and nothing assumes `.exe`. A name that resolves to something that is not a JavaScript runtime is refused, saying so: ``` mcpx: bash resolves to /bin/bash, which is not a known JavaScript runtime; declare it under script.runtimes with a kind (deno, bun, node) ``` ### Declaring runtimes ```json { "script": { "runtimes": { "mydeno": { "kind": "deno", "bin": "/opt/deno/bin/deno", "args": ["--unstable-kv"] }, "node22": { "kind": "node", "bin": "node22" } }, "runtimeOrder": ["mydeno", "bun", "node"] } } ``` `kind` decides how the command line is built; `bin` is a path or a name looked up on `PATH` (default: the declared name); `args` are runtime options placed after mcpx's own fixed options and before the permission flags: | Kind | argv | | ---- | --------------------------------------------------------------------------------- | | deno | `run --quiet --no-check