---
title: "调用 MCP"
method: POST
path: "/api/ai/agent/mcp"
tags: ["AI 服务/Agent"]
---

# 调用 MCP

`POST /api/ai/agent/mcp`

## Request

- Base URL: `https://aitoearn.cn`
- URL: `https://aitoearn.cn/api/ai/agent/mcp`
- Auth: API key in header `X-Api-Key`
- TypeScript: <https://skmtc.dev/aitoearn/apis/aitoearn-api/docs/api/ai/agent/mcp/post.ts> (a function with typed inputs; its response is checked against the schema)

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

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

## Request body

- object: MCP JSON-RPC 请求体。

## Response `200`

第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。

- object: 第三方协议原生响应，不使用 AiToEarn 通用响应包裹。

## Changes

- **2026-11-03** `7cc8f21c4c96`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/aitoearn/apis/aitoearn-api/changes/api/ai/agent/mcp/post.md)

---

[API](https://skmtc.dev/aitoearn/apis/aitoearn-api.md) - [All operations](https://skmtc.dev/aitoearn/apis/aitoearn-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aitoearn/apis/aitoearn-api/revisions/7cc8f21c4c96?raw)
