Skip to main content
An MCP server is a remote service that offers tools over the Model Context Protocol. When you add one to an agent, each session connects to the server, discovers its tools, and lets the agent call them. Calls are made outside the sandbox, and vault credentials are attached to those requests and masked from returned text and structured data before the agent sees them. This page covers agents calling out to MCP servers. To connect your coding assistant to these docs or to the Managed Agents MCP endpoint, see Use with AI coding agents.
Changing an agent or testing a server needs the organization developer or admin role. Testing a server needs the create permission, so the organization user role can’t run a test. See Organizations and roles. The server must use the Streamable HTTP transport at a public http or https URL. Servers on private, loopback, or link-local addresses are refused. Local servers that run over stdio aren’t supported. If the server needs a token, have it ready; the token goes in a vault.
If the service is available in Integrations, connect it there and choose its tools or access level instead of adding an MCP server and a vault credential.
On the Managed Agents MCP endpoint, operation arguments name path parameters in camelCase, such as vaultId. The request body keeps the operation’s REST field names, which the Endpoints reference shows for each operation. Create skills with scripts, and read a skill version’s content, in the console or with the REST API.

Add an MCP server to an agent

Each server entry has a name and a url. MCP servers belong to the agent version, so adding one creates a new version. Running sessions keep the tools they have until you move them to the new version.
  1. In the sidebar, click Agents and open the agent.
  2. On Configuration, find Tools and click Add custom MCP server.
  3. Choose a server from the list or paste its URL. The list suggests a few common servers and says what kind of token each needs. A server from the list is named for you; any other server is named after its URL.
  4. Click Save new version.
The response is the agent at its new version:
If the server project-tracker offers list_issues, the agent sees project-tracker__list_issues. The prefix keeps two servers from clashing. A new version replaces the whole definition, so send skills, tool settings, vault defaults, and every other field you want to keep. See Agents. Next, authenticate the server.
Declared headers are part of agent and session configuration and can be read by users allowed to view that configuration. Keep secrets in a vault. Do not rely on a static header’s name or value to protect a secret.

Authenticate the server

Store the server’s token in a vault as a Token for an MCP server (bearer_token) whose server URL matches the agent’s url. Then grant the vault to the agent with defaultVaultIds, or to a session with vault_ids. If you narrow grants with credential refs, include this credential. Tokens that you paste are stored as-is and aren’t refreshed. If the server issues short-lived OAuth access tokens, rotate the credential before it expires.
A granted token also adds its server. A token for an MCP server in a granted vault adds its server’s tools to the session even if the agent doesn’t list that server. Those tools get a generated vault-... prefix. To keep a server out of a session, don’t grant the vault that holds its token, or leave the credential out of the credential refs.
  • URLs match after lowercasing the scheme and host, dropping a default port (:443 or :80), and ignoring a trailing slash. A different path, subdomain, or port is a different server, so the token isn’t sent there.
  • The token is sent as Authorization: Bearer <token> by default. For a custom credential header such as X-Api-Key, set the vault bearer credential’s secret_name (API only) to the header name. The token is sent as-is under that name. Credential protection also applies to other permitted custom header names when they are bound this way through the vault.
  • If two granted vaults hold a token for the same server, the vault listed first in the session’s grants wins.
  • If no token matches, the session connects without one. That works for public servers and fails for servers that need authorization.
If your server only accepts known IP addresses, allow Recursion’s outbound addresses. Keep the token as well: the addresses are shared by every organization.

Verify the organization caller identity

If you operate an MCP server and want a second check on calls from Recursion, set google_identity to "organization" on its declaration. For example:
Saving the agent waits for Recursion to prepare this organization’s delegate service account. The same delegate is reused for later agents and integrations in the organization. If preparation fails, the agent version is not saved; retry the save. Any agent author in the organization can enable this through the API or the Present organization identity option on a custom MCP server in the console, including for an endpoint they control. It does not replace the server’s access token. The receiver must check the exact audience on every token; checking only the delegate email lets a token issued for another server impersonate this caller. Use an HTTPS URL without user info, query or fragment. Declare an identity-enabled endpoint only once; integration-owned MCP endpoints cannot use this option. Omit google_identity to turn it off rather than setting it to null. On a vault-backed server, edit this declaration through the API or Raw mode; the console checkbox applies to custom servers only. Every MCP request to the declared URL carries X-Recursion-Caller-Identity: Bearer <Google ID token>. Authorization continues to carry the vault credential. The token is short lived and renewed by Recursion. It is audience-bound to the exact full HTTPS MCP URL in the declaration, including its path. The receiver can run on Google Cloud, AWS, or elsewhere: validate the JWT against Google’s public signing keys, require issuer https://accounts.google.com, require that exact audience and a valid expiry, require email_verified, and allowlist the expected delegate service-account email in the email claim. A verified email is the organization identity; do not infer the organization from an unverified header or from the source IP. The receiver still needs its own access-token checks and authorization for the requested tool. The delegate email is stable for an organization. After a successful save, the API returns it as delegate_principal on the enabled mcpServers entry. Share that email with the server owner for its allowlist; it is not a secret. This header is verified by the MCP server itself. Cloud Run IAM cannot verify this caller: a direct Cloud Run receiver must allow unauthenticated invocation and verify X-Recursion-Caller-Identity and the access token in its application. Console export keeps the setting on custom servers, and import prepares the destination organization’s delegate. Its email differs from the source organization’s email, so update the receiver’s allowlist. Console export reports identity on a vault-backed server as not exported; add it again after import. Agent-folder export carries identity on custom servers and reports it as omitted on vault-backed servers.

Test a server before you use it

probeMcpServerV2 makes one live connection using the same URL matching and vault lookup as a session. It creates and changes nothing, but it needs the Developer or Admin role, like creating resources. See Organizations and roles. Omit vaultIds to test without a token. The standalone probe has no agent declaration, so it does not present google_identity. For a server that requires organization identity, save the agent with the option enabled and test it through a session.
  1. In the sidebar, open Advanced, then click Credential vaults and open the vault.
  2. Expand the server’s Token for an MCP server row. It shows whether the server is reachable and how many tools it offers.
  3. Click Test again to run a new test.
Each tool carries readOnlyHint only when the server set annotations.readOnlyHint in its tool list: true when the server says the tool only reads, false when it says the tool may write. It is the server’s advice, passed through as is. Recursion neither verifies nor enforces it, and it never makes a tool run for real in a simulation; only the entry’s simulation list does. A failed test still returns 200. Read the body: What success means: a passing test proves the server is reachable and that the token lets you list tools. It doesn’t prove that every tool call will succeed; permissions, arguments, and the server’s own state still matter.
A test gives up after 15 seconds. A server on a private, loopback, or link-local address is refused before anything is sent, so the test returns reachable: false and fault: egress_blocked with the reason in error.

How a session uses an MCP server

  1. When a session starts, or moves to another agent version, it reads the MCP servers on that version.
  2. For each server, it looks for a Token for an MCP server in the session’s granted vaults whose server URL matches.
  3. It connects, lists the server’s tools, and fixes that list and the tool schemas until the session moves to another agent version.
  4. The agent calls a tool as <server name>__<tool name>. The token is attached to every call outside the sandbox.
Tools, prompts, and resources: sessions use the server’s tools. Text and images that a tool returns are passed to the agent. Server prompts and standalone resources aren’t offered, and resource links in a result aren’t fetched.

Choose which tools an agent gets

A session receives every tool the server lists for its token, except a tool whose <server>__<tool> name is over 119 bytes, which is left out with a warning. You can’t hide individual tools of a server. To limit what an agent can do, give it a token whose scopes allow only what it needs, or point it at a server that offers fewer tools.

Require approval before a tool runs

A server entry can name tools that run only after a person approves the exact call. Add an approval object with the API or an agent folder. The console keeps it when you save the agent, including on a server it generated from a vault credential, but doesn’t edit it yet. A gated server generated from a vault credential has no remove button, because removing the card alone would let the credential grant recreate it without its approval. It is reachable only while a granted credential claims its URL, so turning that credential off stops it; to remove the entry itself, delete it in Raw mode along with the credential. The console blocks a save that would keep such a server reachable without its approval. Exporting an agent from the console leaves a gated server out, along with any granted credential for its URL, and names both in the export’s notes, so you can add them again in the target organization with its approvers. Exporting to an agent folder keeps the approval object, including on a server generated from a vault credential, which the folder declares by its URL so the exported credential still reaches it gated. Neither export grants a credential for a gated server without its approval, because importing would regenerate the server from the credential ungated.
  • tools names 1 to 64 tools, or is ["*"] to gate every tool the server offers, including tools it adds later. When the entry has allowed_tools, every gated tool must be in it.
  • approvers.slack_user_ids names 1 to 25 Slack users (IDs start with U or W). Only they can decide through Slack. With a custom Slack app, anyone holding its Signing Secret can forge an approver’s click; limit who holds that secret.
  • An empty approval, an empty list, or an unknown key is refused when you save the agent, so a typo can’t silently remove the gate.
  • Declare a gated endpoint once. A second entry with the same URL as a gated entry is refused, because only one of them would apply.
  • Give a gated server and its vault credential exactly the same URL. A session refuses to start its tools when a granted credential’s URL is a different spelling of a gated server’s URL (different case, extra slashes, or . and .. path segments), rather than send the credential without the approval.
When the agent calls a gated tool:
  1. Recursion posts an approval card in the session’s Slack thread showing the tool, the server, and every argument, with Approve and Deny buttons. The arguments are shown as JSON. In the arguments and in the tool and server names, backticks and characters that can hide or reorder text (invisible, direction-changing and combining characters, and spaces other than a plain space) appear as \u escapes, so what you read is exactly what runs. Letters that only look like others, from a different alphabet, still appear as letters, so read names and values with care. The call doesn’t run, and the agent is told it is waiting.
  2. An approver clicks. Anyone else who clicks sees a private note and nothing changes. A custom Slack app’s Signing Secret holder can forge a click as an approver. The card updates to show who decided, and the session wakes with the decision.
  3. After an approval, the agent calls the tool again with the same arguments, and the call runs once. A call with different arguments is a new request.
A request waits 24 hours for a decision, and an approval waits 24 hours to be used; after that it expires and the agent must ask again. A denial stands for that exact call in the session. Each session tree can make at most 50 requests. A call whose arguments would take more than 24 KiB to show is refused, because the card must show all of it. An approval belongs to the session that asked for it. A delegated agent in the same session tree can’t use it, even for the identical call. Approval needs a Slack-started session whose agent holds a Slack integration grant for that workspace, so the card can be posted. In any other session a gated tool is refused and doesn’t run. That includes sessions started from the console or a schedule, and delegated agents, which have no Slack thread of their own. A gated tool is also refused in a session whose Slack replies require review (slack_reply_review), because the card would post the arguments to Slack without that review. The approver list is fixed when a session starts; changing it affects new sessions only. The gate applies to tools reached through this server entry. A vault credential the agent can use for the same server under a different URL, or a native integration for the same vendor, is a separate tool surface and isn’t gated by this entry. A session refuses an entry that declares approval on an endpoint reached only through a native integration, rather than drop the gate and serve those tools ungated.

Choose which tools run in a simulation

A simulation runs your agent against its real servers without changing them: unless the run allows writes, every call to a custom MCP server is recorded and answered with a simulated success instead of running. To let the agent read real data during a simulation, name the tools that only read in a simulation object on the server entry. Those tools run for real in a simulated session; unless the run allows writes, every other call is still recorded. Outside a simulation the object changes nothing. Saving an agent refuses the object on an entry for one of Recursion’s own tool services: those tools’ simulation behavior is fixed by Recursion, which records every call it does not itself allow. On such an entry saved before that check, the object is ignored and the session still starts. An entry for Recursion’s Slack tools is skipped in a simulation. A simulated Slack server takes its place only for an agent with a native Slack grant; an agent that reaches Slack through such an entry or a vault credential alone has no Slack tools in a simulation. The simulated thread is never posted to Slack. If the agent has a Slack workspace grant, its catalog read tools, such as reading a channel, a thread or a user profile, run against real Slack with the workspace installation’s token. A read of the simulated thread’s own channel returns that channel’s real history, without the simulated conversation, and fails for a channel that doesn’t exist. Every write through Recursion’s Slack tools is recorded instead of sent, even when the run allows writes; a write that reaches Slack another way, such as through an integration connector or your own Slack MCP server, runs for real once the run allows writes. A grant limited to the triggering thread reads nothing from Slack. On an integration whose tools you find through a tool search, the tools its catalog marks read-only and not destructive (corrected by Recursion where the catalog mislabels a write), plus the tool search itself, run for real in a simulation; unless the run allows writes, every other tool your selection allows is recorded. A tool outside the selection is refused, as it is outside a simulation.
  • read_only_tools names 1 to 64 distinct tools (a longer list is refused), each exactly: a wildcard such as * or get_* is refused, so, unless the run allows writes, a tool the server adds later is recorded until you name it. A name longer than 128 bytes, or one with a space or a control character, names no tool and is refused.
  • When the entry has allowed_tools, every read-only tool must be in it. A tool the entry’s approval gates can’t also be read-only, and "*" in approval.tools leaves no tool that can be.
  • An empty simulation, an empty list, or an unknown key is refused when you save the agent.
  • You decide what counts as read-only, and Recursion does not verify it: a tool you name runs for real in every simulation, so a tool that writes, named here, changes the real system. A server can mark a tool readOnlyHint in its own tool list, but Recursion never relies on that either: unless the run allows writes, a tool you don’t name is recorded, whatever the server says about it.
  • The list is part of the agent version, so changing it publishes a new version, and anyone who can edit the agent can change it.
  • It applies only to the server entry that declares it. Unless the run allows writes, a server generated from a vault credential with no entry records every call; add an entry for its URL to name its read-only tools. Native integrations such as GitHub, Slack, Jira, and Confluence use Recursion’s own read-only lists, and an entry can’t widen them.
The console keeps simulation when you save the agent, including on a server it generated from a vault credential. On the server’s card, Runs for real in simulations lists the named tools as ticked boxes; List tools connects to the server with the agent’s default credential vaults, like a server test, and adds a box for each tool it advertises. Like that test, it sends neither the entry’s own headers nor its organization identity, so a server that needs either may list nothing; name its tools in Raw mode instead. A tool the server marks readOnlyHint says so beside its box but is never ticked for you. The card greys out a tool the save would refuse by its name, allowed_tools or approval, keeps a named tool the server no longer lists until you untick it, keeps a tool you untick as an empty box while you edit the entry, and on a server a credential provides keeps at least one tool: remove the entry to record every call. The card doesn’t know which endpoints are Recursion’s own tool services, so on such an entry it still offers boxes, and the save refuses any you tick. Listing tools needs the Developer or Admin role. You can also edit the list in Raw mode, through the API, or in an agent folder. Exporting to an agent folder keeps it; exporting from the console leaves it out and lists the server as not exported, so, unless the run allows writes, the imported agent records every call until you add it again.

What happens when a server fails

  • At session start: an unreachable server, a rejected token, or a server that lists no tools doesn’t stop the session. Other servers still load, and the session’s events record a warning naming the servers: mcp_auth_rejected when a server refused the request, mcp_no_tools when a server answered but listed no tools, mcp_discovery_failed for any other failure, and mcp_tool_name_too_long for each tool whose <server>__<tool> name is longer than 119 bytes: that tool is left out and the rest of the server’s tools load. Fix the token, or the URL or server, then start a new session. A running session lists a server’s tools again only when it moves to another agent version; moving it to the version it already runs changes nothing.
  • During a call: each request to the server has a 60-second timeout, and a response can be at most 8 MiB. A failed call returns an error to the agent as the tool result, and the agent can decide what to do next.

What can go wrong

The most common problems:
  • A session has an mcp_auth_rejected warning. The server refused the request with 401 or 403. If the warning says the session was granted no credential for the server, turn one on in the agent’s default credentials and save a new agent version, or grant the automation or session a vault that holds one. Otherwise check or rotate the token in the vault. Then start a new session.
  • A session has an mcp_no_tools warning. The server answered but listed no tools. Check that the server offers tools and that its credential grants access to them, then start a new session.
  • A session has an mcp_discovery_failed warning. The server was unreachable, failed the handshake, or is on a private address. Run a test with the same URL and vault, fix the cause, and start a new session.
  • Unexpected vault-... tools appear. A granted vault holds a token for an MCP server the agent doesn’t list. Remove the credential from the session’s grants, or add the server to the agent with a name you choose.
For all error codes, see Errors. For limits, see Limits.

Next steps

Vaults and credentials

Store tokens for MCP servers and control which sessions receive them.

Agents

Publish a new agent version with its MCP servers attached.

Tools

See the built-in tools every session can use.

Events

Read discovery warnings and MCP tool calls in the session timeline.