feat(mcp): adopt shared mcp-web crate in fj mcp serve #72
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/FJ-54-adopt-mcp-web-crate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Make
fj mcp serveover HTTP a multi-user web service built on the shared, product-agnosticmcp-webcrate instead of a single-identity endpoint behind one static bearer. The crate supplies local accounts (email + password + TOTP), browser sessions, an OAuth 2.1 Authorization Server (dynamic client registration, PKCE, both.well-knowndiscovery documents), encryption at rest, and a SQLite state store with an expiry sweep; none of that security-critical code is written in this repo.http.rsnow assembles the crate'sAppStatefrom this service's environment and mounts the rmcp Streamable HTTP/mcpservice behind the crate's Resource-Server bearer middleware, so/mcpis gated by an app-issued OAuth token bound to a local account rather than a shared static secret, and an unauthenticated request gets a 401 carrying aWWW-Authenticatechallenge that points at the protected-resource metadata. The account-to-client seam is stubbed (NoInstanceDirectory): every account reports no configured instance, which FJ-55 replaces with a real per-account Forgejo instance lookup. The#[tool]surface inserver.rsis untouched.The service fails closed at startup when
FORGEJO_MCP_MASTER_KEYorFORGEJO_MCP_SESSION_KEY(each base64 of 32 bytes) is missing or malformed, and never generates either, so a restart cannot silently invalidate every session or orphan every encrypted credential.FORGEJO_MCP_ADMIN_EMAILbootstraps the first admin.fj mcp stdiois unchanged: it sharesinit_serverbut takes on no database, key, or account requirement, as its existing tests show.The crate is pulled from the Pandora's Box Forgejo Cargo registry, aliased
pandoras-box-cargoin.cargo/config.toml; the three build Dockerfiles copy that config so the builder can resolve it. Docs updated: the README HTTP-mode section and env-var table, the repo CLAUDE.md shape note, and a note thatfj mcp service installdoes not yet provision the new keys (tracked in FJ-57).#FJ-54