Local outbound bridge agent for MCP capability forwarding
Project description
mcpassistant-gateway
Async local bridge that connects outbound to the remote MCP bridge over WSS and forwards invoke requests to local MCP servers using the MCP Python client library.
Run
pip install -e .
mcpassistant-gateway
mcpassistant-gateway now opens an interactive menu by default.
Use /start inside the menu to start the gateway in the background.
Use /logs on only when you want to inspect realtime logs.
Press Ctrl+C while running to stop and return to the menu.
You can also use the built-in CLI helpers instead of editing mcp.json manually:
mcpassistant-gateway run
mcpassistant-gateway menu
mcpassistant-gateway settings
mcpassistant-gateway config show
mcpassistant-gateway config set --request-timeout-seconds 120
mcpassistant-gateway run --request-timeout-seconds 120
Inside mcpassistant-gateway menu, use slash commands:
/help
/login
/logout
/show
/set request_timeout_seconds 120
/settings
/run
/login behavior:
- OAuth-first: starts remote OAuth session, opens browser, receives localhost callback, exchanges code, and saves JWT on success.
- Legacy fallback: if OAuth endpoints are unavailable, falls back to
POST /manage/jwt/issue.
For OAuth localhost callback, ensure your auth provider allows:
http://127.0.0.1:43110/callback
mcpassistant-gateway initializes MCP client sessions for configured mcpServers (stdio) and opens the outbound bridge connection to the remote server.
Startup token behavior:
- If
AGENT_JWTis already configured (env or runtime state), startup continues without prompting. - If
AGENT_JWTis missing, the CLI shows a styled prompt and asks you to paste the token. - If WebSocket auth fails with
HTTP 403, the CLI asks for a freshAGENT_JWTand retries immediately. AGENT_IDis auto-derived from JWT claims (or token fingerprint fallback), so no manualAGENT_IDprompt.- Prompted values are saved into the runtime state file, so next runs do not ask again.
Set START_MCP_SERVERS=false if you only want the bridge process.
Configuration can be provided through .env, runtime state, and mcp.json.
If mcp.json does not exist, it is created automatically on first run at .mcpassistant/mcp.json with:
- only an
mcpServersobject - a default
mcpServers.filesystementry scoped to your current working directory
Minimal dynamic .env:
REMOTE_SERVER_BASE_URL=https://your-remote-domain
AGENT_JWT=your_agent_jwt
With this mode:
REMOTE_WEBSOCKET_URLis derived aswss://.../connectAGENT_IDandCAPABILITIESare derived from JWT claims (sub,capabilities) if not explicitly set- Local MCP calls are handled via MCP client sessions for
mcpServers
Troubleshooting: Gemini CLI
Gemini CLI uses the official MCP Streamable HTTP transport (@modelcontextprotocol/sdk).
Some versions may try to open an optional GET SSE stream by sending:
GET <httpUrl>withAccept: text/event-stream
If your remote proxy responds with a short-lived SSE payload (instead of a real long-lived MCP message stream), Gemini may mark the server as Disconnected.
Fix:
- Ensure your remote proxy supports a proper long-lived MCP SSE message stream on
GET /mcpwhenAccept: text/event-stream, and make sure your reverse proxy does not buffer the stream.
Gemini CLI config should use httpUrl (streamable HTTP), pointing at the /mcp endpoint:
{
"mcpServers": {
"filesystem": {
"httpUrl": "https://<your-host>/<subject>/filesystem/mcp",
"timeout": 30000
}
}
}
If your server requires auth, add headers (Gemini supports custom headers per server).
mcpServers + mcpassistant-gateway-bridge
You can run MCP servers from config (supergateway-style) and derive local HTTP endpoints:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "supergateway", "--stdio", "npx", "-y", "@modelcontextprotocol/server-filesystem", "--port", "3004"],
"port": 3004
}
}
}
Run one server:
mcpassistant-gateway-bridge --config ./.mcpassistant/mcp.json --name filesystem
Run all servers in config:
mcpassistant-gateway-bridge --config ./.mcpassistant/mcp.json
uv run --project ".\packages\mcp-local-agent" mcpassistant-gateway
Project details
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 mcpassistant_gateway-0.1.7.tar.gz.
File metadata
- Download URL: mcpassistant_gateway-0.1.7.tar.gz
- Upload date:
- Size: 71.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce7acbb43aa1fab23d3a9deb0da7a27a32bf061b47913644e6b02000bc2a8aee
|
|
| MD5 |
1881977c04975983ae2c810de7527978
|
|
| BLAKE2b-256 |
03592c6aeb4519767c5013cea51e63a385893f4276eecc6959dcd832d7d795e4
|
File details
Details for the file mcpassistant_gateway-0.1.7-py3-none-any.whl.
File metadata
- Download URL: mcpassistant_gateway-0.1.7-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d58e154cd14e68862c8df68a63d95ecdecbabde2829b781956d5a3e3cb0efae6
|
|
| MD5 |
cbd00e57fc854fec7c5d98f1c7ef261c
|
|
| BLAKE2b-256 |
8e62c457a6995bd457bc7f0eb0265f6db5698aaa002063b0a6ae2a01e01340d0
|