探测 MCP 连接

探测 MCP 服务并返回可发现的工具;探测不会保存连接。

POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/connections/actions/probe-mcp

调用前准备

准备具有目标工作区访问权限的个人访问令牌和目标工作区 ID。

请求体

curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/connections/actions/probe-mcp" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "endpoint_uri": "https://mcp.example.com",
    "transport": "http-streaming"
  }'

字段

类型

必填

说明

endpoint_uri

string

要探测的 MCP 服务地址。未提供 connection_id 时必须提供。

connection_id

string

已保存的连接 ID。未提供 endpoint_uri 时必须提供。

auth_type

string

认证类型。

api_key_header

string

API Key 使用的请求头名称。

credential

object

探测时使用的凭据,可包含 bearer_token、api_key、basic_username、basic_password 或 custom_headers。

transport

string

MCP 传输方式:sse 或 http-streaming。未提供时使用 http-streaming。

成功响应

成功时返回 200 和发现的工具。

{"code":0,"data":{"tools":[]}}

字段

类型

说明

data.tool_count

integer

发现的工具数量。

data.protocol_version

string

MCP 协议版本;未提供时不返回。

字段

类型

说明

data.tools

array

MCP 服务返回的工具。

错误响应

{"code":2,"message":"invalid request body"}

字段

类型

说明

code

integer

错误代码。

message

string

面向调用者的错误信息。

最后更新于