MCP HTTP Proxy
Exposes any stdio-based MCP server to the internet via HTTP/SSE transport, enabling remote agents to access MCP tools over a network.
README
MCP HTTP Proxy
Expose any stdio-based MCP server (like @browsermcp/mcp) to the internet via HTTP/SSE transport. Perfect for remote agents that need to access MCP tools over a network.
Features
- 🌐 Standard MCP SSE Transport - Follows MCP HTTP transport specification
- 🔐 API Key Authentication - Secure access with Bearer token
- 🚀 Multiple Exposure Options - Tailscale, ngrok, Cloudflare Tunnel
- 🔄 Session Management - Multiple concurrent sessions supported
- 📦 Works with any MCP server - Defaults to
@browsermcp/mcp
Quick Start
1. Install Dependencies
npm install
2. Configure (Optional)
cp .env.example .env
# Edit .env to set your API key
Generate a secure API key:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
3. Build and Run
npm run build
npm start
Or for development:
npm run dev
API Endpoints (Standard MCP SSE Transport)
| Endpoint | Method | Description |
|---|---|---|
/sse |
GET | Establish SSE connection (returns endpoint URL) |
/message?sessionId=xxx |
POST | Send JSON-RPC messages |
/health |
GET | Health check (no auth required) |
/sessions |
GET | List active sessions (auth required) |
Exposing to the Internet
Option 1: Tailscale (Recommended for Private Access)
Tailscale provides secure, private access without exposing to the public internet.
# Install Tailscale if not already installed
# Then serve via Tailscale
tailscale serve --bg --http 3000
Or use your Tailscale IP directly:
tailscale status # Find your Tailscale IP
Your MCP server will be available at:
https://your-machine.tailnet-name.ts.net(via serve)http://your-tailscale-ip:3000(direct IP)
Use from your agent:
{
"mcpServers": {
"browser-remote": {
"url": "http://your-tailscale-ip:3000/sse",
"headers": {
"Authorization": "Bearer your-api-key"
}
}
}
}
Option 2: ngrok (Public URL)
# Install ngrok if not already installed
ngrok http 3000
ngrok will provide a public URL like https://abc123.ngrok.io.
Option 3: Cloudflare Tunnel
# Install cloudflared if not already installed
cloudflared tunnel --url http://localhost:3000
How the SSE Transport Works
- Client GETs
/sse- Server creates session, sendsendpointevent with message URL - Client POSTs to
/message?sessionId=xxx- Server forwards JSON-RPC to MCP process - Server streams responses - MCP responses sent as SSE
messageevents
Usage Examples
Test Health Check
curl http://localhost:3000/health
Response:
{
"status": "healthy",
"sessions": 0,
"uptime": 10.5,
"transport": "sse",
"endpoints": {
"sse": "/sse (GET - establishes SSE connection)",
"message": "/message?sessionId=xxx (POST - send JSON-RPC messages)"
}
}
Connect via SSE (JavaScript)
const eventSource = new EventSource('http://localhost:3000/sse', {
headers: { 'Authorization': 'Bearer your-api-key' }
});
eventSource.addEventListener('endpoint', (e) => {
console.log('Message endpoint:', e.data);
// e.data = "/message?sessionId=xxx"
});
eventSource.addEventListener('message', (e) => {
console.log('MCP response:', JSON.parse(e.data));
});
Send MCP Request
curl -X POST "http://localhost:3000/message?sessionId=your-session-id" \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Configuration
| Environment Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
HOST |
Host to bind to | 0.0.0.0 |
MCP_API_KEY |
API key for authentication | (none) |
MCP_COMMAND |
Command to run MCP server | npx |
MCP_ARGS |
JSON array of arguments | ["@browsermcp/mcp@latest"] |
Using Different MCP Servers
You can use this proxy with any stdio-based MCP server:
# Example: Use a custom MCP server
MCP_COMMAND=node
MCP_ARGS=["/path/to/your/mcp-server/dist/index.js"]
# Example: Use Python MCP server
MCP_COMMAND=python
MCP_ARGS=["-m", "your_mcp_server"]
Security Notes
- Always use API key authentication when exposing to the internet
- Use HTTPS (Tailscale, ngrok, and Cloudflare all provide this)
- Tailscale is recommended for private access within your tailnet
- Rotate API keys periodically
- Monitor sessions via
/sessionsendpoint
Troubleshooting
MCP Server Not Starting
Check the console logs for errors. The MCP server stderr is forwarded to the proxy's console.
Connection Refused
- Ensure server is running:
curl http://localhost:3000/health - Check Tailscale connectivity:
tailscale status
Authentication Failed
- Check the API key in
.envmatches your request header - Ensure "Bearer " prefix is included in Authorization header
SSE Not Working
- Ensure you're connecting to
/sseendpoint (not just base URL) - Check that Authorization header is sent with GET request too
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。