首页 › AI Agent › Hermes Agent › Hermes Agent MCP 集成

Hermes Agent MCP 集成

​

飞书文档 - 图片

​

配置 MCP 服务器​

基本配置​

在 ~/.hermes/config.yaml 中添加 MCP 服务器:​

​

代码块​

Python

mcp_servers:​

github:​

command: npx​

args: ["-y", "@modelcontextprotocol/server-github"]​

env:​

GITHUB_PERSONAL_ACCESS_TOKEN: "ghp_xxx"​

​

常用 MCP 服务器​

​

#nbvsuxQrrlIU text { white-space: pre; }#nbvsuxQrrlIU .fb0 { stroke: var(--N900-FG, 0.15); }#nbvsuxQrrlIU .fb0 {stroke: rgba(31,35,41, 0.15)}#nbvsuxQrrlIU .fx0 { stroke-miterlimit: 10; }#nbvsuxQrrlIU .fx0 {stroke-miterlimit: 10}#nbvsuxQrrlIU .fa1 { fill: rgb(187, 191, 196); }#nbvsuxQrrlIU .fa1 {fill: rgb(187, 191, 196)}#nbvsuxQrrlIU .fx1 { font: 400 12px MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Tahoma, "PingFang SC", "Microsoft Yahei", Arial, "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }#nbvsuxQrrlIU .fx1 {font-style: normal}#nbvsuxQrrlIU .fx2 { text-anchor: middle; }#nbvsuxQrrlIU .fx2 {text-anchor: middle}#nbvsuxQrrlIU .fx3 { dominant-baseline: central; }#nbvsuxQrrlIU .fx3 {dominant-baseline: central}#nbvsuxQrrlIU .fx4 { stroke: none; }#nbvsuxQrrlIU .fx4 {stroke: none}#nbvsuxQrrlIU .fc0 { fill: var(--text-caption); }#nbvsuxQrrlIU .fc0 {fill: #646a73}#nbvsuxQrrlIU .fa2 { fill: var(--text-link-disabled); }#nbvsuxQrrlIU .fa2 {fill: rgb(187, 191, 196)}#nbvsuxQrrlIU .fa3 { fill: rgb(59, 58, 56); }#nbvsuxQrrlIU .fa3 {fill: rgb(59, 58, 56)}#nbvsuxQrrlIU .fx5 { font: 700 14px MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Tahoma, "PingFang SC", "Microsoft Yahei", Arial, "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }#nbvsuxQrrlIU .fx5 {font-style: normal}#nbvsuxQrrlIU .fx6 { text-anchor: start; }#nbvsuxQrrlIU .fx6 {text-anchor: start}#nbvsuxQrrlIU .fx7 { dominant-baseline: alphabetic; }#nbvsuxQrrlIU .fx7 {dominant-baseline: alphabetic}#nbvsuxQrrlIU .fc1 { fill: rgb(255, 255, 255); }#nbvsuxQrrlIU .fc1 {fill: rgb(255, 255, 255)}#nbvsuxQrrlIU .fx8 { font: 400 14px MonospacedNumber, LarkHackSafariFont, LarkEmojiFont, LarkChineseQuote, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Tahoma, "PingFang SC", "Microsoft Yahei", Arial, "Hiragino Sans GB", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }#nbvsuxQrrlIU .fx8 {font-style: normal}#nbvsuxQrrlIU .fc2 { fill: rgb(51, 51, 51); }#nbvsuxQrrlIU .fc2 {fill: rgb(51, 51, 51)}#nbvsuxQrrlIU .fx9 { font: 400 14px LarkHackSafariFont, LarkEmojiFont, "monospace", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Noto Sans", Tahoma, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Source Han Sans CN", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", STHeiti, SimHei, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", system-ui; }#nbvsuxQrrlIU .fx9 {font-style: normal}#nbvsuxQrrlIU .fb1 { fill: var(--N900-FG, 0.15); }#nbvsuxQrrlIU .fb1 {fill: rgba(31,35,41, 0.15)}#nbvsuxQrrlIU .fb2 { fill: rgb(212, 212, 212); }#nbvsuxQrrlIU .fb2 {fill: rgb(212, 212, 212)}#nbvsuxQrrlIU .fb3 { fill: rgb(232, 234, 246); }#nbvsuxQrrlIU .fb3 {fill: rgb(232, 234, 246)}#nbvsuxQrrlIU .fa4 { fill: var(--bg-body); }#nbvsuxQrrlIU .fa4 {fill: #fff}ABC123456服务器功能安装命令GitHubFilesystemPostgreSQLBrave SearchSlack仓库管理、PR、Issues文件操作数据库查询网页搜索Slack 集成npx -y @modelcontextprotocol/server-githubnpx -y @modelcontextprotocol/server-filesystemnpx -y @modelcontextprotocol/server-postgresnpx -y @modelcontextprotocol/server-brave-searchnpx -y @modelcontextprotocol/server-slack

​

完整示例​

​

代码块​

Bash

mcp_servers:​

github:​

command: npx​

args: ["-y", "@modelcontextprotocol/server-github"]​

env:​

​

​

​

使用 MCP 工具​

配置 MCP 服务器后,工具会自动可用:​

​

代码块​

Python

# 列出可用工具​

​

MCP 工具会以 mcp-- 格式显示。​

GitHub 示例​

​

代码块​

Python

❯ 创建一个新的 GitHub issue​

​

Hermes 会使用 MCP GitHub 服务器来:​

•

创建 issue​

•

添加标签​

•

分配给适当的开发者​

​

​

过滤 MCP 工具​

可以使用 allowed_tools 或 blocked_tools 来过滤工具:​

​

代码块​

YAML

mcp_servers:​

github:​

command: npx​

args: ["-y", "@modelcontextprotocol/server-github"]​

env:​

GITHUB_PERSONAL_ACCESS_TOKEN: "ghp_xxx"​

allowed_tools:​

- github_list_issues​

- github_create_issue​

- github_get_issue​

blocked_tools:​

- github_delete_repository​

​

安全建议:始终限制允许的工具,特别是对于具有敏感操作的服务器如 GitHub(删除操作)或文件系统(删除操作)。​

​

​

MCP 工具集​

MCP 工具作为工具集自动添加到 Hermes:​

​

代码块​

Python

# MCP 工具集自动命名为 mcp-<server>​

hermes chat --toolsets "mcp-github,mcp-filesystem"​

​

​

​

自定义 MCP 服务器​

您可以创建自己的 MCP 服务器来扩展 Hermes:​

实现 MCP 协议​

在 config.yaml 中配置​

工具自动可用​

有关创建 MCP 服务器的详细信息,请参阅 MCP 规范。​

​

​

故障排除​

​

表格加载中...

​

​

💡

提示:使用 hermes doctor 可以诊断 MCP 配置问题。​

​

​