feat(tools): rename gitea_* -> mokogitea_* with deprecated aliases; metadata brand fix (#33) #34

Merged
jmiller merged 1 commits from feat/33-rename-mokogitea-tools into main 2026-07-06 03:01:13 +00:00
4 changed files with 188 additions and 118 deletions
+16
View File
@@ -13,6 +13,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- **Tool rename (Gitea -> MokoGitea brand normalization):** all tools now register
under canonical `mokogitea_*` names via a single `registerTool()` wrapper. The
legacy `gitea_*` names remain as **deprecated aliases** (dual-registered) so
existing agent configs/skills keep working during the transition window. Aliases
are enabled by default and can be disabled by setting `MOKOGITEA_MCP_LEGACY_ALIASES`
to a falsy value (`0`/`false`/`off`/`no`); disabling halves the exposed tool count.
- `gitea_metadata_update`: `standards_version` description corrected from
`mokoplatform standards version` to `mokocli standards version` (brand fix).
### Notes
- `display_name` is intentionally NOT a settable metadata param -- the fork's
`RepoMetadata` model has no `display_name` column; it is derived server-side
(`DerivedDisplayName()` from `extension_type` + `name`). A comment documenting
this was added to `gitea_metadata_update`.
### Added
- `gitea_org_issue_statuses_list` -- list issue status definitions for an org
- `gitea_org_issue_priorities_list` -- list issue priority definitions for an org
+22 -3
View File
@@ -11,7 +11,7 @@ REPO: https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp
[![Node](https://img.shields.io/badge/node-%3E%3D20.0.0-green.svg)](https://nodejs.org)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org)
> MCP server for MokoGitea REST API v1 operations -- 111 tools for complete MokoGitea instance management from Claude Code and other MCP clients.
> MCP server for MokoGitea REST API v1 operations -- 111 tools (canonical `mokogitea_*` names, plus deprecated `gitea_*` aliases) for complete MokoGitea instance management from Claude Code and other MCP clients.
## Table of Contents
@@ -26,7 +26,7 @@ REPO: https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp
## Background
`gitea-api-mcp` is a Model Context Protocol (MCP) server that exposes 111 tools for interacting with the MokoGitea REST API v1. It supports multiple named connections, allowing you to manage several MokoGitea instances from a single server. Authentication uses MokoGitea's native `Authorization: token` header format.
`mokogitea-api-mcp` is a Model Context Protocol (MCP) server that exposes 111 tools for interacting with the MokoGitea REST API v1. Tools use canonical `mokogitea_*` names, with legacy `gitea_*` names retained as deprecated aliases (see [Tools](#tools)). It supports multiple named connections, allowing you to manage several MokoGitea instances from a single server. Authentication uses MokoGitea's native `Authorization: token` header format.
## Install
@@ -112,13 +112,32 @@ Add to your Claude Code MCP config (`~/.claude/claude_desktop_config.json` or pr
When using multiple connections, pass the `connection` parameter to any tool:
```
Use gitea_repo_get with connection "github-mirror" to get owner/repo details.
Use mokogitea_repo_get with connection "github-mirror" to get owner/repo details.
```
If `connection` is omitted, the `defaultConnection` is used.
## Tools
### Tool naming: `mokogitea_*` (canonical) vs `gitea_*` (deprecated aliases)
As part of the Gitea → MokoGitea brand normalization, the **canonical** name for
every tool is `mokogitea_*` (e.g. `mokogitea_repo_get`, `mokogitea_pull_merge`,
`mokogitea_metadata_update`). For a transition window the legacy `gitea_*` names
are still registered as **deprecated aliases** that call the same handlers, so
existing agent configs and skills keep working — but new integrations should use
the `mokogitea_*` names.
The tables below list each tool by its legacy `gitea_*` name for continuity; the
canonical name is the same string with the `gitea_` prefix replaced by
`mokogitea_`.
Legacy aliases are **enabled by default**. To expose only the canonical
`mokogitea_*` names (halving the tool count), set the environment variable
`MOKOGITEA_MCP_LEGACY_ALIASES` to a falsy value (`0`, `false`, `off`, or `no`).
While enabled, both names are registered, so the exposed tool count is roughly
double the 111 logical tools during the deprecation window.
### User / Auth (3 tools)
| Tool | Description |
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@mokoconsulting/mcp-mokogitea-api",
"version": "1.4.2",
"version": "1.5.0",
"description": "MCP server for Gitea REST API v1 operations",
"type": "module",
"main": "dist/index.js",
+149 -114
View File
@@ -14,7 +14,8 @@
* BRIEF: MCP server entry point — registers all Gitea API tools
*/
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { McpServer, type ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
import { loadConfig, getConnection } from './config.js';
@@ -61,26 +62,57 @@ const OwnerRepo = {
const server = new McpServer({
name: 'mokogitea-api-mcp',
version: '1.4.2',
version: '1.5.0',
});
// ── Tool registration wrapper (Gitea → MokoGitea brand normalization) ────
//
// Canonical tool names are `mokogitea_*`. For a transition window the old
// `gitea_*` names are ALSO registered as deprecated aliases so existing agent
// configs / skills keep working. Legacy aliases can be disabled by setting the
// MOKOGITEA_MCP_LEGACY_ALIASES env var to a falsy value (0/false/off/no);
// they are enabled by default. Disabling them halves the exposed tool count.
const LEGACY_ALIASES: boolean = (() => {
const v = process.env.MOKOGITEA_MCP_LEGACY_ALIASES;
if (v === undefined) return true;
return !/^(0|false|off|no)$/i.test(v.trim());
})();
// registerTool(name, description, schema, handler) — mirrors the typed
// server.tool(name, description, paramsSchema, cb) overload so call sites keep
// full zod-schema → handler-arg inference. Registers the canonical `mokogitea_*`
// name and, when aliases are enabled, the legacy `gitea_*` name pointing at the
// same handler.
function registerTool<Args extends ZodRawShapeCompat>(
name: string,
description: string,
paramsSchema: Args,
cb: ToolCallback<Args>,
): void {
const canonical = name.startsWith('gitea_') ? 'mokogitea_' + name.slice('gitea_'.length) : name;
server.tool(canonical, description, paramsSchema, cb);
if (LEGACY_ALIASES && canonical !== name) {
server.tool(name, description, paramsSchema, cb);
}
}
// ── User / Auth ─────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_me',
'Get the authenticated user info',
{ ...ConnectionParam },
async ({ connection }) => formatResponse(await clientFor(connection).get('/user')),
);
server.tool(
registerTool(
'gitea_user_orgs',
'List organizations the authenticated user belongs to',
{ ...PaginationParams, ...ConnectionParam },
async ({ page, limit, connection }) => formatResponse(await clientFor(connection).get('/user/orgs', pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_user_repos',
'List repositories owned by the authenticated user',
{ ...PaginationParams, ...ConnectionParam },
@@ -89,14 +121,14 @@ server.tool(
// ── Repository CRUD ─────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_repo_get',
'Get repository details',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}`)),
);
server.tool(
registerTool(
'gitea_repo_create',
'Create a new repository',
{
@@ -122,14 +154,14 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_delete',
'Delete a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).delete(`/repos/${owner}/${repo}`)),
);
server.tool(
registerTool(
'gitea_repo_edit',
'Edit repository settings',
{
@@ -156,7 +188,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_fork',
'Fork a repository',
{
@@ -173,7 +205,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_generate',
'Create a new repository from a template repository',
{
@@ -205,7 +237,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_search',
'Search repositories',
{
@@ -225,7 +257,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_org_repos',
'List repositories in an organization',
{
@@ -238,7 +270,7 @@ server.tool(
// ── File Contents ───────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_file_get',
'Get file contents from a repository',
{
@@ -254,7 +286,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_dir_get',
'Get directory contents (file listing) from a repository',
{
@@ -271,7 +303,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_file_create_or_update',
'Create or update a file in a repository',
{
@@ -294,7 +326,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_file_delete',
'Delete a file from a repository',
{
@@ -313,7 +345,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_tree_get',
'Get the git tree for a repository (recursive file listing)',
{
@@ -331,21 +363,21 @@ server.tool(
// ── Branches ────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_branches_list',
'List branches in a repository',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/branches`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_branch_get',
'Get a specific branch',
{ ...OwnerRepo, branch: z.string().describe('Branch name'), ...ConnectionParam },
async ({ owner, repo, branch, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/branches/${branch}`)),
);
server.tool(
registerTool(
'gitea_branch_create',
'Create a new branch',
{
@@ -361,7 +393,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_branch_delete',
'Delete a branch',
{ ...OwnerRepo, branch: z.string().describe('Branch name'), ...ConnectionParam },
@@ -370,7 +402,7 @@ server.tool(
// ── Commits ─────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_commits_list',
'List commits in a repository',
{
@@ -388,7 +420,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_commit_get',
'Get a specific commit',
{ ...OwnerRepo, sha: z.string().describe('Commit SHA'), ...ConnectionParam },
@@ -397,7 +429,7 @@ server.tool(
// ── Issues ──────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_issues_list',
'List issues in a repository',
{
@@ -421,14 +453,14 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_get',
'Get a single issue by number',
{ ...OwnerRepo, number: z.number().describe('Issue number'), ...ConnectionParam },
async ({ owner, repo, number, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/issues/${number}`)),
);
server.tool(
registerTool(
'gitea_issue_create',
'Create a new issue',
{
@@ -456,7 +488,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_update',
'Update an issue (supports title, body, state, assignees, milestone, and org-level metadata)',
{
@@ -486,7 +518,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_set_status',
'Set or clear the status on an issue (convenience wrapper around issue update)',
{
@@ -500,7 +532,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_set_priority',
'Set or clear the priority on an issue (convenience wrapper around issue update)',
{
@@ -514,14 +546,14 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_comments_list',
'List comments on an issue',
{ ...OwnerRepo, number: z.number().describe('Issue number'), ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, number, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/issues/${number}/comments`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_issue_comment_create',
'Add a comment to an issue',
{
@@ -535,7 +567,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_issue_search',
'Search issues across all repositories',
{
@@ -557,14 +589,14 @@ server.tool(
// ── Labels ──────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_labels_list',
'List all labels in a repository (includes id, name, color, description — use to discover available type/priority/status labels)',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/labels`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_label_create',
'Create a label',
{
@@ -583,7 +615,7 @@ server.tool(
// ── Milestones ──────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_milestones_list',
'List milestones in a repository',
{
@@ -599,7 +631,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_milestone_create',
'Create a milestone',
{
@@ -619,7 +651,7 @@ server.tool(
// ── Pull Requests ───────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_pulls_list',
'List pull requests',
{
@@ -641,14 +673,14 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_pull_get',
'Get a single pull request',
{ ...OwnerRepo, number: z.number().describe('PR number'), ...ConnectionParam },
async ({ owner, repo, number, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/pulls/${number}`)),
);
server.tool(
registerTool(
'gitea_pull_create',
'Create a pull request',
{
@@ -672,7 +704,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_pull_merge',
'Merge a pull request',
{
@@ -693,14 +725,14 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_pull_files',
'List files changed in a pull request',
{ ...OwnerRepo, number: z.number().describe('PR number'), ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, number, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/pulls/${number}/files`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_pull_review_create',
'Create a pull request review',
{
@@ -719,28 +751,28 @@ server.tool(
// ── Releases ────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_releases_list',
'List releases',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/releases`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_release_get',
'Get a single release by ID',
{ ...OwnerRepo, id: z.number().describe('Release ID'), ...ConnectionParam },
async ({ owner, repo, id, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/releases/${id}`)),
);
server.tool(
registerTool(
'gitea_release_latest',
'Get the latest release',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/releases/latest`)),
);
server.tool(
registerTool(
'gitea_release_create',
'Create a new release',
{
@@ -764,7 +796,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_release_delete',
'Delete a release',
{ ...OwnerRepo, id: z.number().describe('Release ID'), ...ConnectionParam },
@@ -773,14 +805,14 @@ server.tool(
// ── Tags ────────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_tags_list',
'List tags',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/tags`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_tag_create',
'Create a tag',
{
@@ -798,7 +830,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_tag_delete',
'Delete a tag',
{ ...OwnerRepo, tag: z.string().describe('Tag name'), ...ConnectionParam },
@@ -807,21 +839,21 @@ server.tool(
// ── Actions (CI/CD) ─────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_actions_runs_list',
'List workflow runs for a repository',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/actions/runs`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_actions_run_get',
'Get a specific workflow run',
{ ...OwnerRepo, run_id: z.number().describe('Run ID'), ...ConnectionParam },
async ({ owner, repo, run_id, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/actions/runs/${run_id}`)),
);
server.tool(
registerTool(
'gitea_actions_dispatch',
'Trigger a workflow dispatch (e.g. pre-release, deploy)',
{
@@ -838,7 +870,7 @@ server.tool(
)),
);
server.tool(
registerTool(
'gitea_actions_jobs_list',
'List jobs for a workflow run',
{ ...OwnerRepo, run_id: z.number().describe('Run ID'), ...ConnectionParam },
@@ -846,7 +878,7 @@ server.tool(
formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/actions/runs/${run_id}/jobs`)),
);
server.tool(
registerTool(
'gitea_actions_job_logs',
'Get log output for a workflow job',
{ ...OwnerRepo, job_id: z.number().describe('Job ID'), ...ConnectionParam },
@@ -860,7 +892,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_release_asset_upload',
'Upload a file as a release asset (provide base64-encoded content)',
{
@@ -891,7 +923,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_release_asset_delete',
'Delete a release asset',
{
@@ -904,7 +936,7 @@ server.tool(
formatResponse(await clientFor(connection).delete(`/repos/${owner}/${repo}/releases/${release_id}/assets/${asset_id}`)),
);
server.tool(
registerTool(
'gitea_bulk_file_push',
'Push the same file content to multiple repos (uses Contents API)',
{
@@ -957,21 +989,21 @@ server.tool(
// ── Organizations ───────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_org_get',
'Get organization details',
{ org: z.string().describe('Organization name'), ...ConnectionParam },
async ({ org, connection }) => formatResponse(await clientFor(connection).get(`/orgs/${org}`)),
);
server.tool(
registerTool(
'gitea_org_teams_list',
'List teams in an organization',
{ org: z.string().describe('Organization name'), ...PaginationParams, ...ConnectionParam },
async ({ org, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/orgs/${org}/teams`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_org_members_list',
'List members of an organization',
{ org: z.string().describe('Organization name'), ...PaginationParams, ...ConnectionParam },
@@ -980,21 +1012,21 @@ server.tool(
// ── Organization Issue Metadata ──────────────────────────────────────────
server.tool(
registerTool(
'gitea_org_issue_statuses_list',
'List issue status definitions for an organization (id, name, color, closes_issue — use to discover valid status_id values)',
{ org: z.string().describe('Organization name'), ...ConnectionParam },
async ({ org, connection }) => formatResponse(await clientFor(connection).get(`/orgs/${org}/issue-statuses`)),
);
server.tool(
registerTool(
'gitea_org_issue_priorities_list',
'List issue priority definitions for an organization (id, name, color, is_default — use to discover valid priority_id values)',
{ org: z.string().describe('Organization name'), ...ConnectionParam },
async ({ org, connection }) => formatResponse(await clientFor(connection).get(`/orgs/${org}/issue-priorities`)),
);
server.tool(
registerTool(
'gitea_org_issue_types_list',
'List issue type definitions for an organization (id, name, color, is_default — use to discover valid type_id values)',
{ org: z.string().describe('Organization name'), ...ConnectionParam },
@@ -1003,14 +1035,14 @@ server.tool(
// ── Users ───────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_user_get',
'Get a user profile',
{ username: z.string().describe('Username'), ...ConnectionParam },
async ({ username, connection }) => formatResponse(await clientFor(connection).get(`/users/${username}`)),
);
server.tool(
registerTool(
'gitea_users_search',
'Search users',
{
@@ -1023,14 +1055,14 @@ server.tool(
// ── Webhooks ────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_webhooks_list',
'List webhooks for a repository',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/hooks`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_webhook_create',
'Create a webhook',
{
@@ -1054,21 +1086,21 @@ server.tool(
// ── Wiki ────────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_wiki_pages_list',
'List wiki pages',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/wiki/pages`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_wiki_page_get',
'Get a wiki page',
{ ...OwnerRepo, page_name: z.string().describe('Page name/slug'), ...ConnectionParam },
async ({ owner, repo, page_name, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/wiki/page/${page_name}`)),
);
server.tool(
registerTool(
'gitea_wiki_page_create',
'Create a new wiki page',
{
@@ -1088,7 +1120,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_wiki_page_edit',
'Edit an existing wiki page',
{
@@ -1109,7 +1141,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_wiki_page_delete',
'Delete a wiki page',
{
@@ -1121,7 +1153,7 @@ server.tool(
formatResponse(await clientFor(connection).delete(`/repos/${owner}/${repo}/wiki/page/${page_name}`)),
);
server.tool(
registerTool(
'gitea_wiki_page_revisions',
'List revision history for a wiki page',
{ ...OwnerRepo, page_name: z.string().describe('Page name/slug'), ...PaginationParams, ...ConnectionParam },
@@ -1129,7 +1161,7 @@ server.tool(
formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/wiki/revisions/${page_name}`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_wiki_search',
'Search wiki page titles and content',
{ ...OwnerRepo, q: z.string().describe('Search query'), ...PaginationParams, ...ConnectionParam },
@@ -1139,7 +1171,7 @@ server.tool(
// ── Notifications ───────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_notifications_list',
'List notifications for the authenticated user',
{
@@ -1154,7 +1186,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_notifications_read',
'Mark all notifications as read',
{ ...ConnectionParam },
@@ -1163,14 +1195,14 @@ server.tool(
// ── Topics ──────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_repo_topics',
'Get topics (tags) for a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/topics`)),
);
server.tool(
registerTool(
'gitea_repo_topics_set',
'Set topics for a repository (replaces all existing)',
{
@@ -1181,7 +1213,7 @@ server.tool(
async ({ owner, repo, topics, connection }) => formatResponse(await clientFor(connection).put(`/repos/${owner}/${repo}/topics`, { topics })),
);
server.tool(
registerTool(
'gitea_topic_search',
'Search topics across all repositories',
{
@@ -1194,14 +1226,14 @@ server.tool(
// ── Collaborators ───────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_collaborators_list',
'List collaborators on a repository',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/collaborators`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_collaborator_add',
'Add a collaborator to a repository',
{
@@ -1217,7 +1249,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_collaborator_remove',
'Remove a collaborator from a repository',
{
@@ -1230,14 +1262,14 @@ server.tool(
// ── Deploy Keys ─────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_deploy_keys_list',
'List deploy keys for a repository',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/keys`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_deploy_key_create',
'Add a deploy key to a repository',
{
@@ -1256,7 +1288,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_deploy_key_delete',
'Remove a deploy key from a repository',
{
@@ -1269,14 +1301,14 @@ server.tool(
// ── Branch Protection ───────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_branch_protections_list',
'List branch protection rules for a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/branch_protections`)),
);
server.tool(
registerTool(
'gitea_branch_protection_create',
'Create a branch protection rule',
{
@@ -1304,7 +1336,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_branch_protection_delete',
'Delete a branch protection rule',
{
@@ -1317,7 +1349,7 @@ server.tool(
// ── Organization Labels ─────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_org_labels_list',
'List labels for an organization (shared across repos — includes id, name, color, description for type/priority/status discovery)',
{
@@ -1328,7 +1360,7 @@ server.tool(
async ({ org, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/orgs/${org}/labels`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_org_label_create',
'Create an organization-level label',
{
@@ -1347,14 +1379,14 @@ server.tool(
// ── Repository Secrets (Actions) ────────────────────────────────────────
server.tool(
registerTool(
'gitea_repo_actions_secrets_list',
'List Actions secrets for a repository (names only, values hidden)',
{ ...OwnerRepo, ...PaginationParams, ...ConnectionParam },
async ({ owner, repo, page, limit, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/actions/secrets`, pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_repo_actions_secret_create',
'Create or update an Actions secret',
{
@@ -1366,7 +1398,7 @@ server.tool(
async ({ owner, repo, name, data, connection }) => formatResponse(await clientFor(connection).put(`/repos/${owner}/${repo}/actions/secrets/${name}`, { data })),
);
server.tool(
registerTool(
'gitea_repo_actions_secret_delete',
'Delete an Actions secret',
{
@@ -1379,21 +1411,21 @@ server.tool(
// ── Repo Transfer / Mirror ──────────────────────────────────────────────
server.tool(
registerTool(
'gitea_repo_mirror_sync',
'Trigger a push mirror sync for a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).post(`/repos/${owner}/${repo}/mirror-sync`, {})),
);
server.tool(
registerTool(
'gitea_repo_mirrors_list',
'List push mirrors for a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/push_mirrors`)),
);
server.tool(
registerTool(
'gitea_repo_mirror_create',
'Create a push mirror to GitHub (backup). Sets up automatic push mirroring from Gitea to a GitHub repo.',
{
@@ -1420,7 +1452,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_mirror_delete',
'Delete a push mirror from a repository',
{
@@ -1431,7 +1463,7 @@ server.tool(
async ({ owner, repo, mirror_name, connection }) => formatResponse(await clientFor(connection).delete(`/repos/${owner}/${repo}/push_mirrors/${mirror_name}`)),
);
server.tool(
registerTool(
'gitea_repo_mirror_setup_github_backup',
'One-step GitHub backup mirror setup: creates the GitHub repo (if needed) and configures push mirror. Requires a GitHub token with repo+org scope.',
{
@@ -1502,7 +1534,7 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_repo_mirror_setup_github_backup_full',
'Full GitHub backup: mirrors code repo + wiki repo to GitHub. Creates GitHub repo, sets up push mirrors for both code and wiki, triggers initial sync.',
{
@@ -1607,14 +1639,14 @@ server.tool(
// ── Repo Statistics ─────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_repo_languages',
'Get language breakdown for a repository',
{ ...OwnerRepo, ...ConnectionParam },
async ({ owner, repo, connection }) => formatResponse(await clientFor(connection).get(`/repos/${owner}/${repo}/languages`)),
);
server.tool(
registerTool(
'gitea_repo_contributors',
'List contributors with commit counts',
{ ...OwnerRepo, ...ConnectionParam },
@@ -1623,7 +1655,7 @@ server.tool(
// ── Issue Labels (Bulk) ─────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_issue_labels_set',
'Set labels on an issue (replaces existing)',
{
@@ -1637,7 +1669,7 @@ server.tool(
// ── Diff / Compare ──────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_compare',
'Compare two branches, tags, or commits (returns diff stats)',
{
@@ -1651,28 +1683,28 @@ server.tool(
// ── Gitea Admin (Instance-Level) ────────────────────────────────────────
server.tool(
registerTool(
'gitea_admin_orgs_list',
'List all organizations (admin only)',
{ ...PaginationParams, ...ConnectionParam },
async ({ page, limit, connection }) => formatResponse(await clientFor(connection).get('/admin/orgs', pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_admin_users_list',
'List all users (admin only)',
{ ...PaginationParams, ...ConnectionParam },
async ({ page, limit, connection }) => formatResponse(await clientFor(connection).get('/admin/users', pageQuery({ page, limit }))),
);
server.tool(
registerTool(
'gitea_admin_cron_list',
'List cron tasks and their last run time (admin only)',
{ ...ConnectionParam },
async ({ connection }) => formatResponse(await clientFor(connection).get('/admin/cron')),
);
server.tool(
registerTool(
'gitea_admin_cron_run',
'Trigger a cron task (admin only)',
{
@@ -1684,7 +1716,7 @@ server.tool(
// ── Generic API Call ────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_api_request',
'Make a raw API request to any Gitea v1 endpoint',
{
@@ -1708,7 +1740,7 @@ server.tool(
// ── Connections ──────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_list_connections',
'List configured Gitea connections',
{},
@@ -1723,7 +1755,7 @@ server.tool(
// ── Metadata ────────────────────────────────────────────────────────────
server.tool(
registerTool(
'gitea_metadata_get',
'Get repo metadata (project identity, governance, distribution, build settings)',
{
@@ -1737,13 +1769,16 @@ server.tool(
},
);
server.tool(
registerTool(
'gitea_metadata_update',
'Update repo metadata settings (partial update — only provided fields are changed)',
{
owner: z.string().describe('Repository owner'),
repo: z.string().describe('Repository name'),
// identity
// NOTE: display_name is intentionally NOT a settable param — the fork's
// RepoMetadata model has no display_name column; it is derived server-side
// (DerivedDisplayName() from extension_type + name), so sending it is a no-op.
name: z.string().optional().describe('Project name'),
org: z.string().optional().describe('Organization'),
description: z.string().optional().describe('Project description'),
@@ -1755,7 +1790,7 @@ server.tool(
license_name: z.string().optional().describe('Human-readable license name'),
// governance
platform: z.string().optional().describe('Platform (joomla, go, node, php, python, generic)'),
standards_version: z.string().optional().describe('mokoplatform standards version'),
standards_version: z.string().optional().describe('mokocli standards version'),
standards_source: z.string().optional().describe('URL to standards repo'),
// distribution
maintainer: z.string().optional().describe('Maintainer name'),