@@ -11,6 +11,7 @@ import (
1111
1212 ghErrors "github.com/github/github-mcp-server/pkg/errors"
1313 "github.com/github/github-mcp-server/pkg/inventory"
14+ "github.com/github/github-mcp-server/pkg/scopes"
1415 "github.com/github/github-mcp-server/pkg/lockdown"
1516 "github.com/github/github-mcp-server/pkg/octicons"
1617 "github.com/github/github-mcp-server/pkg/sanitize"
@@ -545,7 +546,7 @@ func GetIssueLabels(ctx context.Context, client *githubv4.Client, owner string,
545546
546547// ListIssueTypes creates a tool to list defined issue types for an organization. This can be used to understand supported issue type values for creating or updating issues.
547548func ListIssueTypes (t translations.TranslationHelperFunc ) inventory.ServerTool {
548- return NewTool (
549+ return NewToolWithScopes (
549550 ToolsetMetadataIssues ,
550551 mcp.Tool {
551552 Name : "list_issue_types" ,
@@ -565,6 +566,8 @@ func ListIssueTypes(t translations.TranslationHelperFunc) inventory.ServerTool {
565566 Required : []string {"owner" },
566567 },
567568 },
569+ scopes .ToStringSlice (scopes .ReadOrg ),
570+ scopes .ToStringSlice (scopes .ReadOrg , scopes .WriteOrg , scopes .AdminOrg ),
568571 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
569572 owner , err := RequiredParam [string ](args , "owner" )
570573 if err != nil {
@@ -600,7 +603,7 @@ func ListIssueTypes(t translations.TranslationHelperFunc) inventory.ServerTool {
600603
601604// AddIssueComment creates a tool to add a comment to an issue.
602605func AddIssueComment (t translations.TranslationHelperFunc ) inventory.ServerTool {
603- return NewTool (
606+ return NewToolWithScopes (
604607 ToolsetMetadataIssues ,
605608 mcp.Tool {
606609 Name : "add_issue_comment" ,
@@ -632,6 +635,8 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
632635 Required : []string {"owner" , "repo" , "issue_number" , "body" },
633636 },
634637 },
638+ scopes .ToStringSlice (scopes .Repo ),
639+ scopes .ToStringSlice (scopes .Repo ),
635640 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
636641 owner , err := RequiredParam [string ](args , "owner" )
637642 if err != nil {
@@ -683,7 +688,7 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
683688
684689// SubIssueWrite creates a tool to add a sub-issue to a parent issue.
685690func SubIssueWrite (t translations.TranslationHelperFunc ) inventory.ServerTool {
686- return NewTool (
691+ return NewToolWithScopes (
687692 ToolsetMetadataIssues ,
688693 mcp.Tool {
689694 Name : "sub_issue_write" ,
@@ -736,6 +741,8 @@ Options are:
736741 Required : []string {"method" , "owner" , "repo" , "issue_number" , "sub_issue_id" },
737742 },
738743 },
744+ scopes .ToStringSlice (scopes .Repo ),
745+ scopes .ToStringSlice (scopes .Repo ),
739746 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
740747 method , err := RequiredParam [string ](args , "method" )
741748 if err != nil {
@@ -971,7 +978,7 @@ func SearchIssues(t translations.TranslationHelperFunc) inventory.ServerTool {
971978
972979// IssueWrite creates a tool to create a new or update an existing issue in a GitHub repository.
973980func IssueWrite (t translations.TranslationHelperFunc ) inventory.ServerTool {
974- return NewTool (
981+ return NewToolWithScopes (
975982 ToolsetMetadataIssues ,
976983 mcp.Tool {
977984 Name : "issue_write" ,
@@ -1052,6 +1059,8 @@ Options are:
10521059 Required : []string {"method" , "owner" , "repo" },
10531060 },
10541061 },
1062+ scopes .ToStringSlice (scopes .Repo ),
1063+ scopes .ToStringSlice (scopes .Repo ),
10551064 func (ctx context.Context , deps ToolDependencies , _ * mcp.CallToolRequest , args map [string ]any ) (* mcp.CallToolResult , any , error ) {
10561065 method , err := RequiredParam [string ](args , "method" )
10571066 if err != nil {
0 commit comments