Backend
MCP Server
Caspian can mount an app-owned FastMCP server into the same FastAPI
deployment. The feature is optional and is controlled by
caspian.config.json.
"mcp": false.
Treat this page as capability reference only. If MCP is needed, enable
the flag intentionally and run the Caspian project update workflow so
framework-managed files such as src/lib/mcp/**
are generated together.
Generated application shape
src/lib/mcp/ ├── mcp_server.py └── fastmcp.json settings/restart-mcp.ts main.py package.json
Keep tools and server configuration in
src/lib/mcp/. The current
main.py imports that module only when
cfg.mcp is true, composes the MCP
lifespan with the FastAPI lifespan, and mounts the transport at
/mcp.
Run and inspect
Bundled workflow
npm run mcp
Direct FastMCP workflow
fastmcp run src/lib/mcp/fastmcp.json
Confirm the generated script names in package.json
before running them. The current project has MCP disabled and therefore
does not expose an MCP script or generated server files.
HTTP and CORS ownership
Browser MCP clients preflight the mounted endpoint. The app bootstrap
builds MCP-specific CORS settings from
CORS_ALLOWED_ORIGINS,
APP_BASE_URL, and related environment
values, and includes the required
mcp-session-id and
mcp-protocol-version headers.
The /mcp transport is long-lived and is
excluded from the normal request timeout in this project's
main.py. Preserve that exemption when
changing diagnostics or timeout middleware.