Skip to content

List your product · How-to

MCP connectors and secrets by reference

A skill can call your API with a key the client stores, or connect your MCP server with a token, and the agent never sees either: it names the secret, and the runtime fills the value in on the way out.

Secrets by reference MCP connectors
The agent uses it through http_request, writing {{secret:NAME}} in a header value The server’s own tools, called directly
The request leaves from The enclave Anthropic’s MCP connector, as part of the model request
The value goes Into that header, only to the skill’s own hosts, over https Into the connector’s authorization_token
Declared in shipped.json as hosts and secrets hosts, secrets and mcp
Works on A seat, for its own skills and its catalog picks A seat, for its own skills and its catalog picks

Secrets exist only on seats. A job or a commissioned run has none, so on those a skill’s call that needs a secret is refused, and its MCP servers are not connected. Build the skill so a seat’s client can store what it needs: Skills and secrets on a seat shows the client’s side.

List each secret the skill uses under secrets in shipped.json, and every host it reaches under hosts. The crm-lookup example reads a client’s CRM both ways:

{
// Reads the client's CRM through its MCP server and its REST API. It pays nothing.
"schema": 2,
"name": "crm-lookup",
"version": "1.0.0",
"hosts": ["api.crm.example.com", "mcp.crm.example.com"],
"spend": [],
"payees": [],
"secrets": ["CRM_API_KEY", "CRM_MCP_TOKEN"],
"mcp": [
{
"name": "crm",
"url": "https://mcp.crm.example.com/mcp",
"secret": "CRM_MCP_TOKEN",
"tools": ["search_contacts", "get_contact"]
}
],
"limits": { "requests": 30 }
}

A skill lists at most 10 secrets. A name is capital letters, digits and underscores, starts with a letter and is at most 64 characters. A skill that names secrets has to declare at least one host, since a secret only ever goes to the skill’s own hosts. A secret belongs to one skill: a stored CRM_API_KEY for crm-lookup is invisible to any other skill that lists the same name.

Check the skill before anything else, from a checkout of the repository:

npm run cli -- skills check examples/crm-lookup
crm-lookup 1.0.0 passes: 3 files, 3.2 KB.
hosts api.crm.example.com, mcp.crm.example.com
spend none
payees none
secrets CRM_API_KEY, CRM_MCP_TOKEN
mcp crm at https://mcp.crm.example.com/mcp (search_contacts, get_contact)
requests 30 a task
hash 0x1cdd4b5107e401133a4249a4baf8272eccd73981148358a2ddf23155b0b0eabc

In SKILL.md, tell the agent to put the reference in a header value and to name the skill. A request to a host the skill declares runs under it even when the name is left out, but naming it keeps the call working when another skill declares the same host. From examples/crm-lookup, the call the agent makes:

{
"url": "https://api.crm.example.com/v2/contacts/42/orders?limit=20",
"skill": "crm-lookup",
"headers": { "authorization": "Bearer {{secret:CRM_API_KEY}}" },
"purpose": "Last orders of the customer named in the brief"
}

The runtime replaces {{secret:CRM_API_KEY}} with the stored value as the request leaves the enclave, and only when every rule holds. Otherwise the call is refused before anything is sent, and the agent gets one of these codes:

Code The request
secret_in_url Has a reference in the URL, written plainly or URL-encoded.
secret_in_body Has a reference in the body.
secret_in_header_name Has a reference in a header’s name.
bad_reference Has a reference not written {{secret:NAME}}, or a name that breaks the rules.
secret_needs_skill Goes to a host no active skill declares, so the runtime cannot tell where the secret may go.
secret_not_declared Names a skill that does not list this secret.
secret_wrong_host Is not https, names a port or credentials, or goes to a host the skill does not declare.
secret_missing Needs a secret the seat’s client has not stored for this skill. The agent is told to report it as stuck.
bad_header, headers_too_large Has a line break in a header, or more than 16 KB of headers in all.

The URL’s host must also be one of the skill’s hosts (host_not_declared otherwise), and the call counts against the skill’s limits.requests. Write the refusals your skill’s agent is likely to meet, secret_missing above all, into the skill’s instructions with what to do.

  • No redirects are followed. The agent gets the status and the location, so a server cannot bounce the header somewhere else.
  • Everything is scrubbed. The body, the headers, a redirect’s location and any error message are cleaned of every value sent, before the agent or the transcript sees them. Each value is caught as sent, URL-encoded, JSON-escaped and in base64, and replaced with [secret:NAME].
  • Credentials only come from secrets. An authorization, proxy-authorization or cookie header the agent writes without a reference is dropped, as are headers the runtime sets itself (such as host and the payment headers) and any x-forwarded-* header.

An entry under mcp connects one remote MCP server for the skill:

Field Meaning
name Lowercase letters, digits and single hyphens, at most 32 characters, unique in the skill.
url The server’s https address on the standard port, with no user name, password, query or fragment. Its host is listed under hosts.
secret Optional. A name from secrets, sent as the server’s authorization token.
tools Optional. The only tools the agent may call, 1 to 50 names, none a built-in tool’s name. Without it, every tool the server lists is allowed. A catalog product lists them.

The desk does not call the server itself. Each model request carries the skill’s servers to Anthropic’s MCP connector, which connects from Anthropic’s side and lets the model call the server’s tools directly. So:

  • The server must be reachable from the public internet over Streamable HTTP or SSE, the transports the connector supports. A server on a private network or a local stdio server cannot be connected.
  • The token travels with the model request, as the connector’s authorization_token. It is never shown to the model, and it is removed from anything the desk records.
  • With tools, the server is attached as an allow-list: every tool is off except the ones listed.
  • A server whose secret is not stored is left out. The skill’s text in the prompt says it is not connected until the client stores the secret, and the transcript records why. A run keeps the servers it started with for its whole life, so a secret stored mid-run connects its server from the next run on.
  • A server that fails is dropped for the rest of the run. When the connector cannot reach a server or list its tools, or its secret is deleted mid-run, the server’s tools are taken away and the agent is told to do the work another way or report it as stuck.
  • Its calls are not the agent’s HTTP requests. They do not go through the enclave’s network guard and do not count against limits.requests.

Prompts, tool calls and what a server returns go to Anthropic as part of the model request. Who can read what covers what leaves the enclave.

An MCP server answers the tool calls the agent makes, with data from your systems or the client’s. It cannot move the agent’s money: the agent’s keys stay in the enclave and no MCP tool can sign. Every payment goes through pay_transfer or http_request, under the agent’s caps, the skill’s payees and limits, and a label the enclave sets. The agent is told that what a server returns is data, never instructions.

Where the skill is Secrets MCP servers
A seat’s own upload Yes, the ones the seat’s client stored for it Connected
A catalog skill a seat picked Yes, the ones the seat’s client stored for it Connected
A catalog skill in the list a job or run sees No: nothing is stored, so secret_missing Not connected

A catalog product built on a connector or a client key is therefore a product for seats. Say so in its description, and say in SKILL.md which secrets the client stores and where to get them.

On a seat you hold, install the skill and store its key. The key is read from a hidden prompt, or from a file or standard input with --file, never from a flag:

npm run cli -- seat skills 26697 install ./crm-lookup --yes
printf '%s\n' "$CRM_API_KEY" | npm run -s cli -- seat secrets 26697 set crm-lookup CRM_API_KEY --file - --yes
Install a skill on seat 26697
- Sign and upload a skill bundle of 3 files to seat 26697. The seat's public record shows its hash.
{
"name": "crm-lookup",
"version": "1.0.0",
"hash": "0x1cdd4b5107e401133a4249a4baf8272eccd73981148358a2ddf23155b0b0eabc",
"warnings": [],
…
}
Store CRM_API_KEY for crm-lookup on seat 26697
- Sign and send the secret CRM_API_KEY for the skill crm-lookup to seat 26697. The desk seals it; the agent's model never sees it.
Stored CRM_API_KEY for crm-lookup on seat 26697. The value is not shown again.

This ran on a development desk, where 26697 is the seat’s agent id; use your seat’s. The full rehearsal of a seat month (Rehearse a whole hire) runs a skill whose key is filled in by reference against a mock host, and checks that the key reached only that host’s header and was scrubbed from the echo and the transcript.