mcp-gateway
by: lightconetech
A gateway demo for MCP SSE Server
📌Overview
Purpose: The MCP Server Gateway serves as a protocol translator that allows the Claude Desktop application, which natively supports only stdio-based MCP implementations, to communicate with HTTP/SSE-based MCP servers.
Overview: This gateway addresses the compatibility gap between the stdio protocol used by Claude Desktop and the commonly utilized HTTP/SSE transport in many MCP servers. By facilitating seamless interaction between these differing protocols, the gateway expands the functionality and interoperability of Claude Desktop with a wide range of MCP servers.
Key Features:
-
Protocol Translation: Converts stdio input from Claude Desktop into HTTP/SSE requests that can be understood by MCP servers, ensuring compatibility and enhanced communication capabilities.
-
Response Handling: Translates SSE responses from the MCP servers back into stdio format, allowing Claude Desktop to process the incoming data as if it were received from a native stdio interface.
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 addresses the compatibility gap since Claude Desktop only supports stdio-based MCP servers.
Why This Gateway?
Claude Desktop currently supports the stdio protocol for MCP servers, while many use HTTP with Server-Sent Events (SSE) transport. This gateway acts as a protocol translator, allowing communication with HTTP/SSE MCP servers by:
- Accepting stdio input from Claude Desktop.
- Converting and forwarding requests to HTTP/SSE MCP servers.
- Converting SSE responses back to stdio format.
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:
npm root -g
The gateway will be located at:
<npm_global_root>/@mcphub/gateway/dist/src/mcphub-gateway.js
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 from step 1):
{
"mcpServers": {
"server-name": {
"command": "node",
"args": ["<YOUR_GATEWAY_PATH>"]
}
}
}
3. Configure MCP Server Connection
Specify the MCP server URL with an environment variable (optional):
export MCP_SERVER_URL=https://your-mcp-server.com/api/mcp
By default, the gateway connects to the MCP Hub server.
4. Start Claude Desktop
Start or restart Claude Desktop to apply the changes.
Troubleshooting
-
If you can't find the gateway path, check global packages:
npm list -g @mcphub/gateway
-
Verify your Node.js installation:
node --version npm --version
-
Common issues include permissions errors. If you encounter them, you might need to use
sudo
for installation.
License
Support
If you encounter issues or have questions, please file an issue on GitHub.
Contributing
Contributions are welcome! Feel free to submit a Pull Request.