关于 🚀 NexusHub
NexusHub 是面向 Claude AI 工作流的统一 MCP 服务,将文件、数据库、Docker 和搜索等工具集中提供。它支持 HTTP 与 stdio 接口,并配有管理仪表板。
主要功能
- 01支持 HTTP 和 stdio 接口
- 02整合 Memory、GitHub 与 Brave Search
- 03提供文件、数据库和 Docker 工具
- 04文档摄取与语义搜索
- 05管理 API 密钥和服务配置
- 06仪表板监控服务状态
适用场景
- 01通过一个服务调用多类工具
- 02查询数据库并查看表结构
- 03摄取文档并进行语义检索
- 04通过仪表板检查连接服务状态
MCP 相关
NexusHub 以 MCP 服务形式向 Claude 等客户端提供文件、数据库、Docker、搜索和向量检索工具。客户端可通过 HTTP 或 stdio 连接;它也整合 Memory、GitHub 和 Brave Search MCP 服务。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
http://localhost:8001/mcpclaude mcp add --transport http NexusHub http://localhost:8001/mcp{"mcpServers":{"NexusHub":{"type":"http","url":"http://localhost:8001/mcp"}}}在 Cursor 中打开{"servers":{"NexusHub":{"type":"http","url":"http://localhost:8001/mcp"}}}在 VS Code 中打开{"mcpServers":{"NexusHub":{"type":"http","url":"http://localhost:8001/mcp"}}}{"mcpServers":{"NexusHub":{"serverUrl":"http://localhost:8001/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
🚀 NexusHub
面向 Claude AI 工具的统一 MCP 服务
通过模型上下文协议,搭建 Claude AI 与外部服务之间的强大桥梁。
为 Claude Code 增添文件系统访问、数据库操作、向量搜索、GitHub 集成等功能。
✨ 功能
- 📡 双接口 - 同时支持 HTTP 和 stdio MCP 协议
- 💅 现代化仪表板 - 美观的 Protocol 设计系统管理界面,默认启用深色模式
- 🔌 集成服务 - 整合多个 MCP 服务(Memory、GitHub、Brave Search)
- 🔍 向量数据库 - 支持文档导入和语义搜索
- 🔑 API 管理 - 安全管理 API 密钥和服务配置
- 🐳 Docker 集成 - 使用 Docker 和 Docker Compose 轻松部署
- 📋 高级提示词 - 预配置提示词,助力高效 AI 交互
- 🔄 实时状态 - 监控所有已连接服务的运行状况
采用 Protocol 设计系统的优雅 NexusHub 仪表板界面
🏛️ 架构
NexusHub 使用 Node.js 后端,通过 Express 提供 HTTP 接口,并为命令行接口原生处理 stdio。该服务集成了多个关键服务:
┌─────────────────────────────────────────────────────┐
│ Claude Desktop │
└───────────┬─────────────────┬───────────┬───────────┘
│ │ │
▼ ▼ ▼
┌───────────────────┐ ┌─────────────┐ ┌─────────────┐
│ NexusHub MCP │ │ Memory MCP │ │ GitHub MCP │
│ Server │ │ Server │ │ Server │
└─────────┬─────────┘ └─────────────┘ └─────────────┘
│ ▲ ▲
▼ │ │
┌─────────────────┐ │ │
│ Vector Store │ │ │
└─────────────────┘ │ │
│ │ │
▼ │ │
┌─────────────────┐ ┌─────────────┐ ┌─────────────────┐
│ Filesystem API │ │ Database API│ │ Docker API │
└─────────────────┘ └─────────────┘ └─────────────────┘
🛠️ 可用工具
NexusHub 为 Claude AI 提供以下工具:
| 类别 | 工具 | 描述 |
|---|---|---|
| 文件系统 | fs_list_files | 列出目录中的文件 |
fs_read_file | 读取文件内容 | |
fs_write_file | 写入文件 | |
| 数据库 | db_execute_query | 执行只读 SQL 查询 |
db_list_tables | 列出数据库中的所有表 | |
db_describe_table | 获取表结构 | |
db_insert_data | 向表中插入数据 | |
| Docker | docker_list_containers | 列出 Docker 容器 |
docker_start_container | 启动容器 | |
docker_stop_container | 停止容器 | |
docker_get_container_logs | 获取容器日志 | |
| 搜索 | serper_search | 通过 Serper API 执行网络搜索 |
| 向量数据库 | ingest_docs | 将文档导入向量存储 |
vector_search | 搜索相似文档 |
🚀 开始使用
前置条件
- Docker 和 Docker Compose
- Node.js 18+
- Python 3.8+(用于向量嵌入)
安装
-
克隆仓库:
git clone https://github.com/webdevtodayjason/NexusHub.git cd NexusHub -
设置环境变量:
cp .env.example .env # Edit .env file with your API keys -
启动服务:
docker-compose up -d -
访问仪表板: 在浏览器中打开 http://localhost:8001/dashboard
Claude Desktop 配置
NexusHub 支持两种不同的 Claude Desktop 集成方式:
1. HTTP 模式
此模式通过 HTTP 端点连接到 NexusHub。将以下内容添加到 claude_desktop_config.json:
{
"mcpServers": {
"nexushub": {
"name": "NexusHub MCP Server",
"description": "Centralized MCP server with multiple capabilities",
"url": "http://localhost:8001/mcp",
"enabled": true
}
}
}
2. STDIO 模式(推荐)
此模式使用直接进程通信,性能和可靠性更佳。需要在本地提供 NexusHub 代码:
-
准备包装脚本:
# Make the wrapper script executable chmod +x /path/to/nexushub/nexushub-mcp.sh chmod +x /path/to/nexushub/src/mcp/adapters/stdio-wrapper.js chmod +x /path/to/nexushub/src/mcp/stdio-adapter.js -
添加到你的
claude_desktop_config.json:{ "mcpServers": { "nexushub": { "name": "NexusHub MCP Server", "description": "Centralized MCP server with multiple capabilities", "command": "/path/to/nexushub/nexushub-mcp.sh", "enabled": true }, "brave-search": { "name": "Brave Search MCP", "description": "Provides web search capabilities via Brave Search API.", "command": "docker", "args": ["exec", "-i", "mcp_brave_search", "node", "dist/index.js"], "enabled": true }, "github": { "name": "GitHub MCP", "description": "Provides GitHub repository interaction.", "command": "docker", "args": ["exec", "-i", "mcp_github", "node", "dist/index.js"], "enabled": true }, "memory": { "name": "Memory MCP", "description": "Persistent knowledge graph memory.", "command": "docker", "args": ["exec", "-i", "mcp_memory", "node", "dist/index.js"], "enabled": true } } }
注意: 将 /path/to/nexushub 替换为你的实际 NexusHub 安装路径。
Docker 容器
启动 Claude Desktop 前,请确保所有 Docker 容器都在运行:
cd /path/to/nexushub
docker-compose up -d
这将启动所有必需的 MCP 服务:
- NexusHub(主服务,提供文件系统、数据库和 Docker 工具)
- Brave Search MCP(网页搜索功能)
- GitHub MCP(仓库交互)
- Memory MCP(知识图谱/持久化记忆)
💡 使用示例
以下是将 NexusHub 与 Claude AI 搭配使用的一些示例:
文件操作
Please use fs_list_files to show me all the JavaScript files in the src directory,
then read the content of any interesting files you find.
数据库查询
Can you use db_execute_query to find all users in the database who joined
in the last month and have the "admin" role?
向量搜索
Please use vector_search to find documentation related to "authentication flow"
and summarize the key points.
组合工具
First, use brave_web_search to find the latest best practices for React error boundaries.
Then, use fs_read_file to examine our current implementation in ErrorBoundary.jsx,
and suggest improvements based on what you found.
🧩 如何添加自己的工具
你可以在 /src/mcp/tools/ 目录中添加新的工具定义,以扩展 NexusHub:
// src/mcp/tools/my-custom-tools.js
export function getToolDefinitions() {
return {
my_custom_tool: {
name: 'my_custom_tool',
description: 'Description of what the tool does.',
inputSchema: {
type: 'object',
properties: {
param1: {
type: 'string',
description: 'Description of parameter 1'
}
// Add more parameters as needed
},
required: ['param1']
}
}
};
}
// Tool implementation
export async function myCustomTool(param1) {
// Your custom tool logic here
return { result: 'Success!' };
}
然后将该工具添加到 /src/mcp/tools/index.js 和 /src/mcp/tools/handler.js。
🔄 本地开发
-
安装依赖项:
npm install -
在开发模式下运行:
npm run dev -
测试 stdio 模式:
npm run stdio
🧪 运行测试
# Run all tests
npm test
# Run specific test suite
npm test -- --grep "API Keys"
🔧 故障排除
Claude Desktop 集成问题
-
启动 Claude Desktop 时出现“Unexpected token”错误:
- 确保包装脚本具有正确的权限:
chmod +x nexushub-mcp.sh - 确认所有脚本都能正确过滤非 JSON 输出
- 查看
/tmp/nexushub-debug-*.log中的日志文件,了解详情
- 确保包装脚本具有正确的权限:
-
MCP 服务未加载或工具未显示:
- 确保 Docker 容器正在运行:
docker ps | grep mcp - 检查容器日志:
docker logs mcp_brave_search - 确认 Claude Desktop 配置中的路径/命令正确
- 修改后尝试重启 Claude Desktop
- 确保 Docker 容器正在运行:
-
Docker 容器问题:
- 如果 Docker 日志过大,请清理:
docker system prune - 重启容器:
docker-compose restart - 检查端口冲突:
lsof -i :8001
- 如果 Docker 日志过大,请清理:
常见错误消息
| 错误 | 解决方案 |
|---|---|
| "Method not found" | MCP 服务不支持此方法。检查你使用的工具名称是否正确。 |
| "Socket hang up" | 连接问题。检查 MCP 服务是否正在运行。 |
| "ENOENT" | 未找到文件或目录。检查配置中的路径。 |
| "Permission denied" | 文件权限问题。检查脚本权限。 |
| "Unexpected token" | JSON 解析错误。检查 MCP 服务的标准输出。 |
📚 文档
工具开发指南
- 快速入门指南 - 5 分钟内完成设置并开始使用
- 工具开发指南 - 创建工具的完整指南
- AI 工具创建提示词 - 用于 AI 辅助创建工具的优化提示词
集成指南
- Claude Desktop 集成 - 将 NexusHub 连接到 Claude Desktop
- Claude CLI 集成 - 将 NexusHub 与 Claude CLI 搭配使用
MCP 资源
如需完整文档,请访问 NexusHub Wiki。
🤝 贡献
贡献让开源社区成为一个令人惊叹的学习、启发和创造之地。我们非常感谢你做出的任何贡献。
- Fork 此项目
- 创建功能分支(
git checkout -b feature/AmazingFeature) - 提交更改(
git commit -m 'Add some AmazingFeature') - 推送到分支(
git push origin feature/AmazingFeature) - 发起 Pull Request
📝 许可证
本项目基于 MIT License 发布。更多信息请参阅 LICENSE。
👨💻 作者
🙏 致谢
- Claude AI - 感谢其出色的 AI 能力
- Model Context Protocol - 感谢其提供协议规范
- Protocol Design System - 感谢其提供现代化的 UI 设计语言
- Tailwind CSS - 感谢其提供实用优先的 CSS 框架
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。