MCP server: stateless HTTP + relaxed host check for web-UI hosts
Enables Open WebUI / LibreChat native Streamable-HTTP MCP (host.docker.internal, stateless_http + json_response). Deployed as atlas-brain-mcp on atlas-01. Atlas Corporation proprietary.
This commit is contained in:
parent
43a8dbb36f
commit
c248365c7d
1 changed files with 8 additions and 1 deletions
|
|
@ -30,11 +30,18 @@ import brain
|
|||
|
||||
try:
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp.server.transport_security import TransportSecuritySettings
|
||||
except Exception:
|
||||
sys.stderr.write("SecondBrain MCP needs the MCP SDK: pip install \"mcp[cli]\"\n")
|
||||
raise
|
||||
|
||||
mcp = FastMCP("secondbrain")
|
||||
# Allow reverse-proxied / container access (host.docker.internal, LAN) over Streamable HTTP.
|
||||
# The brain endpoint itself should be bound to a private interface / put behind auth.
|
||||
_SECURITY = TransportSecuritySettings(enable_dns_rebinding_protection=False)
|
||||
# stateless_http + json_response = broadest compatibility with web-UI MCP clients
|
||||
# (e.g. Open WebUI) that don't hold an SSE session.
|
||||
mcp = FastMCP("secondbrain", transport_security=_SECURITY,
|
||||
stateless_http=True, json_response=True)
|
||||
# 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"))
|
||||
|
|
|
|||
Loading…
Reference in a new issue