跳转到主要内容
MCP host 的鉴权 + 端点布局见 MCP 概览。反向 —— 智能体通过 attachments[] 接收文件、以及跨 OpenAPI 和 A2A 的 file_id 模型 —— 见 工具 § 附件调用智能体 § 附件
除工具外,MCP 智能体还能暴露资源(只读数据)和 prompt 模板 (可复用的消息模式)。这些遵循标准 MCP 规范。

资源

资源代表 MCP 客户端可读不可改的数据。

resources/list

发现可用资源:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "resources/list"
}
响应:
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "resources": [
      {
        "uri": "beeos://agent/config",
        "name": "Agent Configuration",
        "description": "Current agent configuration and capabilities",
        "mimeType": "application/json"
      },
      {
        "uri": "beeos://agent/skills",
        "name": "Skill Registry",
        "description": "List of all registered skills with metadata",
        "mimeType": "application/json"
      }
    ]
  }
}

资源 schema

字段类型说明
uristring资源唯一标识
namestring人类可读名
descriptionstring资源包含啥
mimeTypestring资源 content type

resources/read

按 URI 读特定资源:
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "resources/read",
  "params": {
    "uri": "beeos://agent/config"
  }
}
响应:
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "contents": [
      {
        "uri": "beeos://agent/config",
        "mimeType": "application/json",
        "text": "{\"name\":\"Research Assistant\",\"model\":\"gpt-4o\",\"skills\":[\"web_search\",\"summarize\"]}"
      }
    ]
  }
}

Prompt 模板

Prompt 模板是 MCP 客户端可呈现给用户的可复用消息模式。

prompts/list

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "prompts/list"
}
响应:
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "prompts": [
      {
        "name": "research",
        "description": "Research a topic and provide a summary",
        "arguments": [
          {
            "name": "topic",
            "description": "The topic to research",
            "required": true
          },
          {
            "name": "depth",
            "description": "Research depth: brief, standard, or deep",
            "required": false
          }
        ]
      }
    ]
  }
}

prompts/get

按参数渲染 prompt 模板:
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "prompts/get",
  "params": {
    "name": "research",
    "arguments": {
      "topic": "quantum computing",
      "depth": "deep"
    }
  }
}
响应:
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "messages": [
      {
        "role": "user",
        "content": {
          "type": "text",
          "text": "Research quantum computing in depth. Provide a comprehensive summary covering recent advances, key players, and practical applications."
        }
      }
    ]
  }
}

示例:完整资源流程

# 列资源
curl -s -X POST "https://mcp.beeos.ai/${AGENT_ID}/mcp" \
  -H "X-Agent-API-Key: bak_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"resources/list"}' | jq '.result.resources'

# 读一个资源
curl -s -X POST "https://mcp.beeos.ai/${AGENT_ID}/mcp" \
  -H "X-Agent-API-Key: bak_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"resources/read","params":{"uri":"beeos://agent/config"}}' | jq

# 列 prompts
curl -s -X POST "https://mcp.beeos.ai/${AGENT_ID}/mcp" \
  -H "X-Agent-API-Key: bak_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"prompts/list"}' | jq '.result.prompts'

可用性

不是所有智能体都暴露资源或 prompt。智能体没注册过的话响应可能是空数组:
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "resources": []
  }
}
这是正常行为、不是错误。