ACP in the browser
Draft, version 1. A contract for a web page to find a person's Agent Client Protocol agents and talk to them through whatever provider the person has: a browser extension today, perhaps the browser itself later. Any provider may implement it and any page may use it, with no library from this project. Nothing here is an upstream ACP or W3C standard, and it may change until a second provider passes its conformance tests.
The key words MUST, MUST NOT, SHOULD and MAY are as in RFC 2119.
What it builds on
| Layer | Used | Status |
|---|---|---|
| Agent protocol | ACP, unchanged: no method here replaces one of its | v1 stable, v2 draft |
| Remote transport | ACP's WebSocket profile, and this project's WebTransport draft | Active RFD; WebTransport is ours |
| Network discovery | DNS-SD over mDNS | Standards; the service type below is unregistered |
| Page tools | WebMCP, through MCP over ACP | Community Group draft; RFD draft |
| Provider discovery | The shape of EIP-6963: several providers, none overwriting another | A precedent, not a dependency |
ACP is the protocol once connected. This contract covers only what ACP does not: finding an agent, a person's consent, and what a page may ask of it.
Why a page is not an ordinary ACP client
ACP was written for a client the person runs and trusts, such as an editor. Its own text says an MCP server configuration can launch a process. A page is a stranger the person visited, so passing its messages through unread would give any page with a grant:
- a command on the agent's machine, through a stdio entry in
session/new'smcpServers; - the person's history with that agent, through
session/listandsession/load, which replays a whole conversation; - every tool the agent has, approved by the page itself, by answering
session/request_permission, or bysession/set_modeto a mode that stops asking.
So a provider is a gateway with a scope, not a pipe. The scope is small, mechanical and tested here so that nobody has to design it again.
The page API
partial interface Document {
readonly attribute Acp? acp; // absent when no provider is present
};
interface Acp {
readonly attribute unsigned short version; // 1
readonly attribute FrozenArray<AcpProviderInfo> providers;
Promise<sequence<AcpAgent>> agents(); // this origin's grants; never prompts
Promise<sequence<AcpAgent>> request(optional AcpRequest options = {});
Promise<AcpConnection> connect(AcpAgent agent, optional AcpConnectOptions options = {});
Promise<undefined> revoke(AcpAgent agent);
attribute EventHandler onagentschange;
};
dictionary AcpProviderInfo { required DOMString uuid; required DOMString name; required DOMString rdns; DOMString icon; };
dictionary AcpRequest {
DOMString provider; // a uuid, when the page lets the person choose among several; default the first registered
DOMString purpose; // the page's words, shown as the page's words
sequence<unsigned short> acpVersions;
sequence<DOMString> mcpOrigins; // origins other than the page's it will name in mcpServers, shown to the person
sequence<DOMString> peers; // agents the page already knows, listed first
boolean permissions; // asks that the page answer the agent's permission requests; see Scope
};
dictionary AcpAgent {
required DOMString id; // opaque, stable, different for each origin
required DOMString label; // what the person calls it, or what it advertised
required DOMString provider;
required DOMString source; // "dns-sd", "manual", "paired", "local"
required AcpIdentity identity;
required AcpOffers offers;
required DOMString status; // "available", "unreachable", "unknown"; see Fields the provider fills in
required AcpScopeInfo scope;
};
dictionary AcpIdentity { DOMString? peer; required boolean verified; DOMString? method; }; // method: any proof's name, not a fixed list
dictionary AcpOffers { sequence<unsigned short> acpVersions; sequence<DOMString> transports; };
dictionary AcpScopeInfo { required boolean permissions; required DOMString lifetime; sequence<DOMString> mcpOrigins; }; // "once", "always"
dictionary AcpConnectOptions { AbortSignal signal; };
interface AcpConnection {
readonly attribute AcpAgent agent;
readonly attribute ReadableStream readable; // of strings, one complete JSON-RPC message each
readonly attribute WritableStream writable; // of strings, one complete JSON-RPC message each
readonly attribute Promise<AcpClosed> closed;
undefined close();
};
dictionary AcpClosed { required DOMString reason; }; // "page", "agent", "navigation", "revoked", "failed"
Messages are strings, so a WebAssembly module or a Dart program crosses into JavaScript with the type it already has, and ACP's own libraries, which take a pair of streams, need only a parse and a stringify around them.
Errors are DOMExceptions: NotAllowedError for no grant, for an agent the provider no longer knows, for a refusal, for choosing nothing, or for no user activation; NotFoundError only from the registry, for a provider no provider answers to; NetworkError when an agent cannot be reached; AbortError when the signal of connect() ended the wait. An error never says which of "no such agent" and "not granted" applies, so a page cannot probe for agents.
Rules for the page API
document.acpexists only in a secure context's top-level document. A cross-origin frame gets nothing in this version.agents()returns what this origin was granted and nothing else. A page learns about an agent only after the person grants it. Never prompts, and is empty when there are no grants.request()needs transient user activation. The provider asks in its own window, never inside the page, where a page could draw over it. That window lists the agents the provider knows and the ones it has discovered, and MUST let the person grant any number of them, and add one by hand there and then: by URL and fingerprint, or by pairing with a code. The candidates are shown there and not to the page. The page learns only what was granted, and refusing looks the same as having no agents.- A provider MUST also let the person add, remove and revoke agents and grants outside any page's request.
connect()never prompts. A connection belongs to its document: navigating, closing the tab, orrevokecloses it at once, with the reason inclosed.- A provider's
uuidis the same for every page and every install of that build. Different per install, it would be an identifier every site could read. iddiffers per origin, so two sites cannot match their agents by it.identity.peerdoes not differ, and the person is told that the site will see it.
Behaviour the interfaces leave open
What a second provider has to do the same way, or a page cannot tell which one it has.
request()
- The provider reads transient activation where the page cannot forge it: in the extension's content script, a world of its own, as
navigator.userActivation.isActiveat the moment the page's request arrives there. A service worker cannot see activation and a page's own world can lie about it, so every message other thanrequestis passed on as not activated. Activation is checked and not consumed, so the browser's own window for it (a few seconds) bounds what one click can start, and the next rule keeps that to one window. - A tab MUST have at most one request window open, and an origin SHOULD. A
request()made while one is open rejects at once withNotAllowedError, without a second window. - The window closes and
request()rejects withNotAllowedErrorwhen the person closes it, when the page's document goes (navigation, tab closed, its connection to the provider ends) and after 120 seconds with no answer. A provider MUST NOT make a grant for a document that has gone. acpVersionsis a hint for the window, which may say that an agent offers none of those versions. A provider MAY ignore it, and MUST NOT hide an agent from the person or decide what the page learns by it: the version is settled byinitialize.
Grants
- A grant of lifetime
oncebelongs to the tab it was made in: that tab's documents of the origin see it, across reloads, and no other tab does, which asks for its own. It ends when the tab closes or the browser ends.alwaysserves every tab of the origin until revoked. - A grant is for one origin and one agent. For an agent with a verified peer, the agent is its key. An agent with none (a local one, one added by URL) is the provider's own record of it, made when the person added it: another address with no key is another agent, and removing the record ends its grants.
request()for an agent the origin already holds replaces that grant: the sameid, the sessions kept, the lifetime, folder,permissionsandmcpOriginsthe person has just chosen. The new terms apply to connections already open at once, so a person who takespermissionsaway does not wait for a reconnect, andagentschangefires.revoke()of anidthe origin holds nothing for resolves with no effect and no error, as revoking twice does, so a page cannot probe with it. Otherwise it ends the grant's connections withrevokedbefore it resolves.agents()of the registry is each provider's list, in the order they registered. If one provider's rejects, so does the registry's, with that error and no partial list, so a provider SHOULD answeragents()with a list, however it is placed.
Fields the provider fills in
statusis a hint.agents()MUST NOT contact the agent, since that tells it which pages a person visits, so it isunknownunless the provider already knows:availablewhile one of its connections to the agent is open,unreachableafter a connection failed.offers.transportslists the transports the provider can try, as lower case tokens (websocket,webtransport) in its order of preference. It is not a promise, and a page ignores a token it does not know.identity.methodisnullwhenidentity.verifiedis false.
Connections
connect(agent, { signal }): the signal ends only the wait for the connection. Aborting it before the connection is open rejects withAbortError, whatever the signal'sreason, and stops what was being opened; a signal already aborted rejects at once with nothing started. Onceconnect()has resolved the signal does nothing, so a timeout signal cannot cut a live connection.readablecarries each message from the agent as one string, in order, none dropped for a slow reader. It ends, cleanly and not with an error, whenever the connection ends for any reason, after the messages already queued.closedresolves once, with the reason, at the momentreadableends. It never rejects.close(),writable.close(),writable.abort()andreadable.cancel()are the same act: they end the connection with the reasonpage, and doing it again does nothing.- A write after the connection has ended rejects with
InvalidStateError, and sends nothing. After the page's ownwritable.close()orwritable.abort()the stream itself refuses the write first, with theTypeErroreveryWritableStreamgives; nothing is sent either way. - A write of anything but a string rejects with
TypeErrorand errors the writable, so no later write succeeds. Nothing was sent, and the connection stays open untilclose()or its readable's end. - The
closedreasons:pagewhen the page ended it;navigationwhen its document went (navigated, tab closed, orpagehide);revokedwhen its grant ended, whoever ended it;agentwhen the agent ended it in order, with its close;failedfor any other end: a link cut with no close from the agent, the provider restarting, or its worker stopping.
The back/forward cache. A page restored from it is alive, but the provider's connection to it is not. A provider MUST therefore end the document's connections with navigation on pagehide, whether or not the page is kept, and not rely on its port disconnecting, which a restored page would never learn of: its closed would never resolve. What a restored page can do next (whether agents() reaches the provider again, and what a call that was in flight when the page was stored does) is unspecified, because no provider has been run through a real restore.
Why document.acp
WebMCP's draft of 27 October 2026 defines document.modelContext, and Chrome's guide uses it. Older guides use navigator.modelContext. A page calling both should find them in the same place, and the document is the honest scope, since a grant's connections end with it.
A property on document can be shadowed by the page's own markup (<img name="acp">). That fails closed, as "no provider", and finding a provider by event is not affected. A page that shows other people's HTML SHOULD find it by event.
Finding a provider
window.acp was rejected for the reason EIP-6963 records of window.ethereum: whichever extension loaded last won. Here document.acp is a registry, defined the same way by whichever provider arrives first:
- A provider MUST, if
document.acpis not already a registry, define it, with the algorithm inbindings/js/src/registry.mjs. It then registers itself. - Registering dispatches
acp:readyonwindow, withdetail.acpholding the registry. - The registry answers an
acp:requestevent onwindowwith anotheracp:ready, for a page that started listening late.
A provider may arrive after the page has loaded, for instance when the person clicks an extension's button. A page should say what it can do without one, and listen.
Every provider reveals that it is installed, to every page it is injected into. So a provider SHOULD inject only where the person has allowed it (see extensions).
The registry's binding parts
Revision 1. The registry is shared by every provider in a page, whichever arrived first, so what follows is exact, and a provider that cannot import bindings/js/src/registry.mjs (a declared content script cannot be a module) restates it. A provider SHOULD say in a comment beside its copy that it restates revision 1; a change to any point below is a new revision, listed here. The version member of the registry is the page API's, not this number.
- Where it lives. The window holds the registry under
Symbol.for('coqui-acp.registry'), defined withObject.defineProperty(window, symbol, { value }), anddocument.acpisObject.defineProperty(document, 'acp', { value: registry, enumerable: true }): neither can be assigned over or deleted. The provider decides whether a registry exists by the symbol on the window and never by the property, since markup can shadowdocument.acpand a value there that is not ours is replaced. - Its members. A frozen object:
version(1);providers, a frozen array of each provider'sinfoin the order they registered;agents(),request(options),connect(agent, options),revoke(agent);onagentschange(an accessor that keeps a function and otherwisenull),addEventListenerandremoveEventListenerforagentschange; andregister(provider), which only providers call. A page that calls it adds a provider to its own view and to nothing else. - A provider's shape.
{ info, agents(), request(options), connect(agent, options), revoke(agent), addEventListener? }, whereinfois{ uuid, name, rdns, icon? }. Every agent it returns, and theagentof every connection, MUST haveprovider === info.uuid: the registry sendsconnectandrevoketo a provider by that field alone, so an agent without it can never be reached. A provider that hasaddEventListeneris heard foragentschange, which the registry repeats to its own listeners and toonagentschange. - Routing.
requestgoes to the provider named byoptions.provider, else to the first that registered, and rejects withNotFoundErrorwhen none has thatuuid.connectandrevokego to the provider named byagent.providerand reject withNotFoundErrorwhen none has it. A provider is handed the options as the page gave them. - Announcing. Every
registerdispatchesacp:readyonwindow, aCustomEventwhosedetail.acpis the registry, and the registry answers everyacp:requestonwindowwith the same.
Scope
A provider MUST apply this to every message before it reaches the agent. It parses the JSON and forwards its own serialization of what it parsed, so a parser's disagreement over duplicate keys cannot reach the agent. A message that is not one JSON-RPC object, or whose id is neither a string, null nor an integer a number can hold exactly (at most 2^53 - 1), is refused. What reaches the agent is that serialization, so a number JSON allows and a double cannot hold changes: 1e400 becomes null, and an integer past 2^53 loses its last digits. A page that needs one exactly sends it as a string.
| From the page | Result |
|---|---|
initialize |
forwarded |
session/new |
forwarded with cwd replaced by the grant's (removed, for a grant whose folder the provider supplies), and mcpServers checked |
session/prompt, session/cancel, session/close |
forwarded for a session this origin opened with this agent |
session/load, session/resume |
the same, with cwd and mcpServers handled as for session/new |
session/set_model, and session/set_config_option of an option the agent described as category model or thought_level |
forwarded for its own session |
session/set_mode, and session/set_config_option of any other option, including one the agent never described |
forwarded for its own session only if the grant has permissions, since a mode can stop the agent asking |
| A response to a request the agent made of the page | forwarded |
authenticate, session/list, anything else, any _ extension |
refused with -32601; a notification is dropped |
cwdis the grant's, chosen by the person. Without one,session/newis refused. A provider whose agent works in a folder the provider's side makes (a host that gives each site its own scratch folder) may instead mark the grantfolder: "provider": the page'scwdis then removed fromsession/new,session/loadandsession/resumeand never reaches the agent, and the provider MUST supply the folder itself in the same message, from what the browser reported of the page and never from the page. Everything else in the table holds.- Everything else in a session request is removed: a page may send
sessionId(to reopen one of its sessions) andmcpServers, and nothing more.additionalDirectories, which an agent may make writable without asking,systemPromptand any other field are the person's or the provider's to give, never a page's.replayFrompasses, since it only replays a session the page opened. This holds for every grant,permissionsincluded: a page that may answer the agent's questions still cannot add directories. A provider's own application, which the provider marks withownon the grant itself and never at a person's or a page's say, passes the rest. mcpServersmay hold onlytypehttp,sseoracp. Anything else, above all an entry with acommand, is refused whole. AnhttporsseURL MUST behttpsand have the page's origin or one in the grant'smcpOrigins, because the agent connects from its own network and sends the given headers there. So a page onhttp://localhostcannot name itself, nor list itself inmcpOrigins, which holds onlyhttpsorigins: it uses anacpentry, or anhttpsaddress that reaches its server._metais removed from every message, since an agent may give it private meaning.
| From the agent | Result |
|---|---|
| A response | forwarded |
session/update |
forwarded for a session of this origin; dropped otherwise |
session/request_permission |
answered by the person in the provider's window, and not shown to the page; cancelled when nobody answers in time (below). Forwarded only if the grant has permissions |
| Any other request naming a session this origin did not open | refused |
Any other request or notification (fs/*, terminal/*, mcp/message) |
forwarded: it asks the page, and reaches nothing of the person's |
- A session this origin did not open is another origin's, one nobody here opened, or none at all in a message whose method starts with
session/. A request of the agent about one is answered-32601by the provider, to the agent, and a notification about one is dropped. Neither reaches the page. A response is always forwarded. - A permission request the page may not answer is put to the person, who sees the agent's own options. The answer to the agent is the result
{ "outcome": { "outcome": "cancelled" } }, which ACP defines, and not an error, when the person closes the window, when 120 seconds have passed with no answer, and when the page'ssession/cancelfor that session is forwarded, which also closes the window: ACP requires that answer. A connection that ends sends none, since there is no one to send it to. Requests wait one window at a time, in the order they came, and a provider MAY cancel without asking those past a bound it chooses. authenticateis refused for every page. Signing in to an agent is the person's, done with the agent or in the provider's own window before a page's session, and a page that is told the agent needs it (the agent's own error, forwarded as it came) can only tell the person. This contract gives a page no way to ask for it.
Resuming. A page that reloads, or opens again, may keep going: it remembers the agent's id and the ACP session id itself, finds the agent in agents(), connects, sends initialize as on any connection, and then session/resume or session/load with that session id, with no new prompt. This works as long as the grant lasts and the session still exists at the agent. An agent that no longer has it answers with its own error, and the page starts a new one.
- A provider MUST remember which sessions an origin opened with an agent for as long as the grant lasts, and MUST forget them when the grant ends. A session id another origin opened is refused, whether or not the page knows it: knowing an id is not permission to read a person's history.
- A grant of lifetime
oncelasts until the tab closes, across reloads, andalwaysuntil revoked: what each reaches is settled above. - A connection, by contrast, ends with its document, so a turn in progress through a provider ends when the page does. Whether its session can be resumed is up to the agent. Work that must outlive a tab belongs on a connection the page does not hold.
permissions is a grant the person gives only with the words "this site can approve what the agent does for you". It lets the site answer the agent's permission requests and change its mode, so it suits an agent whose damage is bounded. It is never the default, and a provider MAY refuse it for an agent that runs on the person's own computer as the person.
Answering for the agent's reach. A page that wants an agent to act with a person's authority on its service passes an http MCP server of its own origin in mcpServers, with a short-lived token for that conversation in headers. What the agent may do there is what the service allows that person. The token goes to the agent, so it must be worth no more than that conversation.
Identity and trust
Discovery is not trust, and neither is a label. An mDNS answer is an unauthenticated hint that anyone on the link can send, so it can name a server that relays a proof to a real agent. A provider MUST prove the peer, and MUST tie later messages to the proof:
identity.verifiedis true only when every message after the proof is protected by keys that came out of it, or by TLS the proof is bound to at this endpoint. A proof that only shows who holds a key does not count: whoever relayed it holds the channel. False is reported as false, including for a key nobody proved, and a page may refuse such an agent.- A local agent may use no proof at all, or TLS that shows only a host name. A provider may connect to one only if the person added it knowing that, and reports
identity.verifiedfalse, so a page can refuse it. - The first use of an agent's key is the person's decision: pairing with a code, or accepting a fingerprint shown beside the label. It is never automatic.
- A key that changes is a new agent, whose grants do not carry over.
- A provider ends each stream with its close record and, when the transport ends, checks the peer's came: a link that ends without it is reported as cut, never as finished.
- A provider stores the method with the key, and connects by that method only. A failed connection, a refused proof or a record naming another method never selects the other: any of these can come from whoever carries the connection. A peer id is the hash of a key of one type, so only its own method proves it. A browser that cannot run a method, such as one whose WebCrypto has no X25519 for Noise, shows that agent as unreachable from it and says why.
- Grants are keyed by the verified peer, the page's origin, and the provider's profile. A grant for one agent gives nothing on another.
A provider's code must not come from the path it protects. A proxy that serves a page's JavaScript can replace it, so an end-to-end session in that page protects nothing against that proxy. A provider ships its proof code with the extension or application.
The person's key. The provider's own identity proves the connection: the page holds no key and never sees one, and the agent's allow-list names the provider, not each site. A page that connects by itself, with no provider, proves with a key of its own. An agent may instead require a client certificate at TLS, which the browser offers from the person's store or smart card, as for any site. That proves the person to whatever ends the TLS, not to the agent behind a proxy, and whether a provider's background connection gets the browser's prompt is untested.
WebMCP
These are two separate questions.
A page's own tools, to an agent it has connected. The page chooses, per session, and the default is none. A page opts in by putting an entry of type: "acp" in session/new's mcpServers, answering the agent's mcp/message requests from document.modelContext. This needs no help from the provider and no new permission: a page that may prompt an agent can already say anything to it, and tools add no power over the agent that a prompt lacks. exposeWebMcp in bindings/js does this.
- It needs an agent advertising
mcpCapabilities.acp, which upstream's draft makes optional. An agent without it gets no tools, and the page is told. - The default is none because a tool's description is untrusted text in the agent's context, and a page may want an agent that has not read it.
- A tool marked
consequentialHintruns only after a confirmation the page supplies; with none, it is refused. As WebMCP's draft says, a site's hints can be missing or wrong, so this protects a page from its own tools running unasked, not a person from a dishonest page.
An agent reaching into pages. A provider may also offer an agent the tools of pages the person chooses. That is the agent's access to the browser, a separate grant kept by the provider per agent, tab and capability, which this contract does not cover and no page can give. A page's permission to use an agent and an agent's permission to use a page never imply each other.
WebMCP does not replace this contract: it lets a page offer tools to an agent, and says nothing about a page finding one. Offering a person's agents to the browser's own assistant as WebMCP tools is out of scope for this version.
Network discovery
Service type
_acp-agent._tcp. _acp._tcp cannot be used, because IANA's registry assigns the service name acp to the Aeolon Core Protocol. acp-agent is not in the registry today and has not been requested, so this is provisional until it is registered.
A per-protocol type follows _a2a._tcp. An advertiser MAY also publish _agent._tcp with proto=acp, as an individual Internet-Draft proposes, but that draft has no standing yet and defines only A2A's keys.
What is advertised
The instance name is the label. The SRV record gives host and port. TXT keys, none of them trusted:
| Key | Meaning |
|---|---|
txtvers |
1, required |
proto |
acp, required |
path |
the WebSocket path; default /acp |
tls |
1 for wss |
wt |
a UDP port serving WebTransport on the same host, usually the SRV record's number |
wth |
sha256: and the hex hash of the certificate there, for serverCertificateHashes, when no certificate authority vouches for it |
peer |
the peer id, as a hint to match against one already paired |
method |
the proof's method, noise or webcrypto. A record naming none is webcrypto's, the only method before records named one; a client skips one naming a method it cannot run |
acpv |
ACP versions, comma separated |
offers |
protocol tokens served over one link, comma separated, such as acp/1,a2a/1,mcp. A client ignores one it does not know, and what a peer may open is what the link's own document says. See the link |
A client MUST treat all of it as hostile input. It MUST NOT offer a record that names this machine in any spelling, including localhost, *.localhost, a numeric form of a loopback address or an IPv4 address inside an IPv6 one, which would point a person at a service of their own; one that is link-local; one that is plain; or one that names no peer, which nothing could then prove. It SHOULD remove format characters from a label, which can hide part of it or reorder what is shown around it.
Advertising tells everyone on the link that an agent exists, so it MUST be off unless asked for. A record carries nothing secret: a peer id is a public key's hash.
On one machine
An agent bound to loopback is not reachable through an address mDNS could give others. It writes a descriptor instead, one JSON file per listener in a directory only its user can write, which is $COQUI_ACP_DESCRIPTORS if set, otherwise coqui-acp/agents under %LOCALAPPDATA%, $XDG_RUNTIME_DIR or ~/.local/state, the first that is set:
{ "txtvers": 1, "proto": "acp", "label": "My agent", "url": "ws://127.0.0.1:8765/acp", "peer": "sha256:…", "method": "noise", "wt": null, "wth": null }
A descriptor MUST name loopback, with no user name in its URL, and is the only way discovery offers an agent with no key. A person may still add one by hand. A reader removes one nothing answers at, since a killed program leaves its file behind, ignores anything but a regular file, and believes none from a directory others can write to.
The companion
A browser extension cannot query any of this itself: chrome.mdns is documented only for Chrome Apps, a platform deprecated in 2020. It asks a native companion over native messaging, whose messages to the extension are limited to 1 MB. Discovery fits; relaying agent traffic through it means splitting larger messages.
The companion answers one request, { "op": "discover", "seconds": 3 }, with { "candidates": [...] } of at most 64, each { "label", "url", "peer", "method", "source", "webtransport", "webtransportHash", "acpVersions", "offers" }, where source is dns-sd or local. A program that links agentic-peer's companion module is one, registered under a name of its own.
wth lets a browser open WebTransport to an agent with no certificate authority: browsers pin a hash only for a certificate valid for 14 days at most, so an agent's hash changes as it renews one. It can be a hint like the rest because TLS authenticates nothing here: a false hash only fails to open, and whichever transport opens has the same proof to pass. For the same reason a provider MAY try a WebSocket when WebTransport does not open.
A public key proves nothing about who names it. A record can name the key of an agent the person already has, at the address of whoever sent it. A provider MUST show such a record as that agent, under the name the person knows it by and not the record's, and say that choosing it gives the requesting site that agent. It MUST report the agent as unverified until a proof at the new address, and keep the old address until then, going back to it if the proof fails. A stranger that relays to the real agent passes the proof and still reads nothing, since everything after it is sealed, but it does see when and how much is sent.
Connecting shows who is asking. An initiator's first message carries its public key, before the other side has proved anything, so whoever answers at an address learns it, and the same key at several agents can be matched. Keep that in mind when choosing to connect to something discovered.
A provider SHOULD search only when the person asks, since that starts a program and listens on the network, and MUST NOT show a page anything it found. Showing a candidate is not trusting it: it stays unchosen until the person chooses it, with its key beside its label, and choosing it is what accepts that key.
A provider as an extension
Non-normative: what a Chromium Manifest V3 extension needs, as reference.
- Getting into pages.
externally_connectablecannot serve this, since it needs each site listed in the manifest. Use a small script in the page's main world that defines the registry, and a content script between it and the service worker. Checksender.origin, the tab and the document in the service worker: the page's world can forge any message, but not what the browser reports about the sender. - A strict page. A page may run
script-src 'self'; connect-src 'self', and a provider MUST work under it: inject throughchrome.scriptingor a declared main-world content script, never an inline script tag. - Being asked, and asking for little. Injecting everywhere needs permission for every site and tells every site the extension is there. A provider SHOULD start from the person's click on its button, and offer "let sites ask" as a choice that requests the host permission then.
- Connecting. The service worker holds the connection, so a page's
connect-srcdoes not limit it. A worker stops after 30 seconds without an event, which ends its connections, so a provider MUST keep it alive while one is open: an agent can be silent for far longer during a tool call. - Who is protected from whom. A page running a proof itself is only as trustworthy as whoever served it: a proxy that also serves the page can replace the proof's code. An extension or a packaged app does not have that problem, and a page using
document.acpholds no proof at all, so it is the provider's code that counts.
| To | How |
|---|---|
| This machine | ws://127.0.0.1, or localhost |
| The network, with a certificate the browser accepts | wss:// |
| The network, with a self-signed certificate | WebTransport with serverCertificateHashes, or through the companion |
- Local network prompts. Chrome asks the person before a public page reaches a local or loopback address, including over WebSocket and WebTransport. That guide does not mention extensions, so an extension's behaviour here has to be tested before it is relied on.
Other languages
The contract is the page API and the DNS-SD record, so any language can take part:
- WebAssembly and Dart reach
document.acpthrough JavaScript and exchange strings:coqui-acp-pagefor a Rust page, andpackage:coqui_acp/page.dart, whose connectionAcpClienttakes as it is. The Dart one passes under both dart2js and dart2wasm. - A native program has no page: it browses DNS-SD itself, connects directly, and needs no scope, since it answers to the person who ran it.
Conformance
Passing these shows a provider keeps pages in their place. It does not show it proves agents: one that proves nothing, and reports every agent as verified: false, can conform, and a page may refuse every agent it offers.
bindings/js/src/conformance.mjs runs these against any provider, given a small driver that plays the person, a page's origin and an agent. A provider conforms when all pass. Every check has a time bound, 10 seconds unless the driver gives another, and a provider that does not answer in it fails that check by name: one that never closes a connection fails revoke and does not hang the run. The driver's answerNext names the grant's lifetime (once, the default, or always) with the rest of the person's answer. The rules above for request(), grants and connections that no check below runs are not tested here yet, and are no less binding.
| Id | A provider must |
|---|---|
registry |
hold the registry as the binding parts say, keep an earlier provider when a later one registers, route by provider, and answer acp:request |
lifetime |
keep the lifetime the person chose, once when they chose none |
no-grant-no-agents |
show a page nothing without a grant, including an agent it has discovered |
no-grant-no-connection |
refuse to connect, with the same error as for an unknown agent |
activation |
refuse request() without user activation |
person-refuses |
return nothing and remember nothing when the person refuses |
person-chooses |
give a page exactly the agents the person chose, several or one added by hand during the prompt, and nothing about the others |
per-origin |
not let another origin use a grant, and give it a different id |
messages |
carry messages both ways, in order, unchanged in meaning |
revoke |
close at once on revocation, and refuse after it |
navigation |
close at once when the document goes |
stream-end |
end readable cleanly, and resolve closed with the reason |
write-after-close |
reject a write after the end with InvalidStateError, and send nothing |
stream-close |
end as page on close(), writable.close(), writable.abort() and readable.cancel(), and again with no change |
cancel-drops-messages |
drop what the agent says after readable.cancel(), and throw nothing |
write-non-string |
reject a write that is not a string with TypeError, error the writable, and keep the connection open |
no-stdio |
never let a command in mcpServers reach the agent |
mcp-origin |
never let a server of another origin reach the agent, unless granted |
cwd |
replace a page's cwd |
meta |
remove _meta |
sessions |
keep a page to sessions its origin opened, and refuse session/list |
unknown-methods |
refuse authenticate and any extension |
modes |
refuse a mode change without permissions, and an unknown configuration category, while allowing model and effort |
resume |
let a page that reloaded find its agent and resume its session with no prompt, and refuse a session id it did not open |
verified |
report identity.verified false for a key nobody proved |
strict-csp |
define document.acp and connect under script-src 'self'; connect-src 'self' (a browser check: the driver says how) |
permission-to-person |
answer a permission request in its own window, and keep it from the page |
duplicate-keys |
forward what it parsed, not what it received |