{"url": "https://docs.anthropic.com/", "titulek": "Documentation - Claude Platform Docs", "h1": "Start building\nwith Claude", "popis": "Claude API Documentation", "klicova_slova": "", "kanonicka": "https://platform.claude.com/docs/en/home", "jazyk": "en", "robots_meta": "", "og": {"og:title": "Documentation", "og:description": "Claude API Documentation", "og:url": "https://platform.claude.com/docs/en/home", "og:site_name": "Claude Platform Docs", "og:locale": "en", "og:image": "https://platform.claude.com/docs/images/og-claude-platform-docs.png", "og:image:type": "image/png", "og:image:width": "1200", "og:image:height": "630", "og:image:alt": "Documentation", "og:type": "article"}, "jsonld": [], "drobecky": [], "osnova": [{"uroven": 3, "text": "Cookie settings"}, {"uroven": 1, "text": "Start building\nwith Claude"}, {"uroven": 2, "text": "Choose how you build"}, {"uroven": 3, "text": "Messages"}, {"uroven": 3, "text": "Managed Agents"}, {"uroven": 2, "text": "From idea to production"}, {"uroven": 3, "text": "Get started"}, {"uroven": 3, "text": "Build"}, {"uroven": 3, "text": "Evaluate and ship"}, {"uroven": 3, "text": "Operate"}, {"uroven": 2, "text": "The Claude model family"}, {"uroven": 3, "text": "Fable 5.1"}, {"uroven": 3, "text": "Opus 5"}, {"uroven": 3, "text": "Sonnet 5"}, {"uroven": 3, "text": "Haiku 4.5"}, {"uroven": 2, "text": "Keep learning"}], "markdown": "### Cookie settings\n\nWe use cookies to deliver and improve our services, analyze site usage, and if you agree, to customize or personalize your experience and market our services to you. You can read our Cookie Policy [here](https://www.anthropic.com/legal/cookies).\n\nClaude Platform\n\n# Start building\nwith Claude\n\nEverything you need to integrate Claude into your applications. From first API call to production.\n\n[Quickstart](/docs/en/get-started) [Get API key](/settings/keys) [API reference](/docs/en/api/overview)\n\n```\nimport anthropic client = anthropic.Anthropic() message = client.messages.create( model=\"claude-opus-5\", max_tokens=1024, messages=[{ \"role\": \"user\", \"content\": \"Hello, Claude\" }] ) for block in message.content: if block.type == \"text\": print(block.text)\n```\n\nPlatform\n\n## Choose how you build\n\nPick the developer surface that matches your approach, and the infrastructure that fits your stack.\n\n### Messages\n\nDirect model access. You construct every turn, manage conversation state, and write your own tool loop.\n\n[Quickstart](/docs/en/get-started) [API reference](/docs/en/api/messages/create) [Client SDKs](/docs/en/cli-sdks-libraries/overview)\n\n### Managed Agents\n\nFully managed agent infrastructure. Deploy and manage autonomous agents in stateful sessions with persistent event history.\n\n[Quickstart](/docs/en/managed-agents/quickstart) [API reference](/docs/en/api/beta/sessions) [Define your agent](/docs/en/managed-agents/agent-setup)\n\nClaude is also available on these cloud platforms:\n\n [Amazon Bedrock](/docs/en/build-with-claude/claude-in-amazon-bedrock) \n\n [Google Cloud](/docs/en/build-with-claude/claude-on-vertex-ai) \n\n [Microsoft Foundry](/docs/en/build-with-claude/claude-in-microsoft-foundry) \n\nDeveloper journey\n\n## From idea to production\n\nFollow the lifecycle or jump to what you need.\n\n1. 1 Get started[Quickstart](/docs/en/get-started)[Get API key](/settings/keys)[Choose a model](/docs/en/models/overview)[Install an SDK](/docs/en/cli-sdks-libraries/overview)[Try the API in playground](/playground)\n2. 2 Build[Messages API](/docs/en/api/messages/create)[Thinking](/docs/en/build-with-claude/thinking)[Vision](/docs/en/build-with-claude/vision)[Tool use](/docs/en/agents-and-tools/tool-use/overview)[Web search](/docs/en/agents-and-tools/tool-use/web-search-tool)[Code execution](/docs/en/agents-and-tools/tool-use/code-execution-tool)[Structured outputs](/docs/en/build-with-claude/structured-outputs)[Prompt caching](/docs/en/build-with-claude/prompt-caching)[Streaming](/docs/en/build-with-claude/streaming)\n3. 3 Evaluate and ship[Prompting best practices](/docs/en/build-with-claude/prompt-engineering/overview)[Run evals](/docs/en/test-and-evaluate/develop-tests)[Batch testing](/docs/en/build-with-claude/batch-processing)[Safety and guardrails](/docs/en/test-and-evaluate/strengthen-guardrails/increase-consistency)[Rate limits and errors](/docs/en/api/rate-limits)[Cost optimization](/docs/en/about-claude/pricing)\n4. 4 Operate[Workspaces and admin](/docs/en/build-with-claude/workspaces)[API key management](/settings/keys)[Usage monitoring](/docs/en/build-with-claude/usage-cost-api)[Model migration](/docs/en/about-claude/models/migration-guide)\n\nModels\n\n## The Claude model family\n\nChoose the right model for your use case.\n\n### [Fable 5.1](/docs/en/models/fable-5-1/overview)\n\nNew\n\nMost capable Research Multi-day tasks\n\nFor demanding reasoning and long-horizon agentic work\n\n### [Opus 5](/docs/en/models/opus-5/overview)\n\nComplex projects Agents Coding\n\nFor complex agentic coding and enterprise work\n\n### [Sonnet 5](/docs/en/models/sonnet-5/overview)\n\nEveryday tasks Writing Cost-efficient\n\nThe best combination of speed and intelligence\n\n### [Haiku 4.5](/docs/en/models/haiku-4-5/overview)\n\nFastest Lowest cost High volume\n\nThe fastest model with near-frontier intelligence\n\nResources\n\n## Keep learning\n\n\n\n[Courses](https://academy.claude.com/courses) \n\nInteractive courses to master Claude.\n\n\n\n[Cookbook](https://platform.claude.com/cookbook) \n\nCode samples and patterns.\n\n\n\n[Quickstarts](https://github.com/anthropics/anthropic-quickstarts) \n\nDeployable starter apps.\n\n\n\n[What's new](/docs/en/release-notes/overview)\n\nLatest features and updates.\n\n\n\n[Claude Code](https://code.claude.com/docs) \n\nAn agentic coding assistant in your terminal.", "znaku_textu": 4287, "slov": 435, "odkazu": 91, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-13 20:59:10", "sha256": "f12bc7e24c4e8dfb8f31b4df6a8cd4ecafeadc3817619c78e031f91b629b2431", "hloubka": 0, "zdroj_objevu": "seed", "ze_seznamu": true, "mime": "text/html", "odkazy_externi": ["https://www.anthropic.com/legal/cookies", "https://academy.claude.com/courses", "https://platform.claude.com/cookbook", "https://github.com/anthropics/anthropic-quickstarts", "https://code.claude.com/docs", "https://x.com/claudeai", "https://www.threads.com/@claudeai", "https://www.linkedin.com/showcase/claude", "https://www.youtube.com/@anthropic-ai", "https://instagram.com/claudeai", "https://claude.com/solutions/agents", "https://claude.com/solutions/code-modernization", "https://claude.com/solutions/coding", "https://claude.com/solutions/customer-support", "https://claude.com/solutions/financial-services", "https://claude.com/solutions/government", "https://claude.com/solutions/education", "https://claude.com/solutions/teachers", "https://claude.com/solutions/life-sciences", "https://claude.com/partners/amazon-bedrock", "https://claude.com/partners/google-cloud-vertex-ai", "https://claude.com/blog", "https://claude.com/resources/courses", "https://claude.com/resources/use-cases", "https://claude.com/partners/mcp", "https://claude.com/customers", "https://www.anthropic.com/engineering", "https://www.anthropic.com/events", "https://claude.com/partners/powered-by-claude", "https://claude.com/partners/services", "https://claude.com/programs/startups", "https://www.anthropic.com/company", "https://www.anthropic.com/careers", "https://www.anthropic.com/economic-futures", "https://www.anthropic.com/research", "https://www.anthropic.com/news", "https://www.anthropic.com/news/announcing-our-updated-responsible-scaling-policy", "https://trust.anthropic.com/", "https://www.anthropic.com/transparency", "https://www.anthropic.com/supported-countries", "https://status.claude.com/", "https://support.claude.com/", "https://www.anthropic.com/discord", "https://www.anthropic.com/legal/privacy", "https://www.anthropic.com/responsible-disclosure-policy", "https://www.anthropic.com/legal/commercial-terms", "https://www.anthropic.com/legal/consumer-terms", "https://www.anthropic.com/legal/aup"]} {"url": "https://docs.anthropic.com/en/docs/agents-and-tools/mcp-connector", "titulek": "MCP connector - Claude Platform Docs", "h1": "MCP connector", "popis": "Connect to remote MCP servers directly from the Messages API without an MCP client, and allowlist, denylist, or configure individual tools.", "klicova_slova": "", "kanonicka": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector", "jazyk": "en", "robots_meta": "", "og": {"og:title": "MCP connector", "og:description": "Connect to remote MCP servers directly from the Messages API without an MCP client, and allowlist, denylist, or configure individual tools.", "og:url": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector", "og:site_name": "Claude Platform Docs", "og:locale": "en", "og:image": "https://platform.claude.com/web-api/og/docs/en/agents-and-tools/mcp-connector?design-rev=2", "og:image:type": "image/png", "og:image:width": "1200", "og:image:height": "630", "og:image:alt": "MCP connector", "og:type": "article"}, "jsonld": [{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{"@type": "ListItem", "position": 1, "name": "Messages", "item": "https://platform.claude.com/docs/en/intro"}, {"@type": "ListItem", "position": 2, "name": "MCP connector", "item": "https://platform.claude.com/docs/en/agents-and-tools/mcp-connector"}]}], "drobecky": ["Messages", "MCP connector"], "osnova": [{"uroven": 2, "text": "Key features"}, {"uroven": 2, "text": "When Claude uses MCP tools"}, {"uroven": 2, "text": "Limitations"}, {"uroven": 2, "text": "Using the MCP connector in the Messages API"}, {"uroven": 3, "text": "Basic example"}, {"uroven": 2, "text": "MCP server configuration"}, {"uroven": 3, "text": "Field descriptions"}, {"uroven": 2, "text": "MCP toolset configuration"}, {"uroven": 3, "text": "Basic structure"}, {"uroven": 3, "text": "Field descriptions"}, {"uroven": 3, "text": "Tool configuration options"}, {"uroven": 3, "text": "Configuration merging"}, {"uroven": 2, "text": "Common configuration patterns"}, {"uroven": 3, "text": "Enable all tools with default configuration"}, {"uroven": 3, "text": "Allowlist: enable only specific tools"}, {"uroven": 3, "text": "Denylist: disable specific tools"}, {"uroven": 3, "text": "Mixed: allowlist with per-tool configuration"}, {"uroven": 2, "text": "Validation rules"}, {"uroven": 2, "text": "Response content types"}, {"uroven": 3, "text": "MCP tool use block"}, {"uroven": 3, "text": "MCP tool result block"}, {"uroven": 2, "text": "Multiple MCP servers"}, {"uroven": 2, "text": "Authentication"}, {"uroven": 3, "text": "Obtaining an access token for testing"}, {"uroven": 3, "text": "Using the access token"}, {"uroven": 2, "text": "Client-side MCP helpers"}, {"uroven": 3, "text": "Installation"}, {"uroven": 3, "text": "Available helpers"}, {"uroven": 3, "text": "Use MCP tools"}, {"uroven": 3, "text": "Use MCP prompts"}, {"uroven": 3, "text": "Use MCP resources"}, {"uroven": 3, "text": "Error handling"}, {"uroven": 2, "text": "Batch requests"}, {"uroven": 2, "text": "Data retention"}, {"uroven": 2, "text": "Migration guide"}, {"uroven": 3, "text": "Key changes"}, {"uroven": 3, "text": "Migration steps"}, {"uroven": 3, "text": "Common migration patterns"}, {"uroven": 2, "text": "Deprecated version: mcp-client-2025-04-04"}, {"uroven": 3, "text": "Deprecated field descriptions"}, {"uroven": 2, "text": "Compatibility"}], "markdown": "Claude's Model Context Protocol (MCP) connector feature enables you to connect to remote MCP servers directly from the Messages API without a separate MCP client.\n\n## Key features\n\n- **Direct API integration:** Connect to MCP servers without implementing an MCP client\n- **Tool calling support:** Access MCP tools through the Messages API\n- **Flexible tool configuration:** Enable all tools, allowlist specific tools, or denylist unwanted tools\n- **Per-tool configuration:** Configure individual tools with custom settings\n- **OAuth authentication:** Support for OAuth Bearer tokens for authenticated servers\n- **Multiple servers:** Connect to multiple MCP servers in a single request\n\n## When Claude uses MCP tools\n\nOnce an MCP server is connected, Claude calls its tools when the user's request maps to a tool's described capability, either explicitly (\"search Jira for open bugs\") or implicitly (\"what's blocking the release?\" with a Jira server attached).\n\nClaude does **not** call an MCP tool for general knowledge questions about a connected service. Asking \"how do Notion databases work?\" with a Notion server attached is answered directly; asking \"what's in my Projects database?\" triggers the tool.\n\nYou can steer how readily Claude calls MCP tools through your system prompt. See [When Claude uses tools](/docs/en/agents-and-tools/tool-use/overview#when-claude-uses-tools) for general guidance and example phrasings.\n\n## Limitations\n\n- Of the feature set of the [MCP specification](https://modelcontextprotocol.io/introduction#explore-mcp) , only [tool calls](https://modelcontextprotocol.io/docs/concepts/tools) are currently supported.\n- The server must be publicly exposed through HTTP (supports both Streamable HTTP and SSE transports). Local STDIO servers cannot be connected directly.\n\n## Using the MCP connector in the Messages API\n\nThe MCP connector uses two components:\n\n1. **MCP server definition** ( `mcp_servers` array): Defines server connection details (URL, authentication)\n2. **MCP toolset** ( `tools` array): Configures which tools to enable and how to configure them\n\n### Basic example\n\nThis example enables all tools from an MCP server with default configuration:\n\n```\nclient = anthropic.Anthropic() response = client.beta.messages.create( model=\"claude-opus-5\", max_tokens=1000, messages=[{\"role\": \"user\", \"content\": \"What tools do you have available?\"}], mcp_servers=[ { \"type\": \"url\", \"url\": \"https://example-server.modelcontextprotocol.io/sse\", \"name\": \"example-mcp\", \"authorization_token\": \"YOUR_TOKEN\", } ], tools=[{\"type\": \"mcp_toolset\", \"mcp_server_name\": \"example-mcp\"}], betas=[\"mcp-client-2025-11-20\"], ) print(response)\n```\n\n## MCP server configuration\n\nEach MCP server in the `mcp_servers` array defines the connection details:\n\n```\n{ \"type\": \"url\", \"url\": \"https://example-server.modelcontextprotocol.io/sse\", \"name\": \"example-mcp\", \"authorization_token\": \"YOUR_TOKEN\" }\n```\n\n### Field descriptions\n\n| Property | Type | Required | Description |\n| --- | --- | --- | --- |\n| `type` | string | Yes | Currently only \"url\" is supported. |\n| `url` | string | Yes | The URL of the MCP server. Must start with https://. |\n| `name` | string | Yes | A unique identifier for this MCP server. Must be referenced by exactly one MCPToolset in the `tools` array. |\n| `authorization_token` | string | No | OAuth authorization token if required by the MCP server. See Authentication for how to obtain one, or the [MCP specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) for protocol details. |\n\n## MCP toolset configuration\n\nThe MCPToolset lives in the `tools` array and configures which tools from the MCP server are enabled and how they should be configured.\n\n### Basic structure\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"example-mcp\", \"default_config\": { \"enabled\": true, \"defer_loading\": false }, \"configs\": { \"specific_tool_name\": { \"enabled\": true, \"defer_loading\": true } } }\n```\n\n### Field descriptions\n\n| Property | Type | Required | Description |\n| --- | --- | --- | --- |\n| `type` | string | Yes | Must be \"mcp_toolset\". |\n| `mcp_server_name` | string | Yes | Must match a server name defined in the `mcp_servers` array. |\n| `default_config` | object | No | Default configuration applied to all tools in this set. Individual tool configs in `configs` override these defaults. |\n| `configs` | object | No | Per-tool configuration overrides. Keys are tool names, values are configuration objects. |\n| `cache_control` | object | No | [Prompt caching](/docs/en/build-with-claude/prompt-caching) cache breakpoint configuration for this toolset. |\n\n### Tool configuration options\n\nEach tool (whether configured in `default_config` or in `configs`) supports the following fields:\n\n| Property | Type | Default | Description |\n| --- | --- | --- | --- |\n| `enabled` | boolean | `true` | Whether this tool is enabled. |\n| `defer_loading` | boolean | `false` | If true, tool description is not sent to the model initially. Used with [Tool search tool](/docs/en/agents-and-tools/tool-use/tool-search-tool). |\n\nFor the full directory of Anthropic-provided tools and optional properties such as `defer_loading`, see the [Tool reference](/docs/en/agents-and-tools/tool-use/tool-reference). To search across large tool sets, see [Tool search tool](/docs/en/agents-and-tools/tool-use/tool-search-tool).\n\n### Configuration merging\n\nConfiguration values merge with this precedence (highest to lowest):\n\n1. Tool-specific settings in `configs`\n2. Set-level `default_config`\n3. System defaults\n\nExample:\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"google-calendar-mcp\", \"default_config\": { \"defer_loading\": true }, \"configs\": { \"search_events\": { \"enabled\": false } } }\n```\n\nResults in:\n\n- `search_events` : `enabled: false` (from configs), `defer_loading: true` (from default_config)\n- All other tools: `enabled: true` (system default), `defer_loading: true` (from default_config)\n\n## Common configuration patterns\n\n### Enable all tools with default configuration\n\nThe simplest pattern: enable all tools from a server:\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"google-calendar-mcp\" }\n```\n\n### Allowlist: enable only specific tools\n\nSet `enabled: false` as the default, then explicitly enable specific tools:\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"google-calendar-mcp\", \"default_config\": { \"enabled\": false }, \"configs\": { \"search_events\": { \"enabled\": true }, \"create_event\": { \"enabled\": true } } }\n```\n\n### Denylist: disable specific tools\n\nEnable all tools by default, then explicitly disable unwanted tools. Denylisting write or destructive tools is recommended when building read-only assistants, or when you want a human confirmation step before state changes:\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"google-calendar-mcp\", \"configs\": { \"delete_all_events\": { \"enabled\": false }, \"share_calendar_publicly\": { \"enabled\": false } } }\n```\n\n### Mixed: allowlist with per-tool configuration\n\nCombine allowlisting with custom configuration for each tool:\n\n```\n{ \"type\": \"mcp_toolset\", \"mcp_server_name\": \"google-calendar-mcp\", \"default_config\": { \"enabled\": false, \"defer_loading\": true }, \"configs\": { \"search_events\": { \"enabled\": true, \"defer_loading\": false }, \"list_events\": { \"enabled\": true } } }\n```\n\nIn this example:\n\n- `search_events` is enabled with `defer_loading: false`\n- `list_events` is enabled with `defer_loading: true` (inherited from default_config)\n- All other tools are disabled\n\n## Validation rules\n\nThe API enforces these validation rules:\n\n- **Server must exist:** The `mcp_server_name` in an MCPToolset must match a server defined in the `mcp_servers` array\n- **Server must be used:** Every MCP server defined in `mcp_servers` must be referenced by exactly one MCPToolset\n- **Unique toolset per server:** Each MCP server can only be referenced by one MCPToolset\n- **Unknown tool names:** If a tool name in `configs` doesn't exist on the MCP server, a backend warning is logged but no error is returned (MCP servers may have dynamic tool availability)\n\n## Response content types\n\nWhen Claude uses MCP tools, the response includes two new content block types:\n\n### MCP tool use block\n\n```\n{ \"type\": \"mcp_tool_use\", \"id\": \"mcptoolu_014Q35RayjACSWkSj4X2yov1\", \"name\": \"echo\", \"server_name\": \"example-mcp\", \"input\": { \"param1\": \"value1\", \"param2\": \"value2\" } }\n```\n\n### MCP tool result block\n\n```\n{ \"type\": \"mcp_tool_result\", \"tool_use_id\": \"mcptoolu_014Q35RayjACSWkSj4X2yov1\", \"is_error\": false, \"content\": [ { \"type\": \"text\", \"text\": \"Hello\" } ] }\n```\n\n## Multiple MCP servers\n\nYou can connect to multiple MCP servers by including multiple server definitions in `mcp_servers` and a corresponding MCPToolset for each in the `tools` array:\n\n```\n{ \"model\": \"claude-opus-5\", \"max_tokens\": 1000, \"messages\": [ { \"role\": \"user\", \"content\": \"Use tools from both mcp-server-1 and mcp-server-2 to complete this task\" } ], \"mcp_servers\": [ { \"type\": \"url\", \"url\": \"https://mcp.example1.com/sse\", \"name\": \"mcp-server-1\", \"authorization_token\": \"TOKEN1\" }, { \"type\": \"url\", \"url\": \"https://mcp.example2.com/sse\", \"name\": \"mcp-server-2\", \"authorization_token\": \"TOKEN2\" } ], \"tools\": [ { \"type\": \"mcp_toolset\", \"mcp_server_name\": \"mcp-server-1\" }, { \"type\": \"mcp_toolset\", \"mcp_server_name\": \"mcp-server-2\", \"default_config\": { \"defer_loading\": true } } ] }\n```\n\nWith many tools available, Claude selects based on tool names and descriptions. Clear, specific tool descriptions improve selection accuracy. For large tool sets (dozens of tools across several servers), consider enabling `defer_loading` with the [Tool search tool](/docs/en/agents-and-tools/tool-use/tool-search-tool) so only relevant tools are surfaced per query.\n\n## Authentication\n\nFor MCP servers that require OAuth authentication, you'll need to obtain an access token. The MCP connector beta supports passing an `authorization_token` parameter in the MCP server definition.\nAPI consumers are expected to handle the OAuth flow and obtain the access token prior to making the API call, and to refresh the token as needed.\n\n### Obtaining an access token for testing\n\nThe MCP inspector can guide you through the process of obtaining an access token for testing purposes.\n\n1. Run the inspector with the following command. You need Node.js installed on your machine. `npx @modelcontextprotocol/inspector`\n2. In the sidebar on the left, for **Transport type**, select either **SSE** or **Streamable HTTP**.\n3. Enter the URL of the MCP server.\n4. In the right area, click **Open Auth Settings** after **Need to configure authentication?**.\n5. Click **Quick OAuth Flow** and authorize on the OAuth screen.\n6. Follow the steps in the **OAuth Flow Progress** section of the inspector and click **Continue** until you reach **Authentication complete**.\n7. Copy the `access_token` value.\n8. Paste it into the `authorization_token` field in your MCP server configuration.\n\n### Using the access token\n\nOnce you've obtained an access token using either of the preceding OAuth flows, you can use it in your MCP server configuration:\n\n```\n{ \"mcp_servers\": [ { \"type\": \"url\", \"url\": \"https://example-server.modelcontextprotocol.io/sse\", \"name\": \"authenticated-server\", \"authorization_token\": \"YOUR_ACCESS_TOKEN_HERE\" } ] }\n```\n\nFor detailed explanations of the OAuth flow, refer to the [Authorization section](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) in the MCP specification.\n\n## Client-side MCP helpers\n\nIf you manage your own MCP client connection (for example, with local stdio servers, MCP prompts, or MCP resources), the SDKs provide helper functions that convert between MCP types and Claude API types. This eliminates manual conversion code when using an MCP SDK for your language (for example, the [TypeScript MCP SDK](https://github.com/modelcontextprotocol/typescript-sdk)) alongside the Anthropic SDK.\n\n### Installation\n\nInstall both the Anthropic SDK and the MCP SDK:\n\nThe MCP helpers are included in the `mcp` extra, which requires Python 3.10 or later:\n\n```\npip install \"anthropic[mcp]\"\n```\n\n### Available helpers\n\nImport the helpers for your language:\n\n```\nfrom anthropic.lib.tools.mcp import ( async_mcp_tool, mcp_message, mcp_resource_to_content, mcp_resource_to_file, )\n```\n\nHelper names and exact signatures follow each language's conventions; this table shows the TypeScript forms:\n\n| Helper | Description |\n| --- | --- |\n| `mcpTools(tools, mcpClient)` | Converts MCP tools to Claude API tools for use with `client.beta.messages.toolRunner()` |\n| `mcpMessages(messages)` | Converts MCP prompt messages to Claude API message format |\n| `mcpResourceToContent(resource)` | Converts an MCP resource to a Claude API content block |\n| `mcpResourceToFile(resource)` | Converts an MCP resource to a file object for upload |\n\n### Use MCP tools\n\nConvert MCP tools for use with the SDK's [tool runner](/docs/en/agents-and-tools/tool-use/tool-runner), which handles tool execution automatically:\n\n```\nfrom anthropic.lib.tools.mcp import async_mcp_tool from mcp import ClientSession from mcp.client.stdio import StdioServerParameters, stdio_client client = AsyncAnthropic() async def main() -> None: # Connect to an MCP server server_params = StdioServerParameters(command=\"mcp-server\") async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as mcp_client: await mcp_client.initialize() # List tools and convert them for the Claude API tools_result = await mcp_client.list_tools() runner = client.beta.messages.tool_runner( model=\"claude-opus-5\", max_tokens=1024, messages=[ {\"role\": \"user\", \"content\": \"What tools do you have available?\"}, ], tools=[async_mcp_tool(tool, mcp_client) for tool in tools_result.tools], ) final_message = await runner.until_done() print(final_message) asyncio.run(main())\n```\n\n### Use MCP prompts\n\nConvert MCP prompt messages into Claude API message format:\n\n```\nfrom anthropic.lib.tools.mcp import mcp_message prompt = await mcp_client.get_prompt(name=\"my-prompt\") response = await client.beta.messages.create( model=\"claude-opus-5\", max_tokens=1024, messages=[mcp_message(message) for message in prompt.messages], ) print(response)\n```\n\n### Use MCP resources\n\nConvert MCP resources into content blocks to include in messages, or into file objects for upload:\n\n```\nfrom anthropic.lib.tools.mcp import ( mcp_resource_to_content, mcp_resource_to_file, ) # As a content block in a message resource = await mcp_client.read_resource(uri=\"file:///path/to/doc.txt\") response = await client.beta.messages.create( model=\"claude-opus-5\", max_tokens=1024, messages=[ { \"role\": \"user\", \"content\": [ mcp_resource_to_content(resource), {\"type\": \"text\", \"text\": \"Summarize this document\"}, ], } ], ) print(response) # As a file upload file_resource = await mcp_client.read_resource( uri=\"file:///path/to/data.json\", ) uploaded = await client.files.upload( file=mcp_resource_to_file(file_resource), ) print(uploaded.id)\n```\n\n### Error handling\n\nThe conversion functions throw `UnsupportedMCPValueError` if an MCP value isn't supported by the Claude API (in Go, the helpers return an `UnsupportedValueError`; in Java and C#, they throw `AnthropicInvalidDataException`). This can happen with unsupported content types, MIME types, or resource links (resolve resource links with your MCP client before converting).\n\n## Batch requests\n\nYou can include `mcp_servers` in [Message Batches API](/docs/en/build-with-claude/batch-processing) requests. MCP tool calls through the Batches API are priced the same as those in regular Messages API requests.\n\n## Data retention\n\nThe MCP connector is not covered by ZDR arrangements. Data exchanged with MCP servers, including tool definitions and execution results, is retained according to Anthropic's standard data retention policy.\n\nFor ZDR eligibility across all features, see [API and data retention](/docs/en/manage-claude/api-and-data-retention).\n\n## Migration guide\n\nIf you're using the deprecated `mcp-client-2025-04-04` beta header, follow this guide to migrate to the new version.\n\n### Key changes\n\n1. **New beta header:** Change from `mcp-client-2025-04-04` to `mcp-client-2025-11-20`\n2. **Tool configuration moved:** Tool configuration now lives in the `tools` array as MCPToolset objects, not in the MCP server definition\n3. **More flexible configuration:** New pattern supports allowlisting, denylisting, and per-tool configuration\n\n### Migration steps\n\n**Before (deprecated):**\n\n```\n{ \"model\": \"claude-opus-5\", \"max_tokens\": 1000, \"messages\": [ // ... ], \"mcp_servers\": [ { \"type\": \"url\", \"url\": \"https://mcp.example.com/sse\", \"name\": \"example-mcp\", \"authorization_token\": \"YOUR_TOKEN\", \"tool_configuration\": { \"enabled\": true, \"allowed_tools\": [\"tool1\", \"tool2\"] } } ] }\n```\n\n**After (current):**\n\n```\n{ \"model\": \"claude-opus-5\", \"max_tokens\": 1000, \"messages\": [ // ... ], \"mcp_servers\": [ { \"type\": \"url\", \"url\": \"https://mcp.example.com/sse\", \"name\": \"example-mcp\", \"authorization_token\": \"YOUR_TOKEN\" } ], \"tools\": [ { \"type\": \"mcp_toolset\", \"mcp_server_name\": \"example-mcp\", \"default_config\": { \"enabled\": false }, \"configs\": { \"tool1\": { \"enabled\": true }, \"tool2\": { \"enabled\": true } } } ] }\n```\n\n### Common migration patterns\n\n| Old pattern | New pattern |\n| --- | --- |\n| No `tool_configuration` (all tools enabled) | MCPToolset with no `default_config` or `configs` |\n| `tool_configuration.enabled: false` | MCPToolset with `default_config.enabled: false` |\n| `tool_configuration.allowed_tools: [...]` | MCPToolset with `default_config.enabled: false` and specific tools enabled in `configs` |\n\n## Deprecated version: mcp-client-2025-04-04\n\nThe previous version of the MCP connector included tool configuration directly in the MCP server definition:\n\n```\n{ \"mcp_servers\": [ { \"type\": \"url\", \"url\": \"https://example-server.modelcontextprotocol.io/sse\", \"name\": \"example-mcp\", \"authorization_token\": \"YOUR_TOKEN\", \"tool_configuration\": { \"enabled\": true, \"allowed_tools\": [\"example_tool_1\", \"example_tool_2\"] } } ] }\n```\n\n### Deprecated field descriptions\n\n| Property | Type | Description |\n| --- | --- | --- |\n| `tool_configuration` | object | **Deprecated:** Use MCPToolset in the `tools` array instead |\n| `tool_configuration.enabled` | boolean | **Deprecated:** Use `default_config.enabled` in MCPToolset |\n| `tool_configuration.allowed_tools` | array | **Deprecated:** Use allowlist pattern with `configs` in MCPToolset |\n\n## Compatibility\n\n| Supported platforms | Claude APIBetaClaude Platform on AWSBetaMicrosoft FoundryBeta |\n| --- | --- |\n\nWas this page helpful?", "znaku_textu": 17705, "slov": 2309, "odkazu": 175, "kodovani": "utf-8", "kodovani_deklarovane": "utf-8", "format": "html", "duplikat_z": "", "http": 200, "odkud": "live", "wb_ts": "", "stazeno": "2026-09-13 20:59:12", "sha256": "6de22c25c71c10ca41f4e601aee5d1ebfe8c3981b79915a3becbf963b58c2905", "hloubka": 0, "zdroj_objevu": "seed", "ze_seznamu": true, "mime": "text/html", "odkazy_externi": ["https://www.anthropic.com/legal/cookies", "https://modelcontextprotocol.io/introduction", "https://modelcontextprotocol.io/docs/concepts/tools", "https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization", "https://github.com/modelcontextprotocol/typescript-sdk", "https://x.com/claudeai", "https://www.threads.com/@claudeai", "https://www.linkedin.com/showcase/claude", "https://www.youtube.com/@anthropic-ai", "https://instagram.com/claudeai", "https://claude.com/solutions/agents", "https://claude.com/solutions/code-modernization", "https://claude.com/solutions/coding", "https://claude.com/solutions/customer-support", "https://claude.com/solutions/financial-services", "https://claude.com/solutions/government", "https://claude.com/solutions/education", "https://claude.com/solutions/teachers", "https://claude.com/solutions/life-sciences", "https://claude.com/partners/amazon-bedrock", "https://claude.com/partners/google-cloud-vertex-ai", "https://claude.com/blog", "https://claude.com/resources/courses", "https://claude.com/resources/use-cases", "https://claude.com/partners/mcp", "https://claude.com/customers", "https://www.anthropic.com/engineering", "https://www.anthropic.com/events", "https://claude.com/partners/powered-by-claude", "https://claude.com/partners/services", "https://claude.com/programs/startups", "https://www.anthropic.com/company", "https://www.anthropic.com/careers", "https://www.anthropic.com/economic-futures", "https://www.anthropic.com/research", "https://www.anthropic.com/news", "https://www.anthropic.com/news/announcing-our-updated-responsible-scaling-policy", "https://trust.anthropic.com/", "https://www.anthropic.com/transparency", "https://www.anthropic.com/supported-countries", "https://status.claude.com/", "https://support.claude.com/", "https://www.anthropic.com/discord", "https://www.anthropic.com/legal/privacy", "https://www.anthropic.com/responsible-disclosure-policy", "https://www.anthropic.com/legal/commercial-terms", "https://www.anthropic.com/legal/consumer-terms", "https://www.anthropic.com/legal/aup"]}