Model Context Protocol server for Forgejo, Codeberg and Gitea, in Rust
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
One-click editor setup isnβt available for this listing yet β we donβt have a confirmed install command, and weβd rather show nothing than point your editor at the wrong package or host. Follow the projectβs own setup instructions, linked above.
A Model Context Protocol server for Forgejo, Codeberg and Gitea. It lets an MCP client (Claude Code, Claude Desktop, β¦) read your forge β the authenticated user, repositories, issues, and pull requests β over the Forgejo/Gitea REST API.
Status: read-only by default, with opt-in guarded writes (since v0.2). Read tools across the forge β user, repos, issues, pull requests, search, orgs, notifications, comments, reviews, and Actions (CI) runs β plus guarded writes (
create_repo,edit_repo,create_branch,create_issue,create_pull_request,comment_on_issue,delete_repo,migrate_repo, push-mirror management, anddispatch_workflow) gated behind a separate write token and a deliberate, time-boxed write mode. SeeSPECIFICATION.mdfor the full design.
It speaks the Forgejo REST API directly through a small, in-house client (src/forgejo/client.rs,
over the src/mcp_core/ transport) β an independent implementation over the documented
API, not a port of any other server. There is no third-party forge SDK in the trust path, so the
tool surface holding your token is code you can read and audit end to end.
The server speaks MCP protocol version 2026-07-28 (since v0.16) and negotiates down to
2024-11-05, so older clients keep working unchanged. It runs over stdio and exposes
tools only β no resources, prompts, sampling, or roots.
A companion server for Woodpecker CI shipped in this crate as a
second woodpecker-mcp binary from v0.13.0 through v0.17.0. It now lives in its own repository
and crate: woodpecker-mcp.
Woodpecker is its own system β it drives Gitea, GitHub, GitLab, and Bitbucket as readily as
Forgejo, and that server never called the Forgejo API at all β so bundling it here made it
invisible to everyone not running Forgejo. Nothing about it changed in the move; if you were using
the woodpecker-mcp binary from this crate, install it from the new crate instead and point your
MCP client at the new path.
The server is configured by environment variables:
| Variable | Required | Default | Meaning |
|---|---|---|---|
FORGEJO_TOKEN_READ_ONLY | yes | β | Read token (or FORGEJO_TOKEN). Read-only scopes are enough. |
FORGEJO_TOKEN_WRITE | no | β | Write/delete-scoped token. Providing it enables the write tools; omit it for a pure read-only server. |
FORGEJO_WRITE_MINUTES | no | 10 | Default write-mode window (minutes, max 60). |
FORGEJO_MIRROR_TOKEN | no | β | Credential add_push_mirror sends as the remote's password (e.g. a GitHub PAT). Kept out of the conversation β never passed as a tool argument. Omit if you only use use_ssh=true mirrors. |
FORGEJO_MIGRATE_TOKEN | no | β | Credential migrate_repo sends to the source instance it reads from. Also never passed as a tool argument. Kept separate from FORGEJO_MIRROR_TOKEN on purpose β that one authenticates to a push target, so sharing a variable would send a credential to a host it was never issued for. Omit if you only migrate public repos. |
FORGEJO_UPLOAD_ROOT | no | β | Directory upload_release_asset may read files from. Uploading is disabled while this is unset β see Release assets. |
FORGEJO_UPLOAD_MAX_MB | no | 100 | Ceiling on one uploaded asset (MiB). The file is read into memory to be sent. |
FORGEJO_URL | no | https://codeberg.org | Instance base URL. |
FORGEJO_FLAVOR | no | auto | forgejo, gitea, or auto to detect from the instance version. Only the Actions (CI) tools consult it β see Forgejo and Gitea. |
Mint a token at Codeberg β Settings β Applications (or your instance's equivalent). For
the read tools, read scopes (read:repository, read:issue, read:user) suffice. The write
token needs write:repository (including delete, and the repo-admin push-mirror endpoints).
A read token is mandatory: the server refuses to start on a write token alone, and the
read token must be a different token from FORGEJO_TOKEN_WRITE β you can't shortcut by
reusing the write token for reads.
Forgejo 15+ token scoping. Forgejo 15.0 tightened authorization on many repository APIs to match its fine-grained, repository-scoped access tokens. Classic broad tokens are unaffected, but if you mint a repository-scoped token it must actually carry the scopes above β in particular the repo-admin scope for the push-mirror tools, which otherwise return
403. Scope the token to every repo you intend to reach.
Forgejo began as a Gitea fork, and the REST surface is still very nearly the same one. Of the ~25 endpoints this server calls, only the Actions (CI) ones differ. Issues, pull requests, diffs, PR files, branches, file contents, search, orgs, notifications, push mirrors, and migration are identical in path, method, and response shape on both, so they need no special handling and get none.
The flavor is detected once, lazily, from the instance's GET /version β and only the Actions
tools ever ask. Set FORGEJO_FLAVOR to forgejo or gitea to pin it if the detection ever
guesses wrong on your instance.
The detection reads oddly on purpose: Forgejo names Gitea in its own version string (Codeberg reports
16.0.0-dev-741-6f391573+gitea-1.22.0) to advertise API compatibility, while Gitea never names itself (1.27.0+dev-954-g1f3981a301). So agitea-marker means Forgejo. Failing that marker, the major version decides: Gitea is still 1.x, Forgejo renumbered to 7 and beyond.
Where the two forges differ, and what the server does about it:
| Forgejo | Gitea | Handling | |
|---|---|---|---|
| Run filter by git ref | ref, fully qualified | branch, bare name | Translated; refs/heads/main works on both |
| Run filter by workflow | workflow_id query parameter | a separate β¦/actions/workflows/{file}/runs path | Translated |
| Run outcome | status alone | status (phase) plus conclusion | Normalized: conclusion is promoted into status, and also kept verbatim |
| Run field names | commit_sha, prettyref, index_in_repo, title, created | head_sha, head_branch, run_number, display_title, created_at | Normalized to one shape |
| Workflow file and ref | separate: workflow_id and prettyref | combined into path, as ci.yml@refs/heads/main | Split apart; the ref is shortened (main, v0.16.0) and a pull-request ref kept whole |
| Unknown workflow filter | empty list | 404 workflow "x.yml" not found | Surfaced as-is; the tool description says which is which |
workflow_dispatch reply | the created run (return_run_info) | 204 No Content | Forgejo's run is passed through; on Gitea the tool returns an acknowledgement and tells the caller to find the run with list_workflow_runs |
| Workflow directory | .forgejo/workflows, .github/workflows | .gitea/workflows, .github/workflows | Mentioned in the dispatch_workflow tool description |
Translating rather than sending both spellings is deliberate: an unknown query parameter is
ignored, not rejected, so sending Forgejo's ref to Gitea would silently return unfiltered
runs β a filter that looks applied but isn't.
Gitea's path deserves its own warning, because the name lies: it is not a filesystem
path. It is the workflow file, an @, and the fully-qualified ref β ci.yml@refs/heads/main,
or test-pr.yml@refs/pull/1117/head. It is also the only reliable source of the ref, since
head_branch is populated for branch runs and null for tags and pull requests.
Two more things regardless of flavor. Gitea requires a token for the Actions API even on public
repositories. And get_workflow_run deliberately returns the instance's full, unmodified run
object, so that one is shaped differently on each forge; use list_workflow_runs when you
want the normalized view.
The server is read-only by default. create_repo / edit_repo / delete_repo work only when (a)
FORGEJO_TOKEN_WRITE is configured and (b) you've deliberately entered write mode via
enable_write_mode β a time-boxed elevation (default 10 min, max 60) that slides forward on
each write and auto-reverts. write_status reports the state; delete_repo also requires a
confirm argument equal to "owner/repo".
enable_write_mode, disable_write_mode and write_status all report the instance they
apply to, and the elevation note names it in prose, so the announcement reads "write mode is
active on https://gitea.com/" rather than a bare "write mode is on". That matters once you
run more than one of these servers at once β a Codeberg one and a Gitea one, say β where
each has its own independent write mode and an unqualified warning tells you nothing about
which forge is now writable. write_status deliberately never calls the instance, so its
flavor is null until something else has detected it. See SPECIFICATION.md
for the full design.
Only needed if you'll use migrate_repo against a
private source. Public sources need no credential β skip this entirely.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/forgejo-codeberg-gitea)<a href="https://allmcps.com/mcp/forgejo-codeberg-gitea"><img src="https://allmcps.com/api/badge/forgejo-codeberg-gitea?style=directory" alt=" Gitea on AllMCPs" /></a>