From 55f32ef4f5eb245d876ac514c4b85a1465862fb3 Mon Sep 17 00:00:00 2001 From: appleboy Date: Sun, 6 Apr 2025 14:07:17 +0000 Subject: [PATCH] docs: localize README with Chinese translations (#18) - Add links to traditional and simplified Chinese versions of the README. - Add README in Simplified Chinese with installation, usage, and troubleshooting instructions. - Add README in Traditional Chinese with installation, usage, and troubleshooting instructions. Signed-off-by: appleboy Co-authored-by: hiifong Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/18 Co-authored-by: appleboy Co-committed-by: appleboy --- README.md | 2 + README.zh-cn.md | 190 ++++++++++++++++++++++++++++++++++++++++++++++++ README.zh-tw.md | 190 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 382 insertions(+) create mode 100644 README.zh-cn.md create mode 100644 README.zh-tw.md diff --git a/README.md b/README.md index 474a9dc..4a97851 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Gitea MCP Server +[繁體中文](README.zh-tw.md) | [简体中文](README.zh-cn.md) + **Gitea MCP Server** is an integration plugin designed to connect Gitea with Model Context Protocol (MCP) systems. This allows for seamless command execution and repository management through an MCP-compatible chat interface. [![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}) [![Install with Docker in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}&quality=insiders) diff --git a/README.zh-cn.md b/README.zh-cn.md new file mode 100644 index 0000000..6abca53 --- /dev/null +++ b/README.zh-cn.md @@ -0,0 +1,190 @@ +# Gitea MCP 服务器 + +[English](README.md) | [繁體中文](README.zh-tw.md) + +**Gitea MCP 服务器** 是一个集成插件,旨在将 Gitea 与 Model Context Protocol (MCP) 系统连接起来。这允许通过 MCP 兼容的聊天界面无缝执行命令和管理仓库。 + +[![在 VS Code 中使用 Docker 安装](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}) [![在 VS Code Insiders 中使用 Docker 安装](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}&quality=insiders) + +## 什么是 Gitea? + +Gitea 是一个由社区管理的轻量级代码托管解决方案,使用 Go 语言编写。它以 MIT 许可证发布。Gitea 提供 Git 托管,包括仓库查看器、问题追踪、拉取请求等功能。 + +## 什么是 MCP? + +Model Context Protocol (MCP) 是一种协议,允许通过聊天界面整合各种工具和系统。它能够无缝执行命令和管理仓库、用户和其他资源。 + +## 🚧 安装 + +### 在 VS Code 中使用 + +要快速安装,请使用本 README 顶部的单击安装按钮之一。 + +要手动安装,请将以下 JSON 块添加到 VS Code 的用户设置 (JSON) 文件中。您可以通过按 `Ctrl + Shift + P` 并输入 `Preferences: Open User Settings (JSON)` 来完成此操作。 + +或者,您可以将其添加到工作区中的 `.vscode/mcp.json` 文件中。这将允许您与他人共享配置。 + +> 请注意,`.vscode/mcp.json` 文件中不需要 `mcp` 键。 + +```json +{ + "mcp": { + "inputs": [ + { + "type": "promptString", + "id": "gitea_token", + "description": "Gitea 个人访问令牌", + "password": true + } + ], + "servers": { + "github": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-e", + "GITEA_ACCESS_TOKEN", + "docker.gitea.com/gitea-mcp-server" + ], + "env": { + "GITEA_ACCESS_TOKEN": "${input:gitea_token}" + } + } + } + } +} +``` + +### 📥 下载官方二进制版本 + +您可以从[这里](https://gitea.com/gitea/gitea-mcp/releases)下载官方版本。 + +### 🔧 从源代码构建 + +您可以使用 Git 克隆仓库来下载源代码: + +```bash +git clone https://gitea.com/gitea/gitea-mcp.git +``` + +在构建之前,请确保您已安装以下内容: + +- make +- Golang (建议使用 Go 1.24 或更高版本) + +然后运行: + +```bash +make build +``` + +### 📁 添加到 PATH + +构建后,将二进制文件 gitea-mcp 复制到系统 PATH 中包含的目录。例如: + +```bash +cp gitea-mcp /usr/local/bin/ +``` + +## 🚀 使用 + +此示例适用于 Cursor,您也可以在 VSCode 中使用插件。 +要配置 Gitea 的 MCP 服务器,请将以下内容添加到您的 MCP 配置文件中: + +- **stdio 模式** + +```json +{ + "mcpServers": { + "gitea": { + "command": "gitea-mcp", + "args": [ + "-t", + "stdio", + "--host", + "https://gitea.com" + // "--token", "" + ], + "env": { + // "GITEA_HOST": "https://gitea.com", + "GITEA_ACCESS_TOKEN": "" + } + } + } +} +``` + +- **sse 模式** + +```json +{ + "mcpServers": { + "gitea": { + "url": "http://localhost:8080/sse" + } + } +} +``` + +**默认日志路径**: `$HOME/.gitea-mcp/gitea-mcp.log` + +> [!注意] +> 您可以通过命令行参数或环境变量提供您的 Gitea 主机和访问令牌。 +> 命令行参数具有最高优先级 + +一切设置完成后,请尝试在您的 MCP 兼容聊天框中输入以下内容: + +```text +列出我所有的仓库 +``` + +## ✅ 可用工具 + +Gitea MCP 服务器支持以下工具: + +| 工具 | 范围 | 描述 | +| :--------------------------: | :------: | :--------------------------: | +| get_my_user_info | 用户 | 获取已认证用户的信息 | +| create_repo | 仓库 | 创建一个新仓库 | +| fork_repo | 仓库 | 复刻一个仓库 | +| list_my_repos | 仓库 | 列出已认证用户拥有的所有仓库 | +| create_branch | 分支 | 创建一个新分支 | +| delete_branch | 分支 | 删除一个分支 | +| list_branches | 分支 | 列出仓库中的所有分支 | +| list_repo_commits | 提交 | 列出仓库中的所有提交 | +| get_file_content | 文件 | 获取文件的内容和元数据 | +| create_file | 文件 | 创建一个新文件 | +| update_file | 文件 | 更新现有文件 | +| delete_file | 文件 | 删除一个文件 | +| get_issue_by_index | 问题 | 根据索引获取问题 | +| list_repo_issues | 问题 | 列出仓库中的所有问题 | +| create_issue | 问题 | 创建一个新问题 | +| create_issue_comment | 问题 | 在问题上创建评论 | +| get_pull_request_by_index | 拉取请求 | 根据索引获取拉取请求 | +| list_repo_pull_requests | 拉取请求 | 列出仓库中的所有拉取请求 | +| create_pull_request | 拉取请求 | 创建一个新拉取请求 | +| search_users | 用户 | 搜索用户 | +| search_org_teams | 组织 | 搜索组织中的团队 | +| search_repos | 仓库 | 搜索仓库 | +| get_gitea_mcp_server_version | 服务器 | 获取 Gitea MCP 服务器的版本 | + +## 🐛 调试 + +要启用调试模式,请在使用 sse 模式运行 Gitea MCP 服务器时添加 `-d` 标志: + +```sh +./gitea-mcp -t sse [--port 8080] --token -d +``` + +## 🛠 疑难排解 + +如果您遇到任何问题,以下是一些常见的疑难排解步骤: + +1. **检查您的 PATH**: 确保 `gitea-mcp` 二进制文件位于系统 PATH 中包含的目录中。 +2. **验证依赖项**: 确保您已安装所有所需的依赖项,例如 `make` 和 `Golang`。 +3. **检查配置**: 仔细检查您的 MCP 配置文件是否有任何错误或遗漏的信息。 +4. **查看日志**: 检查日志中是否有任何错误消息或警告,可以提供有关问题的更多信息。 + +享受通过聊天探索和管理您的 Gitea 仓库的乐趣! diff --git a/README.zh-tw.md b/README.zh-tw.md new file mode 100644 index 0000000..79af63a --- /dev/null +++ b/README.zh-tw.md @@ -0,0 +1,190 @@ +# Gitea MCP 伺服器 + +[English](README.md) | [简体中文](README.zh-cn.md) + +**Gitea MCP 伺服器** 是一個整合插件,旨在將 Gitea 與 Model Context Protocol (MCP) 系統連接起來。這允許通過 MCP 兼容的聊天界面無縫執行命令和管理倉庫。 + +[![在 VS Code 中使用 Docker 安裝](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}) [![在 VS Code Insiders 中使用 Docker 安裝](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitea&inputs=[{%22id%22:%22gitea_token%22,%22type%22:%22promptString%22,%22description%22:%22Gitea%20Personal%20Access%20Token%22,%22password%22:true}]&config={%22command%22:%22docker%22,%22args%22:[%22run%22,%22-i%22,%22--rm%22,%22-e%22,%22GITEA_ACCESS_TOKEN%22,%22docker.gitea.com/gitea-mcp-server%22],%22env%22:{%22GITEA_ACCESS_TOKEN%22:%22${input:gitea_token}%22}}&quality=insiders) + +## 什麼是 Gitea? + +Gitea 是一個由社群管理的輕量級代碼託管解決方案,使用 Go 語言編寫。它以 MIT 許可證發布。Gitea 提供 Git 託管,包括倉庫查看器、問題追蹤、拉取請求等功能。 + +## 什麼是 MCP? + +Model Context Protocol (MCP) 是一種協議,允許通過聊天界面整合各種工具和系統。它能夠無縫執行命令和管理倉庫、用戶和其他資源。 + +## 🚧 安裝 + +### 在 VS Code 中使用 + +要快速安裝,請使用本 README 頂部的單擊安裝按鈕之一。 + +要手動安裝,請將以下 JSON 塊添加到 VS Code 的用戶設置 (JSON) 文件中。您可以通過按 `Ctrl + Shift + P` 並輸入 `Preferences: Open User Settings (JSON)` 來完成此操作。 + +或者,您可以將其添加到工作區中的 `.vscode/mcp.json` 文件中。這將允許您與他人共享配置。 + +> 請注意,`.vscode/mcp.json` 文件中不需要 `mcp` 鍵。 + +```json +{ + "mcp": { + "inputs": [ + { + "type": "promptString", + "id": "gitea_token", + "description": "Gitea 個人訪問令牌", + "password": true + } + ], + "servers": { + "github": { + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-e", + "GITEA_ACCESS_TOKEN", + "docker.gitea.com/gitea-mcp-server" + ], + "env": { + "GITEA_ACCESS_TOKEN": "${input:gitea_token}" + } + } + } + } +} +``` + +### 📥 下載官方二進制版本 + +您可以從[這裡](https://gitea.com/gitea/gitea-mcp/releases)下載官方版本。 + +### 🔧 從源代碼構建 + +您可以使用 Git 克隆倉庫來下載源代碼: + +```bash +git clone https://gitea.com/gitea/gitea-mcp.git +``` + +在構建之前,請確保您已安裝以下內容: + +- make +- Golang (建議使用 Go 1.24 或更高版本) + +然後運行: + +```bash +make build +``` + +### 📁 添加到 PATH + +構建後,將二進制文件 gitea-mcp 複製到系統 PATH 中包含的目錄。例如: + +```bash +cp gitea-mcp /usr/local/bin/ +``` + +## 🚀 使用 + +此示例適用於 Cursor,您也可以在 VSCode 中使用插件。 +要配置 Gitea 的 MCP 伺服器,請將以下內容添加到您的 MCP 配置文件中: + +- **stdio 模式** + +```json +{ + "mcpServers": { + "gitea": { + "command": "gitea-mcp", + "args": [ + "-t", + "stdio", + "--host", + "https://gitea.com" + // "--token", "" + ], + "env": { + // "GITEA_HOST": "https://gitea.com", + "GITEA_ACCESS_TOKEN": "" + } + } + } +} +``` + +- **sse 模式** + +```json +{ + "mcpServers": { + "gitea": { + "url": "http://localhost:8080/sse" + } + } +} +``` + +**默認日誌路徑**: `$HOME/.gitea-mcp/gitea-mcp.log` + +> [!注意] +> 您可以通過命令行參數或環境變量提供您的 Gitea 主機和訪問令牌。 +> 命令行參數具有最高優先級 + +一切設置完成後,請嘗試在您的 MCP 兼容聊天框中輸入以下內容: + +```text +列出我所有的倉庫 +``` + +## ✅ 可用工具 + +Gitea MCP 伺服器支持以下工具: + +| 工具 | 範圍 | 描述 | +| :--------------------------: | :------: | :--------------------------: | +| get_my_user_info | 用戶 | 獲取已認證用戶的信息 | +| create_repo | 倉庫 | 創建一個新倉庫 | +| fork_repo | 倉庫 | 復刻一個倉庫 | +| list_my_repos | 倉庫 | 列出已認證用戶擁有的所有倉庫 | +| create_branch | 分支 | 創建一個新分支 | +| delete_branch | 分支 | 刪除一個分支 | +| list_branches | 分支 | 列出倉庫中的所有分支 | +| list_repo_commits | 提交 | 列出倉庫中的所有提交 | +| get_file_content | 文件 | 獲取文件的內容和元數據 | +| create_file | 文件 | 創建一個新文件 | +| update_file | 文件 | 更新現有文件 | +| delete_file | 文件 | 刪除一個文件 | +| get_issue_by_index | 問題 | 根據索引獲取問題 | +| list_repo_issues | 問題 | 列出倉庫中的所有問題 | +| create_issue | 問題 | 創建一個新問題 | +| create_issue_comment | 問題 | 在問題上創建評論 | +| get_pull_request_by_index | 拉取請求 | 根據索引獲取拉取請求 | +| list_repo_pull_requests | 拉取請求 | 列出倉庫中的所有拉取請求 | +| create_pull_request | 拉取請求 | 創建一個新拉取請求 | +| search_users | 用戶 | 搜索用戶 | +| search_org_teams | 組織 | 搜索組織中的團隊 | +| search_repos | 倉庫 | 搜索倉庫 | +| get_gitea_mcp_server_version | 伺服器 | 獲取 Gitea MCP 伺服器的版本 | + +## 🐛 調試 + +要啟用調試模式,請在使用 sse 模式運行 Gitea MCP 伺服器時添加 `-d` 標誌: + +```sh +./gitea-mcp -t sse [--port 8080] --token -d +``` + +## 🛠 疑難排解 + +如果您遇到任何問題,以下是一些常見的疑難排解步驟: + +1. **檢查您的 PATH**: 確保 `gitea-mcp` 二進制文件位於系統 PATH 中包含的目錄中。 +2. **驗證依賴項**: 確保您已安裝所有所需的依賴項,例如 `make` 和 `Golang`。 +3. **檢查配置**: 仔細檢查您的 MCP 配置文件是否有任何錯誤或遺漏的信息。 +4. **查看日誌**: 檢查日誌中是否有任何錯誤消息或警告,可以提供有關問題的更多信息。 + +享受通過聊天探索和管理您的 Gitea 倉庫的樂趣!