feat: implement repository collaborator management #1

Open
opened 2026-06-02 06:56:45 +00:00 by a-limasov · 0 comments
Owner

Context

Repository collaborators are a core access-control primitive. Without these endpoints
the MCP server cannot add or remove contributors, check whether a user has access, or
inspect their permission level — all common operations in team workflows.

Endpoints to implement

Method Path Tool name Description
GET /repos/{owner}/{repo}/collaborators list_collaborators List all collaborators
PUT /repos/{owner}/{repo}/collaborators/{collaborator} add_collaborator Add collaborator with permission
DELETE /repos/{owner}/{repo}/collaborators/{collaborator} remove_collaborator Remove collaborator
GET /repos/{owner}/{repo}/collaborators/{collaborator} is_collaborator Check if user is collaborator
GET /repos/{owner}/{repo}/collaborators/{collaborator}/permission get_collaborator_permission Get collaborator permission level

Acceptance Criteria

  • list_collaborators(owner, repo) returns list of users with their permissions
  • add_collaborator(owner, repo, collaborator, permission) accepts permission: read | write | admin | owner
  • remove_collaborator(owner, repo, collaborator) returns {"success": true} on 204
  • is_collaborator(owner, repo, collaborator) returns {"is_collaborator": true/false}
  • get_collaborator_permission(owner, repo, collaborator) returns permission object from API
  • All tools handle 404 (user/repo not found) and 403 (insufficient permissions) gracefully via existing _req error handling

Technical Notes

  • PUT /collaborators/{collaborator} request body: {"permission": "write"} — permission is optional, defaults to write
  • is_collaborator uses HTTP 204 (found) / 404 (not found) — needs custom response handling, not standard _req
  • Gitea permission levels: none | read | write | admin | owner
## Context Repository collaborators are a core access-control primitive. Without these endpoints the MCP server cannot add or remove contributors, check whether a user has access, or inspect their permission level — all common operations in team workflows. ## Endpoints to implement | Method | Path | Tool name | Description | |--------|------|-----------|-------------| | GET | `/repos/{owner}/{repo}/collaborators` | `list_collaborators` | List all collaborators | | PUT | `/repos/{owner}/{repo}/collaborators/{collaborator}` | `add_collaborator` | Add collaborator with permission | | DELETE | `/repos/{owner}/{repo}/collaborators/{collaborator}` | `remove_collaborator` | Remove collaborator | | GET | `/repos/{owner}/{repo}/collaborators/{collaborator}` | `is_collaborator` | Check if user is collaborator | | GET | `/repos/{owner}/{repo}/collaborators/{collaborator}/permission` | `get_collaborator_permission` | Get collaborator permission level | ## Acceptance Criteria - [ ] `list_collaborators(owner, repo)` returns list of users with their permissions - [ ] `add_collaborator(owner, repo, collaborator, permission)` accepts `permission`: `read` | `write` | `admin` | `owner` - [ ] `remove_collaborator(owner, repo, collaborator)` returns `{"success": true}` on 204 - [ ] `is_collaborator(owner, repo, collaborator)` returns `{"is_collaborator": true/false}` - [ ] `get_collaborator_permission(owner, repo, collaborator)` returns permission object from API - [ ] All tools handle 404 (user/repo not found) and 403 (insufficient permissions) gracefully via existing `_req` error handling ## Technical Notes - `PUT /collaborators/{collaborator}` request body: `{"permission": "write"}` — permission is optional, defaults to `write` - `is_collaborator` uses HTTP 204 (found) / 404 (not found) — needs custom response handling, not standard `_req` - Gitea permission levels: `none` | `read` | `write` | `admin` | `owner`
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: a-limasov/gitea-platform-mcp#1