Skip to main content

Module mcp

Module mcp 

Source
Expand description

In-process (SDK) MCP servers — Rust functions exposed to Claude as tools.

The CLI is told about each server with --mcp-config {"mcpServers":{"<name>":{"type":"sdk","name":"<name>"}}} (or later with Session::set_mcp_servers) and then forwards every JSON-RPC message for it as an mcp_message control request; the session answers with {"mcp_response": <JSON-RPC response>}. Claude sees the tools as mcp__<server>__<tool>.

Source: claude_agent_sdk 0.1.48 transport/subprocess_cli.py:240–260, _internal/query.py:305–320, :394–500; binary sdk MCP config schema

Structs§

SdkMcpServer
A named group of SDK tools, served in-process.
SdkTool
A tool definition plus the async function that runs it. #[claude_tool] generates <fn>_tool() -> SdkTool.
ToolContext
What a tool handler knows about its call besides the arguments.
ToolResult
Result of a tool call, returned to the model.

Enums§

ToolContent
One content item of a tool result. Source: MCP CallToolResult.content