gitea
Installation
SKILL.md
Gitea (REST API)
Operate Gitea by sending HTTP requests to $GITEA_URL/api/v1/... authenticated
by $GITEA_TOKEN. This skill does NOT depend on any MCP server — every
operation is a direct curl call.
Keep this entry file small. Load only the reference pack the current turn needs.
Always-On Rules
- Forced forge routing. Before any forge work, run
git remote get-url originand parse the host. If the host isgithub.com, this skill does not apply — usegh, including for internal GitHub organizations. For any other host, treat it as a Gitea candidate: derivehttps://<host>as the probe base URL, runcurl -fsS --max-time 5 "https://<host>/api/v1/version", and use this skill only if HTTP 200 returns JSON with aversionfield. If the probe fails or times out, ask the user; do not guess another forge. - Resolve
$GITEA_URL+$GITEA_TOKENfrom named env pairs, not from the user. Each instance is exported asGITEA_<ALIAS>_URL+GITEA_<ALIAS>_TOKEN(e.g.GITEA_ORGA_URL+GITEA_ORGA_TOKEN). Callgitea_auto(defined in setup.md) to auto-pick the pair whose URL host matches the current repo'sorigin; falls back to the unaliasedGITEA_URL/GITEA_TOKEN, then to gitea-mcp legacyGITEA_HOST/GITEA_ACCESS_TOKEN, then asks the user.$GITEA_URLis always the base URL without the/apisuffix. - Send
Authorization: token $GITEA_TOKENon every request. Never put the token in the query string (?token=) — it would be logged. - Prefer
curl -spiped tojqso results are easy to inspect. Always include-o /dev/null -w '%{http_code}\n'(or--fail-with-body) when verifying success on write/delete calls — Gitea returns success bodies on 2xx and a{ "message": "...", "url": "..." }error envelope on 4xx/5xx. - Respect destructiveness. Any
DELETEagainst/branches,/contents,/releases,/tags, labels, milestones, packages, secrets, variables, or wiki pages is irreversible. State exactly what will be removed and confirm with the user unless explicitly authorized. - Pagination: most list endpoints take
?page=N&limit=M(defaultpage=1,limit=30, server max usually 50). A few older endpoints acceptper_page=as an alias. Loop pages until the response is empty orLink: rel="next"is absent. PUT /repos/{owner}/{repo}/contents/{path}(create/update file):contentmust be base64-encoded. Omitshato create; pass the current fileshato update.- Endpoint responses are the resource directly — Gitea does not wrap them in
{ success, data }. Errors come back with HTTP 4xx/5xx plus{ "message": "...", "url": "..." }.