返回市场
麦普中心-麦普

麦普中心-麦普

作者:warpdev56 星标更新:2025-07-05

项目介绍

<p align="center"> <img src="https://imgur.com/DgWxkmv.png" width="200" height="200"> </p>

安装MCP服务器

在VS Code中安装

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

安装

# 克隆仓库
git clone <repository-url>
cd mcp-hub-mcp

# 安装依赖
npm install
# 或
yarn install
# 或
pnpm install

构建

npm run build
# 或
yarn build
# 或
pnpm build

运行

npm start
# 或
yarn start
# 或
pnpm start

开发模式

npm run dev
# 或
yarn dev
# 或
pnpm dev

配置文件

MCP-Hub-MCP服务器使用Claude Desktop格式的配置文件来自动连接到其他MCP服务器。您可以按以下方式指定配置文件:

  1. 环境变量:设置MCP_CONFIG_PATH环境变量为配置文件路径
  2. 命令行参数:使用--config-path选项指定配置文件路径
  3. 默认路径:使用当前目录下的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": "读取文件的内容",
      "inputSchema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "要读取的文件路径"
          }
        },
        "required": ["path"]
      }
    },
    {
      "name": "writeFile",
      "description": "将内容写入文件",
      "inputSchema": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "要写入的文件路径"
          },
          "content": {
            "type": "string",
            "description": "要写入文件的内容"
          }
        },
        "required": ["path", "content"]
      }
    }
  ]
}

提交消息约定

此项目遵循常规提交进行自动版本控制和CHANGELOG生成。

格式:<类型>(<范围>):<描述>

示例:

  • feat: 添加新的中心连接功能
  • fix: 解决服务器超时问题
  • docs: 更新API文档
  • chore: 更新依赖项

类型:

  • feat:新功能(次要版本提升)
  • fix:修复错误(补丁版本提升)
  • docs:仅文档更改
  • style:不影响代码意义的更改
  • refactor:既不修复错误也不添加功能的代码更改
  • perf:改进性能的代码更改
  • test:添加缺失的测试或纠正现有测试
  • chore:构建过程或辅助工具的更改

重大变更: 在提交注脚中添加BREAKING CHANGE:以触发主要版本提升。

其他链接

许可证

MIT