77
88 ghErrors "github.com/github/github-mcp-server/pkg/errors"
99 "github.com/github/github-mcp-server/pkg/inventory"
10+ "github.com/github/github-mcp-server/pkg/scopes"
1011 "github.com/github/github-mcp-server/pkg/translations"
1112 "github.com/github/github-mcp-server/pkg/utils"
1213 "github.com/google/jsonschema-go/jsonschema"
@@ -38,7 +39,7 @@ type UserDetails struct {
3839
3940// GetMe creates a tool to get details of the authenticated user.
4041func GetMe (t translations.TranslationHelperFunc ) inventory.ServerTool {
41- return NewTool (
42+ return NewToolWithScopes (
4243 ToolsetMetadataContext ,
4344 mcp.Tool {
4445 Name : "get_me" ,
@@ -51,6 +52,8 @@ func GetMe(t translations.TranslationHelperFunc) inventory.ServerTool {
5152 // OpenAI strict mode requires the properties field to be present.
5253 InputSchema : json .RawMessage (`{"type":"object","properties":{}}` ),
5354 },
55+ nil , // no required scopes
56+ nil , // no accepted scopes
5457 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , _ map [string ]any ) (* mcp.CallToolResult , any , error ) {
5558 client , err := deps .GetClient (ctx )
5659 if err != nil {
@@ -110,7 +113,7 @@ type OrganizationTeams struct {
110113}
111114
112115func GetTeams (t translations.TranslationHelperFunc ) inventory.ServerTool {
113- return NewTool (
116+ return NewToolWithScopes (
114117 ToolsetMetadataContext ,
115118 mcp.Tool {
116119 Name : "get_teams" ,
@@ -129,6 +132,8 @@ func GetTeams(t translations.TranslationHelperFunc) inventory.ServerTool {
129132 },
130133 },
131134 },
135+ scopes .ToStringSlice (scopes .ReadOrg ),
136+ scopes .ToStringSlice (scopes .ReadOrg , scopes .WriteOrg , scopes .AdminOrg ),
132137 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
133138 user , err := OptionalParam [string ](args , "user" )
134139 if err != nil {
@@ -207,7 +212,7 @@ func GetTeams(t translations.TranslationHelperFunc) inventory.ServerTool {
207212}
208213
209214func GetTeamMembers (t translations.TranslationHelperFunc ) inventory.ServerTool {
210- return NewTool (
215+ return NewToolWithScopes (
211216 ToolsetMetadataContext ,
212217 mcp.Tool {
213218 Name : "get_team_members" ,
@@ -231,6 +236,8 @@ func GetTeamMembers(t translations.TranslationHelperFunc) inventory.ServerTool {
231236 Required : []string {"org" , "team_slug" },
232237 },
233238 },
239+ scopes .ToStringSlice (scopes .ReadOrg ),
240+ scopes .ToStringSlice (scopes .ReadOrg , scopes .WriteOrg , scopes .AdminOrg ),
234241 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
235242 org , err := RequiredParam [string ](args , "org" )
236243 if err != nil {
0 commit comments