Skip to main content
Watch: I Built an AI App Without Leaving Databricks

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.

JSON
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"]
    }
  }
}

Source: code.claude.com/docs/en/agent-sdk/mcp

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.

Claude Agent SDK MCP features, transports and OAuth, each with its source
FeatureValueSource
ToolsCalls the functions a server exposes.Yescode.claude.com/docs/en/agent-sdk/mcp
ResourcesReads data and files a server exposes as resources.Yescode.claude.com/docs/en/agent-sdk/typescript
PromptsOffers a server's prompt templates to the user.Not statedDocs do not say
SamplingLets a server ask the client's model for a completion.Not statedDocs do not say
RootsTells a server which directories it may work in.Not statedDocs do not say
ElicitationLets a server ask the user for input mid-task.Yescode.claude.com/docs/en/agent-sdk/typescript
DiscoveryPicks up tools, prompts or resources a server adds or removes while connected.Yescode.claude.com/docs/en/mcp
InstructionsUses the instructions a server sends when it connects.Not statedDocs do not say
stdioStarts a local server as a subprocess.Yescode.claude.com/docs/en/agent-sdk/mcp
Streamable HTTPConnects to a remote server over the current HTTP transport.Yescode.claude.com/docs/en/agent-sdk/mcp
SSEConnects over the older HTTP+SSE transport.Yescode.claude.com/docs/en/agent-sdk/mcp
OAuthSigns in to remote servers with OAuth.Nocode.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.

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.

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.