- Go 96.9%
- Shell 1.4%
- Dockerfile 1%
- Makefile 0.7%
Spawns a real forgejo-mcp --transport stdio subprocess, runs the canonical MCP handshake (initialize → notifications/initialized → tools/list → tools/call get_forgejo_mcp_server_version) through the bridge, and verifies each step. Validates that the opaque-pipe assumption holds end-to-end: every JSON-RPC message round-trips correctly with no hand-rolled framing surprises. Binary discovery (skipped if none found): 1. $FORGEJO_MCP_BIN 2. ../../../forgejo-mcp/forgejo-mcp (sibling-repo built binary) 3. go build of ../../../forgejo-mcp into a temp dir Fake Forgejo (httptest.Server) covers the two probes the SDK and forgejo-mcp's testConnection do at startup: - GET /api/v1/version → returns 11.0.0 (>=1.11.0 satisfies SDK gate) - GET /api/v1/user → returns a minimal authenticated user blob Skipped under -short. Catch-all 404 handler logs unexpected probes so new SDK or forgejo-mcp behaviour surfaces clearly in test output. Closes forgejo-mcp-broker-xot. Phase 4 complete. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .beads | ||
| .claude | ||
| cmd/broker | ||
| docs | ||
| internal | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
forgejo-mcp-broker
OAuth 2.1 authorization server and MCP session broker for forgejo-mcp.
Lets MCP clients such as Claude.ai connect to a Forgejo instance through a single public HTTPS endpoint, with per-user authentication delegated to Forgejo's own OAuth2 provider. The broker handles the OAuth dance, then spawns a dedicated forgejo-mcp --transport stdio subprocess for each authenticated session, scoped to the authenticated user's Forgejo access token.
Status: Planning. No code yet. See docs/design.md for the architecture and docs/plan.md for the phased implementation plan.
How it fits
Claude.ai ──HTTPS──▶ Caddy ──▶ fjmcp-broker ──stdio──▶ forgejo-mcp ──▶ Forgejo API
(this) (one per user (per-user
session) token)
fjmcp-broker(this project): one long-running process. Handles OAuth discovery, dynamic client registration, the authorization-code flow against Forgejo, session lifecycle, and stdio-to-streamable-HTTP bridging.forgejo-mcp(existing project): used as-is. Spawned per-session with the authenticated user'sFORGEJO_ACCESS_TOKENin the environment.- Caddy: terminates TLS for the public hostname and reverse-proxies to the broker.
Why a broker instead of adding OAuth to forgejo-mcp?
Process-level isolation. Each user's Forgejo token lives in exactly one subprocess — the broker never needs to demultiplex tokens inside a single shared client. This keeps forgejo-mcp's sync.Once singleton-client pattern valid and avoids a refactor of every tool handler. Full trade-off in docs/design.md.
Quick map
| File | What |
|---|---|
docs/design.md |
Architecture, components, token flow, deployment, security |
docs/plan.md |
Seven-phase implementation plan with acceptance criteria |
License
MIT © 2026 Ole-Morten Duesund.