Skip to content

Commit 32b1efe

Browse files
Expand FGP annotations to repos, context, projects, issue-fields
Annotate the remaining clearly-mappable tools with RequiredPermissions and regenerate the permissions docs table from the tool definitions: - repos: create_repository, fork_repository (administration:write); list_repository_collaborators (administration:read) - context: get_teams, get_team_members (members:read) - projects: projects_get/list (organization_projects:read), projects_write (organization_projects:write) - issues: list_issue_fields (issues:read) list_issue_types stays ungated (org-level issue-type config has no clean repo/org catalog permission). Docs table grows 50->58 rows and is idempotent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fc51918 commit 32b1efe

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

docs/permissions-filtering.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ The generated table below is produced by `script/generate-docs` and lists every
5757
| `actions` | `get_job_logs` | `actions:read` |
5858
| `code_security` | `get_code_scanning_alert` | `security_events:read` |
5959
| `code_security` | `list_code_scanning_alerts` | `security_events:read` |
60+
| `context` | `get_team_members` | `members:read` |
61+
| `context` | `get_teams` | `members:read` |
6062
| `dependabot` | `get_dependabot_alert` | `vulnerability_alerts:read` |
6163
| `dependabot` | `list_dependabot_alerts` | `vulnerability_alerts:read` |
6264
| `discussions` | `discussion_comment_write` | `discussions:write` |
@@ -74,6 +76,9 @@ The generated table below is produced by `script/generate-docs` and lists every
7476
| `labels` | `get_label` | `issues:read` |
7577
| `labels` | `label_write` | `issues:write` |
7678
| `labels` | `list_label` | `issues:read` |
79+
| `projects` | `projects_get` | `organization_projects:read` |
80+
| `projects` | `projects_list` | `organization_projects:read` |
81+
| `projects` | `projects_write` | `organization_projects:write` |
7782
| `pull_requests` | `add_comment_to_pending_review` | `pull_requests:write` |
7883
| `pull_requests` | `add_reply_to_pull_request_comment` | `pull_requests:write` |
7984
| `pull_requests` | `create_pull_request` | `pull_requests:write` |
@@ -85,7 +90,9 @@ The generated table below is produced by `script/generate-docs` and lists every
8590
| `pull_requests` | `update_pull_request` | `pull_requests:write` |
8691
| `repos` | `create_branch` | `contents:write` |
8792
| `repos` | `create_or_update_file` | `contents:write` |
93+
| `repos` | `create_repository` | `administration:write` |
8894
| `repos` | `delete_file` | `contents:write` |
95+
| `repos` | `fork_repository` | `administration:write` |
8996
| `repos` | `get_commit` | `contents:read` |
9097
| `repos` | `get_file_contents` | `contents:read` |
9198
| `repos` | `get_latest_release` | `contents:read` |
@@ -94,6 +101,7 @@ The generated table below is produced by `script/generate-docs` and lists every
94101
| `repos` | `list_branches` | `contents:read` |
95102
| `repos` | `list_commits` | `contents:read` |
96103
| `repos` | `list_releases` | `contents:read` |
104+
| `repos` | `list_repository_collaborators` | `administration:read` |
97105
| `repos` | `list_tags` | `contents:read` |
98106
| `repos` | `push_files` | `contents:write` |
99107
| `secret_protection` | `get_secret_scanning_alert` | `secret_scanning_alerts:read` |

pkg/github/context_tools.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
ghErrors "github.com/github/github-mcp-server/pkg/errors"
99
"github.com/github/github-mcp-server/pkg/ifc"
1010
"github.com/github/github-mcp-server/pkg/inventory"
11+
"github.com/github/github-mcp-server/pkg/permissions"
1112
"github.com/github/github-mcp-server/pkg/scopes"
1213
"github.com/github/github-mcp-server/pkg/translations"
1314
"github.com/github/github-mcp-server/pkg/utils"
@@ -223,7 +224,7 @@ func GetTeams(t translations.TranslationHelperFunc) inventory.ServerTool {
223224
result = attachStaticIFCLabel(ctx, deps, result, ifc.LabelTeam())
224225
return result, nil, nil
225226
},
226-
)
227+
).WithPermissions(permissions.Require(permissions.Members.Read()))
227228
}
228229

229230
func GetTeamMembers(t translations.TranslationHelperFunc) inventory.ServerTool {
@@ -299,5 +300,5 @@ func GetTeamMembers(t translations.TranslationHelperFunc) inventory.ServerTool {
299300
result = attachStaticIFCLabel(ctx, deps, result, ifc.LabelTeam())
300301
return result, nil, nil
301302
},
302-
)
303+
).WithPermissions(permissions.Require(permissions.Members.Read()))
303304
}

pkg/github/issue_fields.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
ghErrors "github.com/github/github-mcp-server/pkg/errors"
1111
"github.com/github/github-mcp-server/pkg/ifc"
1212
"github.com/github/github-mcp-server/pkg/inventory"
13+
"github.com/github/github-mcp-server/pkg/permissions"
1314
"github.com/github/github-mcp-server/pkg/scopes"
1415
"github.com/github/github-mcp-server/pkg/translations"
1516
"github.com/github/github-mcp-server/pkg/utils"
@@ -169,7 +170,7 @@ func ListIssueFields(t translations.TranslationHelperFunc) inventory.ServerTool
169170
return result, nil, nil
170171
})
171172
st.FeatureFlagEnable = FeatureFlagIssueFields
172-
return st
173+
return st.WithPermissions(permissions.Require(permissions.Issues.Read()))
173174
}
174175

175176
// fetchIssueFields returns the issue field definitions for the given owner.

pkg/github/projects.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
ghErrors "github.com/github/github-mcp-server/pkg/errors"
1313
"github.com/github/github-mcp-server/pkg/ifc"
1414
"github.com/github/github-mcp-server/pkg/inventory"
15+
"github.com/github/github-mcp-server/pkg/permissions"
1516
"github.com/github/github-mcp-server/pkg/scopes"
1617
"github.com/github/github-mcp-server/pkg/translations"
1718
"github.com/github/github-mcp-server/pkg/utils"
@@ -273,7 +274,7 @@ Use this tool to list projects for a user or organization, or list project field
273274
}
274275
}
275276
},
276-
)
277+
).WithPermissions(permissions.Require(permissions.OrganizationProjects.Read()))
277278
return tool
278279
}
279280

@@ -422,7 +423,7 @@ Use this tool to get details about individual projects, project fields, and proj
422423
return utils.NewToolResultError(fmt.Sprintf("unknown method: %s", method)), nil, nil
423424
}
424425
},
425-
)
426+
).WithPermissions(permissions.Require(permissions.OrganizationProjects.Read()))
426427
return tool
427428
}
428429

@@ -672,7 +673,7 @@ func ProjectsWrite(t translations.TranslationHelperFunc) inventory.ServerTool {
672673
return utils.NewToolResultError(fmt.Sprintf("unknown method: %s", method)), nil, nil
673674
}
674675
},
675-
)
676+
).WithPermissions(permissions.Require(permissions.OrganizationProjects.Write()))
676677
return tool
677678
}
678679

pkg/github/repositories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ func CreateRepository(t translations.TranslationHelperFunc) inventory.ServerTool
676676

677677
return utils.NewToolResultText(string(r)), nil, nil
678678
},
679-
)
679+
).WithPermissions(permissions.Require(permissions.Administration.Write()))
680680
}
681681

682682
// FetchRepoIsPrivate returns whether a repository is private. It is a thin
@@ -986,7 +986,7 @@ func ForkRepository(t translations.TranslationHelperFunc) inventory.ServerTool {
986986

987987
return utils.NewToolResultText(string(r)), nil, nil
988988
},
989-
)
989+
).WithPermissions(permissions.Require(permissions.Administration.Write()))
990990
}
991991

992992
// DeleteFile creates a tool to delete a file in a GitHub repository.
@@ -2795,5 +2795,5 @@ func ListRepositoryCollaborators(t translations.TranslationHelperFunc) inventory
27952795
callResult = attachStaticIFCLabel(ctx, deps, callResult, ifc.LabelCollaboratorRoster())
27962796
return callResult, nil, nil
27972797
},
2798-
)
2798+
).WithPermissions(permissions.Require(permissions.Administration.Read()))
27992799
}

0 commit comments

Comments
 (0)