Repository navigation
feat(transports): apps serve MCP, and every transport names its app - #46
Closed
ahmad-ajmal wants to merge 4 commits into
Closed
ahmad-ajmal wants to merge 4 commits into
ahmad-ajmal wants to merge 4 commits into
Conversation
…ose by that order manifest.json may carry `transports`, an ordered list of cli, mcp and http. The first is the app's primary channel and the rest are fallbacks; without it the order is cli, mcp, http. Entries are kinds, never addresses. The gate checks it, the builder may edit it, toolkit-sync keeps it, `scaffold --transport` puts one first, and inspect reports it. Identity gains optional `transports` and `mcpUrl` (published by adapters in a later change). Arriving by CLI at an app that asks for another transport first says so. Skills, AGENTS.md and the README say how to choose, and how to operate over plain HTTP when there is no CLI. Spec: spec/v0_2/transports.md.
…ame its app adapter-core serves the app as an MCP server at POST /api/_a2app/mcp/<app id>. Each tool call is one request through the adapter's own router, so the guard, scopes, approval, idempotency, rate limits and audit are the ones HTTP callers meet. Ten tools, the same in every app (spec/v0_2/mcp-tools.json); MCP 2026-07-28 and, without sessions, the three handshake revisions before it. The caller is a credential, never a browser session. HTTP callers may name the app they mean (X-A2App-App); another app answers 409 app_mismatch. The CLI names a verified remote app on every call, and reads identity without its credential. Identity publishes `transports` and `mcpUrl`. Conformance class D covers the binding, and the starter conformance checks it against a running app on any stack.
Agents given only a task and an app picked the right transport each time, and stopped at every refusal. What slowed them is fixed: tools take an entity or operation by its own name, a declared operation is preferred over a raw write, the HTTP routes are listed in full, what to do when a scope or an approval is missing and the person can't be reached, and an MCP server that answers app_mismatch is another app's.
The read-only check used the name as written and the route decodes it, so a
percent-encoded name ("clear%2Ddone") passed the check and ran. The name is
decoded once, checked, and sent as that one segment. Scopes always applied; what
was missing is the promise a harness relies on when it runs a read-only tool
without asking. Found by the Go port's comparison run.
This was referenced Nov 30, 2026
Collaborator
Author
|
Replaced by #56, with the same code. The branch is kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each app now serves MCP itself, so an agent with no CLI can still use it, and every transport lets a caller name the app it means. This is the second of the transports series and is stacked on #45: review its own two commits until that one merges.
What changes
POST /api/_a2app/mcp/<app id>, in@a2app/adapter-core. The react-node blueprint and the sidecar get it from there. Each tool call becomes one request through the adapter's own router, so the guard, scopes, approval, idempotency, rate limits and audit are the existing ones, not copies.spec/v0_2/mcp-tools.json(4.7k characters). Nothing the app says reaches a tool's name, description or schema.X-A2App-Token, orAuthorization: Beareron this endpoint only. Cookies and browser headers count for nothing.Idempotency-KeyandX-A2App-Approvalheaders are ignored, because a harness sends the same headers on every call; they are tool arguments.X-A2App-App. A different app answers409 app_mismatch.a2appnames it on every call. It now reads the identity document without its credential: before, the token went out with the probe that decides whether this is the right app.transportsandmcpUrl. A manifest withoutmcpin its list serves no endpoint; one that declares nothing does.Things to know
adapter-corethat declares nothing starts serving MCP when it updates. It grants nothing HTTP doesn't.mcpUrl, so agents there use CLI, then HTTP, and class D isn't claimed.Tests
adapters/adapter-core/test/mcp.test.mjs: 128 checks, most in pairs (do it over MCP, then look at it over HTTP).New conformance class D (36 checks) and 4 new class A checks. Conformance 127/127.
Checks added to
reverse-proxy(MCP through an adopted app) and the CLI'sconnecttest (no credential in the identity probe; every later call names the app).conformance/starter/run.mjsgained the MCP checks: 76/76 against a running react-node app in each auth mode. The native adapter PRs will run the same file.Real clients against those two apps:
@modelcontextprotocol/sdk1.32.2,@modelcontextprotocol/client2.4.0 (default, auto, and pinned to 2026-07-28), and the MCP Inspector CLI 2.17.0 listing tools and callingdescribe. The SDK clients also ran a write, a guard refusal, the approval flow and a delete.pnpm -r build,typecheckandtestpass on Windows, Node 24; the Python SDK tests pass. The PocketBase e2e is skipped withoutPOCKETBASE_BIN, and is not touched here.Agents on running apps. 13 agents (Sonnet and Haiku) were each given an app and a task, with no mention of transports, and the choice was checked in the app's request log. Default order with the CLI: CLI. No CLI: MCP, or HTTP where MCP wasn't connected or the adapter (Python) doesn't serve it. MCP or HTTP listed first: that one, with the CLI installed. A stale MCP address: refused, next transport, reported. Read-only credential, also under pressure to get it done: stopped at
insufficient_scope, tried no other transport, and did not touch.agent-token. Destructive operation with nobody to ask: stopped atapproval_required. App-queued task over MCP: claimed, progressed, completed. MCP was reached through a small command wrapping the official client, not a harness's native tool list. The second commit is what those runs showed was unclear.Accounts, through the real page. On a multi-user app: owner and member signed up, the member created a read-only token on the account page, MCP showed only the member's records and refused writes, and revoking the token there ended it at once.
Replaced app. Same address, new app id: MCP, HTTP and the CLI each refused it.
Fixed since it opened:
query_operationjudged the operation name as written while the route decodes it, so a percent-encoded name ran an operation that isn't read-only (scopes still applied). Found by the Go port's comparison run. Checks added in three places; they fail without the fix. Conformance is now 128/128.