From c8906761c20b36a746f5478cd769119544c2deb0 Mon Sep 17 00:00:00 2001 From: Eddie Fleurent Date: Sat, 28 Feb 2026 07:50:34 -0500 Subject: [PATCH] fix(mcp): fix SSE transport host binding and remove invalid sse_params kwarg - FastMCP defaults to 127.0.0.1 which prevents remote connections when running SSE transport. Default to 0.0.0.0 and allow override via FASTMCP_HOST / FASTMCP_PORT env vars. - mcp.run() does not accept sse_params kwarg (raises TypeError). Remove it. The --port arg was always a no-op since FastMCP is instantiated at module level before args are parsed; use FASTMCP_PORT env var instead. --- mcp_server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mcp_server.py b/mcp_server.py index c798c13..61d0235 100644 --- a/mcp_server.py +++ b/mcp_server.py @@ -186,7 +186,12 @@ def _ensure_repos_ready(repos: List[str], ctx=None) -> List[str]: # If signature introspection fails, fall back to the safest constructor shape. pass -mcp = FastMCP("FastCode", **_fastmcp_kwargs) +mcp = FastMCP( + "FastCode", + host=os.getenv("FASTMCP_HOST", "0.0.0.0"), + port=int(os.getenv("FASTMCP_PORT", "8080")), + **_fastmcp_kwargs, +) @mcp.tool() @@ -419,6 +424,6 @@ def delete_repo_metadata(repo_name: str) -> str: args = parser.parse_args() if args.transport == "sse": - mcp.run(transport="sse", sse_params={"port": args.port}) + mcp.run(transport="sse") else: mcp.run(transport="stdio")