MCP client - Anthropic - verified
How to add an MCP server to Claude Agent SDK
Where to add MCP servers in Claude Agent SDK: The mcpServers option of query() in code, or a .mcp.json file at the project root loaded through the project setting source. Its docs list support for stdio, Streamable HTTP and SSE. Its docs say it does not run an OAuth flow for remote servers itself.
Claude Agent SDK homepage - Claude Agent SDK in our tools directory - Compare all MCP clients
- Kind
- SDK or framework
- stdio
- Yes
- Streamable HTTP
- Yes
- SSE
- Yes
Add a server
- Where the config lives
- The mcpServers option of query() in code, or a .mcp.json file at the project root loaded through the project setting source
The example from the Claude Agent SDK docs, copied verbatim. Swap in your server's name, command or URL.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"]
}
}
}Which server?
Pick a server from the verified directory of official MCP servers. Each one lists its transport, auth and the setup snippets its vendor publishes, so you can match it to what Claude Agent SDK supports.
MCP support
What the Claude Agent SDK docs say it supports. Not stated means the docs do not say either way.
| Feature | Value | Source |
|---|---|---|
| ToolsCalls the functions a server exposes. | Yes | code.claude.com/docs/en/agent-sdk/mcp |
| ResourcesReads data and files a server exposes as resources. | Yes | code.claude.com/docs/en/agent-sdk/typescript |
| PromptsOffers a server's prompt templates to the user. | Not stated | Docs do not say |
| SamplingLets a server ask the client's model for a completion. | Not stated | Docs do not say |
| RootsTells a server which directories it may work in. | Not stated | Docs do not say |
| ElicitationLets a server ask the user for input mid-task. | Yes | code.claude.com/docs/en/agent-sdk/typescript |
| DiscoveryPicks up tools, prompts or resources a server adds or removes while connected. | Yes | code.claude.com/docs/en/mcp |
| InstructionsUses the instructions a server sends when it connects. | Not stated | Docs do not say |
| stdioStarts a local server as a subprocess. | Yes | code.claude.com/docs/en/agent-sdk/mcp |
| Streamable HTTPConnects to a remote server over the current HTTP transport. | Yes | code.claude.com/docs/en/agent-sdk/mcp |
| SSEConnects over the older HTTP+SSE transport. | Yes | code.claude.com/docs/en/agent-sdk/mcp |
| OAuthSigns in to remote servers with OAuth. | No | code.claude.com/docs/en/agent-sdk/mcp |
Worth knowing
The SDK does not open a browser or run an interactive OAuth flow, so you complete OAuth in your own app and pass the access token in the server headers.
Other SDKs and frameworks
FAQ
Where is the Claude Agent SDK MCP config?
The mcpServers option of query() in code, or a .mcp.json file at the project root loaded through the project setting source. The example on this page is copied from https://code.claude.com/docs/en/agent-sdk/mcp
Does Claude Agent SDK support remote MCP servers over Streamable HTTP?
Yes, per https://code.claude.com/docs/en/agent-sdk/mcp. Its docs list support for stdio, Streamable HTTP and SSE.
Does Claude Agent SDK support OAuth for MCP servers?
No. Its docs say it does not run an OAuth flow for remote servers itself. Source: https://code.claude.com/docs/en/agent-sdk/mcp
Which MCP features does Claude Agent SDK support?
Its docs list Tools, Resources, Elicitation and Discovery. They do not state Prompts, Sampling, Roots and Instructions.
Sources
Last verified from the pages below.
- Agent SDK docs: Connect to external tools with MCP - code.claude.com
- Agent SDK TypeScript reference - code.claude.com
- Claude Code docs: MCP (dynamic tool updates in the Agent SDK) - code.claude.com
Newsletter
New MCP servers, the week they ship
One email per week. New official MCP servers, the coding tools that support them and how developers wire them up.