LM

lightconetech/mcp-gateway

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

153 stars 15 forks 质量 67 趋势 0Apache-2.0

lightconetech/mcp-gateway 是从 https://github.com/lightconetech/mcp-gateway. 导入的 MCP 服务器候选

概览

lightconetech/mcp-gateway 是从 https://github.com/lightconetech/mcp-gateway. 导入的 MCP 服务器候选

概述(AI 翻译)

这是一个网关服务,连接了 Claude Desktop 中基于 stdio 的模型上下文协议(MCP)实现与基于 HTTP/SSE 的 MCP 服务器。这解决了协议兼容性的差距,因为 Claude Desktop 目前仅支持基于 stdio 的 MCP 服务器。请参见这里的讨论。

为什么是这个门户?

Claude桌面应用目前仅支持MCP服务器的stdio协议,而许多MCP服务器使用带有服务器发送事件(SSE)传输的HTTP。该网关作为协议翻译器,使Claude Desktop通过以下方式与任何HTTP/SSE MCP服务器通信:

  1. 接受来自Claude Desktop的标准输入
  2. 将请求转换为并转发到 HTTP/SSE MCP 服务器
  3. 将SSE响应转换为Claude Desktop的stdio格式

安装

全局使用 npm 安装网关:

配置

1.寻找门户路径

安装后,使用以下命令查找 npm 安装网关的位置:

常见的全球套餐地点:

  • macOS(自制节点):/opt/homebrew/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js
  • macOS(默认):/usr/local/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Server Gateway

A gateway service that bridges the stdio-based Model Context Protocol (MCP) implementation in Claude Desktop with HTTP/SSE-based MCP servers. This solves the protocol compatibility gap since Claude Desktop currently only supports stdio-based MCP servers. See the discussion here.

Why This Gateway?

Claude Desktop App currently only supports stdio protocol for MCP servers, while many MCP servers use HTTP with Server-Sent Events (SSE) transport. This gateway acts as a protocol translator, allowing Claude Desktop to communicate with any HTTP/SSE MCP server by:

  1. Accepting stdio input from Claude Desktop
  2. Converting and forwarding requests to HTTP/SSE MCP servers
  3. Converting SSE responses back to stdio format for Claude Desktop

Installation

Install the gateway globally using npm:

npm install -g @mcphub/gateway

Configuration

1. Find the Gateway Path

After installation, find where npm installed the gateway using these commands:

# This shows the root directory of global packages
npm root -g

# The gateway will be located at:
/@mcphub/gateway/dist/src/mcphub-gateway.js

Common global package locations:

  • macOS (Homebrew Node): /opt/homebrew/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js
  • macOS (default): /usr/local/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js
  • Windows: %AppData%\npm\node_modules\@mcphub\gateway\dist\src\mcphub-gateway.js

Verify the installation and path:

npm list -g @mcphub/gateway

2. Configure Claude Desktop

Create or update your Claude Desktop configuration file:

On macOS

Location: ~/Library/Application Support/Claude Desktop/config.json

On Windows

Location: %APPDATA%\Claude Desktop\config.json

Add this configuration (using the path you found in step 1):

{
  "mcpServers": {
    "server-name": {
      "command": "node",
      "args": ["/opt/homebrew/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js"]
    }
  }
}

Note: Replace the path in args with your actual path from step 1.

3. Configure MCP Server Connection

The gateway uses an environment variable to specify which MCP server to connect to:

# Set the MCP server URL (optional)
export MCP_SERVER_URL=https://your-mcp-server.com/api/mcp

By default, the gateway connects to the MCP Hub server at https://server.mcphub.ai/api/mcp, which provides access to various pre-configured MCP services.

4. Start Claude Desktop

Start or restart Claude Desktop to apply the changes.

Troubleshooting

  1. If you can’t find the gateway path:

    # List all global packages and look for @mcphub/gateway
    npm list -g
    
    # Or specifically check the gateway
    npm list -g @mcphub/gateway
    
  2. Verify your Node.js installation:

    # Check Node version
    node --version
    
    # Check npm version
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "server-name": { "command": "node", "args": ["/opt/homebrew/lib/node_modules/@mcphub/gateway/dist/src/mcphub-gateway.js"] } } }