A proxy server for MCP Inspector that enables browser-based connections to MCP servers.
Project description
Browse MCP Proxy
A proxy server that enables browser-based applications to connect to MCP (Model Context Protocol) servers. This proxy handles CORS, session management, and transport type conversion.
Why This Proxy?
Browser-based applications face several challenges when connecting to MCP servers:
-
CORS Restrictions: Browsers enforce Same-Origin Policy, preventing direct connections to MCP servers on different origins.
-
Session Management: MCP's Streamable HTTP transport requires session IDs that browsers can't automatically manage across requests.
-
STDIO Transport: Browser JavaScript cannot spawn local processes, but this proxy can bridge that gap.
Architecture
┌─────────────────┐
│ Browser/Tauri │ (Inspector UI)
│ Frontend App │
└────────┬────────┘
│ 1. HTTP requests (same-origin or CORS-allowed)
│ 2. X-MCP-Proxy-Auth header for security
↓
┌─────────────────┐
│ MCP Proxy │ (this server)
│ Server │ ┌──────────────────────┐
│ │ │ Session Management │
│ • CORS enabled │ │ proxy_id → server_id │
│ • Auth token │←→│ • Target URL │
│ • Transports │ │ • Custom headers │
│ │ └──────────────────────┘
└────────┬────────┘
│ 3. Forwards requests with proper session handling
│ 4. Supports STDIO, SSE, and HTTP transports
↓
┌─────────────────┐
│ Target MCP │ (any MCP server)
│ Server │
└─────────────────┘
Installation
# Using pip
pip install browse-mcp-proxy
# Using poetry
poetry add browse-mcp-proxy
# From source
cd backend/browse-mcp-proxy
poetry install
Usage
Start the Proxy Server
# Basic usage
browse-mcp-proxy serve
# Custom port
browse-mcp-proxy serve --port 6277
# With auto-generated auth token and browser opening
browse-mcp-proxy serve --open
# Disable auth (development only!)
browse-mcp-proxy serve --no-auth
# With custom auth token
browse-mcp-proxy serve --auth-token YOUR_SECRET_TOKEN
Generate Auth Token
browse-mcp-proxy token
API Endpoints
Health Check
GET /health
Response: {"status": "ok"}
Configuration
GET /config
Response: {
"auth_token": "...",
"sessions": [...]
}
Sessions
GET /sessions
DELETE /sessions/{session_id}
STDIO Transport
GET /stdio?command=python&args=-m,browse_mcp&env=KEY=VALUE
POST /stdio/{session_id}/message
SSE Transport
GET /sse?url=http://localhost:8000/sse
POST /sse/{session_id}/message
Streamable HTTP Transport
GET /mcp?url=http://localhost:8000/mcp
POST /mcp?url=http://localhost:8000/mcp
DELETE /mcp?url=http://localhost:8000/mcp
Headers
Authentication
All requests must include:
X-MCP-Proxy-Auth: Bearer YOUR_AUTH_TOKEN
Session Tracking
The proxy returns a session ID that should be included in subsequent requests:
X-Proxy-Session-Id: uuid-string
Custom Headers
To pass custom headers to the target server:
X-Custom-Auth-Header: Header-Name: Header-Value
Environment Variables
| Variable | Description | Default |
|---|---|---|
MCP_PROXY_AUTH_TOKEN |
Authentication token | Random 32-byte hex |
Integration with Desktop App
In the Tauri desktop app, the proxy can be started alongside the MCP server:
// Start proxy
await invoke("start_mcp_proxy", { port: 6277 });
// Connect Inspector to proxy
const proxyUrl = "http://localhost:6277/mcp";
const targetUrl = "http://localhost:8000/mcp";
fetch(`${proxyUrl}?url=${encodeURIComponent(targetUrl)}`, {
headers: {
"X-MCP-Proxy-Auth": `Bearer ${authToken}`,
},
});
Security
- Auth Token: Required by default. Disable with
--no-auth(not recommended for production). - CORS: Configured to allow specific origins (localhost ports by default).
- Origin Validation: Prevents DNS rebinding attacks.
Development
# Install dependencies
poetry install
# Run with auto-reload
browse-mcp-proxy serve --reload --log-level debug
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browse_mcp_proxy-0.1.1.tar.gz.
File metadata
- Download URL: browse_mcp_proxy-0.1.1.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.5 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e869ca8304de3701d8a6dd51968fc088c9b71c027a142e5433a5f91283978ca
|
|
| MD5 |
fa06dde6dbca977e7f4ad78ce3286f03
|
|
| BLAKE2b-256 |
41edd83c9922760dffdcd8eedc5e371f1cf3065637fea8307e695d20d399e75e
|
File details
Details for the file browse_mcp_proxy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: browse_mcp_proxy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.5 Darwin/25.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8d5948efa1441997fb09097b9f7a3ba3ae538c6f17be26490840a86a1934db7
|
|
| MD5 |
4b7d721b1e195849459c832945d0f56f
|
|
| BLAKE2b-256 |
9d1d87f8545391098b51ee30fccae7f788e2aac30e4e9249819edb9a4335380d
|