Skip to content

Spec · Reference gateway · For MCP

Make every AI tool call
say what it does.

WebSpec gives each MCP tool an HTTP method and a path, taken from the tool's name. A gateway in front of your unchanged MCP servers refuses any method the tool's contract doesn't admit.

Request · reference gateway200 OK
DELETE /note?id=welcomeHost: notes.localhost
  • who
  • what kind
  • on what
  • with what

The problem

To the web, every MCP call looks the same.

MCP's HTTP transport sends every tool call as a POST to one endpoint. Since its 2026-07-28 revision a header names the tool, but the rules the web applies by method, such as CORS preflights and method allow-lists, still treat a read, a send, and a delete alike. WebSpec puts what a call does back on the request line, where browsers, proxies, and logs already look.

MCP over HTTPevery call is a POST to /mcp (abridged)
POST /mcp
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: delete_note

{"jsonrpc": "2.0", "id": 1,
 "method": "tools/call",
 "params": {
  "name": "delete_note",
  "arguments": {"id": "welcome"}}}
Through a WebSpec gatewaythe method says what kind of act
DELETE /note?id=welcome
Host: notes.localhost

→ 200 OK

Read it like a sentence

Every part says one thing, and the gateway checks them.

The gateway learns what a tool does, its contract, from the annotations its MCP server declares or from the operator, never from the request. The method and the path select one tool, and on POST a header names the action.

notes.localhost

Who handles itThe host names the destination: here, the MCP server notes. Browsers treat each host as its own origin, and proxies route by it.

A host the gateway doesn't serve, such as mail.localhost: 404 unknown_service

DELETE

What kind of actThe tool's contract, not the caller, decides which methods may run it (MB-1). delete_note declares itself destructive and idempotent, so its contract admits DELETE and not GET: HTTP defines GET as safe, and crawlers follow every link.

A send by GET /email: 405 Method Not Allowed with Allow: HEAD, OPTIONS, POST

/note

On whatThe route rule splits the tool's name at its first underscore. The verb picks the method, and the rest is the path, so delete_note is DELETE /note and read_note is GET /note (PA-4). If the name starts with no verb of the rule, or that verb's method isn't admissible (the contract must admit it, and a tool that isn't idempotent never gets PUT or DELETE), the tool keeps its full name as its path.

A method /note doesn't map, PUT /note: 405 Method Not Allowed with Allow: HEAD, OPTIONS, GET, DELETE A path that maps no tool: 404 tool_not_found

id=welcome

With whatArguments travel in the query or in a JSON body. Bodies must be strict JSON, and each query key may appear once.

A repeated key, ?id=welcome&id=other: 400 duplicate_query_key

SEND

Which action, on POSTPOST covers many kinds of act, so a POST names its action in one word, in the WebSpec-Definer header: send_email is POST /email with SEND. On other methods the definer is optional. A page on another origin can't add this header without a CORS preflight, and by default the gateway refuses the preflight.

CREATE on POST /email: 400 unknown_action A form posted from another site, which can't carry the header: 400 missing_definer

So a GET can reach only a tool whose contract says it is read-only.

Every answer in this section is the reference gateway's, and its test suite checks each one. How it works explains each part in full.

Turn the dial

Raise the level. The model's part never changes.

The operator sets each destination's security level, from 0 to 4. A bank check must be filled in the way the bank expects, carries a signature, bears a number so it is paid only once, clears before the money moves, and may need a second signature when the stakes are high. Each level adds the next of those guarantees, and none takes one away. The model writes the same request at every level. The shim, a small signing layer in the harness that runs the model, adds the rest.

send_email, a send that reaches outside systems (open-world)written by the modeladded by the shim
POST /emailHost: notes.localhostContent-Type: application/jsonWebSpec-Definer: SENDIdempotency-Key: k-91c2WebSpec-Clearance: ff3ea9ba:1792704267WebSpec-Approval: 8b6ef55bac3e5e620082df6b…WebSpec-Nonce: 85e7e0a121d79d6325591680d1fd9172WebSpec-Guard: 1b637e7d {"id":"welcome","to":"ana@example.com"}
Adds
Method binding, the definer on POST, and strictly parsed arguments. Served only on loopback names.
Without it
No definer: 400 missing_definer
Adds
The guard: an HMAC over the method, host, path, query, body, definer, and any idempotency key, with a single-use nonce. The shim and the gateway share its key. Required on a public domain.
Without it
401 guard_missing
Adds
An Idempotency-Key for tools that aren't idempotent, so a retry with the same key gets the stored answer instead of running the tool again.
Without it
400 idempotency_key_required
Adds
A single-use clearance from the harness's policy, bound to this destination, method, tool, and arguments, for every change and for reads marked sensitive or dangerous.
Without it
403 clearance_missing
Adds
A person's signature over the request's method, destination, path, arguments, and body, for destructive tools, tools marked dangerous (the highest risk tier), and open-world changes.
Without it
428 approval_required, with a summary for a person to sign

At each level this is a real request that the reference shim sent to the demo server at that level, under the walkthrough's demo key, and the gateway answered 200 OK. At level 4 it is the second attempt, which carries a person's approval, shortened here. Security levels has the rules.

Where it sits

An HTTP face for the MCP servers you already run.

Model

Writes the method, path, arguments, and on POST one verb. Needs no key.

request
Harness shim

Adds the nonce, signatures, idempotency key, clearance, and approval the level calls for. Learns what to add from OPTIONS.

HTTP
WebSpec gateway
  • Routes each request to one tool, and checks its method against the tool's contract, pinned so a server can't loosen it while the gateway runs
  • Runs the checks the destination's level requires
  • Keeps a hash-chained audit log
MCP
MCP servers

Unchanged, over stdio or HTTP. Their annotations become each tool's contract.

WebSpec and MCP compares what each provides.

Scope

What it stops, and what it doesn't.

Stops

  • L0Any method the tool's contract doesn't admit, such as a GET to a tool not marked read-only
  • L0Forms and scripts on other sites sending unsafe requests
  • L1Forged, altered, or replayed requests
  • L2A retry that would run a side effect twice (best effort under load)
  • L3Changes, and reads marked sensitive or dangerous, that the harness's policy didn't vouch for
  • L4Destructive or dangerous calls, and open-world changes, that no person signed, even from a harness that can't sign with an approver's key

Doesn't

  • —Judge intent. A well-formed, signed call that does the wrong thing passes levels 0 to 3.
  • —Check arguments against the tool's schema. They're checked for form only: strict JSON and no repeated query keys.
  • —Gate open-world reads. A URL fetcher can carry data out in its arguments unless you raise it to dangerous.
  • —Survive a stolen guard key below level 4. One key signs everything levels 1 to 3 require.
  • —Resist guessing on its own. Guard and clearance tags are 32 bits today, so rate-limit at the edge.
  • —Remember across a restart. Nonces, idempotency records, and contract and binding pins live in memory, and a stdio server, which runs as the gateway's user, can force a restart.
  • —Recognize a renamed tool. A tool listed under a new name, on a route no tool held, gets the contract its listing claims.
  • —Help if traffic can route around it. The gateway must be the only way out.

Threat model · Known limits

Where it stands

Built and tested, with the rest written down.

Implemented

Host routing, the route rule and binding pins, tool contracts and pinning, method binding, levels 0 to 4, a hash-chained audit log, and reference deployments for Linux, macOS, and Docker. CI runs the gateway against real MCP servers.

Proposed

Independent signers per level (RFC 9421 signatures), durable state, schema validation, scoped tokens, and intent checks. See the roadmap.

Where to start