MCP Gateway
MCP Gateway is an Streamable HTTP proxy server that bridges HTTP/JSON-RPC requests to multiple MCP (Model Context Protocol) servers running as stdio processes.
Features
- HTTP proxy for MCP servers (stdio → Streamable HTTP)
- Web UI for configuration management
- Auto-start MCP servers on first request
- Support for tools, resources, and prompts
- Docker support
Quick Start
Using Docker Compose```bash
Create your mcp.json configuration
cp sample.mcp.json mcp.json
Start the server
docker compose up --build
Access the web UI at http://localhost:8080
### Manual Setup```bash
# Build frontend
cd frontend
bun install
bun run build
cd ..
# Run server
go run . --addr :8080 --config mcp.json
Configuration
Create mcp.json with your MCP server definitions:```json
{
"mcpServers": {
"my-server": {
"command": "npx",
"args": ["-y", "@example/mcp-server"],
"env": {
"API_KEY": "your-api-key"
},
"disabled": false
}
}
}
### Configuration Options
| Field | Type | Description |
|-------|------|-------------|
| `command` | string | Executable command |
| `args` | string[] | Command arguments |
| `env` | object | Environment variables |
| `disabled` | boolean | Disable the server |
## API
### MCP Proxy Endpoint```
POST /v1/proxy/{server-name}
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}
Supported methods:
- initialize
- tools/list
- tools/call
- resources/list
- resources/read
- prompts/list
- prompts/get
- ping
Management API
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/config |
Get configuration |
| PUT | /api/config |
Save configuration |
| POST | /api/config/reload |
Reload and restart servers |
| GET | /api/servers |
List server statuses |
| POST | /api/servers/{name}/start |
Start a server |
| POST | /api/servers/{name}/stop |
Stop a server |
Usage with MCP Clients
Configure your MCP client to use HTTP transport pointing to the gateway:```
http://localhost:8080/v1/proxy/{server-name}
## Development
### Backend```bash
go run . --addr :8080 --config mcp.json
Frontend```bash
cd frontend
bun install
bun run dev # Starts on port 3000
```
License
MIT
