> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aitoearn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 调用 MCP

> Agent 工具的 MCP Streamable HTTP 端点，无状态，响应为 JSON。

可用 `X-Api-Key`，也可以使用 `Authorization: Bearer <API Key>`。Key 缺失或无效时不会返回 401，而是降级为匿名会话，只暴露 `aitoearn_connection_help`。旧地址 `POST /api/unified/mcp` 会转发到本接口。



## OpenAPI

````yaml /openapi/zh/aitoearn.openapi.json post /api/ai/agent/mcp
openapi: 3.0.1
info:
  title: AiToEarn 开放平台 API
  description: AiToEarn 开放平台 API，支持在中国站与国际站之间切换调试。业务是否成功以响应体 code === 0 为准。
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: 中国站
  - url: https://aitoearn.ai
    description: 国际站
security: []
tags:
  - name: AI 服务
  - name: AI 服务/视频生成
  - name: AI 服务/图像生成
  - name: 渠道管理
  - name: 渠道管理/账号
  - name: 渠道管理/内容发布
  - name: 渠道管理/平台
  - name: 渠道管理/作品
  - name: 渠道管理/账号分组
  - name: 渠道管理/授权
  - name: 资源管理
  - name: AI 服务/大语言模型
  - name: AI 服务/真人素材
  - name: AI 服务/Agent
paths:
  /api/ai/agent/mcp:
    post:
      tags:
        - AI 服务/Agent
      summary: 调用 MCP
      description: >-
        Agent 工具的 MCP Streamable HTTP 端点，无状态，响应为 JSON。


        可用 `X-Api-Key`，也可以使用 `Authorization: Bearer <API Key>`。Key 缺失或无效时不会返回
        401，而是降级为匿名会话，只暴露 `aitoearn_connection_help`。旧地址 `POST /api/unified/mcp`
        会转发到本接口。
      operationId: AgentMcpController_handleStreamablePost
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: MCP JSON-RPC 请求体。
              additionalProperties: true
            examples:
              default:
                summary: 请求示例
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: tools/list
      responses:
        '200':
          description: 第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: 第三方协议原生响应，不使用 AiToEarn 通用响应包裹。
              examples:
                success:
                  summary: 第三方协议原生成功响应
                  value:
                    id: AgentMcpController_handleStreamablePost_example
                    object: response
            text/event-stream:
              schema:
                type: string
                description: SSE 流式响应。
      security:
        - apikey-header-X-Api-Key: []
components:
  securitySchemes:
    apikey-header-X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: 需要从 AiToEarn 获取 API Key。点击前往[「API Key 获取教程」](/zh/use/api-key)。

````