MCP server: add Streamable-HTTP transport (--http)

The transport every web UI (Open WebUI, LibreChat, AnythingLLM, Jan, LobeChat)
consumes natively — so the brain plugs into browser UIs, not just stdio clients.
Atlas Corporation proprietary.
This commit is contained in:
Atlas 2026-07-01 22:20:55 +02:00
parent ebdaafa52d
commit 43a8dbb36f
2 changed files with 11 additions and 2 deletions

View file

@ -145,7 +145,8 @@ etc. — so the assistant gains local, private, long-term memory:
```bash ```bash
pip install "mcp[cli]" pip install "mcp[cli]"
python3 mcp_server.py # stdio MCP server python3 mcp_server.py # stdio — Claude Desktop, Cursor
python3 mcp_server.py --http # Streamable HTTP (MCP_HOST/MCP_PORT) — Open WebUI, LibreChat, web UIs
``` ```
Add to your MCP host's config: Add to your MCP host's config:

View file

@ -35,6 +35,9 @@ except Exception:
raise raise
mcp = FastMCP("secondbrain") mcp = FastMCP("secondbrain")
# Streamable-HTTP bind (used with `--http`); the transport all web UIs consume natively.
mcp.settings.host = os.environ.get("MCP_HOST", "127.0.0.1")
mcp.settings.port = int(os.environ.get("MCP_PORT", "8790"))
@mcp.tool() @mcp.tool()
@ -87,4 +90,9 @@ def stats() -> str:
if __name__ == "__main__": if __name__ == "__main__":
# stdio (Claude Desktop, Cursor): python3 mcp_server.py
# streamable-http (Open WebUI, LibreChat, any web UI): python3 mcp_server.py --http
if "--http" in sys.argv:
mcp.run(transport="streamable-http") # serves at http://MCP_HOST:MCP_PORT/mcp
else:
mcp.run() mcp.run()