MCP Gitee Pull Request Server
A multi-instance Gitee Pull Request creation MCP server with automatic review, test, and merge workflow support.
Features
- ✅ Create Pull Requests on Gitee via API
- ✅ Multi-instance support with repository name isolation
- ✅ Configurable reviewers (assignees and testers)
- ✅ Label support with format validation
- ✅ Draft PR support
- ✅ Automatic review, test, and merge workflows
- ✅ Operation logging
- ✅ Error handling and recovery
Installation
Global Installation (Recommended)
npm install -g @liangshanli/mcp-server-gitee-pull-request
Local Installation
npm install @liangshanli/mcp-server-gitee-pull-request
Install from Source
git clone https://github.com/liliangshan/mcp-server-gitee-pull-request.git
cd mcp-server-gitee-pull-request
npm install
Configuration
Set environment variables:
# Required: Gitee account credentials (use scope_ prefix to avoid conflicts)
export scope_username="your-email@example.com"
export scope_password="your-password"
# Required: OAuth application credentials
# Create OAuth app at: https://gitee.com/oauth/applications
export scope_client_id="your_client_id"
export scope_client_secret="your_client_secret"
# Note: OAuth permission scope is hardcoded as "user_info pull_requests enterprises"
# Required: Repository owner path (enterprise, organization, or personal address)
export owner="your-username-or-org"
# Required: Repository path
export repo="your-repo-name"
# Required: Source branch for Pull Request (branch to be merged)
export head="dev"
# Required: Target branch for Pull Request (branch to merge into)
export base="main"
# Optional: Reviewer usernames, multiple allowed, comma separated
export assignees="username1,username2"
# Optional: Tester usernames, multiple allowed, comma separated
export testers="tester1,tester2"
# Optional: Default labels (comma separated)
export labels="bug,performance"
# Optional: Project name (for multi-instance support)
export PROJECT_NAME="custom-mgit"
# Optional: Automation workflow switches
export AUTO_REVIEW="false"
export AUTO_TEST="false"
export AUTO_MERGE="false"
Getting OAuth Application Credentials
- Visit Gitee OAuth Applications to create your app
- Click "Create Application"
- Fill in the application information and create
- Get
client_idandclient_secret
Note: Access tokens are automatically obtained via OAuth when needed.
Usage
1. Direct Run (Global Installation)
mcp-server-gitee-pull-request
2. Using npx (Recommended)
npx @liangshanli/mcp-server-gitee-pull-request
3. Direct Start (Source Installation)
npm start
4. Managed Start (Production Environment Recommended)
npm run start-managed
Editor Integration
Cursor Editor Configuration
Create .cursor/mcp.json file in project root:
{
"mcpServers": {
"gitee-pr": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "your-username-or-org",
"repo": "your-repo-name",
"head": "dev",
"base": "main",
"assignees": "username1,username2",
"testers": "tester1,tester2",
"labels": "bug,performance",
"PROJECT_NAME": "custom-mgit",
"AUTO_REVIEW": "false",
"AUTO_TEST": "false",
"AUTO_MERGE": "false"
}
}
}
}
VS Code Editor Configuration
Create .vscode/mcp.json file:
{
"servers": {
"gitee-pr": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "your-username-or-org",
"repo": "your-repo-name",
"head": "dev",
"base": "main",
"assignees": "username1,username2",
"testers": "tester1,tester2",
"labels": "bug,performance",
"PROJECT_NAME": "custom-mgit",
"AUTO_REVIEW": "false",
"AUTO_TEST": "false",
"AUTO_MERGE": "false"
}
}
}
}
Multi-instance Configuration
You can run multiple instances for different repositories. Tool names will use repository names as prefixes to avoid conflicts.
Cursor Editor Configuration
{
"mcpServers": {
"gitee-pr-repo1": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "org1",
"repo": "repo1",
"head": "feature-branch",
"base": "main",
"PROJECT_NAME": "Repo1 Project"
}
},
"gitee-pr-repo2": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "org2",
"repo": "repo2",
"head": "develop",
"base": "master",
"PROJECT_NAME": "Repo2 Project"
}
}
}
}
VS Code Editor Configuration
{
"servers": {
"gitee-pr-repo1": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "org1",
"repo": "repo1",
"head": "feature-branch",
"base": "main",
"PROJECT_NAME": "Repo1 Project"
}
},
"gitee-pr-repo2": {
"command": "npx",
"args": ["-y", "@liangshanli/mcp-server-gitee-pull-request"],
"env": {
"scope_username": "your-email@example.com",
"scope_password": "your-password",
"scope_client_id": "your_client_id",
"scope_client_secret": "your_client_secret",
"owner": "org2",
"repo": "repo2",
"head": "develop",
"base": "master",
"PROJECT_NAME": "Repo2 Project"
}
}
}
}