API reference

MCP protocol

The JSON-RPC 2.0 endpoint agents connect to, and exactly what it answers.

Most people never read this page: any MCP client that speaks Streamable HTTP (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, the OpenAI Agents SDK, the official MCP SDKs) connects with just the URL and token, or for a server people sign in to, the URL alone. The test suite connects with the official MCP Python SDK on every run. This page is for people writing their own client or debugging one.

Endpoint#

POST https://api.tracehold.ai/mcp/<server-id>/
Authorization: Bearer <server-token>
Content-Type: application/json

The URL works with or without the trailing slash. Each request is one JSON-RPC 2.0 object; responses are plain JSON, except the streams that tell an agent its tools changed (below).

Signing in#

A server set to People sign in takes an access token from Tracehold's sign-in instead of the server's token (Agent identity). Without a valid one, every request (and the stream) answers 401 with:

WWW-Authenticate: Bearer realm="tracehold",
  resource_metadata="https://api.tracehold.ai/.well-known/oauth-protected-resource/mcp/<server-id>",
  scope="mcp"

(on one line), plus error="invalid_token" when a token was sent. MCP clients follow resource_metadata to Tracehold's authorization server and sign the person in. A server that takes its token answers 401 without resource_metadata, and refuses an access token; a sign-in server refuses its own server token.

Protocol revisions#

Tracehold speaks both:

RevisionHow a client startsChange notices
2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05initialize (Tracehold agrees on the version asked for, else offers 2025-11-25), then Mcp-Session-Id on every requestA GET stream
2026-07-28server/discover; no handshake, no session: every request names its version in _meta and the MCP-Protocol-Version header, with Mcp-Method (and Mcp-Name for tools/call)subscriptions/listen

Clients choose: a 2026-07-28 client discovers first and falls back to initialize on servers that do not answer it. On 2026-07-28, results carry resultType: "complete", tools/list says cacheScope: "private" and ttlMs: 0, ping is gone (404), and errors use the specification's codes and HTTP statuses (-32022 unsupported version with data.supported, -32020 when a header is missing or disagrees with the body; the =?base64?...?= form is read). tools/list is sorted. With no session id, a client's calls on a server are one session while they keep coming within 30 minutes, by the name and version it gives in clientInfo. Claude Code 2.1.296 connects with initialize and listens on the GET stream.

A connector that serves MCP inside your network answers on the same path (http://<connector address>:<port>/mcp/<server-id>/) with the same token or sign-in. It relays to this endpoint with an X-Tracehold-Connector header; agents never send that header themselves. When the connector relays an allowed call, the reply carries the job in result._meta["tracehold/connector_job"]; the connector runs it and answers the agent itself, so the output stays in your network.

Methods#

MethodAnswer
initializeServer name, the protocol version the client asked for (else 2025-11-25), tools capability with listChanged: true, and an Mcp-Session-Id header
notifications/* (no id)HTTP 202, empty body
ping{}
tools/listThe tools this server exposes, including tools from your own MCP servers as <server>__<tool>, and Tracehold's tracehold_wait_for_approval (Approvals)
tools/callRuns the call through the gateway (below)

Anything else returns -32601 Method not found.

Sessions#

initialize answers with an Mcp-Session-Id header. Send it back on later requests, as the MCP specification describes, and every call is grouped into that session under Activity → Sessions. Clients that do not send it are grouped by time (calls within 30 minutes of each other).

When the tools change#

An agent fetches the tools once, when it connects. To hear about changes it keeps a stream open: on 2025-06-18, a GET on the same address with Accept: text/event-stream and the same token or sign-in; on 2026-07-28, a subscriptions/listen request with notifications.toolsListChanged, which is acknowledged first and then carries the notices tagged with its io.modelcontextprotocol/subscriptionId. When someone adds or removes a tool on the server's page, Tracehold sends

{"jsonrpc": "2.0", "method": "notifications/tools/list_changed"}

and the agent calls tools/list again; nothing needs to reconnect. Agents that do not listen see new tools when they reconnect. A removed tool can never be called, whatever list an agent holds.

A stream sends a keep-alive every 15 seconds and ends after 30 minutes (the agent opens another). Replacing the server's token, pausing it or deleting it ends its streams at once, and the old token cannot open another; stopping an agent signed in as a person ends that agent's streams. Agents connected through your connector get the same stream through it.

tools/list#

Each tool carries a one-line description and a JSON Schema for its arguments. For AWS these come from the AWS API definitions, so the agent sees the real parameter names and which are required:

{
  "name": "aws_s3_delete_bucket",
  "description": "Deletes the S3 bucket. (AWS s3 DeleteBucket)",
  "inputSchema": {
    "type": "object",
    "properties": {
      "Bucket": { "type": "string", "description": "Specifies the bucket being deleted." },
      "ExpectedBucketOwner": { "type": "string" }
    },
    "required": ["Bucket"]
  }
}

For providers Tracehold only observes (Kubernetes, GitHub, Cloudflare, Datadog, Terraform) the description ends by saying the call is checked and recorded but not run, so the agent does not wait for a result that will not come.

tools/call#

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": { "name": "aws_s3_delete_bucket", "arguments": { "Bucket": "my-data" } }
}

Every outcome is a normal MCP tool result. isError is true when the action did not run, and the text says why in words the agent can act on.

Allowed and run: your connector ran it. isError: false, the cloud API's response as JSON; for a tool from your own MCP server, that server's answer as it gave it.

Blocked:

Action blocked: Guardrail: Critical actions are blocked on this server

Suggested alternative: s3:PutBucketLifecycleConfiguration
Reason: Set a lifecycle expiration policy instead of deleting the bucket immediately.

Held for a person:

Action requires human approval: Guardrail: Destructive actions are sent to a person on this server
Action ID: 714ddba0-3fec-41e5-a893-0c362291ea48
Approval expires at: 2026-09-28 18:27:36+00:00
To wait for the decision, call tracehold_wait_for_approval with this Action ID: it waits up to 25 seconds at a time, so keep calling it until a person decides or the request expires (people can take several minutes). Once a person approves, it runs this call and returns its result. Repeating this exact call after approval also runs it. Changing the arguments starts a new approval request.

Monitor mode (deploy_mode sandbox): an allowed call runs and answers as above. A call production would hold or block (isError: false) does not run; the text says what production would do:

Recorded, not run: this server is in monitor mode, where allowed calls run and the rest are only recorded. In production this call would be blocked (Guardrail: Critical actions are blocked on this server).
Action ID: e5739bbc-2e94-450f-97c5-a9309c29b7e6

Allowed but not run (isError: true): no connector is online, the cloud is not connected, or the provider is observe-only. The text names which:

Allowed, but not run. No connector is online, so nothing ran. Calls run only on a connector in your cloud, never anywhere else.
Action ID: e5739bbc-2e94-450f-97c5-a9309c29b7e6

Unknown tool: Tool not found: <name>, isError: true.

Errors#

JSON-RPC errors are reserved for requests that never reach the gateway:

CodeMeaning
-32700Body is not JSON
-32600Body is not a single JSON-RPC object
-32601Method not found
-32001Missing or wrong token, with HTTP 401 and WWW-Authenticate (above)
-32002Server is paused or disabled, with HTTP 403; an owner or admin turns it back on on its page
-32003Rate limit exceeded (server-wide, or per risk tier)