Architecture¶
Components¶
browser / CLI / sync tools ──► reverse proxy (TLS) ──► gunicorn :8912 (mcprack Flask app)
│
┌────────────────────────────────────────────────────┼────────────────────┐
▼ ▼ ▼ ▼
database secret store per-user FastMCP per-server relays
(users, servers, (Vaultwarden via bw, composition process (stdio processes and
ACL, requests) or encrypted local store) (loopback) network backends)
The web application serves the portal (
/), the admin area (/admin), the REST API (/api/v1) and the MCP relay (/proxy/mcp).The database holds users, servers, permissions, selections, overrides, templates, API and OAuth tokens, login throttling state and the audit trail.
The secret store holds backend credentials, either in Vaultwarden (through the
bwCLI) or encrypted locally with a key derived fromSECRET_KEY.Per-user composition: mcprack starts a
fastmcpcomposition process bound to127.0.0.1for the user. It mounts signed per-server relay URLs under stable namespaces and stops after 15 idle minutes. Each stdio backend still runs in its own per-user process.
A request, step by step¶
The client calls
/proxy/mcp/aggregatewith either a user-scoped signed path token or anAuthorization: Bearerheader (Aggregate endpoint and individual relays).mcprack resolves the user and rebuilds the composition from the user’s currently selected, enabled and permitted servers.
The composition mounts each server’s signed per-server relay under a namespace derived from its name.
The per-server relay checks access again, resolves credentials, starts a per-user process for a
commandserver or connects to a networkurl.Requests and responses cross both relays with only MCP protocol headers.
Failure handling¶
A failed start is classified, so the cause is visible:
Class |
Meaning |
|---|---|
|
The process could not be launched (binary missing, not executable) |
|
The process died during start-up; the log tail is in the audit entry |
|
Running, but it never answered on its port in time |
|
It answered |
|
It started but serves no tools (usually crashed while loading) |
|
Too many servers are starting at once; retry shortly |
|
The command is refused by the command policy (Policies for commands, URLs and installs) |
Administrators see the class and the tail of the instance log (Admin → Proxy instances, the audit trail); users receive the class and who to ask, never log lines.
Limits¶
A buffered (non-streaming) backend answer may be at most 16 MiB.
At most three MCP servers start at the same time in one worker process; others wait up to ten seconds (
MCP_COLD_START_CONCURRENCY,MCP_COLD_START_WAIT).Inside the aggregate, each backend has its own timeout (
MCPRACK_COMPOSITION_BACKEND_TIMEOUT, default 10 seconds) so one hung server cannot stalltools/listfor the whole composition.Server-sent-event answers are streamed without buffering (
X-Accel-Buffering: no). The standaloneGETstream of Streamable HTTP is answered405for stdio-implemented and Streamable HTTP servers; clients usePOST.