github / github/github-mcp-server

Add `add_repository_collaborator` tool for managing repository access

未关闭
#1,541 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Go
星标
33k
派生
5k
平均合并
2 天 1 小时
30 天内合并 PR
52

描述

### Describe the feature or problem you'd like to solve

There's currently no way for AI agents to manage repository collaborator access through the MCP server. The GitHub REST API supports adding collaborators via `PUT /repos/{owner}/{repo}/collaborators/{username}`, but this capability isn't exposed as a tool.

This makes it impossible for agents to help with common repository administration tasks like granting access to contractors, onboarding team members to private repos, or managing permissions for open source contributors.

### Proposed solution

Add a new `add_repository_collaborator` tool to the `repos` toolset that wraps the [Add a repository collaborator](https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator) API.

**Parameters:**
- `owner` (required): Repository owner
- `repo` (required): Repository name
- `username` (required): Username of the collaborator to add
- `permission` (optional): Permission level to grant - `pull`, `triage`, `push`, `maintain`, or `admin` (defaults to `push`)

**Returns:** Confirmation message indicating whether an invitation was sent or if the user already has access.

This complements existing repo management tools like `create_repository`, `fork_repository`, and `create_branch`.

### Example prompts or workflows (for tools/toolsets only)

1. "Add @contractor-jane to my private repo `acme/secret-project` with read-only access"
2. "Grant @new-hire push access to `myorg/backend-service`"
3. "Give @security-auditor maintain permissions on `myorg/infrastructure`"
4. "Add the following users to my repo with triage access: @alice, @bob, @charlie"
5. "Onboard @intern-2025 to all my private repos with pull access"

### Additional context

I have an implementation ready that follows existing patterns in the codebase, including comprehensive tests. Happy to submit a PR if this feature is accepted.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。