diff --git a/README.md b/README.md index 768fa6c..8ad36cb 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,8 @@ etc. — so the assistant gains local, private, long-term memory: ```bash 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: diff --git a/mcp_server.py b/mcp_server.py index d8b96bb..70d6868 100755 --- a/mcp_server.py +++ b/mcp_server.py @@ -35,6 +35,9 @@ except Exception: raise 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() @@ -87,4 +90,9 @@ def stats() -> str: if __name__ == "__main__": - mcp.run() + # 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()