diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/2026-11-23T23-51-36Z_research_mcpx-investigation.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/2026-11-23T23-51-36Z_research_mcpx-investigation.md new file mode 100644 index 000000000..25d3315b6 --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/2026-11-23T23-51-36Z_research_mcpx-investigation.md @@ -0,0 +1,16 @@ +# mcpx investigation — research corpus + +The research corpus behind the mcpx programme investigation (#13264), gathered 2026-11-23: the state of mcpx, its designs and issue landscape — plus the mcpx door build notes (mcpx-door-20261123/) from the same day's door work (#13657). + +## Provenance + +Migrated 2026-11-23 from hatch-personal (`workspace/`) under the DOCS-MIGRATION programme (#5983): code-project research and design material lives in this repo's `doc/` area; the hatch repos keep only hatch-operational material. This is a dated research record — it states what was known when the research was done and is not rewritten later. + +## Contents + +- `mcpx-door-20261123/EXECUTOR-BRIEF.md` +- `mcpx-door-20261123/README.md` +- `mcpx-program-investigation-prompt.md` +- `research-mcpx-designs.md` +- `research-mcpx-issues.md` +- `research-mcpx-state.md` diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/EXECUTOR-BRIEF.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/EXECUTOR-BRIEF.md new file mode 100644 index 000000000..90f3efbfe --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/EXECUTOR-BRIEF.md @@ -0,0 +1,76 @@ +# mcpx Worker (W1, #13657) — continuation brief + +## State already reached (verified from tool read-backs, 2026-11-23 ~13:50 CST) + +- Laptop primary clone `~/git/code` was on `main`, CLEAN at fetch time + (the dirt named in the original brief — modified + `doc/fleet-schedule-registry.md`, untracked `pkgs/id/examples/` — + was NOT present; nothing was touched/stashed/committed by this lane). +- Worktree created: `~/git/code-mcpx-door-20261123`, branch + `lane-mcpx-door-20261123`, off `origin/main` @ `0a6ca03ccca` + (Merge PR #13538). +- Copied into the worktree (unadapted, byte copies): + `pkgs/desktop-commander/worker/.` → `pkgs/mcpx/worker/` + (node_modules excluded; 18 files incl. package-lock.json), and the + three workflows → `.github/workflows/mcpx-worker-{publish,promote,tests}.yml`. + +## Why this lane stopped + +The `git worktree add` exec result tripped a platform execution-risk +flag on the checkout content. Per the task rule, the operation was +retried via the Desktop Commander endpoint +(`https://commander.security.cab/mcp`, bearer by name +`desktop-commander.machine-bearer` via `fleet secrets get`, in-memory +only): attempt 1 got Cloudflare error 1010 (browser signature banned, +Python UA); attempt 2 (browser UA) got a connection closed without +response. DC route from the sandbox is therefore not working this +session. Remaining build steps must run in a venue that does not trip +the flag — Drew's standing route: a laptop-local OpenCode session +working in the worktree in-session, evidence recorded on #13657, +Archer/parent finishes (merge) via `gh` from the record. + +## Remaining steps for the executor (in the laptop worktree) + +1. Get `adapt.py`, `filter.ts`, `README.md` from the sandbox workspace + `~/workspace/mcpx-door-20261123/` to the laptop (they are + hand-authored lane assets, not repo content). +2. Run `python3 adapt.py` from `~/git/code-mcpx-door-20261123` + (it performs all Commander→mcpx swaps, the index.ts bare-path + + selector restructure, writes `src/filter.ts`, appends the + bare-path/selector tests to `test/proxy.test.ts`, fixes the + package-lock name, and asserts the final config/AUD/KV/scope + values). Then copy the companion `README.md` over + `pkgs/mcpx/worker/README.md` (adapt.py deliberately excludes it). +3. Sanity greps: no `desktop-commander` left outside README's + historical mention; workflows reference `MCPX_WORKER_*`, + environment `mcpx-production`, concurrency `mcpx-worker-lifecycle`, + artifact `mcpx-worker-upload--`, tag prefix + `mcpx-`. +4. In `pkgs/mcpx/worker`: `npm ci --no-audit --no-fund`, `npm test`, + `npm run typecheck` — all green before PR. (Node v24.21.0 / npm + 11.19.0 verified present on the laptop.) +5. Commit (only `pkgs/mcpx/worker/**` + the three workflow files), + push `lane-mcpx-door-20261123`, open PR: description covers the + door, the adaptations, bare-path equivalence, the filtering seam; + "Part of #13657" — NO closing keywords (#13657 stays open until + live verification). Re-read PR comments immediately before merging; + merge once green. +6. Filtering enforcement: DO NOT invent semantics. `src/filter.ts` + ships architecture-only (selector `ns` parsed once in the router, + `DEFAULT_FILTER_PROFILE = "conservative"`, pass-through + `filterMcpResponse`). The enforcement spec arrives as a follow-up + from the parent; if it lands before the PR merges, implement it in + `filter.ts` + tests in the same PR. + +## Key adaptation values (already encoded in adapt.py) + +- Worker `mcpx`, package `mcpx-worker`, routes `["mcpx.security.cab"]`, + workersDev false, compatibilityDate `2025-09-15` (unchanged). +- ISSUER `https://mcpx.security.cab`, RESOURCE + `https://mcpx.security.cab/mcp`, SCOPE `mcpx`, OWNER_EMAIL unchanged. +- BRIDGE_BASE `https://mcpx-link.security.cab`, ACCESS_TEAM_DOMAIN + `snowy-sun-58a9.cloudflareaccess.com` (unchanged), ACCESS_AUD + `b34b9764fb317774bf5c0ff0ac9cbd8a2ab80ed346d06f08d74967011bac640e`, + KV OAUTH_KV id `11eb93dc9fa24087ae57b12483dc6172`. +- devDeps unchanged: cf 1.0.0-beta.20, wrangler 4.152.0, + @cloudflare/workers-types ^5.20261019.1. diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/README.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/README.md new file mode 100644 index 000000000..e4d9e96ad --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-door-20261123/README.md @@ -0,0 +1,124 @@ +# mcpx Worker — public MCP endpoint (#13657) + +The public front door for mcpx at `mcpx.security.cab`, mirroring the +proven desktop-commander Worker build (#13404). Hosted MCP clients +(Claude, ChatGPT) and the owner's own tooling reach the laptop's mcpx +daemon through this Worker; nothing else on the laptop is exposed. + +## Path of a request + +``` +AI client + -> POST https://mcpx.security.cab/mcp (bare https://mcpx.security.cab/ is identical) + Guarded by this Worker's OAuth 2.1 authorization server + (src/oauth.ts). Hosted clients connect from their own servers + and cannot pass a Cloudflare Access login, so /mcp takes a + Bearer token instead — or the machine bearer for the owner's + own tooling. + -> this Worker (src/index.ts): checks the Bearer, computes the + filter selector (src/filter.ts), then proxies the streamable-HTTP + MCP request, swapping the caller's credentials for its own + bridge egress token. + -> https://mcpx-link.security.cab/mcp + Access app "mcpx link (bridge)": service-token-only policy. + -> sandbox-link Cloudflare Tunnel -> http://localhost:8932 on amd + -> the mcpx bridge proxy on 127.0.0.1:8932 + -> the mcpx daemon's /mcp endpoint, discovered via the daemon's + state descriptor +``` + +`workers_dev` is off; `mcpx.security.cab` (a Worker route) is the +only public door. + +## Origin lockdown + +The mcpx daemon listens on loopback only and is unauthenticated — +it trusts its only caller, the local bridge proxy. This door is the +security boundary: it exposes `/mcp` (and its bare-path twin `/`) +only, behind OAuth/machine-bearer auth. The daemon's `/v1/*` API is +never proxied and has no public path. + +## OAuth front door (src/oauth.ts) + +Standard MCP authorization shape, so Claude and ChatGPT can connect: + +- `GET /.well-known/oauth-protected-resource` (and `.../mcp`) and + `GET /.well-known/oauth-authorization-server` — public discovery. +- `POST /register` — dynamic client registration (RFC 7591); public + clients only (`token_endpoint_auth_method: "none"`), redirect URIs + must be https or loopback http. Clients live in the `OAUTH_KV` + namespace under `client:`. +- `GET /authorize` — the approval page, and the ONE path still behind + Cloudflare Access: the "mcpx" Access app is scoped to + `mcpx.security.cab/authorize` with the owner-email policy only + (Google SSO identity). The Worker also verifies the Access JWT + itself (RS256 against the team JWKS, audience, owner email) before + rendering. Approving issues a single-use code (10 min, PKCE S256 + bound) via the form's POST back to `/authorize`. +- `POST /token` — authorization-code exchange (PKCE verified, code + consumed on any attempt) issuing an opaque access token (1 h) and + a rotating refresh token (30 d). Codes and tokens are stored in KV + under their SHA-256 (`code:`, `at:`, `rt:`), + never in the clear. Revoke a client by deleting its `at:`/`rt:` + entries (and its `client:` record) from the namespace. +- `/mcp` (and `/`) without a valid Bearer returns 401 with + `WWW-Authenticate: Bearer resource_metadata="https://mcpx.security.cab/.well-known/oauth-protected-resource"`, + which is what sends hosted clients into the OAuth flow. + +## Filtering (src/filter.ts) + +Architecture in place; enforcement spec pending on #13657. + +- A per-request selector is parsed from the `ns` query parameter in + exactly one place (`resolveFilterSelector` in src/filter.ts), + computed by the router and passed to the proxy/filter layer. +- No selector means the named conservative default profile + (`DEFAULT_FILTER_PROFILE = "conservative"`). +- `ns` is consumed by this door and stripped before proxying; all + other query parameters pass through untouched. +- Until the enforcement spec lands, `filterMcpResponse` is a + pass-through: the selector is threaded end to end so enforcement + can be added in src/filter.ts without touching the router. + +## Secrets — by name only, never values + +| Where | Name | +| --- | --- | +| fleet secrets (Bitwarden) | `cloudflare.access.mcpx-link-client-id` / `-client-secret` — bridge-door token the Worker presents | +| fleet secrets (Bitwarden) | `cloudflare.api-token-mcpx-worker` — scoped deploy token | +| fleet secrets (Bitwarden) | `mcpx.machine-bearer` — the /mcp machine bearer | +| fleet secrets (Bitwarden) | `cloudflare.tunnel.sandbox-link-token` — the sandbox-link tunnel the bridge door rides | +| GitHub environment `mcpx-production` | `MCPX_WORKER_CF_TOKEN` (same deploy 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 | + +## Deploys — cf version deployments via GitHub Actions + +Modeled on the desktop-commander / id-mail publisher-promoter pair: + +1. **Publish** (`mcpx-worker-publish.yml`, manual dispatch on main, + `confirm_upload`): tests, a credential-free dry run, then + `upload-version.mjs` runs `cf workers versions create` with the + Worker secrets file. Uploading changes no traffic. The run emits + a provenance artifact (`mcpx-worker-upload--`) + naming the exact version, tag (`mcpx--run--attempt-`), + and baseline. +2. **Promote** (`mcpx-worker-promote.yml`, manual dispatch with the + publish run id + attempt, `confirm_promotion`): + `verify-upload-run.mjs` vouches the run was a successful manual + publish on main, then `promote.mjs` checks the live deployment + still matches the manifest baseline (or already serves exactly + this version — an idempotent no-op) and creates a deployment with + exactly that version at 100%. + +Tests (`mcpx-worker-tests.yml`) run on pushes and PRs touching this +directory. + +## Client setup + +- Hosted clients (Claude, ChatGPT): add the custom connector + `https://mcpx.security.cab/mcp`; the client registers itself and + sends the owner through the Access sign-in + approval page on + first connection. +- Header-capable clients (Claude Code, Cursor, other mcpx clients): + send `Authorization: Bearer ` (fleet secrets: + `mcpx.machine-bearer`). diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-program-investigation-prompt.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-program-investigation-prompt.md new file mode 100644 index 000000000..1e0bb3d31 --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/mcpx-program-investigation-prompt.md @@ -0,0 +1,253 @@ +# MCPX Program — Full Investigation, Next-Steps Design & Build-Out Prompt + +**You are the coordinator of a program-scale investigation and build-out of mcpx** — Drew's +MCP aggregation and proxy daemon in `developing-today/code` (`pkgs/mcpx/`), the single gateway +through which every agent on the fleet reaches every MCP server. Dig into the **full system**: +what it aggregates, how the daemon lives and dies, how its 252 settings behave, who consumes it +(harnesses, fleet, Atlas, ID), and what it should become. This prompt is a **starting point, not +a conclusive or final stopping point**. Work the design end to end, begin implementation +wherever you are unblocked, and when a pass finishes, review what remains, expand the plan, and +repeat — until nothing more can be done with the access and authority you have. Use subtasks and +orchestration heavily: launch many parallel agents (analyze, research, design, document, +implement) and keep them pointed at the frontier. A phase finishing is a signal to start the +next one, not to stop and ask. + +--- + +## 1. What mcpx is (ground truth — verify, don't re-derive) + +mcpx is a Go daemon + CLI (version 0.1.0) that owns every MCP server process on a machine and +exposes them to agents through one surface, so no harness ever loads every tool schema into +context. The agent loop is `mcpx ls` → `mcpx search` → `mcpx types ` → +`mcpx run` / `mcpx exec` (TypeScript scripts on deno/bun/node with namespaces preloaded). +One canonical source in `pkgs/mcpx/` (the dedup shipped; [#8822](https://github.com/developing-today/code/issues/8822) +is its tracking home). Programme homes: epic [#8993](https://github.com/developing-today/code/issues/8993) +(one canonical MCP gateway and server parity), maintenance epic +[#12459](https://github.com/developing-today/code/issues/12459), and the super tracker +[#1900](https://github.com/developing-today/code/issues/1900) (every theme, in one order, with +the disagreements between them). + +- **Surface**: ~50 CLI commands in five groups (running code, finding tools, the daemon, + configuration, inspection) — including `exec`, `catalog` (token-budgeted tool listing), + `search` (keyword or semantic), `types`, `prompt` (words in, script back), `proxy` + (an OpenAI-compatible LLM reverse proxy), `serve` (MCP over stdio), `stdio-proxy` (daemon + API over an ssh tunnel), `settings`, `servers`, `registry`, `dashboard`. Public Go API at + `pkg/client`; ~60 internal packages (`daemon`, `settings`, `catalog`, `policy`, `elicit`, + `mcpauth`, `mcpclient`, `mcpserver`, `model`, `tasks`, …). +- **Daemon lifecycle**: transports are local socket/systemd, ssh, and **tsnet** (the daemon + as a tailnet node). Upgrades use a **takeover handoff** — the successor starts as the old + daemon's child and receives stdio children's pipes over a unix socket; streamable HTTP + upstream sessions survive, SSE sessions do not. Cold restarts resume streamable HTTP + sessions from `upstream-sessions.json` (#1414 phases 1–2 landed; phase 3 open). The + self-described stopgap replacement is a **supervisor that owns each stdio child's pipes + for its whole life** — design [#1384](https://github.com/developing-today/code/issues/1384), + Phase 3 [#9963](https://github.com/developing-today/code/issues/9963). When no daemon runs, + the CLI starts one inline and polls readiness on the `daemon.inlineStartPoll` interval. +- **Config system**: a typed settings registry — **252 distinct setting paths**, each + reachable via config file, environment, and `mcpx settings`, with resolved-value + provenance. The registry carries an **effect-probe contract**: every setting has a named + e2e probe proving it changes behaviour, or a written exemption; the exemption count is + ratcheted (`EffectExemptionPin`) and can only shrink, only in the PR that adds the + replacing probe. **The exemption tail is exactly 8 settings** (verified 2026-11-23): + `daemon.inlineStartPoll`, `daemon.tsnet.hostname`, `daemon.tsnetUpTimeout`, + `http.streamBufferInit`, `embeddings.wasmPath` (unheld — they wait on harness shapes: + a controllable tailnet, a timing-observable inline-start harness, an allocation oracle, + an in-tree embed-exporting wasm fixture) and `plugin.instructions`, `plugin.disabledTools`, + `protoTasks.cancelGrace` (**flag-held** — Drew's item-specific approvals; the last is + #8473's final exemption). Coverage burn-downs: #8465, #8469 (blocked), #8471 (parked), + #8472, #8473. +- **The book exists and is the Pages root**: `pkgs/mcpx/docs/` (mdBook, `.#mcpx-docs`, + siteUrl argument) — 84 SUMMARY chapters, 120 markdown files, ~288k words including the + package-local archives (`decisions/`, `changes/`, `compare/`, `spec/`). It deploys via + `.github/workflows/mcpx-docs.yml` as the **whole repo Pages site** at + https://developing-today.github.io/code/ — the fleet book already joins under `/fleet/`, + atlas and id books join the same deploy. mcpx design records live in the book tree, + **not** the repo-root `doc/` archive (0 mcpx entries there). No mechanical + book-vs-binary coverage proof has ever been run — the audit is yours to build. +- **Deployment**: Nix modules in `pkgs/mcpx/modules/` are consumed **through the + openchamber flake** (`inputs.openchamber.nixosModules.mcpx` etc.); `services.openchamber.enable` + cascades to opencode + mcpx (2026-11-04 consolidation). The laptop runs + `services.mcpx` with settings in `home/common/mcpx-settings.nix`; the live + `~/.config/mcpx/config.json` (beside its `config.json.pre-cascade-20261103` fossil) + aggregates many servers: chrome-devtools, cloudrun, codebase-memory, codedb, + codex-connectors, deepwiki, desktop-commander, antigravity, and more. +- **Integrations, verified**: **Atlas is a live remote server in the laptop's mcpx** — + server `"atlas"` → `https://atlas-search.developing-today.workers.dev/mcp` (#8625; the + wiring landed under Drew's 2026-11-22 order; the remainder is cross-client acceptance). + **ID's MCP bridge + `mcp_policy::PolicySession`** landed on the ID side (#7916, #7917 + closed) — MCP behind a capability layer. **fleet ↔ mcpx is design-stage**: design-mill + passes #10389 / #10390 / #10393 / #10405 are open and unlanded. The opencode plugin is + the deep harness integration (v2 rewrite #1858, SET-REMAINDER #2841 blocked; harness-free + plugin core #1861). Server parity (GitHub/Atlassian/Datadog logins, #8809) is **Drew-gated**. +- **Census** (Search API, 2026-11-23): **21 open `app/mcpx`** (374 all-state), **45 open + `epic/mcpx-platform`** (110 all-state), 92 open issues mentioning mcpx anywhere. + 18 open mcpx-mentioning issues carry `status/blocked`. Blocker heads: the exemption + tail (§above), #1858 → #2841, #2686 + #10330 (test venues), #9900 → #1881 (release + channels), #8017 (github failover), #3016 (nightly stress), #12738 (deploy wedge in + the mcpx check phase), #13225 (Pages staging). +- **Embeddings inside mcpx**: the daemon has its own embeddings subsystem for semantic + tool search (`internal/catalog/embeddings.go`) — a wazero Wasm embedder + (`embeddings.wasmPath`) and remote OpenAI-compatible endpoints. This is tool-discovery + search, a different index from Atlas's corpus search; the boundary is un-drawn. + +## 2. Drew's directions (the next-steps agenda — design all of it, build what's unblocked) + +### A. Server onboarding and lifecycle +Make adding a server a designed, boring path end to end: declaration shapes (stdio +command, remote URL, adapter-wrapped CLI #11147/`adapters.allowBare` + cwd, OpenAPI-derived +`api` servers, plugins, registry finds), credential resolution (in-memory `mcpx secrets`, +env, per-server env), health/probe semantics, restart and reload without disturbing +unchanged servers, and removal with session cleanup. Finish the supervisor design +(#1384 → #9963): one lifecycle design that unifies takeover, cold-restart resume +(#1414 phase 3), and supervised stdio — a daemon upgrade should become a plain restart +of a front end whose children never notice. Cover multi-daemon machines (`mcpx daemons`) +and the systemd/socket-activation posture. + +### B. Per-client policy and capability ceilings +mcpx is where every client's reach is actually decided, but today policy is scattered +(rate limits and elicitation in `proto.*`, write policy, autonomy levels). Design **one +per-client policy model**: client identity (harness, seat, session), a capability +ceiling per client (which namespaces, which tools, read/write posture, rate and budget), +and enforcement inside the daemon so every transport inherits it. Tie the ladder to the +fleet's existing disciplines instead of inventing a third one: **Atlas's sensitivity +ceilings** (public < internal < private < sensitive, enforced server-side per +client identity) and **ID's capability discipline** (attenuable, revocable, audited — +the `PolicySession` shape). Open questions to design, not assume: how a ceiling is +declared (settings, config, per-server manifest), how elicitation binds user identity +(#7843, #1957), annotation trust, and what the audit record of a refused call looks like. +#12900 thread 2 (is Atlas headed for multi-client use?) is Drew's decision — design the +ceiling model so it survives either answer; don't pre-build multi-tenancy. + +### C. Remote and hosted servers as versioned deployments +The Atlas server is the template: a hosted MCP server shipped as a versioned Cloudflare +deployment and wired into mcpx by URL. Generalize it: how a remote server is declared, +versioned, health-checked, and rolled back from the mcpx side; OAuth authorization for +remote servers **and for mcpx's own /mcp** (#1950, 61 conformance rows); session resume +across deploys; what `mcpx registry` should promise about a hosted server's provenance. +Close the release-channel gap on mcpx itself (#9900 → #1881): the install channels the +docs promise must be channels that exist. + +### D. Config-system completion — burn the exemption tail to zero +The ratchet only moves one way; finish it. For each of the 8 exempt settings, design +the probe (or, where a setting is a pure allocation hint like `http.streamBufferInit`, +the contract decision that reclassifies it honestly — an exemption with a permanent +reason is a design smell, not a resting place): a harness-controlled tailnet for the +two `daemon.tsnet.*` settings and `daemon.tsnetUpTimeout`'s bring-up budget; a +timing-observable inline-start harness for `daemon.inlineStartPoll`; a small +embed-exporting **wasm fixture model in-tree** for `embeddings.wasmPath` (which also +unblocks real testing of the Wasm embedder). The three flag-held settings +(`plugin.instructions`, `plugin.disabledTools`, `protoTasks.cancelGrace`) get their +probe designs prepared and recorded — implementation waits for Drew's word, exactly +like the 11 sibling plugin.* probes that landed 2026-11-23 under #8472. In parallel: +the remaining burn-downs (#8465 CLI running group, #8469, #8471) and the test-venue +blockers (#2686, #10330) that decide how much of this CI can see. + +### E. Daemon lifecycle, transports, and reach +Beyond §A's supervisor: tsnet as a first-class reach (a daemon on the tailnet, +reachable from any seat — the `stdio-proxy`/ssh pattern generalized), inline-start +semantics, stream buffering as a designed contract (#4375: one bounded response-read +contract for all outbound calls — the `http.streamBufferInit/Max` pair is one +instance), dashboard and observability of the daemon itself, and the upgrade path's +failure shapes. Every bound in the daemon should be a setting with a probe (§D) — +no magic numbers with a comment. + +### F. Observability and the event record +mcpx already keeps events, logs, stats, and feedback (`mcpx feedback`, the event +store, logstore). Design the coherent observability story: one event record for +every tool call (client, ceiling decision, latency, bytes, refusal reason), stats +that answer "which servers/tools does the fleet actually use", feedback wired to +something that consumes it, and the dashboard as the live view of the same record — +not three partial systems. This is also the audit substrate §B's policy model needs. + +### G. Library and embedding use +mcpx's parts should be usable without the daemon: the public Go API (`pkg/client` +today), the C ABI / WASM / mcpx-as-its-own-upstream programme (#1877), the +harness-free plugin core with per-harness adapters (#1861), and embedding the +catalog/settings/policy packages as libraries in fleet and ID. Define the versioned +library surface (what is public, what is internal, what stability is promised), +with embedding examples taken from real call sites. + +### H. The integration surface: mcpx ↔ fleet ↔ Atlas ↔ ID +- **fleet**: land the design-mill line (#10389 one fleet surface, #10390 pass-through + subcommands + endpoint/credential resolution, #10393 MCP everywhere — namespaces, + fan-out, remote graph, #10405 transitive capability purity). `fleet` verbs should + reach MCP through mcpx, with mcpx's ceilings (§B) as the enforcement point. +- **Atlas**: close #8625's remainder (cross-client acceptance: OpenClaw / OpenCode / + OpenChamber / Muse lanes, identity-stamped, ceiling-enforced, audit-logged) and + draw the two-search boundary: mcpx's semantic tool discovery vs Atlas corpus + search, one mental model for an agent choosing between them. +- **ID**: design the interop the landed ID bridge now makes possible — ID as an + mcpx upstream (worlds/apps as namespaces), mcpx as the gateway through which ID + clients reach external MCP servers under ID's capability discipline, and code-mode + interop (#1940: nested code mode, `?codemode=false`, the `mcpx_exec` contract). +- **Harnesses**: the opencode v2 plugin remainder (#2841, behind #1858), and the + per-harness skills (`mcpx-{agy,codex,claude,opencode2}`) kept in lockstep with + the plugin core (#1861). + +### I. The model layer and the AI surface +Settle where the model comes from (#1891, #1925 — blocked): the provider layer mcpx +owns, model profiles, the `prompt` command's contract, the OpenAI-compatible +`proxy`, and life after MCP Sampling's deprecation. Include administration by intent +(#1931: finish the operation surface, then route a sentence to a declared operation), +the request repair ladder (#1927), and lifecycle hooks on exec (#1929) — these are +one AI-surface design, currently four issues. + +### J. Book extension, issue map, and the living record +1. **Extend the mcpx book** (it exists — do not rebuild it): first run the missing + **mechanical coverage audit** — every CLI command and flag, every one of the 252 + settings (with default + provenance + probe/exemption status), every transport, + every public library entry point, mapped to a chapter or a named gap; then write + the missing chapters (the §A–§I designs join as book chapters in `pkgs/mcpx/docs/`, + per mcpx's own convention), fix reverse gaps (chapters describing surfaces the + code no longer has — the ASSESSMENT corrections-header pattern), and keep the + zero-warning build + docs-twins gates green. The book's deployment chapter must + absorb the new reality: its deploy now carries the fleet, atlas, and id books + under subpaths (#13225's staging fix is part of this workstream's surface). + Extend the docs-sync contract the way fleet's DOC-01 works: a surface change + (command, flag, setting, transport) updates its chapter in the same change. +2. **An issue-by-issue map of ALL mcpx issues** — every open `app/mcpx` and + `epic/mcpx-platform` issue (and the mcpx-adjacent #8625/#8993/#1900 families), + prioritized in best working order, **with all blockers marked both on the issues + themselves and in the priority list** (book chapter + tracking issue kept + current). Blockers are worked, not just listed. +3. **Designs + PRs** — every workstream produces landed designs (mcpx product + designs in the book tree; programme records in the repo `doc/` archive) and, + wherever unblocked, merged implementation PRs. + +## 3. How to work (fleet rules — binding) + +- GitHub via the **gh CLI / REST only** (the GitHub connector is banned). File a GitHub + issue in the owning repo the same pass for any problem found. +- Execution on the **laptop** (primaries stay on main + clean; worktrees on branches, + landed by PR). Never `git stash` in shared clones. Never force-push main. +- Before implementing any issue: premise check + singular-ownership check (a claim + comment from another agent is a hard stop). Re-read an issue's newest comments + immediately before merging. +- Builds/tests dispatch-first (`fleet queue dispatch`), laptop fallback; a container + environment failure is not a test result — record which route verified. Tests name + their oracle. Note the standing trap: the fleet-build container cannot run some + mcpx suites (the #13159 family) and `nix build .#deploy` wedges in the mcpx check + phase (#12738) — route around them and record the route. +- Evidence standard: every factual claim carries its checked source or is labelled + unverified; counts computed from a named source, never estimated in prose. +- **Respect standing holds**: flag-held items are not yours to implement without + Drew's item-specific word — for mcpx that is #8472's `plugin.disabledTools` + + `plugin.instructions` remainders and #8473's `protoTasks.cancelGrace`. Investigate + and design around them; prepare their probes; never land them. Decisions that are + Drew's (#8809 server logins, #8810's OS/call-method/auth answers, #1943's CNAME + "apply it", #12900 thread 2) get surfaced with substance — options, ramifications, + recommendation — never silently decided and never re-asked once recorded. +- Secrets by name only, never values. mcpx's own secrets handling is in-memory only; + keep it that way in every design. Never touch the `vertexinc` org. External + communications need per-item pre-approval. Quota doctrine: plan quotas only, + never funds; a 402 is a wall. + +## 4. The iteration rule + +This prompt is the **starting point**. When every workstream has reported, do not +conclude: re-survey (issues, settings registry, book coverage, consumers, the live +daemon's server set), reconcile what the passes learned, expand the design set and +the issue map, and run the next pass. The program ends only when a full pass finds +nothing more that can be designed, documented, or implemented with the authority +available — and even then, the book, the issue map, the exemption ratchet at zero, +and the docs-sync contract remain as the living record the next pass starts from. diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-designs.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-designs.md new file mode 100644 index 000000000..d59cfdc24 --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-designs.md @@ -0,0 +1,137 @@ +# mcpx — existing designs, docs & the design backlog (research, 2026-11-23) + +Sources: laptop checkout `~/git/code` at `4cfceaa8` (2026-11-23), `pkgs/mcpx/docs/` +tree + SUMMARY, `pkgs/mcpx/{ASSESSMENT,TODO,OPENCODE-V2}.md`, GitHub REST issue +reads. Issue numbers are developing-today/code unless prefixed otherwise. + +## 1. Where mcpx designs live (three homes, no single register) + +1. **The book tree** (`pkgs/mcpx/docs/`) — the public record: 84 SUMMARY chapters, + plus package-local archives `decisions/` (8 files), `changes/` (8), + `compare/` (12), `spec/` (13), `audit/` (3), `testing/` (3). Design-shaped + chapters already in the book: `elicitation.md` (a design), `proposals.md`, + `ideas.md`, `parity.md`, `protocol.md` (every revision, both directions), + `compendium.md` (structure + mapping), `declared-but-unread.md` and + `in-name-only.md` (self-audits of settings that are declared but never read / + named but not real — the book audits the code, unusually). +2. **Package working docs** — `ASSESSMENT.md` (the lootbox replacement audit, + with a 2026-10-30 corrections header — claims aged against the code are + corrected in place), `TODO.md` (the supervisor design + session-resume state, + written as prose, not issues), `OPENCODE-V2.md`, `TESTING.md`, `AGENTS.md` + (the agent-facing contract), `agentdocs.go` + `agents-docs/`. +3. **GitHub issues** — the tracker family (#1884–#1987, filed as one design + pass) and the design-mill passes (#10389–#10405). There is **no mcpx charter + doc** and no single design register; #1900 (the super tracker, §3) is the + closest thing and it is an ordering, not a register. + +Contrast: the ID program has no charter either, but ID designs funnel into the +repo-root `doc/` archive (~2,900 paths). mcpx has **0** entries there — its +archive is the book tree. Any program-level design series must respect that +split: program records land in `doc/` per fleet convention; mcpx product +designs belong in `pkgs/mcpx/docs/` where the book renders them. + +## 2. The tracker family (one design pass, still the backlog's spine) + +Filed as a set (source/creator), each a theme with its own sub-designs: + +- #1884 TTL renewal — one convention (touch-on-read), not a renew endpoint per resource +- #1885 extensibility — plugins, hooks, tool sources, embedding (tracker) +- #1887 surfaces — reaching the daemon over ssh and the browser, keeping what you reached +- #1888 the book — overview, manual, compendium (tracker) +- #1889 runtimes, languages, dependencies +- #1890 docs site platform — generator, Pages, subdomain, agent markdown +- #1891 the AI layer and search — where a model comes from, everything that would use one +- #1892 comprehensive docs + testing strategy +- #1894 docs level 1 — the 30-second layer +- #1900 **the backlog build-out** — every theme, in one order, with the disagreements + between them (super tracker) +- #1905 testing: integration tests for every feature, across environments +- #1911 how the JS runtime is chosen; TypeScript handling; automatic validate/compile +- #1915 resolve a script's import graph statically; prepare missing dependencies (in-review) +- #1925 where the model comes from — a provider layer mcpx owns, model profiles, + life after MCP Sampling's deprecation (**blocked**) +- #1927 checking, refusing, repairing a request — a graded ladder from diagnostics + to rewrite-and-run +- #1929 lifecycle hooks on exec — prePrompt/postPrompt/onError as one declared list +- #1931 administration by intent — finish the operation surface, then route a + sentence to a declared operation +- #1940 mcpx × opencode code mode — nested code mode, `?codemode=false`, `mcpx_exec` +- #1950 OAuth authorization for remote servers and for /mcp (61 conformance rows; in-review) +- #1957 smaller conformance gaps — user identity, annotation trust, rate limits, + cursors, URI encoding, prompt validation, restart, invalidation +- #1983 testing environments as CI matrix entries; #1985 CI workflow skeleton; + #1987 extended platforms (static artifacts; alpine/scratch/distroless/flatpak/Fedora/Windows) +- #4375 design: read it bounded — one response-read contract for outbound calls +- #7843 conformance: user-identity — how elicitation state binds identity (or refuses to) +- #8242 evaluate in-house deterministic simulation (Antithesis declined) +- #8465/#8469/#8471/#8472/#8473 the settings/CLI coverage burn-downs (see state file §5) +- #8822 dedup (shipped; tracking home), #8809 server-parity logins (Drew-gated) +- #9963 Phase 3 of #1384 (supervised stdio by default), #11147 two unbuilt #1962 + considerations (adapters.allowBare gate — also #13118; cwd parameter for bare tools) +- #10330 CI venue for three scripts suites; #10471 CI over budget (rolling); + #2686 nix-sandbox checkPhase exclusions; #3016 nightly stress failure (blocked) + +## 3. The design-mill passes (fleet-level, mcpx as a component) + +- #10389 one fleet surface for OpenCode, OpenChamber, ID, and mcpx (priority/high) +- #10390 pass 1: fleet subcommands for the four tools — pass-through, endpoint + + credential resolution +- #10393 pass 4: MCP everywhere — fleet MCP via mcpx, namespaces, fan-out, remote graph +- #10394 pass 5: embedding research — ID and mcpx inside fleet +- #10405 supplement: middle-road fleet MCP, ID graph publication, transitive + capability purity + +These are the fleet↔mcpx integration designs; none has landed as of 2026-11-23 +(all open, `status/triaged`). + +## 4. Book coverage vs the actual surface (gap analysis, to be proven mechanically) + +Knowns: ~50 CLI commands (binary `--help`), 252 settings paths, 8 effect +exemptions, ~60 internal packages, one public Go package (`pkg/client`), the +/v1 HTTP API (book has `http-api.md`), the MCP protocol surface (`protocol.md`), +transports socket/systemd + ssh + tsnet. + +Suspected gaps (hypotheses for the survey pass, labelled unverified): +- The book predates parts of the settings ratchet: whether the configuration + chapter enumerates all 252 settings with defaults + provenance, or a subset, + is unmeasured. The docs-twins check inside `.#mcpx-docs` gates twin currency + for *some* surfaces only. +- The exemption tail (§5 of the state file) — the book's `declared-but-unread.md` + covers declared-but-unread settings; whether the 8 effect exemptions are + documented as a set anywhere public is unmeasured. +- Post-book features: tsnet transport, the takeover handoff, session resume + (#1414 phases), the Atlas remote server pattern, multi-daemon (`mcpx daemons`), + the OpenAI-compatible `proxy` — each needs a chapter-presence check. +- Reverse gap: book chapters describing surfaces the code no longer has + (ASSESSMENT.md's corrections header is the pattern for how this repo handles + aged claims; the book itself has no equivalent sweep on record). + +## 5. Standing design tensions the investigation must engage + +1. **Supervisor vs takeover** (#1384/#9963, TODO.md): the takeover handoff is a + self-described stopgap; SSE sessions can't move. The supervisor design is + the daemon-lifecycle centrepiece. +2. **Session state across restarts** (#1414): Phases 1–2 landed; Phase 3 + (graceful-shutdown DELETE) open. Cold restart, takeover, and supervisor + designs interact — they are one lifecycle design, currently three documents. +3. **Identity & conformance** (#1957, #7843, #1950): elicitation state binding + identity, annotation trust, OAuth for remote servers and for /mcp itself. + This is where per-client policy lives today — prompts and rate limits + (proto.* settings), not a capability-ceiling model. +4. **The model layer** (#1891, #1925): mcpx owns a provider layer + profiles; + MCP Sampling's deprecation forces the question. The `proxy` command and + `prompt` command both hang off this. +5. **Two searches**: mcpx's semantic tool search (embeddings subsystem, + `embeddings.wasmPath`, wazero) vs Atlas corpus search (served *through* + mcpx as the `atlas` remote server). Discovery-inside-mcpx vs corpus search + is an un-drawn boundary. +6. **Embedding mcpx itself** (#1877, #1885): public Go API (pkg/client exists), + C ABI, WASM, mcpx-as-its-own-upstream; the harness-free plugin core (#1861). + Library use is designed but not yet a documented, versioned surface. +7. **Release channels** (#1881 release.yaml + artifacts + install channels; + #9900 GHCR container channel never published — blocked): the docs promise + install paths the release pipeline only partly keeps. +8. **Docs platform** (#1890, #1943): the book is live at the repo Pages root; + the custom subdomain is Drew's pending word; the fleet/atlas/id books now + share mcpx's deploy — the book's own deployment chapter must absorb that + fact (it is no longer mcpx's site alone). diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-issues.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-issues.md new file mode 100644 index 000000000..5c3549c56 --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-issues.md @@ -0,0 +1,111 @@ +# mcpx — issue census, blocker chains & Drew-gated items (research, 2026-11-23) + +Source: GitHub Search API + REST reads against developing-today/code, 2026-11-23 +~06:35 CST. Counts are label-exact from the Search API `total_count`; the +programme's precise union (labels overlap) is the issue-map deliverable. + +## 1. Census headline + +| Slice | Open | All-state | +|---|---|---| +| `app/mcpx` | **21** | 374 | +| `epic/mcpx-platform` | **45** | 110 | +| `epic/mcpx` | 3 | — | +| `epic/mcpx-maintenance` | 1 (the epic itself, #12459) | — | +| `queue/blocked` ∩ `app/mcpx` | 4 | — | +| `status/blocked` ∩ text "mcpx" | 18 | — | +| Any open issue mentioning "mcpx" (title/body) | 92 | — | + +The two main labels overlap heavily (most `app/mcpx` issues also carry +`epic/mcpx-platform`); the tracker family (#1884–#1987) mostly carries only +`epic/mcpx-platform`. Programme homes: + +- **#8993** — epic: one canonical MCP gateway and server parity. Children by + label: #8822 (dedup — shipped, tracking home) + #8809 (server logins). + Both are natively parented under the design-register epic #8986 (one-parent + rule), so #8993 has 0 direct sub-issues by design, recorded on the epic. +- **#12459** — epic(mcpx): maintenance (parent: #8993). Recurring + implementation/reliability/docs/hygiene follow-ups live here. +- **#1900** — the backlog build-out super tracker: every theme, in one order, + with the disagreements between them. +- **#8822** — dedup shipped; remains open as the tracking home. + +## 2. The open `app/mcpx` set (21, complete) + +12459 (maintenance epic) · 11147 (two unbuilt #1962 considerations: +adapters.allowBare gate + cwd for bare tools; in-review; gate half also #13118) · +10471 (CI over budget, rolling) · 9963 (#1384 Phase 3: supervised stdio by +default) · 8473 / 8472 / 8471 / 8469 / 8465 (coverage burn-downs) · 7843 +(user-identity conformance design) · 4375 (bounded response-read contract +design) · 3016 (nightly stress failure; blocked) · 2841 (#1858 SET-REMAINDER; +blocked) · 2686 (e2e/settings suites vs nix sandbox; blocked) · 1987 / 1985 / +1983 (testing platforms / CI skeleton / environments) · 1957 (smaller +conformance gaps) · 1940 (code mode interop) · 1414 (session-resume design) · +1384 (supervisor design). + +The remaining ~24+ `epic/mcpx-platform`-only opens are the tracker family +(#1884–#1929), the docs trackers (#1888–#1894, #1943), embedding (#1877), +plugin core (#1861), v2 plugin (#1858), OAuth (#1950, in-review), model layer +(#1925, blocked), simulation (#8242), release channels (#1881, #9900 blocked), +failover (#8017, blocked), and the design-mill passes (#10389–#10405). + +## 3. Blocker chains (heads first) + +- **Config-system completion**: #8473 (proto family) → its last exemption is + `protoTasks.cancelGrace` — **flag-held**; #8472 (plugin family) → remainders + `plugin.instructions` + `plugin.disabledTools` — **flag-held** (the 11 sibling + plugin.* exemptions were cleared 2026-11-23 by JS-host e2e probes; these two + wait on Drew's word). The unheld five (`daemon.inlineStartPoll`, + `daemon.tsnet.hostname`, `daemon.tsnetUpTimeout`, `http.streamBufferInit`, + `embeddings.wasmPath`) have no chain — they wait on harness shapes, not issues. +- **Plugin line**: #1858 (opencode v2 plugin rewrite) → #2841 (SET-REMAINDER + items 1–5, blocked). #1861 (harness-free plugin core) is the parallel design. +- **Test-venue line**: #2686 (nix build sandbox can't run e2e/settings suites) + and #10330 (three scripts suites, no registry-named venue) gate how much of + the coverage programme CI can even see; #12738 (in-review: `nix build .#deploy` + wedges in the mcpx check phase) is the same family from the deploy side. +- **Release line**: #9900 (GHCR container channel never published — push denied + on the v0.1.0 run; publish path now dispatch-only; blocked) → #1881 + (release.yaml, artifacts, the install channels the docs promise). +- **Atlas line**: #8625 (Atlas MCP in mcpx — the wiring is LIVE on the laptop; + the remainder is cross-client acceptance, blocked) — its blockers live in the + Atlas programme (D1 chain etc.), not in mcpx. +- **Failover line**: #8017 (github failover: daemon call-path wiring + live + activation, follow-on to #7948; blocked). +- **CI health**: #3016 (nightly stress failure, blocked), #10471 (CI over + budget, rolling), #8866 (PR workflow runs cancelled en masse; one mcpx run + stuck queued; blocked, user/escalated). +- **Pages line**: #13225 (stage fleet docs into the writable Pages directory) — + the mcpx-docs deploy now carries the fleet book and will carry atlas/id; + staging correctness is mcpx-deploy maintenance. + +## 4. Waiting on Drew (decisions / gates — surface, never decide) + +- **#8809** — GitHub / Atlassian / Datadog MCP server logins (OAuth/PAT): + `user/escalated`, blocked. Epic #8993's parity half cannot finish without it. +- **#8810** — one-command local agent CLI via this VM's mcpx: needs Drew's + OS / call-method / auth answers. `user/escalated`, blocked. +- **#1943** — mcpx docs custom subdomain: the recorded pending decision is + Drew's "apply it" for the mcpx CNAME. +- **Flag holds touching mcpx** (Drew's item-specific approvals, recorded + 2026-11-23): #8472's `plugin.disabledTools` and `plugin.instructions` + remainders; #8473's `protoTasks.cancelGrace` (last exemption in #8473). + Investigation and design around these is free; implementation is not. +- **#12900 thread 2** (Atlas programme) — is Atlas headed for multi-client + use? The answer shapes mcpx's per-client ceiling design; it is Drew's call, + prepared as an options paper by the Atlas programme. + +## 5. Cross-programme dependencies + +- **Atlas**: #8625 (above); #6062/#9109 Part C (ID graph publication) reaches + mcpx when ID content becomes searchable — mcpx is the likely serving gateway. +- **ID**: #7916/#7917 (MCP bridge + PolicySession) closed 2026-11-23 — ID's + capability-first MCP posture is landed on the ID side; the interop design + (ID as mcpx upstream; mcpx as ID's gateway) is unfiled design space. +- **fleet**: design-mill #10389/#10390/#10393/#10405 (all open, triaged); + #13191 (queue repair verb) is fleet-side but its book chapter rides the + fleet book's DOC-01 rule — the same docs-sync pattern this programme extends + to mcpx. +- **OpenChamber cascade**: services.openchamber.enable → opencode + mcpx + (2026-11-04 consolidation) — mcpx's module surface is consumed via the + openchamber flake, so module changes have a cross-repo consumer. diff --git a/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-state.md b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-state.md new file mode 100644 index 000000000..f69d6a623 --- /dev/null +++ b/doc/2026-11-23T23-51-36Z_research_mcpx-investigation/research-mcpx-state.md @@ -0,0 +1,216 @@ +# mcpx — current state (research, 2026-11-23) + +All facts below are from first-hand reads on 2026-11-23: the laptop checkout +`~/git/code` at `4cfceaa8afc08cf2cea88b9d733a2ace14c8ad5a` (2026-11-23 06:31 CST) via +`~/tools/laptop-ssh.sh`, the installed binary's own `--help`, and GitHub REST reads. +Anything not verified is labelled as such. + +## 1. What mcpx is + +- A **Go daemon + CLI that aggregates every MCP server on the machine behind one + surface** (`pkgs/mcpx/` in developing-today/code; VERSION `0.1.0`). One canonical + source: the multi-copy dedup is done and tracked as shipped on + [#8822](https://github.com/developing-today/code/issues/8822) (open as tracking home). +- The model (from `pkgs/mcpx/README.md` and `pkgs/mcpx/AGENTS.md`, verified against the + binary): a local daemon owns every MCP server process; agents never load tool schemas + into context up front. The loop is `mcpx ls` → `mcpx search ` → + `mcpx types [.]` → `mcpx run ` / `mcpx exec ''`. + Scripts are TypeScript on a real runtime (deno, else bun, else node) with the full + runtime (filesystem, network, subprocesses); `log`, `emit`, `tools` and every + namespace are preloaded on `globalThis`. Named scripts live at `.mcpx/scripts/.ts` + searched upward, then `~/.config/mcpx/scripts/`. +- Lineage: built as the replacement for the lootbox fork (`pkgs/mcpx/ASSESSMENT.md`, + corrected 2026-10-30). mcpx now carries nine direct dependencies + (`docs/dependencies.md`). + +## 2. Code layout (pkgs/mcpx/) + +- Entry: `cmd/mcpx/main.go`; public Go API: `pkg/client` (the embedding surface — + see [#1877](https://github.com/developing-today/code/issues/1877), open: public Go API, + C ABI, WASM, mcpx as its own upstream). +- `internal/` (~60 packages): `adapter`, `api`, `artifacts`, `cache`, `catalog`, + `cli`, `config`, `conformance`, `daemon`, `dashboard`, `defaults`, `diagnose`, + `e2e`, `elicit`, `events`, `eventstore`, `execsvc`, `hooks`, `launcher`, `logging`, + `logstore`, `mcpauth`, `mcpclient`, `mcpheaders`, `mcpserver`, `mcpspec`, `model`, + `openapi`, `opencode`, `plugin`, `pluginsession`, `policy`, `pool`, `preflight`, + `probe`, `progspec`, `recipes`, `settings`, `tasks`, and more. +- Packaging: `package.nix`, `container-image.nix`, `real-servers.nix`, + `go-toolchain.nix`; Nix modules in `pkgs/mcpx/modules/` (`common.nix`, + `nixos.nix`, `home-manager.nix`, `darwin.nix`). +- Agent skill shims live in-repo: `.opencode/skills/mcpx-{agy,codex,claude,opencode2}` + and `.agents/skills/mcpx-*` — per-harness adapters over the same daemon. + +## 3. CLI surface (installed binary, `mcpx --help`, 2026-11-23) + +~50 commands in five groups: + +- **Running code**: `embeddings`, `exec`, `feedback`, `prompt` (words in, script back), + `proxy` (OpenAI-compatible LLM reverse proxy), `recipes`, `run`, `scripts`, `skills`. +- **Finding tools**: `batch`, `call`, `catalog` (token-budgeted), `client` (generated + TS client), `ls`, `openapi`, `prompts`, `resources`, `schema`, `search` (keyword or + semantic), `types`. +- **The daemon**: `cache`, `daemon [--detached]`, `daemons` (multi-daemon per machine), + `refresh`, `reload`, `restart`, `serve` (MCP over stdio for a spawning host), + `status`, `stdio-proxy` (daemon API over stdin/stdout, for ssh tunnels), `stop`, + `supervise` (internal), `upgrade` (in-place handover to a new binary). +- **Configuration**: `adapter` (CLI programs declared as tools), `api` (OpenAPI + services as tools), `completion`, `config`, `help`, `init`, `man`, `plugin`, + `registry` (find + add public-registry servers), `secrets` (in-memory only), + `servers` (add/remove without restart), `settings` (read/change any setting, + from anywhere). +- **Inspection**: `dashboard` (live web dashboard), plus doctor/diagnose/stats/elicit + surfaces referenced across the settings registry and issues (the help output was + read to the dashboard line; the inspection tail was not fully captured — verify + in the survey pass). + +## 4. Daemon lifecycle & transports + +- Transports (`internal/daemon/`): local (unix socket / systemd — + `transport_systemd_linux.go`), `transport_ssh.go`, `transport_tsnet.go` + (tsnet: the daemon as a tailnet node). Client side mirrors this: + `internal/cli/client.go` builds a tsnet dialer (`daemon.NewTSNetDialer`). +- **Takeover handoff** (today): `mcpx upgrade` / `daemon --takeover` — the old daemon + starts its successor as its own child (stays in the service cgroup) and passes + stdio children's pipes over a unix socket. Streamable HTTP upstream sessions + survive; SSE upstream sessions do not (closed + re-initialised on first call). + `pkgs/mcpx/TODO.md` names the replacement: **a supervisor that owns each stdio + child's pipes for the child's whole life** — design issue + [#1384](https://github.com/developing-today/code/issues/1384), Phase 3 + [#9963](https://github.com/developing-today/code/issues/9963) (supervised stdio by + default + lifecycle hygiene). +- **Cold-restart session resume**: legacy streamable HTTP upstream sessions resume + from `upstream-sessions.json` (#1415 Phase 1, #1416 Phase 2 landed; design + [#1414](https://github.com/developing-today/code/issues/1414); the Phase 3 + graceful-shutdown DELETE question remains open). +- Inline start: when no daemon is running, the CLI starts one inline and polls for + readiness — the poll interval is the `daemon.inlineStartPoll` setting, read at + `internal/cli/connect.go:305`. Sibling bounds (`daemon.inlineStartTimeout`, + `autostart.pollInterval`, takeover/socket-probe timeouts) all have effect probes; + the poll interval itself does not (see §5). +- Stream scanning: CLI/exec read daemon responses through a stream scanner sized by + `http.streamBufferInit` / `http.streamBufferMax` (`internal/cli/streamscan.go`, + `opcmd.go:555`, `client.go:1283`, `exec.go:302`); #11308 fixed the + init > max line case. + +## 5. The config system and the exemption tail + +- Settings are a typed registry (`internal/settings/`, ~45 files: `registry.go`, + `wire.go`, `defaults` in `internal/defaults/defaults.go`). **252 distinct setting + paths** are declared (`Path:` literals, counted 2026-11-23). Every setting is + reachable via config file, environment, and `mcpx settings`, with a resolved-value + provenance view (`mcpx config`). +- **Effect-probe contract** (`internal/settings/effect.go`): every setting must have + either an **effect probe** (a named e2e test proving the setting changes behaviour — + `EffectProbes`, 220+ entries) or a **written exemption** (`EffectExemptions`). + `CheckEffectCoverage` fails the build on any gap, on a probe+exemption duplicate, + or on an exemption without a reason. The exemption count is ratcheted by + `EffectExemptionPin` — **it can only shrink, and only in the PR that adds the + replacing probe**. The pin's comment is a dated shrink log (#8467–#8474 chains, + 2026-11-17 → 2026-11-23). +- **The exemption tail is exactly 8 settings** (pin = 8, verified 2026-11-23): + | Setting | Written reason (abridged) | Probe shape it needs | + |---|---|---| + | `daemon.inlineStartPoll` | lifecycle/timing: a bound/interval the isolated harness cannot vary deterministically | a harness that can observe inline-start readiness timing | + | `daemon.tsnet.hostname` | lifecycle/binding: a network identity the harness cannot vary | a tailnet the harness controls | + | `daemon.tsnetUpTimeout` | tsnet bring-up needs a tailnet the harness does not have | same | + | `http.streamBufferInit` | allocation-capacity hint only; allocation size is not a stable e2e behaviour oracle | an allocation-observing oracle, or a contract decision that the hint is probe-exempt by kind | + | `embeddings.wasmPath` | needs a compiled wasm model fixture the harness does not provide; no embed-exporting model ships with the repo | a small embed-exporting wasm fixture model in-tree | + | `plugin.instructions` | read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host | JS-host e2e probes (the #8472 pattern that cleared 11 sibling plugin.* exemptions on 2026-11-23) | + | `plugin.disabledTools` | same | same | + | `protoTasks.cancelGrace` | task-store cancellation timing; covered by internal/tasks store tests, not a settings with/without probe | a settings-level cancel-timing probe | + The last three are **flag-held** (Drew's item-specific approvals, recorded + 2026-11-23): #8472's `plugin.disabledTools` + `plugin.instructions` remainders and + #8473's `protoTasks.cancelGrace` (the last exemption in #8473 — landing it empties + that issue's list). The first five are unheld and unclaimed. +- Coverage burn-down tracking homes (open): #8465 (CLI commands, running group), + #8469 (settings http-transport family, blocked), #8471 (settings model-ai family, + parked), #8472 (settings plugin family, in-review), #8473 (settings proto family). + Also open: #2686 (e2e/settings suites cannot run in the nix build sandbox — + checkPhase exclusions), #10330 (three scripts suites have no registry-named CI venue). + +## 6. The book (exists — the Pages root) + +- Sources: `pkgs/mcpx/docs/` — mdBook (`pkgs/mcpx/book.toml`, src = `docs`, + `create-missing = false`), built by `pkgs/mcpx/docs.nix` as flake output + `.#mcpx-docs` with a `siteUrl` argument (#1939 Approach C, #1941). A Go + preprocessor (`docs-history`, stdlib-only) renders release metadata/history. +- Scale: `docs/SUMMARY.md` has **84 chapter entries** (112 lines); **120 markdown + files, ~287,877 words** under `docs/` including the package-local archives: + `decisions/` (8), `changes/` (8), `compare/` (12), `spec/` (13), `audit/` (3), + `testing/` (3), `catalogue/` (1), plus 48 top-level chapters (index, overview, + quick-start, install, cli, compendium, configuration, modes, consumer, container, + protocol, http-api, elicitation design, parity, proposals, ideas, declared-but-unread, + in-name-only, landing checklist, level-2 page map, research-and-findings, …). +- Deploy: `.github/workflows/mcpx-docs.yml` builds `.#mcpx-docs` on push to main and + deploys the **whole Pages site** — mcpx is the root book at + https://developing-today.github.io/code/ and the fleet book joins under `/fleet/` + (staged by the fleet-docs path; #13225, open, fixes staging fleet docs into the + writable Pages directory). One Pages site per repo: every other book (fleet done, + atlas #13251 in flight, id planned) joins this deploy under its subpath. +- Docs trackers (open): #1888 (the book — overview/manual/compendium), #1889 + (runtimes/languages/dependencies), #1890 (site platform), #1892 (docs + testing + strategy), #1894 (docs level 1 — the 30-second layer), #1943 (custom subdomain — + **blocked, Drew's word**: "apply it" for the mcpx CNAME is his recorded pending + decision). +- Note: mcpx design records live **package-locally** (`docs/decisions`, `docs/changes`) + — the repo-root `doc/` archive has **0** mcpx-named entries. The ID/Atlas programs + put designs in `doc/`; mcpx's own convention is the book tree itself. +- Book-vs-surface gap (to be measured, not assumed): the CLI has ~50 commands and + 252 settings; the book has a compendium + configuration chapters and a + docs-twins currency check inside the `.#mcpx-docs` build, but no mechanical + coverage proof of book-vs-binary surface has been run for this program — that + audit is a deliverable. + +## 7. Deployment: the Nix cascade + +- Modules ship in `pkgs/mcpx/modules/` but are consumed **through the openchamber + flake**: `dezren39-nix/flake.nix` re-exports `inputs.openchamber.nixosModules.mcpx` + / `homeManagerModules.mcpx` / `darwinModules.mcpx` (lines 318–320), and the laptop + config enables `services.mcpx` in `home/common/default.nix` (line 1219) with the + daemon's settings in `home/common/mcpx-settings.nix` (`services.mcpx.settings`). + Per MEMORY (2026-11-04 consolidation): `services.openchamber.enable` cascades to + opencode + mcpx. +- Fossil of the cascade: the laptop's live `~/.config/mcpx/config.json` sits beside + `config.json.pre-cascade-20261103` — the pre-consolidation config, kept. +- The daemon runs from the Nix profile (`/etc/profiles/per-user/user/bin/mcpx`). + +## 8. Integrations (verified state) + +- **Atlas → mcpx: LIVE.** `home/common/mcpx-settings.nix` declares server `"atlas"` → + `https://atlas-search.developing-today.workers.dev/mcp` (the atlas-search Worker's + MCP endpoint, POST /mcp), gated per the comment on #8625. This is Drew's 2026-11-22 + order (Atlas MCP as a versioned Cloudflare deployment wired into the laptop's mcpx + as a remote server) in its landed form. The remainder lives on + [#8625](https://github.com/developing-today/code/issues/8625) (open, blocked: + cross-client acceptance — OpenClaw / OpenCode / OpenChamber / Muse lanes). + Atlas sensitivity ceilings are enforced server-side in the Worker; what mcpx adds + per-client on top is an open design question for this program. +- **ID ↔ mcpx**: ID ships its own MCP bridge with `mcp_policy::PolicySession` in + id-caps (#7916 closed; #7917 closed 2026-11-23) — MCP servers sit behind ID's + capability layer. The mcpx-side questions are open design: ID as an mcpx upstream, + mcpx as the gateway ID clients reach the world through, and code-mode interop + ([#1940](https://github.com/developing-today/code/issues/1940): nested code mode, + `?codemode=false`, what a harness expects of `mcpx_exec`). +- **fleet ↔ mcpx**: design-stage. Design-mill passes #10389 (one fleet surface for + OpenCode/OpenChamber/ID/mcpx), #10390 (fleet subcommands, pass-through + endpoint/ + credential resolution), #10393 (MCP everywhere — fleet MCP via mcpx, namespaces, + fan-out, remote graph), #10405 (middle-road fleet MCP, transitive capability + purity) are all open. `fleet search` (Atlas) is a separate, landed integration. +- **Harness adapters**: the opencode plugin is the deep integration — v1 plugin, + the v2 rewrite [#1858](https://github.com/developing-today/code/issues/1858) with + its SET-REMAINDER [#2841](https://github.com/developing-today/code/issues/2841) + (blocked), `docs/opencode-plugin-v2.md` (verified API facts). A harness-free + plugin core with adapters for codex / claude code / pi / manus is + [#1861](https://github.com/developing-today/code/issues/1861) (open). Per-harness + skills: `mcpx-{agy,codex,claude,opencode2}`. +- **Server parity**: epic #8993's second half — GitHub / Atlassian / Datadog MCP + server logins at parity ([#8809](https://github.com/developing-today/code/issues/8809), + blocked, `user/escalated`: Drew-gated OAuth/PAT). The live laptop config already + aggregates many servers (chrome-devtools, cloudrun, codebase-memory, codedb, + codex-connectors, deepwiki, desktop-commander, antigravity, … — from + `~/.config/mcpx/config.json` keys, read 2026-11-23). +- **Embeddings inside mcpx**: the daemon has its own embeddings subsystem + (`internal/catalog/embeddings.go`): a wazero-based Wasm embedder + (`embeddings.wasmPath`), remote OpenAI-compatible embeddings (probed), and + semantic `mcpx search`. This is mcpx's tool-discovery search — a different index + from Atlas's corpus search; the boundary between them is a design question. diff --git a/doc/README.md b/doc/README.md index 2936ca79a..eb0943af7 100644 --- a/doc/README.md +++ b/doc/README.md @@ -171,6 +171,7 @@ Two names break the pattern. They stay as they are because other documents link - [CNCF landscape investigation](2026-11-23T23-46-55Z_research_cncf-investigation/2026-11-23T23-46-55Z_research_cncf-investigation.md) — the 2026-11-23 CNCF survey (~150 projects, seven areas) with adopt/defer verdicts for the estate. - [Fleet investigation research corpus](2026-11-23T23-48-17Z_research_fleet-investigation/2026-11-23T23-48-17Z_research_fleet-investigation.md) — the 2026-11-23 research behind the fleet programme investigation (#13272): census, queue broker, agents/secrets/quota, designs. - [ID investigation research corpus](2026-11-23T23-50-00Z_research_id-investigation/2026-11-23T23-50-00Z_research_id-investigation.md) — the 2026-11-23 research behind the ID programme investigation (#13240): system state, technology, Roc research, the ID-100 list. +- [mcpx investigation research corpus](2026-11-23T23-51-36Z_research_mcpx-investigation/2026-11-23T23-51-36Z_research_mcpx-investigation.md) — the 2026-11-23 research behind the mcpx programme investigation (#13264), plus the mcpx door build notes. ## Legacy places