Agent聚合器

@1mcp-app/agent
1 Stars 139 次浏览 1mcp-app 更新于 2026-08-23

一个统一的模型上下文协议(MCP)服务器,它将多个MCP服务器聚合为一个,使得像Claude Desktop、Cursor和Cherry Studio这样的AI助手可以连接到单个服务器,而不是管理多个实例。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "file-server": {
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "~/Downloads"
      ],
      "command": "npx",
      "disabled": false,
      "tags": [
        "filesystem"
      ]
    },
    "mcp-server-fetch": {
      "args": [
        "mcp-server-fetch"
      ],
      "command": "uvx",
      "disabled": false
    },
    "server-memory": {
      "args": [
        "-y",
        "@modelcontextprotocol/server-memory"
      ],
      "command": "npx",
      "disabled": false
    },
    "web-server": {
      "args": [
        "mcp-server-fetch"
      ],
      "command": "uvx",
      "disabled": false,
      "tags": [
        "network",
        "web"
      ]
    }
  }
}

服务介绍

1MCP - 一个适用于所有场景的MCP服务器

一个统一的模型上下文协议服务器实现,将多个MCP服务器聚合到一个中。

NPM 版本
NPM 许可证
smithery 徽章

概览

1MCP(一个MCP)旨在简化您与AI助手的工作方式。无需为不同的客户端(如Claude Desktop、Cherry Studio、Cursor、Roo Code、Claude等)配置多个MCP服务器,1MCP提供了一个单一的、统一的服务器,该服务器可以:

  • 将多个MCP服务器聚合到一个统一的界面
  • 通过消除冗余的服务器实例来减少系统资源使用
  • 简化不同AI助手之间的配置管理
  • 提供一种标准化的方式让AI模型与外部工具和资源交互
  • 支持动态配置重载而无需重启服务器
  • 处理优雅关闭和服务清理

快速开始

要使Cursor能够使用已经在Claude Desktop中配置好的现有MCP服务器,请按照以下步骤操作:

  1. 使用Claude Desktop的配置文件运行1MCP服务器:
npx -y @1mcp/agent --config ~/Library/Application\ Support/Claude/claude_desktop_config.json
  1. 在您的Cursor配置文件(~/.cursor/mcp.json)中添加1MCP服务器:
{
    "mcpServers": {
        "1mcp": {
            "type": "http",
            "url": "http://localhost:3050/sse"
        }
    }
}
  1. 开始享受吧!

使用方法

您可以直接使用npx运行服务器:

# Basic usage (starts server with SSE transport)
npx -y @1mcp/agent

# Use existing Claude Desktop config
npx -y @1mcp/agent --config ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Use stdio transport instead of SSE
npx -y @1mcp/agent --transport stdio

# Show all available options
npx -y @1mcp/agent --help

可用选项:

  • --transport, -t: 选择传输类型 ("stdio" 或 "sse", 默认: "sse")
  • --config, -c: 使用特定的配置文件
  • --port, -P: 更改SSE端口 (默认: 3050)
  • --host, -H: 更改SSE主机 (默认: localhost)
  • --tags, -g: 通过标签过滤服务器(参见下面的“理解标签”部分)
  • --help, -h: 显示帮助

使用环境变量的例子:

# Using environment variables
ONE_MCP_PORT=3051 ONE_MCP_TAGS=network,filesystem npx -y @1mcp/agent

# Or in your shell configuration
export ONE_MCP_PORT=3051
export ONE_MCP_TAGS=network,filesystem
npx -y @1mcp/agent

Docker

您也可以使用Docker来运行1MCP:

# Pull the latest image
docker pull ghcr.io/1mcp-app/agent:latest

# Run with SSE transport (default)
docker run -p 3050:3050 ghcr.io/1mcp-app/agent

# Run with a custom config file
docker run -p 3050:3050 -v /path/to/config.json:/config.json ghcr.io/1mcp-app/agent --config /config.json

# Run with stdio transport
docker run -i ghcr.io/1mcp-app/agent --transport stdio

可用镜像标签:

  • latest: 最新稳定版本
  • vX.Y.Z: 特定版本 (例如 v1.0.0)
  • sha-<commit>: 特定提交

环境变量

您可以使用以ONE_MCP_为前缀的环境变量来配置1MCP:

  • ONE_MCP_TRANSPORT: 传输类型 ("stdio" 或 "sse", 默认: "sse")
  • ONE_MCP_PORT: SSE端口 (默认: 3050)
  • ONE_MCP_HOST: SSE主机 (默认: "localhost")
  • ONE_MCP_CONFIG: 配置文件路径
  • ONE_MCP_TAGS: 逗号分隔的标签列表,用于过滤服务器

使用环境变量的例子:

docker run -p 3051:3051 \
  -e ONE_MCP_PORT=3051 \
  -e ONE_MCP_TAGS=network,filesystem \
  ghcr.io/1mcp-app/agent

理解标签

标签帮助您控制哪些MCP服务器对不同的客户端可用。可以将标签视为描述每个服务器功能的标签。

如何使用标签

  1. 在您的服务器配置中:为每个服务器添加标签以描述其功能
{
  "mcpServers": {
    "web-server": {
      "command": "uvx",
      "args": ["mcp-server-fetch"],
      "tags": ["network", "web"],
      "disabled": false
    },
    "file-server": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "~/Downloads"],
      "tags": ["filesystem"],
      "disabled": false
    }
  }
}
  1. 当以stdio模式启动1MCP时:您可以按标签过滤服务器
# Only start servers with the "network" tag
npx -y @1mcp/agent --transport stdio --tags "network"

# Start servers with either "network" or "filesystem" tags
npx -y @1mcp/agent --transport stdio --tags "network,filesystem"
  1. 当使用SSE传输时:客户端可以请求具有特定标签的服务器
{
    "mcpServers": {
        "1mcp": {
            "type": "http",
            "url": "http://localhost:3050/sse?tags=network"  // Only connect to network-capable servers
        }
    }
}

示例标签:

  • network: 用于执行网络请求的服务器
  • filesystem: 用于处理文件操作的服务器
  • memory: 用于提供内存/存储的服务器
  • shell: 用于运行 shell 命令的服务器
  • db: 用于处理数据库操作的服务器

配置

全局配置

服务器自动在全局位置管理配置:

  • macOS/Linux: ~/.config/1mcp/mcp.json
  • Windows: %APPDATA%/1mcp/mcp.json

配置文件格式

{
  "mcpServers": {
    "mcp-server-fetch": {
      "command": "uvx",
      "args": [
        "mcp-server-fetch"
      ],
      "disabled": false
    },
    "server-memory": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-memory"
      ],
      "disabled": false
    }
  }
}

工作原理

系统架构

graph TB
    subgraph "AI Assistants"
        A1[Claude Desktop]
        A2[Cursor]
        A3[Cherry Studio]
        A4[Roo Code]
    end

    subgraph "1MCP Server"
        MCP[1MCP Agent]
    end

    subgraph "MCP Servers"
        S1[Server 1]
        S2[Server 2]
        S3[Server 3]
    end

    A1 -->|sse| MCP
    A2 -->|sse| MCP
    A3 -->|sse| MCP
    A4 -->|sse| MCP

    MCP --> |sse| S1
    MCP --> |stdio| S2
    MCP --> |stdio| S3

请求流程

sequenceDiagram
    participant Client as AI Assistant
    participant 1MCP as 1MCP Server
    participant MCP as MCP Servers

    Client->>1MCP: Send MCP Request
    activate 1MCP

    1MCP->>1MCP: Validate Request
    1MCP->>1MCP: Load Config
    1MCP->>MCP: Forward Request
    activate MCP

    MCP-->>1MCP: Response
    deactivate MCP

    1MCP-->>Client: Forward Response
    deactivate 1MCP

开发

安装依赖项:

pnpm install

构建服务器:

pnpm build

对于带有自动重建功能的开发:

pnpm watch

运行服务器:

pnpm dev

调试

使用 MCP Inspector,它作为一个包脚本可用:

pnpm inspector

Inspector 将提供一个 URL,以便您在浏览器中访问调试工具。

相关 MCP 服务