You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add comprehensive MCP server configuration guide
Add documentation for all MCP server configuration options including:
- External stdio servers (with note that Claude Code auto-spawns them)
- SSE and HTTP remote servers
- Config file path option
- MCP tool naming pattern
This addresses issue #87 by clarifying how to configure MCP servers
and explaining that users don't need to manually run stdio servers.
Copy file name to clipboardExpand all lines: README.md
+81-1Lines changed: 81 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,11 +87,91 @@ Code. See [src/claude_agent_sdk/client.py](src/claude_agent_sdk/client.py).
87
87
88
88
Unlike `query()`, `ClaudeSDKClient` additionally enables **custom tools** and **hooks**, both of which can be defined as Python functions.
89
89
90
+
### MCP Server Configuration
91
+
92
+
The SDK supports multiple ways to configure [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) servers that provide tools to Claude:
93
+
94
+
#### External Stdio Servers
95
+
96
+
For existing MCP servers that run as separate processes, use dictionary-based configuration. **You don't need to manually run these servers** - Claude Code automatically spawns and manages them:
97
+
98
+
```python
99
+
from claude_agent_sdk import ClaudeAgentOptions, ClaudeSDKClient
100
+
101
+
options = ClaudeAgentOptions(
102
+
mcp_servers={
103
+
"filesystem": {
104
+
"type": "stdio", # Optional, "stdio" is the default
A **custom tool** is a Python function that you can offer to Claude, for Claude to invoke as needed.
93
173
94
-
Custom tools are implemented in-process MCP servers that run directly within your Python application, eliminating the need for separate processes that regular MCP servers require.
174
+
Custom tools are implemented as in-process MCP servers that run directly within your Python application, eliminating the need for separate processes that regular MCP servers require.
95
175
96
176
For an end-to-end example, see [MCP Calculator](examples/mcp_calculator.py).
0 commit comments