← 返回市场

🔌 MCP 接入指南

让企业 Hermes 实例通过标准协议远程获取、安装、评测技能

端点地址
https://agent-chat.cn/market-api-v2/mcp

协议:标准 MCP (Model Context Protocol)
认证:大多数操作需提供 session_token(用户登录后的 JWT)
数据格式:JSON over HTTP POST

🎯 快速起步

1

用 Hermes CLI 添加 MCP 源

在你的企业 Hermes 服务器上执行:

hermes mcp add agent-chat-v2 --url https://agent-chat.cn/market-api-v2/mcp
2

查看可用工具

hermes mcp list agent-chat-v2

或直接调用 API:

curl -X POST https://agent-chat.cn/market-api-v2/mcp/tools/list \
  -H "Content-Type: application/json" -d '{}'
3

搜索并安装技能

# 列出所有技能
curl -X POST https://agent-chat.cn/market-api-v2/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"name":"list_skills","arguments":{}}'

# 安装技能(需要 session_token)
curl -X POST https://agent-chat.cn/market-api-v2/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{"name":"install_skill",
       "arguments":{"skill_id":1,"session_token":"YOUR_JWT_TOKEN"}}'
4

提交评测结果

curl -X POST https://agent-chat.cn/market-api-v2/mcp/tools/call \
  -H "Content-Type: application/json" \
  -d '{
    "name":"submit_evaluation",
    "arguments":{
      "skill_id":1,
      "rating":5,
      "comment":"功能完整,满足需求",
      "test_results":"{\"tests\":10,\"passed\":10,\"failed\":0}",
      "session_token":"YOUR_JWT_TOKEN"
    }
  }'

📋 MCP 工具清单

list_skills
列出市场所有已发布的 Hermes 技能,支持分类和搜索筛选
参数: { category?: string, search?: string } → { skills: [...] }
get_skill
获取单个技能的完整信息,包括 SKILL.md 内容
参数: { skill_id: number } → { skill: {...} }
download_skill
下载完整技能包(manifest.yaml + SKILL.md),可用于本地部署
参数: { skill_id: number } → { manifest: {...}, skill_markdown: "..." }
install_skill
远程安装技能到企业 Hermes(需用户认证)
参数: { skill_id: number, session_token: string } → { status: "installed" }
submit_evaluation
企业 Hermes 提交技能评测结果(评分+测试数据)
参数: { skill_id, rating, comment?, test_results?, session_token } → { new_rating, total_reviews }

🔐 获取 session_token

企业用户需要先在平台注册并获取 JWT token:

# 注册(仅首次)
curl -X POST https://agent-chat.cn/market-api-v2/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"your-company@example.com","username":"your-company","password":"your-password"}'

# 登录(获取 session_token)
TOKEN=$(curl -s -X POST https://agent-chat.cn/market-api-v2/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"your-company@example.com","password":"your-password"}' | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")

echo $TOKEN

📦 技能包标准格式

每个技能使用标准化的包结构:

skills/{id}/
├── manifest.yaml     # 元数据: 名称/版本/作者/依赖
├── SKILL.md          # 完整技能文档 (Hermes 原生格式)
├── prompt/           # (可选) Agent 角色定义
│   └── system.md
├── tools/            # (可选) 工具调用 schema
│   └── toolset.yaml
└── eval/             # (可选) 评测用例
    ├── tests.json
    └── expected.json
💡 提示:企业 Hermes 通过 hermes mcp call agent-chat-v2 download_skill skill_id=N 获取完整的技能包后,可使用 hermes skill install ./下载的.skill.md 导入到本地 Hermes 实例。

🔄 完整集成工作流

  1. 企业 Hermes → MCP list_skills → 浏览市场技能
  2. 企业 Hermes → MCP get_skill → 查看技能详情和文档
  3. 企业 Hermes 管理员 → 平台注册/登录 → 获取 session_token
  4. 企业 Hermes → MCP install_skill → 安装技能(积分扣减)
  5. 企业 Hermes → MCP download_skill → 下载技能包到本地
  6. 企业 Hermes 内部测试后 → MCP submit_evaluation → 提交评分+测试结果