Skip to main content
Glama

Gitea MCP Tool

Gitea API 的 MCP (Model Context Protocol) 服务器,让 AI 助手能够与 Gitea 进行交互。

npm version License: MIT GitHub

v2.0 架构

┌─────────────────────────────────────────────────────────────┐
│                    Gitea MCP Tool v2.0                      │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐          ┌─────────────────────────┐  │
│  │   MCP Server    │          │      keactl CLI         │  │
│  │  (Lite Mode)    │          │    (Full Features)      │  │
│  ├─────────────────┤          ├─────────────────────────┤  │
│  │ ~22 智能工具    │          │ 200+ 命令               │  │
│  │ • 智能分析      │          │ • 完整 CRUD 操作        │  │
│  │ • 内容生成      │          │ • Issue/PR/Repo 管理    │  │
│  │ • 工作流管理    │          │ • Wiki/Release/Branch   │  │
│  │ • 规范检查      │          │ • CI/CD 配置            │  │
│  └────────┬────────┘          └────────────┬────────────┘  │
│           │                                │               │
│           └────────────┬───────────────────┘               │
│                        ▼                                   │
│              ┌─────────────────┐                           │
│              │   Gitea API     │                           │
│              └─────────────────┘                           │
└─────────────────────────────────────────────────────────────┘

Related MCP server: @maxronner/tea-mcp

特性

  • MCP 智能工具 - ~22 个智能分析、内容生成、工作流管理工具

  • keactl CLI - 200+ 命令,完整 CRUD 操作(Issue/PR/Repo/Wiki/Release)

  • 低 Context 消耗 - MCP Lite 模式优化,减少 90% token 使用

  • 多客户端支持 - Claude Desktop/CLI、OpenCode、Codex、Cline、Cursor

  • 8 个交互式 Prompts - 引导式操作模板

快速安装

# npm 安装(推荐)
npm install -g gitea-mcp-tool

# 或使用安装脚本
curl -fsSL https://gitea.ktyun.cc/Kysion/entai-gitea-mcp/raw/branch/main/install-quick.sh | bash

配置

1. 配置 MCP 客户端

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "gitea-mcp-tool": {
      "command": "gitea-mcp",
      "env": {
        "GITEA_BASE_URL": "https://your-gitea-server.com",
        "GITEA_API_TOKEN": "your_token_here"
      }
    }
  }
}

Claude CLI (~/.claude.json):

{
  "mcpServers": {
    "gitea-mcp-tool": {
      "type": "stdio",
      "command": "gitea-mcp",
      "env": {
        "GITEA_BASE_URL": "https://your-gitea-server.com",
        "GITEA_API_TOKEN": "your_token_here"
      }
    }
  }
}

OpenCode (~/.config/opencode/config.json):

{
  "mcpServers": {
    "gitea-mcp-tool": {
      "type": "stdio",
      "command": "gitea-mcp",
      "env": {
        "GITEA_BASE_URL": "https://your-gitea-server.com",
        "GITEA_API_TOKEN": "your_token_here"
      }
    }
  }
}

通用 MCP 配置 (.mcp.json 放在项目根目录):

{
  "mcpServers": {
    "gitea-mcp-tool": {
      "type": "stdio",
      "command": "gitea-mcp",
      "env": {
        "GITEA_BASE_URL": "https://gitea.ktyun.cc",
        "GITEA_DEFAULT_OWNER": "Kysion",
        "GITEA_DEFAULT_REPO": "entai-gitea-mcp"
      }
    }
  }
}

在运行前,请在环境变量中提供 GITEA_API_TOKEN,否则服务器会因缺少认证而启动失败。

2. 获取 API Token

  1. 登录 Gitea → 设置 → 应用

  2. 生成新令牌

  3. 复制到配置文件

3. 重启客户端

MCP + CLI 混合使用

v2.0 采用 MCP 智能工具 + keactl CLI 混合模式:

操作类型

推荐方式

示例

智能分析

MCP 工具

gitea_workflow_infer_labels、gitea_compliance_check_all

内容生成

MCP 工具

gitea_issue_create、gitea_pr_create

CRUD 操作

keactl CLI

keactl issue list、keactl repo get

批量操作

keactl CLI

keactl issue close 1,2,3

MCP 智能工具示例

// 智能标签推断
gitea_workflow_infer_labels({ issue_number: 42, auto_apply: true })

// 规范检查
gitea_compliance_check_all()

// 生成工作流报告
gitea_workflow_generate_report({ time_range: "week" })

// AI 辅助创建 Issue
gitea_issue_create({ title: "Bug: 登录失败", body: "详细描述..." })

keactl CLI 示例

# 仓库操作
keactl repo list
keactl repo get

# Issue 操作
keactl issue list --state open
keactl issue get 42
keactl issue create --title "Bug" --body "描述"
keactl issue close 42

# PR 操作
keactl pr list
keactl pr create --title "feat: 新功能" --head feature --base main
keactl pr merge 1

# Wiki 操作
keactl wiki list
keactl wiki get "Home"
keactl wiki create --title "Guide" --content "# 指南"

# Release 操作
keactl release list
keactl release create --tag v1.0.0

# Branch 操作
keactl branch list
keactl branch create feature/new

# CI/CD 配置
keactl cicd init
keactl cicd status
keactl cicd validate

MCP 工具清单

基础设施 (5 个)

工具

说明

gitea_init

初始化项目配置

gitea_mcp_upgrade

升级 MCP 工具

gitea_context_get

获取当前上下文

gitea_context_set

设置默认上下文

gitea_user_current

获取当前用户

智能内容生成 (2 个)

工具

说明

gitea_issue_create

AI 辅助创建 Issue

gitea_pr_create

AI 辅助创建 PR

工作流智能分析 (10 个)

工具

说明

gitea_workflow_init

初始化工作流配置

gitea_workflow_load_config

加载工作流配置

gitea_workflow_sync_labels

同步标签系统

gitea_workflow_sync_board

同步项目看板

gitea_workflow_check_issues

检查 Issue 工作流

gitea_workflow_infer_labels

智能标签推断

gitea_workflow_check_blocked

检测阻塞 Issue

gitea_workflow_escalate_priority

优先级自动升级

gitea_workflow_sync_status

状态双向同步

gitea_workflow_generate_report

生成工作流报告

规范检查 (5 个)

工具

说明

gitea_compliance_init

初始化规范配置

gitea_compliance_check_branch

检查分支命名

gitea_compliance_check_commit

检查提交信息

gitea_compliance_check_pr

检查 PR 规范

gitea_compliance_check_all

全面规范检查

文档

本地文档

Wiki 文档

详细文档请参阅 Wiki:

版本

当前版本: v2.0.0-beta | MCP 工具数: ~22 | CLI 命令数: 200+

许可证

MIT License

问题反馈

提交 Issue

Available Tools

22 tools
gitea_compliance_check_all综合规范检查B

Run comprehensive compliance check on branch, commits, and/or PR. Returns detailed report.

Inputs: owner, repo, branch, pr_number, +3 more.

gitea_compliance_check_branch检查分支命名规范B

Check if branch name complies with naming conventions. Returns compliance status and suggestions.

Inputs: branch (required), config_path.

gitea_compliance_check_commit检查提交信息规范B

Check if commit message complies with Conventional Commit format. Can check by SHA or message directly.

Inputs: owner, repo, sha, message, +2 more.

gitea_compliance_check_pr检查 PR 格式规范C

Check if PR description complies with format requirements (sections, issue links, etc.).

Inputs: pr_number (required), owner, repo, config_path, +1 more.

gitea_compliance_init初始化规范检查配置C

Initialize compliance configuration file (.gitea/compliance.yaml) with default rules.

Inputs: force, config_path.

gitea_context_get获取当前上下文B

Get current default context (owner, repo, org, project)

Inputs: no named parameters.

gitea_context_set设置默认上下文C

Set default context for subsequent operations. All parameters are optional.

Inputs: owner, repo, org, project.

gitea_init初始化项目配置C

Initialize project configuration files (.gitea-mcp.json). Auto-detects Git repository info if available.

Inputs: owner, repo, gitea_url, set_as_default, +1 more.

gitea_issue_create创建 IssueB

Create a new issue. Use this tool for AI-assisted issue creation with smart content generation.

Inputs: title (required), owner, repo, body, +4 more.

gitea_mcp_upgrade升级 MCP 工具B

Upgrade Gitea MCP tool to the latest version. Downloads and installs from the latest release.

Inputs: auto_confirm.

gitea_pr_create创建 Pull RequestC

Create a new pull request. Use this tool for AI-assisted PR creation with smart content generation.

Inputs: title (required), head (required), base (required), owner, +6 more.

gitea_user_current获取当前用户B

Get information about the currently authenticated user

Inputs: no named parameters.

gitea_workflow_check_blocked检测阻塞 IssueB

Detect issues that are blocked or exceeding SLA. Checks for stale issues based on priority-specific time limits.

Inputs: owner, repo, threshold_hours.

gitea_workflow_check_issues检查 Issue 工作流C

Check all open issues against workflow rules. Identifies missing labels, conflicts, and provides suggestions for improvement.

Inputs: owner, repo, issue_number, rules.

gitea_workflow_escalate_priority优先级升级A

Automatically escalate priority for aged issues. P3→P2 after 30 days, P2→P1 after 14 days, P1→P0 after 3 days. Security issues are always P0.

Inputs: owner, repo, dry_run.

gitea_workflow_generate_report生成工作流报告B

Generate a comprehensive workflow report including issue statistics, health score, and recommendations. Output in JSON and Markdown formats.

Inputs: owner, repo, time_range.

gitea_workflow_infer_labels智能标签推断C

Infer labels for an issue based on title and body content. Uses keyword matching and pattern recognition to suggest type, priority, and area labels.

Inputs: issue_number (required), owner, repo, auto_apply.

gitea_workflow_init初始化工作流配置A

Initialize Issue workflow configuration for a project. Generates .gitea/issue-workflow.yaml with labels, board columns, and automation rules based on project type.

Inputs: project_type (required), owner, repo, language.

gitea_workflow_load_config加载工作流配置B

Load and parse the workflow configuration from .gitea/issue-workflow.yaml. Returns the parsed config and validation results.

Inputs: owner, repo.

gitea_workflow_sync_board同步项目看板C

Create or update project board with columns mapped to status labels. Columns: Backlog, In Progress, Review, Testing, Done.

Inputs: owner, repo, board_name.

gitea_workflow_sync_labels同步标签系统C

Sync repository labels based on workflow configuration. Creates status/, priority/, type/* and other labels defined in the config.

Inputs: owner, repo, dry_run.

gitea_workflow_sync_status状态双向同步A

Synchronize issue status labels with project board column positions. Supports label-to-board, board-to-label, or bidirectional sync.

Inputs: direction (required), owner, repo.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 22 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap in the compliance and workflow categories that could cause confusion. For example, gitea_compliance_check_all and the individual compliance checks (branch, commit, pr) might be ambiguous about when to use each, and the workflow tools like gitea_workflow_check_issues and gitea_workflow_generate_report have overlapping functions in analyzing issues. However, descriptions help clarify boundaries.

    Naming Consistency5/5

    Tool names follow a highly consistent pattern with the prefix 'gitea_' followed by a category (e.g., compliance, context, workflow) and a descriptive verb_noun combination. All tools use snake_case uniformly, making them predictable and easy to parse. This consistency aids in understanding the tool set at a glance.

    Tool Count3/5

    With 22 tools, the count is on the higher side for a server focused on Gitea integration, which might feel heavy and potentially overwhelming. While it covers compliance, context, issues, PRs, and workflow automation, some tools could be consolidated or omitted without losing functionality, indicating borderline appropriateness for the scope.

    Completeness4/5

    The tool set provides comprehensive coverage for compliance checks, issue and PR creation, workflow automation, and context management in Gitea. Minor gaps exist, such as missing tools for updating or deleting issues/PRs, and limited operations on repositories beyond compliance (e.g., no list_repos or get_repo). However, agents can work around these with the available tools for core workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      B
      quality
      Not graded
      maintenance
      Enables comprehensive Git and GitHub operations through 30 DevOps tools including repository management, file operations, workflows, and advanced Git features. Provides complete Git functionality without external dependencies for seamless integration with Gitea and GitHub platforms.
      18
      819 npm
      -
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to read repositories, manage issues, inspect CI/CD workflow runs, create branches, commit files, and open pull requests on a self-hosted Gitea instance.
      7
      MIT

    Appeared in Searches