Back to MCP directory
publicPublicdnsLocal runtime

mcp-gateway-go

mcp-gateway-go是一个基于Go的轻量级网关,可将标准输入输出的MCP服务器转换为SSE端点,实现与客户端(如浏览器或AI代理)的实时HTTP通信。

article

README

🚀 mcp-gateway-go

mcp-gateway-go 是一款轻量级的 Go 语言网关,它能够将标准输入输出(stdio)的模型上下文协议(MCP)服务器转换为 Server-Sent Events (SSE) 端点。借助这一功能,可实现通过 HTTP 与客户端(如网页浏览器或 AI 代理)进行实时通信。

🚀 快速开始

mcp-gateway-go 的使用分为安装和运行两个步骤,以下为你详细介绍。

📦 安装指南

使用以下命令安装 mcp-gateway-go

go install github.com/zhengkunwang223/mcp-gateway-go@latest

💻 使用示例

基础用法

安装完成后,可使用以下命令运行 mcp-gateway-go

mcp-gateway-go --port 7979 --baseUrl http://127.0.0.1:7979  --command "npx -y @modelcontextprotocol/server-filesystem /tmp"

参数说明

| 参数 | 详情 | |------|------| | --port 7979 | 要监听的端口(默认为 7979) | | --baseUrl "http://localhost:7979" | SSE 的基础 URL | | --ssePath "/sse" | 订阅 SSE 的路径(默认为 /sse) | | --messagePath "/message" | 消息的路径(stdio→SSE,默认为 /message) | | --oauth2Bearer "some-access-token" | 在请求中添加带有提供的 Bearer 令牌的 Authorization 头 |

📚 详细文档

额外资源

你可以通过以下链接获取更多相关资源:

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client