# Forgejo / Codeberg / Gitea [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/brechanbech/forgejo-mcp-rs  
**GitHub Stars:** 2  
**Views:** 11  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/forgejo-codeberg-gitea

## Description
Model Context Protocol server for Forgejo, Codeberg and Gitea, in Rust

## Tools
Capabilities this server exposes over MCP:

- **whoami** — The authenticated user (verifies the token)
- **version** — This MCP server's version, the connected instance's version, and its `flavor` (`forgejo` or `gitea`)
- **list_orgs** — Organizations you belong to
- **list_notifications** — Your notification threads, slimmed (`all=true` for read+unread)
- **list_keys** — An account's SSH and GPG keys (omit `username` for yourself). `verified` decides whether a signature can verify at all — but **Gitea omits the field on SSH keys**, so absent means unreported, not unverified. GPG entries carry the addresses the key covers and whether each is activated
- **write_status** — Report write-mode state (token configured? active? minutes left?)
- **enable_write_mode** — Enter/leave the time-boxed write mode
- **list_my_repos** — Your repositories (auto-paginated, slimmed)
- **search_repos** — Repositories whose name or topics match a keyword (`include_description` widens it), slimmed like `list_my_repos`, with the match count
- **get_repo** — One repository's details (incl. default branch, size in KiB, and the `has_*` unit toggles), slimmed
- **create_repo** — Create a repo (defaults to private)
- **edit_repo** — Edit repo settings — visibility, description, website, default branch, unit toggles (issues, PRs, wiki, releases, actions, packages, projects), archive. Only provided fields change; no renames. A unit that is **off** 404s its whole endpoint family rather than returning empty results, so `has_releas…
- **delete_repo** — Delete a repo (needs `confirm = "owner/repo"`)
- **migrate_repo** — Copy a repo in from **another** instance — the only tool that carries issues/PRs across instances. Answers once the import has finished, and names any empty repository a failure left behind; leaves the source untouched; credential from `FORGEJO_MIGRATE_TOKEN
- **get_repo_tree** — A repository's git tree (optional `sha`, `recursive`). Entries are path/type/size/sha; check `truncated` before concluding a file is absent
- **get_file_contents** — Read a file (decodes text) or list a directory (`owner/repo/path`, optional `ref`). Optional `start_line`/`end_line` take a 1-indexed inclusive window, clamped to the file; `total_lines` is always reported
- **create_or_update_file** — Create a file, or replace its content, as one commit (owner/repo/path/content as UTF-8 text). Pass the current `sha` from `get_file_contents` to update; a stale one is refused. Optional `message`, `branch`, `new_branch
- **delete_file** — Delete a file as one commit (owner/repo/path/sha). Optional `message`, `branch`, `new_branch
- **list_branches** — Branches in `owner/repo` (auto-paginated, slimmed to name/commit/protected)
- **list_branch_protections** — A repository's protection rules: what each enforces (`require_signed_commits`, direct pushes, approvals, status checks) for a branch name or glob. Allowlists omitted; an empty list means nothing is protected
- **create_branch** — Create a branch (owner/repo/new_branch, optional old_ref)
- **delete_branch** — Delete a branch (owner/repo/branch). The forge refuses the default and protected branches
- **list_commits** — Commits on a ref (`owner/repo`, optional `sha` and `path`; auto-paginated). Slimmed to sha, subject, author, date and signature state — the raw objects carry base64 `signature`/`payload` blobs and per-commit `files`/`stats
- **get_commit** — One commit (`owner/repo/sha`), same fields. `signature` is `verified`, `unverified` or `unsigned`; `signer` on the first, `reason` on the second
- **get_commit_statuses** — Individual statuses against a commit/branch/tag: context, status, description, `target_url`. `get_combined_status` rolls these into one verdict
- **get_combined_status** — The rolled-up CI verdict for a ref — one state plus the latest per check. The tool for "did CI pass?"; `get_commit_statuses` gives the transition history
- **list_issues** — Issues in `owner/repo` (open by default), without the pull requests the forges also list as issues. Filter by `labels`, `milestones`, `author`, `assignee`, `mentioned`, `search`, and `since`/`before`; an unknown label or milestone name is refused, since the forge would list everything. `sort` (`old…
- **list_issue_comments** — The whole comment thread on an issue/PR, oldest first, slimmed; `since`/`before` filters, and `page`/`limit` paged here
- **create_issue** — Create an issue (owner/repo/title, optional body)
- **edit_issue** — Edit an issue in place (owner/repo/index): `state` open/closed, `title`, `body`, `assignees`, `milestone`, `due_date`, `labels` (names). Only what is passed changes; works on a pull request's number too, so `state: closed` closes a PR unmerged
- **comment_on_issue** — Comment on an issue/PR (owner/repo/index/body)
- **list_pull_requests** — Pull requests in `owner/repo` (open by default); filter by `base` and `head` branch (`head` may be `owner:branch`) to ask whether a branch already has an open pull request, and by `author`; `sort` by `oldest`, `recentupdate`, `recentclose`, `mostcomment` and others, on both forges. Slimmed: branche…
- **list_pull_request_files** — Files a PR changes (auto-paginated), with per-file additions/deletions and rename info. Forgejo omits the hunks here — use `get_pull_request_diff` for content
- **get_pull_request_diff** — A PR's unified diff. `file_path` narrows it to one file (matching either side of a rename); otherwise truncated at 64 KiB, raise with `max_bytes
- **list_pull_request_reviews** — Reviews on a PR — approve/request-changes/comment verdicts + summary bodies (inline comments as a count)
- **create_pull_request** — Open a PR (owner/repo/title/head/base, optional body)
- **create_pull_request_review** — Review a PR (owner/repo/index/verdict): `approve`, `request_changes` or `comment`, with a summary `body` and optional `commit_id
- **merge_pull_request** — Merge a PR (owner/repo/index): `style` merge/rebase/rebase-merge/squash/fast-forward-only, optional title/message, `delete_branch`, and a `head_sha` guard that refuses the merge if the head moved. Answers with the PR as it now stands
- **list_workflow_runs** — Actions (CI) runs in `owner/repo`, slimmed to one shape on both forges; newest first, 30 to a page by default; filter by `head_sha`/`ref`/`status`/`event`/`workflow_id`. Outcome is in each run's `status
- **get_workflow_run** — One workflow run by `run_id`, in `list_workflow_runs`' shape
- **list_workflow_jobs** — The jobs of one run, normalized on both forges; each job's `id` is what `get_job_log` takes. Forgejo 16+
- **get_job_log** — Part of one job's log, fetched by HTTP `Range` — the last 32 KiB by default (`max_bytes` up to 1 MiB), cut to whole lines, colour codes and timestamps stripped. `earlier` / `later` give the next window to ask for. Forgejo 16+
- **dispatch_workflow** — Trigger an Actions workflow via `workflow_dispatch` (owner/repo/`workflow` file name/`ref`, optional `inputs`); returns the created run on Forgejo, an acknowledgement on Gitea
- **cancel_workflow_run** — Cancel a pending or running run (owner/repo/`run_id`); answers with the run as it now stands. Forgejo 16+
- **rerun_workflow** — Rerun a finished run, or with `job_id` one job and the jobs that depend on it; answers with the run. Forgejo 17+ — an instance without the endpoint is reported as such, with its version, and nothing is rerun
- **list_releases** — A repo's releases, newest first (auto-paginated), slimmed to identity plus `asset_count` and `asset_names
- **get_release** — One release by git **tag** — the lookup that makes a release script idempotent. The same slim shape, plus the notes and `target_commitish
- **list_release_assets** — A release's attached files (`id`, name, size, download URL) by `release_id
- **create_release** — Create a release on a tag (`tag_name`; `target_commitish` creates the tag when it does not exist)
- **edit_release** — Edit a release in place by `release_id` — `body` (the notes), `name`, `tag_name`, `draft`, `prerelease`. Only the fields passed are sent, so omitting one leaves it alone
- **upload_release_asset** — Attach a **local file** to a release. Confined to `FORGEJO_UPLOAD_ROOT`; disabled entirely when that is unset
- **delete_release_asset** — Remove one asset by `attachment_id` — needed to replace a same-named file, which Forgejo would otherwise keep alongside
- **list_push_mirrors** — List a repo's push mirrors (admin-scoped; secrets never returned)
- **add_push_mirror** — Auto-push a repo to an external remote (e.g. a GitHub mirror); credential from `FORGEJO_MIRROR_TOKEN` or `use_ssh=true
- **delete_push_mirror** — Remove a push mirror by `remote_name
- **sync_push_mirrors** — Trigger an immediate push-mirror sync

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/brechanbech/forgejo-mcp-rs), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
cargo build --release   # target/release/forgejo-mcp-rs
```

2. Install:

```sh
cargo install --path .  # install to ~/.cargo/bin
```

3. Add to Claude Code:

```sh
claude mcp add --scope user forgejo /path/to/target/release/forgejo-mcp-rs \
  --env FORGEJO_URL=https://codeberg.org \
  --env FORGEJO_TOKEN_READ_ONLY=your_read_token_here
```

## Documentation

## What Forgejo / Codeberg / Gitea does

Forgejo / Codeberg / Gitea connects an MCP client to a Forgejo or Gitea instance through its REST API. Codeberg is the default endpoint, but `FORGEJO_URL` can point to another compatible installation. The server is implemented in Rust and provides tools only: it does not expose MCP resources, prompts, sampling, or roots.

The read surface covers the authenticated account, repositories, organizations, issues, pull requests, comments, reviews, branches, commits, branch protections, repository trees, file contents, search, notifications, releases, and release assets. It also normalizes Actions-related data across Forgejo and Gitea, including workflow runs, jobs, job logs, individual commit statuses, and combined CI results.

Read results are commonly reduced to practical fields rather than returning every API field. Pagination is handled automatically for several list operations. File reads can target a line range, pull request diffs can be narrowed to a file, and commit or workflow queries support filters such as refs, paths, statuses, and events.

## How it works

The server communicates directly with the Forgejo/Gitea REST API using an in-house client. It runs over stdio and negotiates MCP protocol versions so older clients can continue to connect. The connected forge is detected lazily from its version response, or can be selected explicitly with `FORGEJO_FLAVOR`.

Forgejo and Gitea use different names and response formats for some Actions endpoints. The server translates workflow filters, normalizes run and job fields, and adapts differences in dispatch, cancellation, reruns, and job lookup. Other shared endpoints, including issues, pull requests, diffs, branches, files, search, organizations, notifications, migration, and push-mirror operations, use the common API surface.

CI inspection includes a combined-status tool for the direct question of whether checks passed, while the individual-status tool preserves each check's context, state, description, and target URL. Job logs are retrieved in bounded byte windows, with navigation fields for requesting earlier or later portions.

## Setup and configuration

Build with Cargo using `cargo build --release`, or install the executable with `cargo install --path .`. The project runs on macOS and Linux; Windows is untested.

Set `FORGEJO_TOKEN_READ_ONLY` to a read token before starting the server. The token must be distinct from the optional `FORGEJO_TOKEN_WRITE`; a write token alone is rejected. Read scopes such as repository, issue, and user access are sufficient for the read tools. `FORGEJO_URL` defaults to Codeberg, and `FORGEJO_FLAVOR` accepts `forgejo`, `gitea`, or `auto`.

Providing `FORGEJO_TOKEN_WRITE` enables guarded write tools. Write mode uses a time-limited window controlled by `FORGEJO_WRITE_MINUTES`, which defaults to 10 minutes and is capped at 60. Separate credentials can be supplied for repository migration and push mirrors. Release asset uploads require `FORGEJO_UPLOAD_ROOT`; the upload size limit is configurable with `FORGEJO_UPLOAD_MAX_MB`.

## Tools and capabilities

- Verify the authenticated user and connected forge version.
- List repositories, organizations, notifications, issues, pull requests, comments, reviews, branches, and releases.
- Inspect repository metadata, branch protections, trees, files, commits, signatures, keys, diffs, and changed files.
- Query individual and combined commit statuses.
- List workflow runs and jobs, retrieve run details, and read bounded job-log sections.
- Search repositories and inspect release assets.
- Report write-token and write-mode state with `write_status`.

## Limitations and notes

Forgejo and Gitea Actions behavior is normalized, but some differences remain visible when an endpoint returns an error or when one forge omits fields. Forgejo 16 or newer is required for workflow job support. Gitea does not report the same SSH-key verification field as Forgejo, so an absent value should not be interpreted as a failed verification.

Repository trees can be truncated, so callers should inspect the `truncated` indicator before deciding that a path is absent. Pull request diffs are capped at 64 KiB unless a file-specific request or a larger `max_bytes` value is used. Job logs default to the last 32 KiB and can be requested in additional windows up to 1 MiB.

The server is read-only by default, and credentials for migration and push mirrors are kept in environment variables rather than passed as tool arguments. Windows support is untested.

_Full upstream README: https://allmcps.com/mcp/forgejo-codeberg-gitea/readme_

