Claude 的模型上下文協議 (MCP) 連接器功能讓您能夠直接從 Messages API 連接到遠端 MCP 伺服器,無需單獨的 MCP 客戶端。
"anthropic-beta": "mcp-client-2025-04-04"
mcp_servers
參數:
mcp_servers
陣列中的每個 MCP 伺服器支援以下配置:
屬性 | 類型 | 必需 | 描述 |
---|---|---|---|
type | string | 是 | 目前僅支援 “url” |
url | string | 是 | MCP 伺服器的 URL。必須以 https:// 開頭 |
name | string | 是 | 此 MCP 伺服器的唯一識別符。它將在 mcp_tool_call 區塊中用於識別伺服器並向模型消除工具歧義。 |
tool_configuration | object | 否 | 配置工具使用 |
tool_configuration.enabled | boolean | 否 | 是否啟用此伺服器的工具(預設:true) |
tool_configuration.allowed_tools | array | 否 | 限制允許的工具清單(預設情況下,允許所有工具) |
authorization_token | string | 否 | 如果 MCP 伺服器需要,則為 OAuth 授權權杖。請參閱 MCP 規範。 |
mcp_servers
陣列中包含多個物件來連接到多個 MCP 伺服器:
authorization_token
參數。
API 消費者需要處理 OAuth 流程並在進行 API 呼叫之前取得存取權杖,以及根據需要重新整理權杖。
access_token
值。
authorization_token
欄位。