Gitea MCP server: connecting AI assistants to Gitea

Updated

The Gitea MCP server (gitea-mcp) is Gitea’s official bridge between a Gitea instance and AI assistants that speak the Model Context Protocol. It lets an assistant list repositories, read code, issues and pull requests, and, if you allow it, open issues, commit files or merge pull requests. Run it locally over stdio with a dedicated account and a narrow, read-only token first; only widen access once you trust the setup.

At a glance

Item Details (checked 2026-12-05)
Official repository gitea.com/gitea/gitea-mcp, on Gitea’s own forge
Latest release v1.13.0, published 6 November 2026
Licence MIT
Install options release binaries (Linux, macOS, Windows), Docker image docker.gitea.com/gitea-mcp-server, or make install with Go 1.27 or later
Transports stdio (default) and http (stateless, endpoint /mcp)
Main settings GITEA_HOST / -H, GITEA_ACCESS_TOKEN / -T, read-only -r / GITEA_READONLY
Safest start stdio, a bot account, read scopes only, read-only mode

If Gitea itself is new to you, start with what Gitea is and the Git hosting hub.

What MCP is and what this server does

The Model Context Protocol site describes MCP as “an open-source standard for connecting AI applications to external systems.” An MCP client (Claude Code, VS Code, Cursor, OpenCode and others) starts or connects to an MCP server, and the server offers tools the model can call.

gitea-mcp turns Gitea’s API into such tools. The README groups them by scope and marks each as Read or Write:

  • Reading: your user and organizations, repository search, file trees and file contents, branches, tags, commits, releases, issues, pull requests with diffs and reviews, labels, milestones, wiki pages, packages, projects, notifications, time tracking, and Actions runs, logs and artifacts.
  • Writing: creating or editing issues and comments, creating, merging or closing pull requests, submitting reviews, committing or deleting files, creating branches and tags, changing repository settings and branch protections, writing Actions secrets and variables, dispatching or approving Actions runs, and deleting package versions, which the README marks as irreversible.

Many tools are consolidated: one tool such as issue_write handles several operations through a method parameter. Three settings shape what the model sees:

  • -r or GITEA_READONLY hides every Write tool.
  • -S / --scope (GITEA_SCOPES) loads only tools from the listed scopes, for example issue,pull_request.
  • -O / --tools (GITEA_TOOLS) loads only the named tools.

Fewer tools means fewer ways for a manipulated model to do damage, so use these filters from day one.

Get the official server

Use the repository on gitea.com. The Docker image’s own metadata names https://gitea.com/gitea/gitea-mcp as its source. Several unrelated projects use names like “gitea mcp” with different settings, so do not mix their instructions with this one.

The README offers three ways to install:

  1. Release binary. Download the archive for your platform from the releases page, check it against the checksums file published with each release, and put gitea-mcp in your PATH.
  2. Docker image. docker.gitea.com/gitea-mcp-server. Tags include exact versions such as 1.13.0, latest and nightly. The image runs as a non-root user.
  3. From source. With Go 1.27 or later:
git clone https://gitea.com/gitea/gitea-mcp.git
cd gitea-mcp
make install

Releases are frequent: five minor versions appeared between mid-October and early November 2026. MCP’s local server security guide recommends pinning an exact version and updating on purpose, so prefer 1.13.0 over latest, avoid nightly for daily use, and read the release notes before you move up.

Create a dedicated account and a narrow token

The token is the real security boundary. Whatever the assistant does, it does as the token’s user, within the token’s scopes.

  1. Create a separate Gitea user for the assistant, not your own account and never an administrator. Add it as a collaborator, with read access, only to the repositories it should see. The token cannot reach more than that user can.
  2. Sign in as that user and open Settings → Applications → Generate New Token, as Gitea’s API docs describe.
  3. Set Repository and Organization Access. Gitea offers “Public only” or “All (public, private, and limited)”. Choose “Public only” if the assistant only needs public projects.
  4. Pick permissions per category. Each category can be “No Access”, “Read” or “Read and Write”. Gitea requires at least one, and “a scope is required even for public repositories.”
  5. Copy the token immediately. Gitea shows it only once.

Neither the gitea-mcp README nor Gitea’s docs say which token scope each MCP tool needs. The list below is this guide’s own inference from Gitea’s scope table, which says which API routes each scope covers. If a tool fails with a permission error, check its route before widening anything.

  • read:repository: Gitea says the repository scope covers /repos/* routes except issues, including files, pull requests and releases, so the file, branch, commit, pull request and release tools likely need it.
  • read:issue: the issue scope covers issue, label and milestone routes.
  • read:user: the user scope covers /user/* routes, which get_me most likely calls.
  • read:notification and read:organization: probably needed only for the notification and organization tools.

A reasonable read-only start is read:repository and read:issue, adding read:user if you want the assistant to know who it is. Upgrade to write:issue before write:repository: commenting on issues is far less risky than committing code or merging. Never grant admin scopes, and avoid the special all scope.

Expiry and rotation. Gitea’s token documentation describes no expiry date for personal access tokens, so rotation is up to you. The token settings page has a Regenerate action that keeps the name and permissions but invalidates the old value at once. Regenerate on a schedule, and immediately if a token may have leaked.

Local setup over stdio

In stdio mode your MCP client starts gitea-mcp as a child process and talks to it through standard input and output. No port is opened, and the token never leaves your machine except in requests to your Gitea.

This is the README’s configuration for clients such as Cursor, with two changes: the host is a placeholder for your instance, and -r is added so the server starts read-only.

{
  "mcpServers": {
    "gitea": {
      "command": "gitea-mcp",
      "args": ["-t", "stdio", "--host", "https://gitea.example.org", "-r"],
      "env": {
        "GITEA_ACCESS_TOKEN": "CHANGE_ME"
      }
    }
  }
}

For VS Code, the README’s configuration runs the Docker image and asks for the token when the server starts, instead of storing it in the file. Two changes here: the image is pinned to a release, and GITEA_HOST is added, using the same -e pattern the README shows for other clients. Without it, the server’s built-in default host is gitea.com, not your instance:

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "gitea_token",
        "description": "Gitea Personal Access Token",
        "password": true
      }
    ],
    "servers": {
      "gitea-mcp": {
        "command": "docker",
        "args": ["run", "-i", "--rm", "-e", "GITEA_ACCESS_TOKEN", "-e", "GITEA_HOST", "docker.gitea.com/gitea-mcp-server:1.13.0"],
        "env": {
          "GITEA_ACCESS_TOKEN": "${input:gitea_token}",
          "GITEA_HOST": "https://gitea.example.org"
        }
      }
    }
  }
}

The Docker route matches MCP’s own advice. Its local server security guide warns that a local server is an ordinary process with your account’s access to files, environment variables and network, and calls process isolation “the single highest-leverage mitigation”, with a container as its baseline. With stdio, the container still talks to the client normally.

Keep tokens out of shared files. The README says the VS Code block also works in a workspace .vscode/mcp.json, without the outer mcp key. If you use that, keep the prompt-based input and never write a token into a file inside a repository. Client config files sit in predictable places on disk, so use per-server environment settings or your client’s secret store rather than exporting the token in your shell profile. Avoid the -d debug flag outside troubleshooting: the README says debug logs include every request sent to Gitea.

Once connected, the README suggests asking “list all my repositories” as a first test.

Remote setup over HTTP

Start the server with -t http and clients connect to /mcp, by default on port 8080. The README describes this mode as stateless and POST-only, with a /healthz endpoint for health checks. Clients send the Gitea token per request in an Authorization header.

Treat this as an internal service:

  • Bind it to localhost or a VPN address. The server’s built-in help (gitea-mcp --help) says the HTTP listen address defaults to all interfaces. Always set it with -b / --bind, for example -b 127.0.0.1. In Docker, publish the port only on 127.0.0.1 or your VPN interface instead. MCP’s guidance adds that binding to 127.0.0.1 “is not an authentication boundary”, so authentication still matters.
  • Put TLS in front if anything other than localhost connects, using the same reverse proxy that serves Gitea. The README says proxies must forward the Mcp-Protocol-Version, Mcp-Method and Mcp-Name headers unchanged.
  • Know what the header mode is. The README calls the per-request token “credential passthrough rather than MCP OAuth”. MCP’s security best practices describe token passthrough as an anti-pattern. It is acceptable for one person on a private network, not for a shared service.

For several users, or clients that cannot hold a token, the README documents an OAuth 2.1 mode in which each user signs in with their own Gitea account (README command, with example.org placeholders):

gitea-mcp -t http -oauth -oauth-public-url https://mcp.example.org -H https://gitea.example.org

You register an OAuth2 application in Gitea once (Confidential Client unchecked, so the flow uses PKCE), and -r narrows the requested scopes to read-only. The catch: hosted assistants connect from the provider’s network, so the README says both this server and Gitea must be reachable over HTTPS from there. That means exposing both to the internet. If you do, keep them patched, restrict access by IP to the provider’s published ranges where you can, and keep Gitea’s admin pages behind your VPN. If that exposure is unacceptable, use a local client over stdio instead.

Prompt injection: require confirmation for writes

Anything the assistant reads from Gitea becomes input to the model. An issue, a pull request description, a review comment or a file written by someone else can contain instructions such as “close all open issues” or “add this secret to the workflow”. MCP’s local server security guide notes that “prompt injection in untrusted content can steer an honest server” into overreach, using whatever access it was given.

The defenses are layered:

  • Read-only by default. Use -r plus read-only scopes for triage and review work.
  • Separate profiles. If you need writes, run a second server entry with -S limited to the scopes you need, such as issue, and a token with only write:issue.
  • Human confirmation. MCP’s tools specification says there “SHOULD always be a human in the loop with the ability to deny tool invocations.” Keep your client’s approval prompt on for every Write tool, read the arguments before approving, and never auto-approve merges, file commits, branch protection changes, Actions secrets or package deletions.
  • Watch public repositories closely. Anyone can open an issue there, so they are the easiest route for injected text.

For broader agent security, see the handbook’s guide to self-hosted AI agents.

Forgejo

The official README does not mention Forgejo, so this guide does not claim compatibility. If you are still choosing a forge, the Gitea vs Forgejo comparison covers the differences.

When not to use it

  • For automation that must run the same way every time. Labeling, releases and checks belong in CI; see setting up a Gitea Actions runner. A model is the wrong tool for deterministic jobs.
  • When code must not leave your network. Tool results go into the model’s context. With a hosted assistant, your private code and issues go to that provider. If policy forbids that, run the model yourself (running an LLM yourself) or skip this.
  • When you cannot give it a narrow account. If the only option is your own or an admin token, do not connect it.
  • To reach Gitea from anywhere without a VPN. Exposing an HTTP MCP endpoint publicly just for convenience adds attack surface for little gain.

If your Gitea instance is not set up yet, the Gitea Docker Compose guide covers installation, TLS and backups.

Frequently asked questions

Where is the official Gitea MCP server?
It lives on Gitea's own forge at gitea.com/gitea/gitea-mcp, and its Docker image is docker.gitea.com/gitea-mcp-server. Several unrelated projects use similar names with different settings, so check the repository and image name before you install anything.
Which token scopes does the Gitea MCP server need?
Only the ones for the tools you use. For reading code, pull requests and issues, read:repository and read:issue are a sensible start, plus read:user if you want the get_me tool. Add a write scope only when you have decided the assistant may change things, and pair it with confirmation prompts in your client.
Can I make the Gitea MCP server read-only?
Yes. Start it with -r or set GITEA_READONLY, and the server hides every tool marked Write. Combine that with a token that only has read scopes, so the limit holds even if a setting is lost.
Is it safe to run the Gitea MCP server in HTTP mode?
Only behind TLS and authentication, and preferably only on localhost or a VPN. Its built-in help says the HTTP listener uses all interfaces by default, so bind it to 127.0.0.1 with -b (or publish the Docker port only on localhost or a VPN address), and use the OAuth mode rather than a shared static token if other people connect.
Does the Gitea MCP server work with Forgejo?
The official README does not mention Forgejo, so this guide makes no claim either way. If you run Forgejo, treat it as untested and check the project's issue tracker before relying on it.

Sources, checked December 5, 2026

  1. gitea-mcp repository and README (gitea.com)
  2. gitea-mcp releases (v1.13.0, 6 November 2026)
  3. gitea-mcp LICENSE (MIT)
  4. gitea-mcp v1.13.0 cmd/cmd.go (built-in help: transport and HTTP listen defaults)
  5. gitea-mcp v1.13.0 Dockerfile (non-root image, source label)
  6. Docker Hub: gitea/gitea-mcp-server tags
  7. Gitea docs: API usage (creating access tokens)
  8. Gitea docs: OAuth2 provider (token scopes)
  9. Gitea 28.4.0 English locale file (token settings labels)
  10. Model Context Protocol: What is MCP?
  11. Model Context Protocol: Security best practices
  12. Model Context Protocol: Local server security
  13. Model Context Protocol specification 2026-07-28: Tools (human in the loop)

More in Git hosting