forked from zereight/gitlab-mcp
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Branches management entity (browse_branches, manage_branch) #79
Copy link
Copy link
Closed
Labels
enhancementNew feature, new MCP tool, new capabilityNew feature, new MCP tool, new capability
Description
Summary
Add branches management as new CQRS entity with browse_branches and manage_branch tools.
Motivation
- Security critical for enterprise users
- Branch protection is essential for code quality workflows
- Competitors (rifqi96, GitHub MCP) have this
Proposed Tools
browse_branches (Query)
| Action | Description |
|---|---|
list |
List all branches |
get |
Get specific branch details |
list_protected |
List protected branches |
get_protected |
Get protection rules for branch |
manage_branch (Command)
| Action | Description |
|---|---|
create |
Create new branch from ref |
delete |
Delete branch |
protect |
Add branch protection |
unprotect |
Remove branch protection |
update_protection |
Update protection rules |
GitLab API
GET /projects/:id/repository/branches- List branchesGET /projects/:id/repository/branches/:branch- Get branchPOST /projects/:id/repository/branches- Create branchDELETE /projects/:id/repository/branches/:branch- Delete branchGET /projects/:id/protected_branches- List protectedPOST /projects/:id/protected_branches- Protect branchDELETE /projects/:id/protected_branches/:name- UnprotectPATCH /projects/:id/protected_branches/:name- Update protection
Docs: https://docs.gitlab.com/ee/api/branches.html
Docs: https://docs.gitlab.com/ee/api/protected_branches.html
Example Usage
// Create branch
{
action: "create",
project_id: "my-org/app",
branch: "feature/new-feature",
ref: "main"
}
// Protect branch
{
action: "protect",
project_id: "my-org/app",
branch: "main",
push_access_level: 40, // Maintainers
merge_access_level: 30, // Developers
allow_force_push: false
}Tasks
- Create
src/entities/branches/directory - Create
schema-readonly.tswith BrowseBranchesSchema - Create
schema.tswith ManageBranchSchema - Create
registry.tswith handlers - Add to tool registry
- Add tier metadata (protected branches: Premium for some features)
- Add unit tests
Tier Requirements
- Basic branches: GitLab Free
- Protected branches: GitLab Free (basic), Premium (code owners, approval rules)
Complexity
HIGH - New entity, protection rules are complex, ~250 LOC
Priority
HIGH - Security critical
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature, new MCP tool, new capabilityNew feature, new MCP tool, new capability