Repository navigation
feat(transports): apps are reached by CLI, MCP or HTTP, in the order they ask for - #56
Closed
ahmad-ajmal wants to merge 14 commits into
Closed
ahmad-ajmal wants to merge 14 commits into
ahmad-ajmal wants to merge 14 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.
The bridge told every harness to use the a2app CLI. It now uses the first of the app's transports the run can reach, and writes the prompt for it. Over MCP, the harness gets a configuration file for that one run with the app's endpoint and the task's own credential: 0600, only its path in the arguments, removed when the run ends. Routes in harnesses.json gain `transports` and `mcpArgs`; the built-in claude route has the latter. An inbound route gets the app's address, order and MCP endpoint in its body. Plugins say what to do when the CLI is missing, and no longer call it the only way to operate an app. The account page shows the app's MCP address beside a new token.
This was referenced Nov 30, 2026
- An agent that came by MCP is told the app's order: in the server's instructions, in whoami, and in the first describe (conventions.transports). The skill and AGENTS.md say to read it before the first call. - A 401 says where a credential comes from (A2APP_TOKEN, the account page), and no longer points at .agent-token. HTTP is reachable only with a credential in hand, where the work changes anything. - dev, the skills and AGENTS.md say that only a2app moves to the candidate: connected MCP tools and the usual address still reach the live app. - scaffold writes `transports` only when it is a choice, so an older agent-app accepts the app. It refuses --transport mcp on a blueprint that does not serve MCP, the gate refuses it on a running app, and serve names a malformed list. - starter conformance says what it did not check. - Docs keep the token off the command line; a missing CLI is the person's to install.
… that puts another first
…e described From the second audit. - whoami says when a credential gives less than the owner has, and such a caller is told to stay with it, not sent to a CLI that acts as the owner. - A2APP_TOKEN is one app's: A2APP_APP names it, and it goes to no other app. - a2app says nothing of the live app's transports while it answers from a dev candidate. - The SDK encodes ids, entities and operations in paths: `b-1?x` was `b-1`. - Bridge routes have arguments per transport, their own MCP configuration format and a JSON prompt; the run's values are in the environment. - Plugin tools follow the app's order, over MCP or HTTP without the CLI. - One table of transports, and what must name each is keyed by it.
Collaborator
Author
|
Replaced by #61, which has this 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.
An app can say how agents reach it: CLI, MCP or HTTP, in order. CLI stays first unless someone asks otherwise, and an agent without the CLI uses MCP or HTTP. Replaces #45, #46 and #54: the same code, without the new test files. Their descriptions have the full details.
What changes
manifest.jsonmay carry"transports": ["cli", "mcp", "http"]; absent means that order. Entries are kinds, never addresses. Agents use the first they can reach, and a refusal is the app's answer on every transport.scaffold --transport,validate,inspectand the skills follow.POST /api/_a2app/mcp/<app id>, ten tools, the same in every app. Each call is one request through the app's own router, so scopes, approval, guard and limits are the existing ones. It takes a token, never a session.X-A2App-App, or the id in the MCP address. Another app answers409 app_mismatch. The CLI reads the identity document without its credential.Spec:
spec/v0_2/transports.md,spec/v0_2/mcp-tools.json. New fields are optional.After an independent audit. Agents that come by MCP are told the app's order (instructions, whoami, the first describe).
a2appsays it on every screen of an app that puts another first. A 401 says where a credential comes from instead of pointing at.agent-token, and HTTP counts as reachable only with a credential in hand.dev, the skills and AGENTS.md say that onlya2appmoves to the candidate.scaffoldwritestransportsonly when it is a choice, and refuses--transport mcpon a blueprint that serves none; the gate andservecheck it too.After a second audit.
whoamisayslimited: trueto a credential that gives less than the owner's, and such a caller is told to stay with it, not sent to a CLI that acts as the owner.A2APP_TOKENis one app's.A2APP_APPnames it, and it is sent to no other app. A redirect never carries it.b-1?xwas read asb-1, and over MCPp%41aspA: a delete could hit the wrong record.a2appsays nothing of the live app's transports while it answers from a dev candidate.argsFor), its own MCP file format (mcpConfig), a JSON prompt, and the run's values in the environment.Things to know
The built-in
codex,geminiandaiderroutes stay CLI only: how each is given an MCP server for one run could not be confirmed from their docs. A profile says it. No built-in route grants the network for HTTP.An older agent-app (0.2.5 and before) accepts an app with no
transports, which is whatscaffoldnow writes by default. It refuses one that has the key, and itstoolkit-syncremoves it: raise the CLI's version with this release.An app on
adapter-corethat declares nothing starts serving MCP when it updates. It grants nothing HTTP doesn't.The Python, Go, Rust, Rails and PocketBase adapters are in feat(adapters): MCP, app naming and approval previews in Python, Go, Rust, Rails and PocketBase #58. Until it lands agents there use CLI, then HTTP.
CraftBot's public links refuse the MCP path, and must until its gateway reads the call in the body.
OAuth sign-in for MCP hosts is not part of this.
Tests
.testfiles are left out of this PR, on request. Existing ones change only where they would fail against the new code (bridge,install,manifest-merge). What was left out stays on the old branches (feat/transports-mcp,feat/transports-bridge).pnpm -r build,typecheckandtestpass on this branch. Before the files were left out, all of them passed against this same code.clauderun over MCP (not logged in on this machine); Hermes' 24 dashboard tests (no FastAPI here).