AI工具统一MCP服务器

NexusHub是一个连接Claude AI与外部服务的统一MCP服务器,提供文件系统访问、数据库操作、向量搜索、GitHub集成等功能。

  • by webdevtodayjason
  • HTML
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 webdevtodayjason/nexushub

使用说明

🚀 NexusHub

Claude AI工具的统一MCP服务器

A powerful bridge between Claude AI and external services via Model Context Protocol.
Enhance Claude Code with filesystem access, database operations, vector search, GitHub integration, and more.

演示 • 文档 • 报告Bug • 请求功能


✨ 特性

  • 📡 双接口 -支持HTTP和stdio MCP协议
  • 💅 现代仪表板 -美观的协议设计系统管理界面,默认为暗模式
  • 🔌 综合服务 -组合多个MCP服务器(内存、GitHub、Brave Search)
  • 🔍 矢量数据库 -文档摄取和语义搜索功能
  • 🔑 API管理 -安全地管理API密钥和服务配置
  • 🐳 Docker集成 -使用Docker和Docker Compose轻松部署
  • 📋 高级提示 -用于有效AI交互的预配置提示
  • 🔄 实时状态 -监控所有连接服务的运行状况


The elegant NexusHub dashboard interface with Protocol design system

🏛️ 建筑

NexusHub使用Node.js后端,Express用于HTTP接口,原生stdio用于CLI接口。服务器集成了几个关键服务:

┌─────────────────────────────────────────────────────┐
│                  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_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+(用于向量嵌入)

安装

  1. 克隆存储库:

    git clone https://github.com/webdevtodayjason/NexusHub.git
    cd NexusHub
    
  2. 设置环境变量:

    cp .env.example .env
    # Edit .env file with your API keys
    
  3. 启动服务:

    docker-compose up -d
    
  4. 访问仪表板: 打开 http://localhost:8001/dashboard 在您的浏览器中

Claude桌面配置

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代码在本地可用:

  1. 准备包装脚本:

    # 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
    
  2. 添加到您的 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(存储库交互)
  • 存储器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.

🧩 如何添加自己的工具

您可以通过向NexusHub添加新的工具定义来使用自定义工具扩展NexusHub /src/mcp/tools/ 目录:

// 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.

🔄 地方发展

  1. 安装依赖项:

    npm install
    
  2. 在开发模式下运行:

    npm run dev
    
  3. 对于stdio模式测试:

    npm run stdio
    

🧪 运行测试

# Run all tests
npm test

# Run specific test suite
npm test -- --grep "API Keys"

🔧 故障排除

Claude桌面集成问题

  1. 启动Claude Desktop时出现“意外令牌”错误:

    • 确保您的包装脚本具有适当的权限: chmod +x nexushub-mcp.sh
    • 验证所有脚本是否正确过滤非JSON输出
    • 检查中的日志文件 /tmp/nexushub-debug-*.log 详见
  2. MCP服务器未加载或工具未出现:

    • 确保Docker容器正在运行: docker ps | grep mcp
    • 检查容器日志: docker logs mcp_brave_search
    • 验证Claude Desktop配置是否具有正确的路径/命令
    • 更改后尝试重新启动Claude Desktop
  3. Docker容器问题:

    • 如果Docker日志太大,请清除它们: docker system prune
    • 重新启动容器: docker-compose restart
    • 检查端口冲突: lsof -i :8001

常见错误消息

错误 解决方案
“找不到方法” MCP服务器不支持此方法。检查您是否使用了正确的工具名称。
“套接字挂起” 连接问题。检查MCP服务器是否正在运行。
“ENOENT” 找不到文件或目录。检查配置中的路径。
“权限被拒绝” 文件权限问题。检查脚本权限。
“意外令牌” JSON解析错误。检查MCP服务器的stdout输出。

📚 文档

工具开发指南

集成指南

MCP资源

有关完整文档,请访问 NexusHub维基.

🤝 贡献

贡献使开源社区成为一个学习、激励和创造的好地方。你所做的任何贡献都是 非常感谢.

  1. 分叉项目
  2. 创建功能分支(git checkout -b feature/AmazingFeature)
  3. 提交您的更改(git commit -m 'Add some AmazingFeature')
  4. 推到分支机构(git push origin feature/AmazingFeature)
  5. 打开拉取请求

📝 许可证

根据MIT许可证分发。看 LICENSE 了解更多信息。

👨‍💻 作者

杰森·布拉舍尔

🙏 致谢


Built with ❤️ by Jason Brashear