diff --git a/README.md b/README.md index 02e71a9d65409a655e03552794432b3ce3336bd1..cc96d409d3974bd2c476714b0917d46ade71f268 100644 --- a/README.md +++ b/README.md @@ -1,187 +1,110 @@ -# Gitee Enterprise MCP Server +# Gitee 企业版 MCP 服务器 -Gitee Enterprise MCP Server is a Model Context Protocol (MCP) server implementation for Gitee Enterprise. It provides a set of tools for interacting with Gitee Enterprise API, allowing AI assistants to manage enterprise repositories, issues, pull requests, and more. +Gitee MCP (Model Control Protocol) 服务器为 Gitee 企业版平台提供 AI 模型交互能力,允许模型通过标准协议访问和操作 Gitee 平台上的代码仓库、问题跟踪、Pull Request 等功能。 -## Features +## 功能特性 -- Interact with Gitee Enterprise repositories, issues, pull requests -- Support for enterprise-level operations and management -- Configurable API base URL to support different Gitee Enterprise instances -- Support for SSE and Stdio transport -- Dynamic toolset enable/disable +- **代码仓库管理**:创建、列出、获取文件内容、获取仓库结构等 +- **问题跟踪系统**:创建、更新、评论、查询 Issues +- **Pull Request 操作**:创建、更新、合并、获取详情、评论 Pull Requests +- **项目管理**:Scrum 瀑布模型支持,包括冲刺(Sprint)和版本(Version)管理 +- **组织架构访问**:企业、项目组、成员信息查询 +- **标签与状态管理**:Issue 类型、状态、标签的查询 -
-Scenario Example +## 安装 -1. Get specific enterprise issues - ![get_issues](./docs/images/get_issues.png) -2. Improve the issue content - ![update_issue](./docs/images/update_issue.png) -3. Divide subtasks - ![create_sup_issues](./docs/images/create_sub_issues.png) -4. Create PR/Review PR - ![create_pr_and_review](./docs/images/pr_review.png) -
+### 使用预编译包安装 -## Installation(This step can be skipped directly when starting npx) - -### Prerequisites +```bash +npm install -g mcp-gitee-ent +``` -- Go 1.23.0 or higher -- MCP token, [Go to get](https://gitee.com/profile/mcp_gitee_ent_access_tokens) +### 从源码构建 -### Building from Source +1. 安装 Go 1.23+ +2. 克隆仓库 +3. 构建项目: -1. Clone the repository: - ```bash - git clone https://gitee.com/oschina/mcp-gitee-ent.git - cd mcp-gitee-ent - ``` +```bash +make build +``` -2. Build the project: - ```bash - make build - ``` - Move ./bin/mcp-gitee-ent PATH env +### Docker 部署 -### Use go install - ```bash - go install gitee.com/oschina/mcp-gitee-ent@latest - ``` +```bash +docker build -t gitee-mcp-server . +docker run -p 8000:8000 gitee-mcp-server +``` -## Usage +## 使用方法 -Check mcp-gitee-ent version: +### 启动服务器 ```bash -mcp-gitee-ent --version +mcp-gitee-ent --transport tcp --addr :8000 ``` -## MCP Hosts Configuration -
- - - - - -
- -Config example: -- npx +### MCP 主机配置 + +在客户端配置 MCP 连接: + ```json { - "mcpServers": { - "gitee-ent": { - "command": "npx", - "args": [ - "-y", - "@gitee/mcp-gitee-ent@latest" - ], - "env": { - "GITEE_ENT_API_BASE": "https://api.gitee.com/enterprises", - "GITEE_ENT_MCP_ACCESS_TOKEN": "" - } - } - } + "host": "localhost", + "port": 8000 } ``` -- executable -```json -{ - "mcpServers": { - "gitee-ent": { - "command": "mcp-gitee-ent", - "env": { - "GITEE_ENT_API_BASE": "https://api.gitee.com/enterprises", - "GITEE_ENT_MCP_ACCESS_TOKEN": "", - } - } - } -} + +### 命令行选项 + +```bash +--transport string 传输协议 (tcp 或 unix,默认 tcp) +--addr string 监听地址 (默认 :8000) +--disabled-tools 禁用的工具集 +--enabled-tools 强制启用的工具集 ``` -### Command-line Options - -- `--token`: access token -- `--api-base`: Gitee Ent API base URL (default: https://api.gitee.com/enterprises) -- `--version`: Show version information -- `--transport`: Transport type (stdio or sse, default: stdio) -- `--sse-address`: The host and port to start the SSE server on (default: localhost:8000) -- `--enabled-toolsets`: Comma-separated list of tools to enable (if specified, only these tools will be enabled) -- `--disabled-toolsets`: Comma-separated list of tools to disable - -### Environment Variables - -You can also configure the server using environment variables: - -- `GITEE_ENT_MCP_ACCESS_TOKEN`: Gitee MCP ent access token -- `GITEE_ENT_API_BASE`: Gitee ENT API base URL -- `ENABLED_TOOLSETS`: Comma-separated list of tools to enable -- `DISABLED_TOOLSETS`: Comma-separated list of tools to disable - -### Toolset Management - -Toolset management supports two modes: - -1. Enable specified tools (whitelist mode): - - Use `--enabled-toolsets` parameter or `ENABLED_TOOLSETS` environment variable - - Specify after, only listed tools will be enabled, others will be disabled - - Example: `--enabled-toolsets="update_enterprise_issue,list_enterprise_repositories"` - -2. Disable specified tools (blacklist mode): - - Use `--disabled-toolsets` parameter or `DISABLED_TOOLSETS` environment variable - - Specify after, listed tools will be disabled, others will be enabled - - Example: `--disabled-toolsets="update_enterprise_issue,list_enterprise_repositories"` - -Note: -- If both `enabled-toolsets` and `disabled-toolsets` are specified, `enabled-toolsets` takes precedence -- Tool names are case-sensitive - -## Available Tools - -The server provides various tools for interacting with Gitee Enterprise: - -| Tool | Category | Description | -|----------------------------------------|---------------|-------------| -| **list_enterprises** | Enterprise | List user's enterprises | -| **list_enterprise_repositories** | Repository | List repositories in an enterprise | -| **create_enterprise_repository** | Repository | Create a repository in an enterprise | -| **create_enterprise_repo_release** | Repository | Create a release for repository | -| **list_enterprise_repo_releases** | Repository | List releases for repository | -| **get_enterprise_repository_file_content** | Repository | Get the content of a specific file in the repository | -| **get_enterprise_repo_tree** | Repository | Get the tree structure of a repository | -| **list_enterprise_pulls** | Pull Request | List enterprise pull requests | -| **create_enterprise_repo_pull** | Pull Request | Create a pull request for repository | -| **merge_enterprise_pull** | Pull Request | Merge a pull request | -| **get_enterprise_pull_detail** | Pull Request | Get pull request detail | -| **update_enterprise_pull** | Pull Request | Update a pull request | -| **get_enterprise_pull_diff** | Pull Request | Get pull request diff | -| **comment_enterprise_pull** | Pull Request | Comment on a pull request | -| **list_enterprise_pull_comments** | Pull Request | List pull request comments | -| **create_enterprise_issue** | Issue | Create an issue | -| **update_enterprise_issue** | Issue | Update an issue | -| **get_enterprise_issue_detail** | Issue | Get issue detail | -| **list_enterprise_issues** | Issue | List issues | -| **comment_enterprise_issue** | Issue | Comment on an issue | -| **list_enterprise_issue_comments** | Issue | List issue comments | -| **get_user_info** | User | Get user info | -| **list_enterprise_members** | Member | List members of an enterprise | -| **list_enterprise_groups** | Group | List groups in an enterprise | -| **list_enterprise_labels** | Label | List labels of an enterprise | -| **list_programs** | Program | List programs of an enterprise | -| **list_scrum_sprints** | Program | List Scrum Sprints | -| **create_scrum_sprint** | Program | Create a Scrum Sprint | -| **list_scrum_versions** | Program | List Scrum Versions | -| **list_issue_types** | Issue Type | List issue types | -| **list_issue_type_states** | Issue State | List issue states | - -## Contribution - -We welcome contributions from the open-source community! If you'd like to contribute to this project, please follow these guidelines: - -1. Fork the repository. -2. Create a new branch for your feature or bug fix. -3. Make your changes and ensure the code is well-documented. -4. Submit a pull request with a clear description of your changes. - -For more information, please refer to the [CONTRIBUTING](CONTRIBUTING.md) file. +### 环境变量 + +- `GITEE_ACCESS_TOKEN` - Gitee API 访问令牌 +- `GITEE_API_BASE` - 自定义 Gitee API 地址(用于私有部署) + +## 工具集管理 + +### 可用工具 + +- **仓库操作** + - `create_repository` - 创建新仓库 + - `list_repository` - 列出企业仓库 + - `get_file_content` - 获取文件内容 + - `get_tree` - 获取仓库结构 + +- **问题跟踪** + - `create_issue` - 创建 Issue + - `update_issue` - 更新 Issue + - `comment_issue` - 评论 Issue + - `list_issues` - 列出 Issues + - `get_issue_detail` - 获取 Issue 详情 + +- **Pull Request** + - `create_pull` - 创建 Pull Request + - `merge_pull` - 合并 Pull Request + - `list_pulls` - 列出 Pull Requests + - `get_pull_detail` - 获取 Pull Request 详情 + +- **项目管理** + - `list_scrum_sprints` - 列出 Scrum 冲刺 + - `list_scrum_versions` - 列出 Scrum 版本 + +- **组织架构** + - `list_enterprises` - 列出企业 + - `list_ent_groups` - 列出企业组 + - `list_ent_members` - 列出企业成员 + +## 贡献 + +请参考 [CONTRIBUTING.md](CONTRIBUTING.md) 获取贡献指南。 + +## 许可证 + +本项目采用 Apache-2.0 许可证。详见 [LICENSE](LICENSE) 文件。 \ No newline at end of file