Documentation Index
Fetch the complete documentation index at: https://mintlify.com/anthropics/claude-agent-sdk-python/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Creates an in-process MCP server that runs directly in your application’s process. Unlike external MCP servers that run as separate processes, SDK MCP servers provide better performance, simpler deployment, and easier debugging.Signature
Parameters
Unique identifier for the server. This name is used to reference the server in the
mcp_servers configuration.Server version string. This is for informational purposes and doesn’t affect functionality.
List of
SdkMcpTool instances created with the @tool decorator. These are the functions that Claude can call through this server. If None or empty, the server will have no tools.Returns
McpSdkServerConfig - A configuration object that can be passed to ClaudeAgentOptions.mcp_servers. This config contains the server instance and metadata needed for the SDK to route tool calls.
Benefits of SDK MCP Servers
Better Performance
No IPC overhead - tools run directly in your process
Simpler Deployment
Single process deployment with no external dependencies
Easier Debugging
Debug tools in the same process as your application
Direct State Access
Tools have direct access to your application’s variables and state
Examples
Simple Calculator Server
Basic server with multiple arithmetic tools:Server with Application State Access
Server tools that access and modify application state:Multiple Servers
Using multiple SDK MCP servers in one application:Usage with query()
SDK MCP servers are configured throughClaudeAgentOptions:
Notes
Server Lifecycle: The server lifecycle is managed automatically by the SDK. You don’t need to start or stop servers manually.
Tool Access: Tools defined in SDK MCP servers have direct access to your application’s variables, functions, and state. This enables powerful integrations but requires careful consideration of scope and side effects.
Performance: SDK MCP servers run in-process, eliminating the overhead of subprocess creation and inter-process communication found in external MCP servers.
See Also
- @tool - Decorator for creating tool functions
- ClaudeAgentOptions - Configuration for using servers with query()
- query() - One-shot query function