Working draft (Specification Enhancement Proposal, not yet submitted). See About ‘WIP’. This is the sealed stream that Garage Door has used since November 12, 2026 to connect Garage Remote on iOS, Android and the desktop to a person’s own nodes, restated as an extension to the Model Context Protocol so that any client, server or relay could implement it. The extension identifier below is a proposal; the MCP project has not adopted it.
| Field | Value |
|---|---|
| Title | Sealed transport: end-to-end encrypted MCP through untrusted relays |
| Author | Rick Mark-Penwell |
| Status | Draft |
| Type | Extensions Track (a transport extension; MCP’s messages do not change) |
| Created | 2026-11-24 |
| Extension identifier | io.modelcontextprotocol/sealed (proposed) |
Abstract
The sealed transport carries MCP’s JSON-RPC messages between a client and a server that cannot reach each other directly. They connect through a relay that forwards opaque bytes and holds no key able to read or alter them.
Each session is a Noise Protocol Framework handshake (Noise_IK_25519_ChaChaPoly_SHA256 for a known device, Noise_XX_25519_ChaChaPoly_SHA256 to enroll one), run over WebSocket binary messages. After the handshake, every MCP message travels as encrypted chunks.
Trust is anchored in a trust anchor, an Ed25519 key held only by the servers. The anchor certifies each server’s and each client device’s static keys. Enrolling a new device needs a person’s approval, either by comparing a short code on both screens or by scanning a QR code that carries a one-time secret.
The relay can route sessions, deny service and observe sizes and timing. It cannot read requests, results or tool names, and it cannot forge or reorder them.
Motivation
MCP defines two transports: stdio, for a server the client launches, and Streamable HTTP, for a server the client reaches by URL. Neither fits a common deployment: a personal or company server behind NAT or a firewall that opens no listener, reached from a phone or a laptop elsewhere.
Today the usual answer is a hosted gateway. The server dials out to the gateway, the client speaks Streamable HTTP to the gateway, and the gateway terminates TLS. The gateway therefore sees every query and every excerpt in the clear. For MCP servers that front private corpora (mail, documents, code), that is the very data the deployment exists to protect. Keys derived from an OAuth token do not help, because the authorization server that issues the token is usually the gateway itself, and the token reaches it on every request.
When the client can run the implementer’s code (a native app, a desktop bridge launched over stdio, an IDE plugin), the two ends can encrypt to each other and use the gateway only as a relay. This proposal standardizes how they do that, so that:
- relays can be generic and interchangeable, with no knowledge of MCP;
- clients and servers from different vendors can interoperate end to end;
- the security properties can be stated precisely and reviewed once.
Terminology
The key words MUST, SHOULD and MAY are used as in RFC 2119 and RFC 8174.
- Server: the MCP server, which holds a static X25519 key (its agreement key) and an Ed25519 identity key.
- Client device (or device): the MCP client. It holds its own agreement and identity keys, created on the device and never exported.
- Relay: forwards WebSocket binary messages between a device and a server’s outbound connection. It is trusted for availability only.
- Node id: an opaque string naming one server to the relay and to the ends (section 2.1). It is bound into every handshake.
- Endpoint: an opaque
wss://URL at which the relay accepts sessions for a node id. Clients never build one. - Trust anchor: an Ed25519 key pair whose private half exists only on servers the person controls. Its public half is the anchor key.
- Directory: the anchor key, plus each server’s certificate, plus device certificates and revocations, published by any party (usually the relay). The ends verify everything they read from it, so it needs no trust for integrity.
- Profile label
P: a short ASCII string with no newline that namespaces every context string. This document definesmcp. Garage’s deployment usesgarage. b64u: base64url without padding (RFC 4648 section 5).
Specification
1. Layers
MCP JSON-RPC message (UTF-8 JSON)
└─ chunked into Noise transport messages (section 5)
└─ Noise handshake and transport (section 4)
└─ WebSocket binary messages: device ⇄ relay (section 3)
└─ relay ⇄ server: the relay's own tunnel, out of scope
The relay-to-server leg is out of scope. A relay MUST deliver each binary message from the device to the server, and each from the server back to the device, unmodified and in order, for the life of one WebSocket. It MUST NOT merge or split messages.
2. Discovery and the directory
A device needs a node id, an endpoint for it, and the anchor key. It learns them from one of:
- a pairing link (section 6.4), which also pins the anchor key; or
- a directory document, fetched over HTTPS from a URL the deployment publishes:
{
"extension": "io.modelcontextprotocol/sealed",
"profile": "mcp",
"anchor_key": "<b64u Ed25519 public key>",
"servers": [
{
"node_id": "<opaque, section 2.1>",
"endpoint": "<opaque wss:// URL>",
"identity_key": "<b64u Ed25519>",
"agreement_key": "<b64u X25519>",
"certificate": "<b64u signature, section 6.1>",
"online": true
}
],
"device_certificates": [ { "...": "section 6.2" } ],
"revocations": [ { "device_id": "<b64u>", "signature": "<b64u>" } ]
}
A device MUST verify each server’s certificate against the anchor key and MUST ignore a server whose certificate fails. A device that has already pinned an anchor key MUST stop if a directory lists a different one.
A directory reached through a server’s MCP Protected Resource Metadata or server card MAY advertise the extension under its identifier. The exact field is left to the MCP project’s general extension-negotiation mechanism.
2.1 Node ids and endpoints
The proposal fixes no address format. A node id is an opaque string of 1 to 128 characters from the base64url alphabet. An endpoint is an opaque wss:// URL. Clients MUST NOT parse, build or derive either one. They take both from the directory or a pairing link, and compare node ids only for equality.
- A deployment SHOULD make a node id carry no meaning: no person’s name, machine name, hostname, account handle, or anything else a relay operator, a log or a network observer could read as identifying. Two RECOMMENDED forms:
- random:
b64uof at least 16 random bytes, made when the node first registers with the relay; - key-derived:
b64u(SHA-256(P + " node id v1\n" || identity_key bytes)), truncated to its first 22 characters (128 bits).
- random:
- The relay maps each node id to the node’s outbound connection however it likes. The node id MAY appear in the endpoint, or the relay MAY hand out a different endpoint per device or per session (for example a capability URL that expires).
- The node id the ends bind into the prologue (4) and into node certificates (6.1) is the opaque id, never the endpoint. Moving a node to another relay or endpoint therefore needs no new certificate, and a relay that sends a session to the wrong node makes the handshake fail.
- A node’s human-readable name, if any, travels only inside the sealed session (for example in MCP’s
serverInfo), where the relay cannot read it.
3. The WebSocket
- The device opens the node’s
endpointwith the WebSocket subprotocolmcp.sealed.v1. A relay that accepts MUST echo it. - The device MAY send
Authorization: Bearer <token>(for example an OAuth 2.1 access token issued under MCP’s authorization specification). That token only decides whether the relay routes the session. It MUST NOT be used as, or to derive, key material. - Only binary messages carry the protocol. Text messages MUST be ignored. Pings keep the socket alive.
- One WebSocket carries exactly one sealed session, and one sealed session is one MCP session. When the socket closes, the session ends. A device that reconnects MUST run a new handshake and send
initializeagain. - A binary message is at most 65,536 bytes: one Noise message of up to 65,535 bytes, plus the mode byte on the device’s first message.
4. Handshake
- Protocol names:
Noise_IK_25519_ChaChaPoly_SHA256andNoise_XX_25519_ChaChaPoly_SHA256(Noise revision 34). The device is the initiator. - The prologue is the UTF-8 bytes of
P + " sealed v1\n" + node_id. A session therefore cannot be moved from one node id to another. - The device’s first binary message is one mode byte followed by the first Noise handshake message:
0x01IK when the device is enrolled and knows the server’s agreement key, or0x02XX when the device is enrolling (section 6). A server MUST close the session on any other mode. - Handshake payloads are UTF-8 JSON objects. Unknown members MUST be ignored.
IK (an enrolled device).
| Message | Direction | Payload |
|---|---|---|
| 1 | device → server | {"certificate": <device certificate>} |
| 2 | server → device | {"node_id": <node id>}, plus "renewed": <device certificate> when section 6.5 applies |
The server MUST check that the certificate verifies under the anchor key, that it has not expired, that its agreement_key equals the static key the handshake revealed, and that the device has not been revoked. If any check fails, the server MUST close the session without replying.
XX (a device enrolling).
| Message | Direction | Payload |
|---|---|---|
| 1 | device → server | empty |
| 2 | server → device | {"node_id", "identity_key", "certificate"}: the server’s node certificate |
| 3 | device → server | {"identity_key", "name"}, plus "pairing": <proof> for QR pairing (6.4) |
After message 2, the device MUST verify the node certificate under the anchor key it holds, against the agreement key the handshake revealed, and MUST stop if verification fails. A server that takes no new devices MUST close the session when it receives an XX message 1.
When Split() completes, the server’s first transport message (section 5) in an XX session is the enrollment result: {"enrolled": <device certificate>} or {"refused": "<reason>"}. After a refusal, the server closes the session. After enrolled, the session carries MCP like any IK session.
5. Transport framing
After Split(), every MCP message (one JSON-RPC request, response or notification, or a JSON-RPC batch where the negotiated MCP version allows one) is sent as one or more chunks:
plaintext chunk = flag (1 byte) || up to 65,518 bytes of the message
flag = 0x01 for the message's last chunk, 0x00 when more follow
binary message = Noise transport encryption of the plaintext chunk (adds a 16-byte tag)
- The limit of 65,518 bytes is Noise’s 65,535-byte maximum, less the 16-byte tag and the flag byte.
- An empty message is sent as one chunk holding only the flag
0x01. - A receiver MUST close the session when a chunk fails to decrypt, when a decrypted chunk is empty (it has no flag), or when a reassembled message would exceed its limit. That limit MUST be at least 16 MiB.
- Noise’s nonces reject replayed, reordered and dropped messages. There is no rekeying, because a session lasts only as long as its socket.
Within a session, MCP runs unchanged. Either side MAY send requests and notifications, so server-to-client requests (sampling, elicitation) work as they do over stdio. Mcp-Session-Id, SSE and resumability belong to Streamable HTTP and do not apply.
6. Trust anchor, certificates and enrollment
6.1 Node certificate
The node certificate is the anchor’s Ed25519 signature, in b64u, over:
P + " node certificate v1\n" + node_id + "\n" + identity_key + "\n" + agreement_key
identity_key and agreement_key are the server’s keys in b64u.
6.2 Device certificate
The device certificate is a JSON object:
| Member | Value |
|---|---|
device_id |
equal to identity_key |
identity_key |
the device’s Ed25519 public key, b64u |
agreement_key |
the device’s X25519 public key, b64u |
name |
at most 80 characters, no newline |
scope |
an opaque string the servers interpret (6.6) |
expires_at |
an integer, Unix seconds |
signature |
the anchor’s Ed25519 signature, b64u, over the payload below |
P + " device certificate v1\n" + device_id + "\n" + identity_key + "\n" + agreement_key + "\n"
+ name + "\n" + scope + "\n" + decimal(expires_at)
Certificates SHOULD last no more than 90 days.
6.3 Enrolling by short code
The default way to enroll is for the person to compare a short code on both screens:
- The device runs XX (section 4). Both ends then compute a code from the final handshake hash
h:d = SHA-256(P + " enroll code v1" || h). Take the first 4 bytes ofdas a big-endian unsigned integer, shift it right by 2, and read the top 30 bits as six 5-bit groups, most significant first. Map each group through Crockford’s base32 alphabet0123456789ABCDEFGHJKMNPQRSTVWXYZ, and show the result asXXX-XXX. - The server shows the device’s
nameand the code, and asks the person to approve. It SHOULD also ask whichscopeto grant. The device shows the same code. - If the person approves, a server that holds the anchor’s private key signs a device certificate and returns it as
{"enrolled": ...}. The device MUST verify that certificate under its anchor key, for its own agreement key, before it keeps it.
The comparison is what defeats a relay in the middle. A relay that substitutes its own keys runs two separate handshakes, one with each end, and the two have different hashes, so the codes differ.
6.4 Enrolling by QR code
A server that holds the anchor’s private key MAY show a pairing link as a QR code:
<scheme>://join?endpoint=<endpoint>&node=<node id>&anchor=<anchor key>&secret=<b64u of 32 random bytes>
The secret is single-use and SHOULD expire within 10 minutes. The device pins the anchor key from the link, not from the directory. In XX message 3 it adds:
"pairing": b64u(HMAC-SHA256(secret, P + " pairing v1\n" || h3))
Here h3 is the handshake hash just before message 3 is written. A server that finds a matching, unused, unexpired secret approves the device at once, with the scope chosen when the code was shown, and then discards the secret. A proof that matches no pending secret MUST be refused, not offered to the person for approval.
6.5 Renewal
When an enrolled device’s certificate expires within 30 days, a server holding the anchor’s private key MAY add "renewed" to its IK message 2: a new certificate for the same device_id and keys, with a later expires_at. The device MUST keep it only if it verifies under the pinned anchor key for the device’s own agreement key and lasts longer than the certificate it replaces. Otherwise the device MUST ignore it.
6.6 Scope
scope is decided by the server. Servers MUST apply it to everything a session may do, and SHOULD leave out of tools/list the tools the scope does not allow. Garage uses search (read tools only) and ask (also the server’s own model). A server MAY narrow a scope further by local policy, but MUST NOT widen it.
6.7 Revocation
A revocation is the anchor’s signature over P + " device revocation v1\n" + device_id. Servers MUST refuse a revoked device at its next handshake, and SHOULD share revocations through the directory so that every server learns of them.
7. Errors and closing
A server that refuses a handshake closes the WebSocket. The relay MAY tell the device that the server is offline by closing with code 1013 (Try Again Later). Errors at the MCP level are ordinary JSON-RPC errors inside the session. Close reasons MUST NOT carry anything confidential, because the relay reads them.
Rationale
- Noise rather than TLS inside the WebSocket. Noise needs no certificate authority, runs over a message transport without a record layer of its own, has small, well-specified handshakes with published test vectors, and IK gives a 1-RTT handshake that hides the device’s identity from the relay.
- A trust anchor rather than pairing with each server. One approval enrolls a device with every server the person runs, and the relay cannot add a server or a device, because it never holds the anchor’s private key.
- The anchor’s private key stays on servers. A deployment’s relay is usually also its sign-in and billing service. Keeping the anchor’s private half off the relay is what lets the relay host the directory safely.
- Sign-in only routes. OAuth remains the way a relay decides who may connect, and it composes with MCP’s authorization specification. Because the token never becomes key material, a relay that issues tokens still cannot read anything.
- Short code and QR, not trust on first use alone. The directory is the one place a relay could substitute the anchor key. Either a code comparison or a QR code catches that substitution.
- Opaque node ids and endpoints. Addressing is the relay’s business, and anything structured in it (a slug, a hostname, a path) leaks to every log and observer on the way and ties the protocol to one relay’s URL layout. Binding the opaque id, not the URL, into the handshake keeps the ends independent of where they are reached.
- A flag byte rather than a length prefix. Each chunk is already authenticated and its length is known, so a single continuation flag is enough. It also means a reassembled message cannot be truncated without the receiver noticing.
Alternatives considered:
- Deriving keys from the OAuth token. Rejected, because the issuer and the relay are usually the same party.
- TLS terminated on the server, with the relay passing it through by SNI. This is the only option that works for hosted MCP clients, which cannot run extra code. It is complementary to this proposal, needs no protocol change, and is left to deployments.
- P-256 in the Secure Enclave or StrongBox. This would keep device keys in hardware, but it leaves Noise’s named suites. It is a possible future suite.
Security considerations
- What the relay sees: the opaque node id it routes by, its own sign-in token (and so which account and device class), when each session opens and closes, how many messages cross and how large they are, and close reasons. Because node ids are opaque (2.1), the relay and anyone reading its logs learn which sessions go to the same node, not what or whose that node is. Implementations MAY pad messages to fixed buckets to blunt size analysis. This proposal does not require padding.
- What the relay cannot do: read or forge content, impersonate a device or a server, enroll a device, add a server, or move a session to another node id. It can drop or delay sessions.
- The first contact. The device first learns the anchor key either from the directory, which may be hostile, or from a QR code. The code comparison (6.3) or the QR secret (6.4) MUST be completed before a device trusts a directory-supplied anchor key.
- Forward secrecy. Every session uses fresh ephemeral keys. A static key compromised later does not reveal past sessions.
- Clients served by the relay. A browser client whose JavaScript the relay serves gets no end-to-end guarantee against that relay, because the relay could serve a page that leaks the keys. Such clients SHOULD NOT describe themselves as end to end. Native apps and locally installed bridges are the intended clients.
- Hosted MCP clients. An assistant whose MCP client runs on its provider’s servers cannot use this transport, and its provider reads whatever it retrieves. This proposal does not change that.
- Device keys SHOULD be non-exportable and excluded from backups (for example,
ThisDeviceOnlyin the Apple Keychain, or Keystore-wrapped keys on Android). - Lost devices. Revocation (6.7) takes effect at the next handshake. Certificates expire within 90 days. Sessions already open stay open until their socket closes. A server MAY close the open sessions of a device it revokes.
Backward compatibility
This proposal adds a transport. MCP’s messages, its lifecycle and its other transports do not change. A client or server that does not implement the transport is unaffected.
Reference implementation
Garage Door runs this protocol with P = garage: a Ruby relay, reference server end and desktop bridge, a Swift server end on macOS with iOS and macOS clients, and a Kotlin client for Android. Each is tested against the published Noise test vectors, and an end-to-end test checks that no plaintext crosses the relay. Garage Door’s code is closed source; the protocol described here is open for anyone to implement.
Garage’s deployment differs from this text in a few names and shapes, none of which touches the cryptography, so it can align without re-enrolling any device:
- It sends no WebSocket subprotocol yet;
mcp.sealed.v1is a one-line change on each end. - Its node id is the door id, a short slug, and the device builds the endpoint itself. The proposal’s node id is opaque and its endpoint comes from the directory.
- Its pairing link names the parameters
gateway,doorandaccount. - Its directory carries the same facts in its own shape behind Door’s sign-in, rather than as the public document in section 2.
- Its server end only answers requests; nothing Garage serves needs server-to-client requests today.
Open items
- Test vectors. Fixed keys, a fixed node id, and the resulting IK and XX transcripts, codes, pairing proofs, certificates and a chunked 70 KB message, generated from the Ruby implementation and checked against the Swift one. To come before submission.
- The extension identifier.
io.modelcontextprotocol/sealedassumes the MCP project adopts it; otherwise a vendor prefix applies. - Hardware-bound device keys, by adding a P-256 suite for the Secure Enclave and StrongBox.