Skip to main content
Glama

1MCP - 一个 MCP 服务器,满足所有人的需求

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

NPM 版本 NPM 许可证 铁匠徽章

概述

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

  • 将多个 MCP 服务器聚合到一个统一的界面

  • 通过消除冗余服务器实例来减少系统资源的使用

  • 简化不同 AI 助手之间的配置管理

  • 为 AI 模型与外部工具和资源交互提供标准化方式

  • 支持动态配置重新加载,无需重启服务器

  • 处理正常关机和资源清理

Related MCP server: MCP Starter

快速入门

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

  1. 使用 Claude Desktop 配置文件运行 1MCP 服务器:

npx -y @1mcp/agent --config ~/Library/Application\ Support/Claude/claude_desktop_config.json
  1. 将 1MCP 服务器添加到您的 Cursor 配置文件 ( ~/.cursor/mcp.json ):

{
    "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”或“http”,默认值:“http”)

  • --config, -c :使用特定的配置文件

  • --port, -P :更改 HTTP 端口(默认值:3050)

  • --host, -H :更改 HTTP 主机(默认值: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 HTTP 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.YZ :特定版本(例如v1.0.0

  • sha-<commit> :特定提交

环境变量

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

  • ONE_MCP_TRANSPORT :传输类型(“stdio”或“http”,默认值:“http”)

  • ONE_MCP_PORT :HTTP 端口(默认值:3050)

  • ONE_MCP_HOST :HTTP 主机(默认值:“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 :用于发出 Web 请求的服务器

  • 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 -->|http| MCP
    A2 -->|http| MCP
    A3 -->|http| MCP
    A4 -->|http| MCP

    MCP --> |http| 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

检查器将提供一个 URL 来访问浏览器中的调试工具。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/1mcp-app/agent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server