关于 MCP-Hub MCP
MCP-Hub MCP 是一个 MCP 枢纽服务,可通过单一接口连接并管理多个其他 MCP 服务。它面向需要使用大量 MCP 服务的用户,按需连接不常用的服务,以减少上下文占用和无关工具干扰。
主要功能
- 01通过配置文件自动连接其他 MCP 服务
- 02列出已连接服务的工具
- 03调用已连接服务上的工具并返回结果
- 04使用正则表达式搜索工具名称和描述
适用场景
- 01仅在需要时连接 Atlassian MCP、Playwright MCP 等低频服务
- 02在大量工具中按关键字或模式查找可用工具
- 03通过统一入口调用 filesystem 等服务的工具
MCP 相关
该项目本身是 MCP 服务,向 MCP 客户端暴露 list-all-tools、call-tool 和 find-tools 三个工具,并在后端连接和管理其他 MCP 服务。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
MCP-Hub-MCP 服务
一个用于连接和管理其他 MCP(模型上下文协议)服务的中枢服务。
概览
本项目构建了一个 MCP 中枢服务,通过单一接口连接和管理多个 MCP(模型上下文协议)服务。 它允许你仅在需要时连接不常用的 MCP(例如 Atlassian MCP、Playwright MCP),从而避免上下文使用过多和内容污染。 这可以让活跃工具集保持专注且易于管理,减少 AI 错误并提升性能。
主要功能
- 通过配置文件自动连接其他 MCP 服务
- 列出已连接服务上的可用工具
- 调用已连接服务上的工具并返回结果
配置
将以下内容添加到你的 mcp.json 中:
使用 npx
{
"mcpServers": {
"other-tools": {
"command": "npx",
"args": [
"-y",
"mcp-hub-mcp",
"--config-path",
"/Users/username/mcp.json"
]
}
}
}
安装和运行
要求
- Node.js 18.0.0 或更高版本
- npm、yarn 或 pnpm
安装
# Clone repository
git clone <repository-url>
cd mcp-hub-mcp
# Install dependencies
npm install
# or
yarn install
# or
pnpm install
构建
npm run build
# or
yarn build
# or
pnpm build
运行
npm start
# or
yarn start
# or
pnpm start
开发模式
npm run dev
# or
yarn dev
# or
pnpm dev
配置文件
MCP-Hub-MCP 服务使用 Claude Desktop 格式的配置文件,自动连接其他 MCP 服务。 你可以通过以下方式指定配置文件:
- 环境变量:将
MCP_CONFIG_PATH环境变量设为配置文件路径 - 命令行参数:使用
--config-path选项指定配置文件路径 - 默认路径:使用当前目录中的
mcp-config.json文件
配置文件格式:
{
"mcpServers": {
"serverName1": {
"command": "command",
"args": ["arg1", "arg2", ...],
"env": { "ENV_VAR1": "value1", ... }
},
"serverName2": {
"command": "anotherCommand",
"args": ["arg1", "arg2", ...]
}
}
}
示例:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/Users/username/Downloads"
]
},
"other-server": {
"command": "node",
"args": ["path/to/other-mcp-server.js"]
}
}
}
用法
MCP-Hub-MCP 服务提供以下工具:
1. list-all-tools
返回所有已连接服务中的工具列表。
{
"name": "list-all-tools",
"arguments": {}
}
2. call-tool
调用特定服务上的工具。
serverName:要从中调用工具的 MCP 服务名称toolName:要调用的工具名称toolArgs:传递给工具的参数
{
"name": "call-tool",
"arguments": {
"serverName": "filesystem",
"toolName": "readFile",
"toolArgs": {
"path": "/Users/username/Desktop/example.txt"
}
}
}
3. find-tools
在所有已连接服务中查找与正则表达式模式匹配的工具(类似 grep 的功能)。
pattern:要在工具名称和描述中搜索的正则表达式模式searchIn:搜索范围:"name"、"description" 或 "both"(默认:"both")caseSensitive:搜索是否区分大小写(默认:false)
{
"name": "find-tools",
"arguments": {
"pattern": "file",
"searchIn": "both",
"caseSensitive": false
}
}
示例模式:
"file"- 查找所有包含 "file" 的工具"^read"- 查找所有以 "read" 开头的工具"(read|write).*file"- 查找用于读取或写入文件的工具"config$"- 查找所有以 "config" 结尾的工具
输出示例:
{
"filesystem": [
{
"name": "readFile",
"description": "Read the contents of a file",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "Path to the file to read"
}
},
"required": ["path"]
}
},
{
"name": "writeFile",
"description": "Write content to a file",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "Path to the file to write"
},
"content": {
"type": "string",
"description": "Content to write to the file"
}
},
"required": ["path", "content"]
}
}
]
}
提交消息规范
本项目遵循 Conventional Commits 进行自动版本管理和 CHANGELOG 生成。
格式:<type>(<scope>): <description>
示例:
feat: add new hub connection featurefix: resolve issue with server timeoutdocs: update API documentationchore: update dependencies
类型:
feat:新功能(MINOR 版本升级)fix:修复错误(PATCH 版本升级)docs:仅修改文档style:不影响代码含义的更改refactor:既不修复错误也不添加功能的代码更改perf:提升性能的代码更改test:添加缺失的测试或修正现有测试chore:构建流程或辅助工具的更改
重大更改:
在提交页脚中添加 BREAKING CHANGE:,以触发 MAJOR 版本升级。
其他链接
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。