# 智能体与 MCP

读取每个智能体的支出与节省，通过受治理的 MCP 网关调用工具，并运行助手的只读工具。

[完整的 API 参考](https://www.azothos.ai/zh/docs/api)

> 路由摘要和字段名称均以英文撰写，本页与文件中都是如此。

## /api/v1/agents

### GET /api/v1/agents

Spend and savings per agent

- **认证** — API 密钥
- **密钥作用域** — `agents:read`
- **参数** — `days`
- **应答** — `200` · `400` [validation_failed](https://www.azothos.ai/zh/docs/errors#validation_failed) · `401` [api_key_missing](https://www.azothos.ai/zh/docs/errors#api_key_missing), [api_key_invalid](https://www.azothos.ai/zh/docs/errors#api_key_invalid) · `403` [api_key_scope_denied](https://www.azothos.ai/zh/docs/errors#api_key_scope_denied), [api_key_role_denied](https://www.azothos.ai/zh/docs/errors#api_key_role_denied), [ip_not_allowed](https://www.azothos.ai/zh/docs/errors#ip_not_allowed), [plan_required](https://www.azothos.ai/zh/docs/errors#plan_required) · `429`

## /api/v1/mcp

### GET /api/v1/mcp

Not used — the MCP gateway opens no stream (405)

- **认证** — API 密钥
- **密钥作用域** — `agents:write`
- **模块** — 在部署运行 `FEATURE_MCP_GATEWAY` 时提供。
- **应答** — `405`

### POST /api/v1/mcp

The governed MCP gateway (Streamable HTTP, tools only)

- **认证** — API 密钥
- **密钥作用域** — `agents:write`
- **模块** — 在部署运行 `FEATURE_MCP_GATEWAY` 时提供。
- **请求体** — `application/json`
- **应答** — `200` · `202` · `400` · `401` [api_key_missing](https://www.azothos.ai/zh/docs/errors#api_key_missing), [api_key_invalid](https://www.azothos.ai/zh/docs/errors#api_key_invalid) · `403` [key_not_bound_to_agent](https://www.azothos.ai/zh/docs/errors#key_not_bound_to_agent), [origin_not_allowed](https://www.azothos.ai/zh/docs/errors#origin_not_allowed), [api_key_scope_denied](https://www.azothos.ai/zh/docs/errors#api_key_scope_denied), [plan_required](https://www.azothos.ai/zh/docs/errors#plan_required) · `429` · `500` [internal_error](https://www.azothos.ai/zh/docs/errors#internal_error) · `501` [feature_disabled](https://www.azothos.ai/zh/docs/errors#feature_disabled) · `503` [feature_disabled](https://www.azothos.ai/zh/docs/errors#feature_disabled), [service_unavailable](https://www.azothos.ai/zh/docs/errors#service_unavailable)

### DELETE /api/v1/mcp

Not used — the MCP gateway keeps no session (405)

- **认证** — API 密钥
- **密钥作用域** — `agents:write`
- **模块** — 在部署运行 `FEATURE_MCP_GATEWAY` 时提供。
- **应答** — `405`

## /api/v1/insights

### POST /api/v1/insights/{tool}

Run one of the assistant's read tools

- **认证** — API 密钥
- **密钥作用域** — `insights:read`
- **模块** — 在部署运行 `FEATURE_ASSISTANT` 时提供。
- **参数** — `tool` (必填)
- **请求体** — `input` · `locale`
- **应答** — `200` · `400` [validation_failed](https://www.azothos.ai/zh/docs/errors#validation_failed) · `401` [api_key_missing](https://www.azothos.ai/zh/docs/errors#api_key_missing), [api_key_invalid](https://www.azothos.ai/zh/docs/errors#api_key_invalid) · `403` [assistant_disabled](https://www.azothos.ai/zh/docs/errors#assistant_disabled), [api_key_scope_denied](https://www.azothos.ai/zh/docs/errors#api_key_scope_denied), [plan_required](https://www.azothos.ai/zh/docs/errors#plan_required) · `404` [unknown_tool](https://www.azothos.ai/zh/docs/errors#unknown_tool) · `429` · `500` [internal_error](https://www.azothos.ai/zh/docs/errors#internal_error) · `501` [feature_disabled](https://www.azothos.ai/zh/docs/errors#feature_disabled) · `503` [service_unavailable](https://www.azothos.ai/zh/docs/errors#service_unavailable)
