Add Streamable HTTP transport, bearer auth, and Docker deployment

- Enable stateless_http + json_response on FastMCP for scalable HTTP
  serving without sticky sessions (Traefik-friendly)
- Add MCP_TRANSPORT env var to select stdio (default) vs streamable-http
- Add bearer token auth middleware (MCP_AUTH_TOKEN) with /health bypass
- Add Dockerfile (Python 3.12-slim + uv) and docker-compose.yml with
  Traefik v2/v3 labels, ACME TLS, and health check routing
- Add .env.example with multi-instance config for mini/tn-sb/tn-mr2/p-mba
- Add uvicorn + starlette as runtime dependencies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
PiersandClaude Opus 4.6 committed 2026-02-15 03:54:43 +00:00
1 parent 3a33d34bd1
commit 5ca58735eb
8 files changed
+175 -3

No files matched your search

+15 -1
View File
@@ -3,6 +3,8 @@
from contextlib import asynccontextmanager
from mcp.server.fastmcp import FastMCP
from starlette.requests import Request
from starlette.responses import JSONResponse
from syncthing_mcp.registry import get_all_instances
@@ -23,7 +25,19 @@ async def app_lifespan(app):
yield {}
mcp = FastMCP("syncthing_mcp", lifespan=app_lifespan)
mcp = FastMCP(
"syncthing_mcp",
lifespan=app_lifespan,
stateless_http=True,
json_response=True,
)
@mcp.custom_route("/health", methods=["GET"])
async def health(request: Request) -> JSONResponse:
"""Unauthenticated health-check endpoint for Docker / Traefik probes."""
return JSONResponse({"status": "ok"})
# Import all tool modules so they register with `mcp` via decorators.
import syncthing_mcp.tools # noqa: E402, F401