使用说明
MCP集线器
包管理器 模型上下文协议 服务器。
使用单个命令搜索、安装和管理MCP服务器。
mcphub search filesystem
mcphub install io.github.user/server-filesystem
mcphub doctor # ← diagnose broken MCP servers
适用于: 克劳德代码·克劳德桌面·光标
特性
- 一个命令安装 -安装任何MCP服务器并自动配置您的客户端
- 智能检测 -自动查找Claude Desktop、Cursor和其他MCP客户端
- 注册表搜索 -从您的终端浏览整个MCP服务器生态系统
- MCP服务器模式 -在Claude Code或Cursor中使用mcphub作为MCP服务
- 零配置 -使用合理的默认值即可开箱即用
- 安全配置更新 -在修改配置文件之前备份它们
- 跨平台 -macOS、Linux和Windows支持
- 单个二进制 -无运行时依赖关系
安装
选择任何方法:
curl(macOS/Linux)
curl -fsSL https://raw.githubusercontent.com/Ricardo-M-L/mcphub/master/install.sh | sh
家酿
brew tap Ricardo-M-L/mcphub
brew install mcphub
npm
npm install -g @ricardo.m.lu/mcphub
去
go install github.com/Ricardo-M-L/mcphub/cmd/mcphub@latest
来源
git clone https://github.com/Ricardo-M-L/mcphub.git
cd mcphub
make build
# Binary at ./bin/mcphub
用法
搜索MCP服务器
mcphub search filesystem
mcphub search database
mcphub search github
mcphub search slack
# JSON output
mcphub search filesystem --json
# Limit results
mcphub search database --limit 5
查看服务器详细信息
mcphub info io.github.user/server-filesystem
mcphub info io.github.user/server-filesystem --json
安装MCP服务器
mcphub install io.github.user/server-filesystem
运行install时会发生什么:
- 查询 MCP注册表 对于服务器
- 确定安装方法(npm/npx或远程URL)
- 提示所需的环境变量(API键等)
- 自动检测已安装的MCP客户端(Claude Desktop、Cursor)
- 将服务器配置写入每个客户端的配置文件(带备份)
- 在中记录安装
~/.mcphub/mcphub-lock.json
针对特定客户:
mcphub install io.github.user/server-filesystem --client claude-desktop
mcphub install io.github.user/server-filesystem --client cursor
列出已安装的服务器
mcphub list
mcphub list --json
删除服务器
mcphub remove io.github.user/server-filesystem
这将从所有配置的MCP客户端和锁文件中删除服务器。
发布您自己的MCP服务器
如果您已经构建了一个MCP服务器,并希望其他人通过mcphub安装它,请按照以下步骤操作:
1.将您的MCP服务器发布到npm
cd my-mcp-server
npm publish --access public
发布后,任何人都可以使用以下命令运行您的服务器 npx @your-scope/my-mcp-server.
2.创建mcphub清单
mcphub init
这产生了 mcphub.json 文件。使用您的服务器信息进行编辑:
{
"name": "your-org/my-mcp-server",
"version": "1.0.0",
"description": "What your MCP server does",
"runtime": {
"type": "npm",
"command": "npx",
"package": "@your-scope/my-mcp-server"
},
"transport": "stdio",
"environmentVariables": [
{
"name": "API_KEY",
"description": "Your API key for the service",
"required": true,
"secret": true
}
]
}
3.验证并发布
# Validate without publishing
mcphub publish --dry-run
# Publish to MCP Registry
mcphub publish
4.现在任何人都可以安装您的服务器
# Search for it
mcphub search my-mcp-server
# Install (auto-configures Claude Desktop / Cursor)
mcphub install your-org/my-mcp-server
# Or add directly to Claude Code
claude mcp add my-server npx @your-scope/my-mcp-server
支持的运输类型
| 传输 | 工作原理 | 用户下载? | 示例 |
|---|---|---|---|
| 标准 | 通过npx进行本地进程 | 是(npm包) | npx @scope/my-server |
| 可流式传输http | 远程HTTP端点 | 否,仅连接到URL | https://api.example.com/mcp |
| SSE | 服务器发送事件端点 | 否,仅连接到URL | https://api.example.com/sse |
对于远程服务器(可流式传输的http/sse),请设置 mcphub.json 这样地:
{
"name": "your-org/my-remote-server",
"version": "1.0.0",
"description": "My remote MCP server",
"transport": "streamable-http",
"remoteUrl": "https://api.example.com/mcp"
}
用户安装方式相同——mcphub自动检测传输类型:
mcphub install your-org/my-remote-server
# → Configures URL in Claude Desktop / Cursor, zero download
分发选项
| 方法 | 你做什么 | 用户如何安装 | 最适合 |
|---|---|---|---|
| npm+stdio | npm publish + mcphub publish |
mcphub install xxx |
CLI工具、本地服务器 |
| 远程URL | 部署服务器+ mcphub publish |
mcphub install xxx (零下载) |
API服务,云MCP |
| 直接的 | npm publish 只有 |
claude mcp add xxx npx @scope/pkg |
简单,无需注册 |
用作MCP服务(克劳德代码/光标)
mcphub本身可以作为MCP服务器运行,因此您可以直接从AI助手搜索和安装MCP服务器。
快速设置(2个命令)
# Install the MCP server binary
go install github.com/Ricardo-M-L/mcphub/mcp@latest
# Add to Claude Code
claude mcp add mcphub mcphub-mcp
就是这样。重新启动Claude Code并开始聊天。
替代方案:从源代码构建
git clone https://github.com/Ricardo-M-L/mcphub.git
cd mcphub
go build -o bin/mcphub-mcp ./mcp
claude mcp add mcphub /path/to/mcphub/bin/mcphub-mcp
其他MCP客户端
或手动添加到 ~/.claude/settings.json:
{
"mcpServers": {
"mcphub": {
"command": "/path/to/mcphub-mcp"
}
}
}
克劳德桌面版 -添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mcphub": {
"command": "/path/to/mcphub-mcp"
}
}
}
光标 -添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"mcphub": {
"command": "/path/to/mcphub-mcp"
}
}
}
3.在对话中使用
重启客户端后,您可以说:
- “搜索数据库MCP服务器”
- “安装文件系统MCP服务器”
- “我安装了哪些MCP服务器?”
- “删除github MCP服务器”
可用的MCP工具
| 工具 | 说明 |
|---|---|
search_servers |
在MCP注册表中搜索服务器 |
install_server |
安装服务器并自动配置客户端 |
list_installed |
列出所有已安装的MCP服务器 |
remove_server |
从所有客户端中删除服务器 |
server_info |
获取服务器的详细信息 |
运作原理
MCP Registry
(registry.modelcontextprotocol.io)
|
HTTP API
|
Terminal ──── mcphub CLI ────────────┤
| |
| Search / Info
|
Install / Remove
|
┌─────────┼─────────┐
| | |
Claude Cursor Claude
Desktop Code
| | |
config config config
.json .json .json
- mcphub不下载软件包 -对于基于npm的服务器,它写道
npx -y <package>进入您的客户端配置。npx在运行时处理下载和缓存。 - mcphub不运行MCP服务器 -它只配置您的MCP客户端来运行它们。
- 配置安全 -始终创建
.bak在修改配置文件之前进行备份。 - 文件 -跟踪已安装的服务器
~/.mcphub/mcphub-lock.json.
支持的MCP客户端
| 客户端 | 配置路径 | 自动检测 |
|---|---|---|
| 克劳德桌面 | ~/Library/Application Support/Claude/claude_desktop_config.json |
是的 |
| 光标 | ~/.cursor/mcp.json |
是的 |
| 克劳德代码 | ~/.claude/settings.json |
计划中 |
| OpenCode | opencode.json |
计划中 |
项目结构
mcphub/
├── cmd/mcphub/ # CLI entrypoint
├── mcp/ # MCP server mode (stdio transport)
├── internal/
│ ├── cli/ # Command definitions (search, install, list, remove, info, publish)
│ ├── registry/ # MCP Registry API client
│ ├── installer/ # Package installers (npm, remote)
│ ├── config/ # MCP client config read/write (with backup)
│ ├── store/ # Local lockfile management
│ ├── ui/ # Terminal output formatting
│ └── platform/ # OS-specific file paths
├── server/ # Registry API server (Go + SQLite + FTS5)
│ ├── handler/ # REST API handlers
│ ├── crawler/ # Upstream registry sync
│ └── db/ # SQLite with full-text search
├── web/ # Web UI (Next.js + TypeScript)
├── npm/ # npm package wrapper
├── install.sh # curl installer script
├── Dockerfile # Container build
├── Makefile # Build targets
└── .github/workflows/ # CI/CD + Release automation
发展
先决条件
- 转到1.23+
- Node.js 20+(用于web UI)
构建
# CLI
make build
# MCP server
go build -o bin/mcphub-mcp ./mcp
# Registry API server
go build -o bin/mcphub-server ./server
# Web UI
cd web && npm install && npx next build
测试
make test
在本地运行
# CLI
./bin/mcphub search filesystem
# MCP server (stdio)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./bin/mcphub-mcp
# Registry API server
./bin/mcphub-server --port 8080
路线图
- [x] CLI:搜索、安装、列表、删除、信息、发布、初始化
- [x] 自动配置Claude桌面和光标
- [x] Claude Code/Cursor集成的MCP服务器模式
- [x] 带有SQLite+FTS5全文搜索的注册表API服务器
- [x] 用于浏览MCP服务器的Web UI
- [x] API质量评分(完整性、可安装性、文档、安全性)
- [x] 带有GitHub Actions+跨平台发布版本的CI/CD
- [x] 5种分发方式:curl、Homebrew、npm、Go、source
- [x] 14个单元测试通过
- [x] Claude Code和Windsurf自动检测支持
- [x] 从MCP工具模式(TypeScript和Python)自动生成SDK
- [x] 服务器健康监测(mcphub医生)
- [x] 社区评级和评论(mcphub率和评级)
贡献
我们欢迎捐款!看 贡献.md 作为指导方针。
许可证
Apache-2.0-见 许可证 了解详情。