Back to catalog / Agent tools
Provide an in-process read-only MCP tool
Wrap a narrow Python function as an SDK MCP server and allow only its named tool.
Goal
Let the agent call a controlled application function without launching a separate MCP process.
Steps
- Define a function with
@tool(name, description, input_schema), validate input, and bind it to a read-only data source. [mcp] - Create the server with
create_sdk_mcp_server(name=..., version=..., tools=[...])and register it inClaudeAgentOptions(mcp_servers={...}). [mcp] - Add only the
mcp__<server>__<tool>name toallowed_tools, test with synthetic data, and inspect ToolUseBlock/ToolResultBlock. [mcp]
How to verify
The agent can call only the intended tool; invalid arguments are rejected and errors set `is_error`.
Troubleshooting
If the tool is missing, check the server key, tool name, and full allowed_tools name; return content text blocks for results.
Permissions
Prerequisites
- Python 3.10+, SDK MCP dependencies, and read-only test data.
Permissions
- Do not connect trading or write endpoints; the tool backend must use least-privilege access to test data.
Limitations
The SDK MCP server runs in-process; your function backend enforces data permissions, not the tool description.
Pinned upstream source
- Repository
- anthropics/claude-agent-sdk-python
- File path
- examples/mcp_calculator.py
- Pinned commit
b6e9d12fe1cc98dde988ab7b7713c1feeee50c6c- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: MIT