Skip to content

Commit a1bf6c3

Browse files
feat(governance): add rulesets tools in new governance toolset
Add a new non-default "governance" toolset (icon: law) with tools for managing GitHub repository rulesets at the repository, organization, and enterprise levels. Read operations are consolidated behind method-dispatch tools to match the current MCP surface: - repository_ruleset_read (get, list, get_rules_for_branch, list_rule_suites, get_rule_suite) - organization_repository_ruleset_read (get, list) Write operations remain single-purpose tools, split by level because each level requires a distinct OAuth scope for scope-challenge accuracy: - create_repository_ruleset (repo) - create_organization_repository_ruleset (admin:org) - create_enterprise_repository_ruleset (admin:enterprise) Adds the read:enterprise and admin:enterprise scopes and the law octicon as shared governance infrastructure. Supersedes #821. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e886867-a922-419a-b02c-ac643716aea8
1 parent 822c877 commit a1bf6c3

14 files changed

Lines changed: 1772 additions & 6 deletions

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ The following sets of tools are available:
597597
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/comment-discussion-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/comment-discussion-light.png"><img src="pkg/octicons/icons/comment-discussion-light.png" width="20" height="20" alt="comment-discussion"></picture> | `discussions` | GitHub Discussions related tools |
598598
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/logo-gist-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/logo-gist-light.png"><img src="pkg/octicons/icons/logo-gist-light.png" width="20" height="20" alt="logo-gist"></picture> | `gists` | GitHub Gist related tools |
599599
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/git-branch-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/git-branch-light.png"><img src="pkg/octicons/icons/git-branch-light.png" width="20" height="20" alt="git-branch"></picture> | `git` | GitHub Git API related tools for low-level Git operations |
600+
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/law-light.png"><img src="pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture> | `governance` | Repository governance tools for managing rulesets at the repository, organization, and enterprise levels |
600601
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/issue-opened-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/issue-opened-light.png"><img src="pkg/octicons/icons/issue-opened-light.png" width="20" height="20" alt="issue-opened"></picture> | `issues` | GitHub Issues related tools |
601602
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/tag-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/tag-light.png"><img src="pkg/octicons/icons/tag-light.png" width="20" height="20" alt="tag"></picture> | `labels` | GitHub Labels related tools |
602603
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/bell-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/bell-light.png"><img src="pkg/octicons/icons/bell-light.png" width="20" height="20" alt="bell"></picture> | `notifications` | GitHub Notifications related tools |
@@ -883,6 +884,75 @@ The following sets of tools are available:
883884

884885
<details>
885886

887+
<summary><picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/law-light.png"><img src="pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture> Governance</summary>
888+
889+
- **create_enterprise_repository_ruleset** - Create enterprise repository ruleset
890+
- **Required OAuth Scopes**: `admin:enterprise`
891+
- `bypass_actors`: The actors that can bypass the rules in this ruleset (object[], optional)
892+
- `conditions`: Conditions for when this ruleset applies, e.g. {"ref_name": {"include": ["refs/heads/main"], "exclude": []}} (object, optional)
893+
- `enforcement`: The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them (string, required)
894+
- `enterprise`: Enterprise slug (string, required)
895+
- `name`: The name of the ruleset (string, required)
896+
- `rules`: An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object (object[], required)
897+
- `target`: The target of the ruleset. Defaults to 'branch' (string, optional)
898+
899+
- **create_organization_repository_ruleset** - Create organization repository ruleset
900+
- **Required OAuth Scopes**: `admin:org`
901+
- `bypass_actors`: The actors that can bypass the rules in this ruleset (object[], optional)
902+
- `conditions`: Conditions for when this ruleset applies, e.g. {"ref_name": {"include": ["refs/heads/main"], "exclude": []}} (object, optional)
903+
- `enforcement`: The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them (string, required)
904+
- `name`: The name of the ruleset (string, required)
905+
- `org`: Organization name (string, required)
906+
- `rules`: An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object (object[], required)
907+
- `target`: The target of the ruleset. Defaults to 'branch' (string, optional)
908+
909+
- **create_repository_ruleset** - Create repository ruleset
910+
- **Required OAuth Scopes**: `repo`
911+
- `bypass_actors`: The actors that can bypass the rules in this ruleset (object[], optional)
912+
- `conditions`: Conditions for when this ruleset applies, e.g. {"ref_name": {"include": ["refs/heads/main"], "exclude": []}} (object, optional)
913+
- `enforcement`: The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them (string, required)
914+
- `name`: The name of the ruleset (string, required)
915+
- `owner`: Repository owner (string, required)
916+
- `repo`: Repository name (string, required)
917+
- `rules`: An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object (object[], required)
918+
- `target`: The target of the ruleset. Defaults to 'branch' (string, optional)
919+
920+
- **organization_repository_ruleset_read** - Read organization repository rulesets
921+
- **Required OAuth Scopes**: `read:org`
922+
- **Accepted OAuth Scopes**: `admin:org`, `read:org`, `write:org`
923+
- `method`: Operation to perform:
924+
- 'get': Get a specific repository ruleset by ID (requires 'ruleset_id').
925+
- 'list': List all repository rulesets for the organization. (string, required)
926+
- `org`: Organization name (string, required)
927+
- `page`: Page number for pagination (min 1) (number, optional)
928+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
929+
- `ruleset_id`: Ruleset ID. Required for the 'get' method. (number, optional)
930+
931+
- **repository_ruleset_read** - Read repository rulesets
932+
- **Required OAuth Scopes**: `repo`
933+
- `actor_name`: The handle for the GitHub user account to filter rule suites on. Used by the 'list_rule_suites' method. (string, optional)
934+
- `branch`: Branch name. Required for the 'get_rules_for_branch' method. (string, optional)
935+
- `includes_parents`: Include rulesets configured at higher levels that also apply. Defaults to true. Used by the 'get' and 'list' methods. (boolean, optional)
936+
- `method`: Operation to perform:
937+
- 'get': Get a specific ruleset by ID (requires 'ruleset_id').
938+
- 'list': List all rulesets for the repository.
939+
- 'get_rules_for_branch': Get all rules that apply to a branch (requires 'branch').
940+
- 'list_rule_suites': List rule suites, the evaluations of rules against pushes.
941+
- 'get_rule_suite': Get a specific rule suite by ID (requires 'rule_suite_id'). (string, required)
942+
- `owner`: Repository owner (string, required)
943+
- `page`: Page number for pagination (min 1) (number, optional)
944+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
945+
- `ref`: The name of the ref (branch, tag, etc.) to filter rule suites by. Used by the 'list_rule_suites' method. (string, optional)
946+
- `repo`: Repository name (string, required)
947+
- `rule_suite_id`: Rule suite ID. Required for the 'get_rule_suite' method. (number, optional)
948+
- `rule_suite_result`: The rule suite result to filter by. Used by the 'list_rule_suites' method. (string, optional)
949+
- `ruleset_id`: Ruleset ID. Required for the 'get' method. (number, optional)
950+
- `time_period`: The time period to filter rule suites by. Used by the 'list_rule_suites' method. (string, optional)
951+
952+
</details>
953+
954+
<details>
955+
886956
<summary><picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/issue-opened-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/issue-opened-light.png"><img src="pkg/octicons/icons/issue-opened-light.png" width="20" height="20" alt="issue-opened"></picture> Issues</summary>
887957

888958
- **add_issue_comment** - Add comment to issue or pull request

docs/remote-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
3030
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/comment-discussion-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/comment-discussion-light.png"><img src="../pkg/octicons/icons/comment-discussion-light.png" width="20" height="20" alt="comment-discussion"></picture><br>`discussions` | GitHub Discussions related tools | https://api.githubcopilot.com/mcp/x/discussions | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/discussions/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%2Freadonly%22%7D) |
3131
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/logo-gist-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/logo-gist-light.png"><img src="../pkg/octicons/icons/logo-gist-light.png" width="20" height="20" alt="logo-gist"></picture><br>`gists` | GitHub Gist related tools | https://api.githubcopilot.com/mcp/x/gists | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/gists/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%2Freadonly%22%7D) |
3232
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/git-branch-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/git-branch-light.png"><img src="../pkg/octicons/icons/git-branch-light.png" width="20" height="20" alt="git-branch"></picture><br>`git` | GitHub Git API related tools for low-level Git operations | https://api.githubcopilot.com/mcp/x/git | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/git/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%2Freadonly%22%7D) |
33+
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/law-light.png"><img src="../pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture><br>`governance` | Repository governance tools for managing rulesets at the repository, organization, and enterprise levels | https://api.githubcopilot.com/mcp/x/governance | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/governance/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%2Freadonly%22%7D) |
3334
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/issue-opened-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/issue-opened-light.png"><img src="../pkg/octicons/icons/issue-opened-light.png" width="20" height="20" alt="issue-opened"></picture><br>`issues` | GitHub Issues related tools | https://api.githubcopilot.com/mcp/x/issues | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/issues/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%2Freadonly%22%7D) |
3435
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/tag-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/tag-light.png"><img src="../pkg/octicons/icons/tag-light.png" width="20" height="20" alt="tag"></picture><br>`labels` | GitHub Labels related tools | https://api.githubcopilot.com/mcp/x/labels | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/labels/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%2Freadonly%22%7D) |
3536
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/bell-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/bell-light.png"><img src="../pkg/octicons/icons/bell-light.png" width="20" height="20" alt="bell"></picture><br>`notifications` | GitHub Notifications related tools | https://api.githubcopilot.com/mcp/x/notifications | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/notifications/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%2Freadonly%22%7D) |
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"annotations": {
3+
"title": "Create enterprise repository ruleset"
4+
},
5+
"description": "Create a new repository ruleset for an enterprise",
6+
"inputSchema": {
7+
"properties": {
8+
"bypass_actors": {
9+
"description": "The actors that can bypass the rules in this ruleset",
10+
"items": {
11+
"properties": {
12+
"actor_id": {
13+
"description": "The ID of the actor that can bypass a ruleset",
14+
"type": "number"
15+
},
16+
"actor_type": {
17+
"description": "The type of actor that can bypass a ruleset",
18+
"enum": [
19+
"Integration",
20+
"OrganizationAdmin",
21+
"RepositoryRole",
22+
"Team",
23+
"DeployKey"
24+
],
25+
"type": "string"
26+
},
27+
"bypass_mode": {
28+
"description": "When the specified actor can bypass the ruleset",
29+
"enum": [
30+
"always",
31+
"pull_request"
32+
],
33+
"type": "string"
34+
}
35+
},
36+
"type": "object"
37+
},
38+
"type": "array"
39+
},
40+
"conditions": {
41+
"description": "Conditions for when this ruleset applies, e.g. {\"ref_name\": {\"include\": [\"refs/heads/main\"], \"exclude\": []}}",
42+
"type": "object"
43+
},
44+
"enforcement": {
45+
"description": "The enforcement level of the ruleset. 'evaluate' allows admins to test rules before enforcing them",
46+
"enum": [
47+
"disabled",
48+
"active",
49+
"evaluate"
50+
],
51+
"type": "string"
52+
},
53+
"enterprise": {
54+
"description": "Enterprise slug",
55+
"type": "string"
56+
},
57+
"name": {
58+
"description": "The name of the ruleset",
59+
"type": "string"
60+
},
61+
"rules": {
62+
"description": "An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object",
63+
"items": {
64+
"properties": {
65+
"parameters": {
66+
"description": "Parameters for rule types that require additional configuration",
67+
"type": "object"
68+
},
69+
"type": {
70+
"description": "The type of rule, e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks'",
71+
"type": "string"
72+
}
73+
},
74+
"required": [
75+
"type"
76+
],
77+
"type": "object"
78+
},
79+
"type": "array"
80+
},
81+
"target": {
82+
"description": "The target of the ruleset. Defaults to 'branch'",
83+
"enum": [
84+
"branch",
85+
"tag",
86+
"push",
87+
"repository"
88+
],
89+
"type": "string"
90+
}
91+
},
92+
"required": [
93+
"enterprise",
94+
"name",
95+
"enforcement",
96+
"rules"
97+
],
98+
"type": "object"
99+
},
100+
"name": "create_enterprise_repository_ruleset"
101+
}

0 commit comments

Comments
 (0)