feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json (FJMCP-21) #31

Merged
David merged 1 commit from feat/FJMCP-21-forgejo-token-env into main 2026-06-25 11:19:32 +02:00
Member

Read FORGEJO_TOKEN once in ForgejoServer::from_env_with_policy alongside FORGEJO_HOST. When set and non-empty it builds the authenticated Forgejo client directly via Auth::Token, decoupled from the fj CLI's keys.json, so a deployment (notably the http service mode) can supply a credential without installing or configuring fj. When unset, the server falls back to the existing keys.json lookup so local development keeps working unchanged.

Both api() and api_and_token() honor the token: the latter returns it alongside the client for attachment downloads. Update the module doc comment, the server tool-description string, and the README (Authentication section, configuration table, HTTP transport notes) to document FORGEJO_TOKEN and the env-first-with-fallback precedence. Add a unit test that the token path builds an authenticated client without touching keys.json.

Fixes FJMCP-21

Read FORGEJO_TOKEN once in ForgejoServer::from_env_with_policy alongside FORGEJO_HOST. When set and non-empty it builds the authenticated Forgejo client directly via Auth::Token, decoupled from the fj CLI's keys.json, so a deployment (notably the http service mode) can supply a credential without installing or configuring fj. When unset, the server falls back to the existing keys.json lookup so local development keeps working unchanged. Both api() and api_and_token() honor the token: the latter returns it alongside the client for attachment downloads. Update the module doc comment, the server tool-description string, and the README (Authentication section, configuration table, HTTP transport notes) to document FORGEJO_TOKEN and the env-first-with-fallback precedence. Add a unit test that the token path builds an authenticated client without touching keys.json. Fixes FJMCP-21
feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 28s
Create release / Create release from merged PR (pull_request) Has been skipped
efb8f85d6a
Read FORGEJO_TOKEN once in ForgejoServer::from_env_with_policy alongside FORGEJO_HOST. When set and non-empty it builds the authenticated Forgejo client directly via Auth::Token, decoupled from the fj CLI's keys.json, so a deployment (notably the http service mode) can supply a credential without installing or configuring fj. When unset, the server falls back to the existing keys.json lookup so local development keeps working unchanged.

Both api() and api_and_token() honor the token: the latter returns it alongside the client for attachment downloads. Update the module doc comment, the server tool-description string, and the README (Authentication section, configuration table, HTTP transport notes) to document FORGEJO_TOKEN and the env-first-with-fallback precedence. Add a unit test that the token path builds an authenticated client without touching keys.json.

#FJMCP-21
David changed title from feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json to feat(auth): authenticate with FORGEJO_TOKEN env var, fall back to keys.json (FJMCP-21) 2026-06-25 11:19:24 +02:00
David merged commit 4541e8cd83 into main 2026-06-25 11:19:32 +02:00
David deleted branch feat/FJMCP-21-forgejo-token-env 2026-06-25 11:19:32 +02:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pandoras-box/forgejo-mcp!31
No description provided.