Add create_api_token tool and FORGEJO_TOKEN support #3

Closed
opened 2026-03-01 21:57:28 +00:00 by forgejo_admin · 0 comments
Contributor

Plan

todo-forgejo-token-auth — TODO-scoped work

Repo

forgejo-mcp~/forgejo-mcp/

User Story

As an agent that needs Forgejo API access
I need an MCP tool that can create API tokens
So that I can bootstrap token-based auth and generate tokens for CI secrets and other services

Acceptance Criteria

  • create_api_token MCP tool exists wrapping POST /api/v1/users/{username}/tokens
  • Accepts token name, optional scopes
  • Returns the token value (Forgejo only shows it once)
  • A persistent FORGEJO_TOKEN is generated and saved to ~/secrets/pal-e-services/forgejo.env
  • forgejo-mcp's mcp.json env config updated to include FORGEJO_TOKEN

Additional Information

Depends on forgejo-sdk token auth being done first — the SDK needs token auth support before the MCP can switch to using it. However, the create_api_token tool itself can use basic auth (it's creating a token, not consuming one).

Forgejo token creation API: POST /api/v1/users/{username}/tokens with body {"name": "...", "scopes": [...]}. Returns {"id": N, "name": "...", "sha1": "the-actual-token"}.

pal-e-docs: issue-forgejo-mcp-token-tool

Checklist

  • PR opened with related notes
  • Tests cover token creation
  • FORGEJO_TOKEN generated and persisted in secrets
  • mcp.json updated
  • todo-forgejo-token-auth — parent TODO
  • issue-forgejo-sdk-token-auth — dependency (SDK needs token auth first)
  • repo-forgejo-mcp — repo page
  • project-claude-config
### Plan `todo-forgejo-token-auth` — TODO-scoped work ### Repo `forgejo-mcp` — `~/forgejo-mcp/` ### User Story As an agent that needs Forgejo API access I need an MCP tool that can create API tokens So that I can bootstrap token-based auth and generate tokens for CI secrets and other services ### Acceptance Criteria - `create_api_token` MCP tool exists wrapping `POST /api/v1/users/{username}/tokens` - Accepts token name, optional scopes - Returns the token value (Forgejo only shows it once) - A persistent `FORGEJO_TOKEN` is generated and saved to `~/secrets/pal-e-services/forgejo.env` - forgejo-mcp's mcp.json env config updated to include `FORGEJO_TOKEN` ### Additional Information Depends on forgejo-sdk token auth being done first — the SDK needs token auth support before the MCP can switch to using it. However, the `create_api_token` tool itself can use basic auth (it's creating a token, not consuming one). Forgejo token creation API: `POST /api/v1/users/{username}/tokens` with body `{"name": "...", "scopes": [...]}`. Returns `{"id": N, "name": "...", "sha1": "the-actual-token"}`. pal-e-docs: `issue-forgejo-mcp-token-tool` ### Checklist - [ ] PR opened with related notes - [ ] Tests cover token creation - [ ] FORGEJO_TOKEN generated and persisted in secrets - [ ] mcp.json updated ### Related - `todo-forgejo-token-auth` — parent TODO - `issue-forgejo-sdk-token-auth` — dependency (SDK needs token auth first) - `repo-forgejo-mcp` — repo page - `project-claude-config`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
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
ldraney/forgejo-mcp#3
No description provided.