feat(ops-bridge): add HTTP/SSE MCP transport for remote Claude Code sessions

server.py: MCP_TRANSPORT and MCP_PORT env vars select transport at startup
  (default: stdio — no behaviour change for local use)
Makefile: `make mcp-http` starts SSE server on 127.0.0.1:8001

Remote registration (one-liner on COULOMBCORE after tunnel is up):
  claude mcp add-json -s user state-hub \
    '{"type":"sse","url":"http://127.0.0.1:18001/sse"}'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 00:13:14 +01:00
parent 7b7b725f8b
commit f3fca3088f
2 changed files with 13 additions and 1 deletions

View File

@@ -28,6 +28,13 @@ seed:
api:
uv run uvicorn api.main:app --reload --host 127.0.0.1 --port 8000
## MCP server in SSE/HTTP mode for remote Claude Code sessions (e.g. COULOMBCORE).
## Exposes the same tools as the stdio server over HTTP at http://127.0.0.1:8001/sse
## Remote clients connect via the ops-bridge tunnel (port 18001 on the remote host).
## Registration on the remote: claude mcp add-json -s user state-hub '{"type":"sse","url":"http://127.0.0.1:18001/sse"}'
mcp-http:
MCP_TRANSPORT=sse MCP_PORT=8001 uv run python mcp_server/server.py
dashboard:
cd dashboard && npm run dev

View File

@@ -1421,4 +1421,9 @@ def update_repo_goal(
# ---------------------------------------------------------------------------
if __name__ == "__main__":
mcp.run(transport="stdio")
transport = os.environ.get("MCP_TRANSPORT", "stdio")
if transport == "stdio":
mcp.run(transport="stdio")
else:
port = int(os.environ.get("MCP_PORT", "8001"))
mcp.run(transport=transport, host="127.0.0.1", port=port)