Connect Claude and Cursor to Self-Hosted Gitea with gitea-mcp

Connecting Claude and Cursor to a self-hosted Gitea via gitea-mcp

* This page contains promotional content

I wanted to operate my self-hosted Gitea from Claude (Claude Code / Claude Desktop) and Cursor, which I use every day, over MCP.

MCP setup on GitHub is very easy, but Gitea needed a few extra steps.
I installed the official gitea-mcp on macOS, issued an access token on the Gitea side, and tried using the same binary from both clients over stdio. I did not try connecting from other editors such as VS Code. For that, refer to the official repository.

make install on macOS tries to write to /bin and fails

After building gitea-mcp, make install stopped with the following error.

cp: /bin/gitea-mcp: Operation not permitted
make: *** [install] Error 1

At first I thought it was just SIP (System Integrity Protection) blocking the write. That part is true: even with sudo, macOS will not let you write to /bin.
What I could not explain was why it tried to install into a system directory in the first place.

The install target in the Makefile looks like this.

install: build
    @mkdir -p $(GOPATH)/bin
    @cp $(EXECUTABLE) $(GOPATH)/bin/$(EXECUTABLE)

$(GOPATH) is a make variable that simply passes through the shell environment variable GOPATH.
If GOPATH is unset in the terminal, it becomes an empty string, and $(GOPATH)/bin turns into /bin.
macOS /bin lives on a SIP-protected system volume, so even sudo cannot write there, and you get Operation not permitted.

The fix is to set GOPATH explicitly when running make install.

GOPATH=$(go env GOPATH) make install

Alternatively, put the following in ~/.zshrc (or similar), reopen the terminal, and then run make install.

export GOPATH=$(go env GOPATH)
export PATH=$PATH:$GOPATH/bin

If go env GOPATH prints nothing, the default is usually $HOME/go.


Issuing an access token on self-hosted Gitea

I created an application token in Gitea, scoped to all repositories.
The host is https://git.example.com. (dummy URL)

On top of “all repositories”, the following scopes were enough, working backwards from the APIs that gitea-mcp actually calls.

ScopeAccessUse
repositoryread and writeCreating, updating, and deleting files; creating repositories; branch operations
issueread and writeFetching, creating, and commenting on issues / PRs. Gitea treats PRs as issues
organizationreadsearch_org_teams
userreadget_my_user_info / search_users
admin / activitypub / misc / notification / packageleave inaccessibleThis MCP server does not use them

I paste the issued token into a config file, so I am masking it here.


Connecting from Claude and Cursor

I used the issued token so that both Claude (Claude Code / Claude Desktop) and Cursor could talk to gitea-mcp.
The config is the same JSON for both.

{
  "mcpServers": {
    "gitea": {
      "command": "gitea-mcp",
      "args": [
        "-t", "stdio",
        "--host", "https://git.example.com",
        "--token", "<issued-token>"
      ]
    }
  }
}

For Claude Code, run claude mcp add, or append the JSON above to the Claude Desktop config file.
For Cursor, append the same content to ~/.cursor/mcp.json (or .cursor/mcp.json in the project root).

Because this is stdio mode, each client just starts its own process. The same binary and the same token can be reused as-is.
The token is stored in plaintext in the config file, so tightening file permissions or passing it via an environment variable is worth considering.

To connect from other MCP clients such as VS Code, see the official gitea-mcp repository .


Summary

make install falling into /bin on macOS was caused by an unset GOPATH becoming an empty string, so $(GOPATH)/bin turned into /bin.
Either run GOPATH=$(go env GOPATH) make install, or export GOPATH and PATH in ~/.zshrc and install again.

Issue the token for all repositories. repository / issue read-write plus organization / user read is enough.
Claude and Cursor can share the same JSON over stdio. For other editors, follow the official docs.

Categories: Self-hosting 
Tags: Gitea MCP macOS 

See also