Skip to content

MCP ​

Overview
What it isAn MCP server that gives agents tools
CLIagt mcp
Agent toolsresource_* with kind: "mcp", resource_test, mcp_probe, agent_mcp_list
Web consoleResources → MCP; MCP in the agent form
Filemcps/<category>/<name>/mcp.json
Crateagt-mcp

What it does ​

An MCP resource describes how to start (stdio) or reach (HTTP) one Model Context Protocol server. Attach it to native agents, and they can call its tools. Each run connects to the agent's MCP servers at the start, and every call is checked against the tool's input schema and the approval policy.

Registering a server does not give anyone access; only agents it is attached to can use it. Codex agents do not use these resources; configure MCP in Codex instead.

How to use it ​

Web console: Resources → New resource → MCP, then paste the configuration.

CLI:

bash
agt mcp create files --file ./files.json
agt mcp probe files                       # start it and list its tools
agt agent update researcher --add-mcp files

Agent tools: register with resource_write, check with mcp_probe, attach with resource_write(kind="agent", data={}, add={"mcps":["files"]}). See MCP tools.

Common parameters ​

ParameterMeaning
command, args, cwdHow to start a stdio server; cwd must be absolute
urlAddress of an HTTP server
bearer_token_env_varEnvironment variable holding the HTTP bearer token

All parameters ​

Commands ​

CommandOptionsMeaning
create <name>--file <path> (required), --category <c>Register a server from a JSON file
update <name>--file <path> (required), --category <c>Replace the configuration
test <ref>--category <c>Validate the configuration. Does not start or contact the server.
probe <ref>--category <c>Start or connect exactly as a run would, initialize, list tools and compile their input schemas, then disconnect. Calls no tool.
list, info, delete, categorySee Resources

File: mcp.json ​

The file is an mcpServers object with exactly one server, whose key must equal the resource name.

stdio server

json
{
  "mcpServers": {
    "files": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/srv/shared"],
      "cwd": "/srv/shared",
      "env": { "LOG_LEVEL": "warn" }
    }
  }
}
FieldRequiredMeaning
commandyesProgram name on the PATH, or an absolute path
argsnoArray of strings. Relative paths resolve against cwd; ${cwd} and ${workspace} are replaced with cwd.
cwdyesAbsolute working directory. The server always starts here, whichever agent uses it.
envnoExtra environment variables (string values)
type / transportnostdio. Inferred when absent.

HTTP server

json
{
  "mcpServers": {
    "search": {
      "url": "https://mcp.example.com/mcp",
      "bearer_token_env_var": "SEARCH_TOKEN",
      "http_headers": { "X-Team": "research" },
      "env_http_headers": { "X-Account": "SEARCH_ACCOUNT" }
    }
  }
}
FieldRequiredMeaning
urlyesAbsolute http or https URL. Must not contain a user name or password.
bearer_token_env_varnoEnvironment variable whose value is sent as Authorization: Bearer ...
http_headersnoFixed headers
env_http_headersnoHeaders whose values come from environment variables (header name → variable name)
type / transportnohttp. Inferred from url.

Environment variables are read when agt connects, from the environment of the Web console or scheduler process.

Agent tools ​

ToolParametersMeaning
resource_writekind: "mcp", data: {mcpServers: {...}}Register or replace a server
resource_testkind: "mcp", referenceValidate the configuration only
mcp_probereferenceStart or connect and check the tools, as agt mcp probe
agent_mcp_listagentList the MCP servers attached to an agent

How tool calls are checked ​

  • Tool arguments are validated against the server's input schema (JSON Schema 2020-12 by default) before anything else. Invalid calls return an error to the model and never reach the server or the approval queue.
  • Schemas may not load external references.
  • Every call goes through approval. To let a server's own readOnlyHint count, add "trust_read_only_hint": true to its entry in mcpServers (stdio or HTTP). Tools that server marks read-only then run without approval; its other tools are still reviewed. Only set this for servers you trust, since the hint comes from the server itself.
  • When an agent with resource_management changes its own MCP servers, the new tools load after its current batch of tool calls. If loading fails, it keeps the old tools and is told why.
  • Agent: attaching servers
  • Permissions: approval of each call
  • Harness: Codex agents, which use their own MCP configuration

Released under the MIT License.