Harness Notes

MCP

Updated 2026-11-22,

On this page

How to connect MCP servers to each harness and what their tools can do once connected. The protocol table at the end shows which parts of the MCP specification each client supports.

Setting up a server

QuestionClaude Codechecked at 2.1.299
Add a server

Run claude mcp add --transport http <name> <url> for a remote server or claude mcp add [--env KEY=value] <name> -- <command> [args...] for a local stdio server; use claude mcp add-json <name> '<json>' for a raw JSON entry and claude mcp add-from-claude-desktop to import from Claude Desktop (macOS and WSL). Entries go under mcpServers in ~/.claude.json (local and user scope) or .mcp.json at the project root (project scope), with type, command/args/env or url/headers. Names may contain only letters, numbers, hyphens and underscores, and an entry with a url but no type is rejected.

Put -- before a stdio server's command so its flags aren't parsed by Claude Code.

Plugins can also bundle servers in a plugin-root .mcp.json or inline in plugin.json.

Transports

Claude Code supports stdio, Streamable HTTP ("type": "http", alias streamable-http), SSE ("type": "sse", deprecated) and WebSocket ("type": "ws"). From v2.1.265, --transport http falls back to SSE automatically when the server doesn't accept HTTP. WebSocket can only be configured through JSON (.mcp.json or claude mcp add-json) and authenticates with headers only, not OAuth.

"type": "sdk" in-process servers can only be registered by an SDK host application such as the Agent SDK or the desktop app.

2.1.307 retries a mid-call HTTP disconnect only for readOnlyHint/idempotentHint tools, reducing duplicate writes. This is distinct from Tasks lifecycle recovery.

Where configs live, and project trust

Local scope (the default) and user scope live in ~/.claude.json, and project scope lives in .mcp.json at the repository root. Admins can add managed-mcp.json for exclusive control, or managedMcpServers in managed settings. When the same name is defined more than once, the highest-precedence entry wins whole, with no field merging, in the order managed, local, project, user, plugin, claude.ai connector. Interactive sessions ask you to approve .mcp.json servers (reset with claude mcp reset-project-choices), and committed enableAllProjectMcpServers or enabledMcpjsonServers approvals are ignored until you trust the folder.

claude -p, Agent SDK and cloud sessions load .mcp.json servers without asking; use disabledMcpjsonServers or --strict-mcp-config to keep one out.

managed-mcp.json lives at /Library/Application Support/ClaudeCode/ (macOS), /etc/claude-code/ (Linux/WSL) or C:\Program Files\ClaudeCode\ (Windows).

Sign in or pass credentials

For OAuth 2.0 on HTTP and SSE servers, run /mcp in a session or claude mcp login <name> in your shell (--no-browser over SSH). Claude Code supports dynamic client registration and CIMD, pre-registered clients via --client-id, --client-secret and --callback-port (or an oauth object in JSON), plus oauth.scopes and oauth.authServerMetadataUrl; tokens are stored and refreshed automatically. Static credentials go in --header/headers, dynamic ones come from a headersHelper command, and .mcp.json expands ${VAR} and ${VAR:-default} in command, args, env, url and headers.

In a remote server's url and headers, Claude Code's own and cloud-provider credential variables such as ANTHROPIC_API_KEY always expand to empty.

claude -p and the Agent SDK can't run the OAuth flow, so sign in interactively first.

A project or local headersHelper runs only after you trust the folder.

2.1.307 fixes locked-keychain and sleep-during-connect authentication/status failures in print/headless sessions; publisher-reported recovery, not a new transport.

Using its tools

QuestionClaude Codechecked at 2.1.299
Approve, allow or block tools

MCP tool calls go through the normal permission prompt unless a rule or mode approves them. Add rules under permissions.allow, ask or deny: mcp__server or mcp__server__* covers a whole server, and mcp__server__tool covers one tool. A deny rule such as mcp__* removes the tools from context entirely. To block servers rather than tools, use allowedMcpServers and deniedMcpServers (by name, command or URL), disabledMcpjsonServers, or turn a server off in /mcp.

An allow glob must start with a literal mcp__<server>__ prefix; an unanchored mcp__* allow rule is ignored.

Tools marked _meta["anthropic/requiresUserInteraction"]: true, and claude.ai connector tools your organization sets to ask, prompt on every call even in bypassPermissions mode.

Plugin server tools are named mcp__plugin_<plugin>_<server>__<tool>.

Tool search & code mode

Tool search is on by default: only tool names and server instructions load at startup, and Claude loads full definitions on demand through the ToolSearch tool, so there is no fixed tool cap. Change this with ENABLE_TOOL_SEARCH (true, false, auto or auto:N for a percentage-of-context threshold), keep a server's tools always loaded with "alwaysLoad": true in its entry, or set "alwaysLoad": false to defer everything. Since 2.1.304, tool search also defaults on behind custom ANTHROPIC_BASE_URL gateways; a 400 or 422 is retried without it. Older models may still disable tool search.

Server instructions and upfront tool descriptions are cut at 4,096 characters, and deferred tool descriptions at 16,384 (CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH overrides both).

Tools whose full name exceeds 128 characters, or whose schema is invalid, are left out.

To filter tools, use deny rules such as mcp__server__tool; per-subagent servers and tools can be set in the agent's frontmatter.

Output size and timeouts

Tool output above 10,000 tokens shows a warning. Results over MAX_MCP_OUTPUT_TOKENS (default 25,000), or text results over 50,000 characters, are saved to a file in the session's tool-results directory and replaced with the file path; a tool can raise its own character limit to 500,000 with _meta["anthropic/maxResultSizeChars"]. MCP_TIMEOUT sets the server startup timeout (default 30 s), MCP_TOOL_TIMEOUT or a per-server timeout sets the wall-clock limit per call (default about 28 hours), and a call with no response or progress for 5 minutes (remote) or 30 minutes (stdio) aborts with an error (CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT). A main-conversation call still running after 2 minutes moves to a background task (CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS).

HTTP and SSE requests also have a per-request timer of at least 60 seconds to the first response byte.

A response or WebSocket message over 16 MiB fails.

Error text over about 11,000 characters is trimmed to its first and last 5,000 characters.

Resources

Type @ to see resources from connected servers alongside files, and reference one as @server:protocol://path; it is fetched and attached to your message. Claude also gets built-in tools to list and read MCP resources when a server supports them.

MCP Apps UI resources (ui:// or text/html;profile=mcp-app) are hidden from @ suggestions and the list tool.

Prompts

Server prompts appear in the / menu as /server:prompt (MCP) and also run as /mcp__server__prompt. Arguments go after the command, separated by spaces, and the prompt's result is injected into the conversation.

Arguments are split on whitespace, so each one must be a single token.

Prompts from a server named anthropic-skills are hidden because that name is reserved.

When a server asks you or the model

Partly

Elicitation is supported in both modes: form requests open a dialog, and URL requests ask before opening a link in your browser. The Elicitation hook can answer either automatically. Servers can also see your roots: roots/list returns the launch directory plus any --add-dir directories, and Claude Code sends list_changed when they change. The docs don't describe sampling, so servers shouldn't count on calling the model through Claude Code.

If a server stops connecting after the v2.1.287 URL-elicitation change, add "bareElicitationCapability": true to its config entry.

2026-10-23: exact schema coverage, backend answer validation after hook mutation and unattended print-mode elicitation remain unverified; see docs/research/mcp-elicitation.md.

2026-10-24: task elicitation is interactive-terminal only; non-interactive tasks requesting input are canceled without Elicitation hooks or the SDK callback. This does not establish ordinary print-mode elicitation behavior.

Running servers

QuestionClaude Codechecked at 2.1.299
Status, enable, reconnect, debug

Use claude mcp list (status for each server), claude mcp get <name> (details plus an Issue: line on failure) and claude mcp remove <name> in the shell. Inside a session, /mcp opens a panel to view tools, authenticate, reconnect, disable or clear auth. You can also run /mcp reconnect <server|all>, /mcp enable <server|all> or /mcp disable <server|all> directly. Toggles are saved per project in ~/.claude.json as disabledMcpServers, and claude --debug=mcp or --debug-file shows connection logs.

Remote servers reconnect automatically, with 5 attempts and exponential backoff; stdio servers do not.

2.1.305 changes managed stdio allowlisting: allowedMcpServers no longer filters managed-mcp.json servers using ${VAR} only in env; deniedMcpServers is the explicit opt-out. Supplied cloud/SDK setMcpServers definitions no longer get replaced by same-named local settings entries.

2.1.309 fixes disabled servers reconnecting during later permission prompts in print/SDK sessions.

Run the harness as an MCP server

Yes. claude mcp serve runs Claude Code as a stdio MCP server that exposes its own tools, such as file read/edit and Bash, to another client, for example with "command": "claude", "args": ["mcp", "serve"] in Claude Desktop. The connecting client is responsible for confirming each tool call.

Since v2.1.271, a running tool call sends a progress update every 30 seconds.

Protocol features

FeatureClaude Codeprotocol 2026-07-28, with fallback to older servers
Roots

Let a server discover the client-approved filesystem roots; this is not the server process working directory.

deprecated in the current spec

Supported

Answers roots/list with the launch directory plus every --add-dir / additionalDirectories path, and sends notifications/roots/list_changed when that set changes (v2.1.203+).

Source
Sampling

Let a server request an LLM interaction through the host, with user review and model preferences.

deprecated in the current spec

Not documented

The MCP docs do not describe sampling/createMessage support.

Sampling with tools

Let the sampling loop invoke tools recursively; do not confuse this with ordinary server tool calls.

deprecated in the current spec

Not documented

Elicitation (generic)

Server-originated MCP input requests, distinct from permission approvals, model ask-user tools, generic chat forms or MCP Apps. Check each mode and host separately.

Supported

Both modes documented. Elicitation hooks can return accept/decline/cancel with structured content and bypass ElicitationResult; result hooks can replace user replies. Exact schema coverage, validation after hooks, and unattended print-mode behavior are unverified. Rechecked 2026-10-24: modern connections explicitly advertise both modes. Non-interactive task elicitation cancels the task without hooks/callbacks; ordinary print-mode behavior remains separately unverified.

Source
Form elicitation

Collect typed property-keyed answers using the restricted elicitation schema, with accept/decline/cancel. Schema parsing, UI validation and backend answer validation are separate claims.

Supported

Structured property-keyed answers. Docs do not establish all schema constraints or backend validation. Follow MCP prohibition on sensitive form data despite the password example in harness docs.

Source
URL elicitation

Direct the user to an external interaction without collecting its sensitive data. Acceptance is not completion; track legacy completion notifications separately from current MRTR retry.

Supported

On 2026-07-28 connections since v2.1.281 and on 2025-11-25 connections since v2.1.287; URLs over roughly 8,000 escaped characters can only be declined.

Source
Prompts

Expose reusable, argument-aware server prompts through the client UI.

Supported

Listed as /server:prompt (MCP) and runnable as /mcp__server__prompt with whitespace-split arguments.

Source
Resources

List and read server-provided context independently from tool execution.

Supported

@server:uri mentions plus built-in list/read resource tools for Claude.

Source
Resource templates

Discover and fill parameterized resource URIs.

Partly

Claude Code fetches resources/templates/list for @-mention autocomplete; the docs don't describe how template parameters are filled.

Source
Argument completion

Complete prompt arguments and resource-template parameters without an LLM call.

Not documented

No documented completion/complete support for prompt or template arguments.

Progress

Correlate monotonic progress with a request; UI display and timeout extension are separate behaviors.

Supported

Progress is shown on the tool call and its background task, and resets the idle timeout but not the per-server wall-clock timeout.

Source
Cancellation

Cooperatively cancel in-flight protocol requests and propagate intent to the handler.

Partly

Stopping a backgrounded MCP call from /tasks cancels it; the docs warn the server may still finish the work.

Source
Protocol logging

Deliver correlated server logs through MCP rather than relying on process stderr.

deprecated in the current spec

Not documented

Docs mention a per-server debug log but not MCP logging/setLevel or notifications/message.

Subscriptions

Receive correlated updates over a long-lived request.

Partly

On the v2 runtime, servers on revision 2026-07-28 deliver list_changed over a held-open stream; resource content subscriptions aren't documented.

Source
Multi-round-trip requests

Pause a request for sampling, elicitation, or roots input and retry it with opaque request state.

Not documented

Tasks (legacy)

Durable polling, status, result, and cancellation state from the 2025-11-25 experimental protocol era.

earlier experimental spec

Not documented

The documented 2026-07-28 extension does not establish legacy 2025-11-25 Tasks support. /tasks also contains ordinary background calls.

Tasks extension

Asynchronous tool results using io.modelcontextprotocol/tasks on 2026-07-28 connections, separate from legacy Tasks and client backgrounding.

separate protocol extension

Partly

October 24 documentation: public beta from 2.1.304 with eligible sessions and 2026-07-28 connections. Superseding 2.1.319 publisher notes: terminal tasks work without feature-flag fetching, including third-party providers and telemetry-off sessions; immediate backgrounding can be disabled with CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND, tasks with CLAUDE_CODE_DISABLE_MCP_TASKS=1. Earlier SDK/open-input and desktop/VS Code/one-shot exclusions have not been re-audited; no runtime probe.

Source
Events and agent wake-up

External updates that can trigger agent work. ChatGPT Work documents signed webhook subscriptions; Codex has a separate hosted-app event stream. Receiving an event and starting a model turn are separate capabilities.

separate protocol extension

Not documented

Not audited for this harness/version. Other notification or resource-subscription support does not establish event-triggered agent work.

Notes and sources

Claude Code, 14 sources
  • Dynamic list changes are documented for tools, prompts, and resources.
  • The reviewed documentation does not establish sampling, completion, content subscriptions, general current subscriptions/MRTR, legacy Tasks, or a protocol-log UI.
  • 2.1.304 enables tool search by default behind custom ANTHROPIC_BASE_URL gateways, retrying without it after HTTP 400/422. New cloud conversations no longer wait on local stdio MCP servers from claude.ai-synced plugins unless alwaysLoad: true. This hosted startup change does not establish another transport capability.
  • 2026-10-24 documentation recheck supersedes the announcement-only assessment: Tasks extension public beta is documented for 2.1.304+, subject to session and feature-flag gates. Documentation evidence only; no source inspection or runtime probe. Historical elicitation evidence is retained.
  • 2.1.310 tells non-interactive sessions not to repeat a timed-out MCP call whose elicitation was unanswered. 2.1.311 fixes interrupts blocked by resource reads, late-connected server tools in subagents, local-scope project labels below repository roots, and misleading remote authentication status. These fixes do not establish broader Tasks session support.
  • 2.1.319 publisher update supersedes the October 24 terminal feature-fetch gate: terminal MCP tasks can run without feature-flag fetching, including third-party providers/gateways and DISABLE_TELEMETRY. Tasks move to background immediately; CLAUDE_CODE_DISABLE_MCP_TASK_BACKGROUND keeps the call waiting, and CLAUDE_CODE_DISABLE_MCP_TASKS=1 disables tasks. This does not establish legacy Tasks compatibility or remove the separately documented SDK/desktop/print-mode restrictions. Documentation only; no wire/runtime probe.
  • 2.1.321 publisher security fixes: MCP OAuth redirects no longer send secrets to another host; oversized (>16 MiB) PreToolUse mcp_tool hook replies refuse the tool instead of skipping the hook; reconnect/directory-change tool-loading races are repaired. These are documentation findings, not a changed protocol declaration.
  • 2.1.326 publisher notes fix parallel long MCP calls reading another call's saved result, exact-name tool search choosing a different server, and root anyOf/oneOf input schemas showing only one branch. 2.1.327 retries most remote hostname/HTTPS servers after extended outages for about a day and logs elicitation mode/action/field names rather than contents. 2.1.328 fixes root anyOf/oneOf/allOf tools disappearing and excludes invalid-schema tools on third-party providers or with telemetry/flags off. Publisher evidence only; no interoperability probe.
Add a server, 1
Transports, 2
Where configs live, and project trust, 3
Sign in or pass credentials, 2
Approve, allow or block tools, 3
Tool search & code mode, 3
Output size and timeouts, 2
Resources, 1
Prompts, 1
When a server asks you or the model, 4
Status, enable, reconnect, debug, 5
Run the harness as an MCP server, 1