hotswap-mcp-bridge
A standalone node process that manages and translates sse/stdio <> sse/stdio MCP connections with hot-swap capabilities
GitHub Stars
5
User Rating
Not Rated
Forks
1
Issues
0
Views
1
Favorites
0
DISCLAIMER
This bridge is intended for use in FLUJO but currently untested - please report any issues you encounter by opening a Github Issue
MCP Transport Bridge
A bridge between different MCP transport protocols that enables seamless integration with existing implementations.
Overview
The MCP Transport Bridge allows different MCP clients to connect to the same MCP server using different transport protocols. It also supports environment variable management and server hot-swapping.
Key Features
- Transport Protocol Bridging: Connect clients and servers using different transport protocols (stdio, SSE, memory)
- Environment Variable Management: Update server environment variables dynamically
- Server Hot-Swapping: Restart servers with new environment variables while maintaining client connections
- API-Driven: RESTful API for managing servers and connections
Use Cases
Scenario 1: Client B connects first, then Client A
- Client B connects to the bridge using stdio
- The bridge starts Server C with default environment
- Client A connects to the bridge and updates environment variables
- The bridge restarts Server C with the new environment
- The bridge reconnects Client B to the restarted Server C
Scenario 2: Client A connects first, then Client B
- Client A connects to the bridge and sets environment variables
- The bridge starts Server C with Client A's environment
- Client B connects to the bridge
- The bridge connects Client B to Server C (which already has Client A's environment)
Getting Started
Installation
npm install
npm run build
Running the Demo
node examples/demo-workflow.js
This will demonstrate the complete workflow with:
- Starting the bridge
- Registering Server C
- Client B connecting to Server C via the bridge
- Client A connecting and updating environment variables
- Server C being restarted with the new environment
Using the Bridge Launcher
The bridge launcher acts as a proxy between Client B and Server C:
node examples/bridge-launcher.js --server-id <server-id> [--port <port>] [--host <host>]
Using Client A
Client A can connect to the bridge and update environment variables:
node examples/client-a.js --server-id <server-id> [--port <port>] [--host <host>]
API Reference
Servers
GET /api/servers: List all serversGET /api/servers/:id: Get server detailsPOST /api/servers: Create a new serverPUT /api/servers/:id: Update a serverDELETE /api/servers/:id: Delete a serverPOST /api/servers/:id/start: Start a serverPOST /api/servers/:id/stop: Stop a serverPOST /api/servers/:id/environment: Update server environment variables
Connections
GET /api/connections: List all connectionsGET /api/connections/:id: Get connection detailsPOST /api/connections: Create a new connectionDELETE /api/connections/:id: Delete a connectionPOST /api/connections/:id/disconnect: Disconnect a connectionPOST /api/connections/:id/reconnect: Reconnect a connection
Integration Guide
For Client B
- Configure Client B to point to the bridge launcher instead of directly to Server C
- The bridge launcher will handle the connection to Server C via the bridge
For Client A
- Connect to the bridge API
- Update environment variables for Server C
- Connect to Server C via the bridge
Architecture
┌─────────────┐ ┌─────────────────────────────────┐ ┌─────────────┐
│ Client A │ │ MCP Bridge │ │ Server C │
│ (SSE/WS) │────▶│ │────▶│ (stdio) │
└─────────────┘ │ ┌─────────────┐ ┌───────────┐ │ └─────────────┘
│ │Environment │ │ Server │ │ ▲
┌─────────────┐ │ │ Manager │ │ Registry │ │ │
│ Client B │ │ └─────────────┘ └───────────┘ │ │
│ (stdio) │────▶│ │─────────────┘
└─────────────┘ └─────────────────────────────────┘
License
MIT
45
Followers
25
Repositories
0
Gists
6
Total Contributions