@@ -10,6 +10,7 @@ import (
1010 "time"
1111
1212 ghErrors "github.com/github/github-mcp-server/pkg/errors"
13+ "github.com/github/github-mcp-server/pkg/lockdown"
1314 "github.com/github/github-mcp-server/pkg/sanitize"
1415 "github.com/github/github-mcp-server/pkg/translations"
1516 "github.com/go-viper/mapstructure/v2"
@@ -227,7 +228,7 @@ func fragmentToIssue(fragment IssueFragment) *github.Issue {
227228}
228229
229230// GetIssue creates a tool to get details of a specific issue in a GitHub repository.
230- func IssueRead (getClient GetClientFn , getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
231+ func IssueRead (getClient GetClientFn , getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc , flags FeatureFlags ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
231232 return mcp .NewTool ("issue_read" ,
232233 mcp .WithDescription (t ("TOOL_ISSUE_READ_DESCRIPTION" , "Get information about a specific issue in a GitHub repository." )),
233234 mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -296,20 +297,20 @@ Options are:
296297
297298 switch method {
298299 case "get" :
299- return GetIssue (ctx , client , owner , repo , issueNumber )
300+ return GetIssue (ctx , client , gqlClient , owner , repo , issueNumber , flags )
300301 case "get_comments" :
301- return GetIssueComments (ctx , client , owner , repo , issueNumber , pagination )
302+ return GetIssueComments (ctx , client , owner , repo , issueNumber , pagination , flags )
302303 case "get_sub_issues" :
303- return GetSubIssues (ctx , client , owner , repo , issueNumber , pagination )
304+ return GetSubIssues (ctx , client , owner , repo , issueNumber , pagination , flags )
304305 case "get_labels" :
305- return GetIssueLabels (ctx , gqlClient , owner , repo , issueNumber )
306+ return GetIssueLabels (ctx , gqlClient , owner , repo , issueNumber , flags )
306307 default :
307308 return mcp .NewToolResultError (fmt .Sprintf ("unknown method: %s" , method )), nil
308309 }
309310 }
310311}
311312
312- func GetIssue (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int ) (* mcp.CallToolResult , error ) {
313+ func GetIssue (ctx context.Context , client * github.Client , gqlClient * githubv4. Client , owner string , repo string , issueNumber int , flags FeatureFlags ) (* mcp.CallToolResult , error ) {
313314 issue , resp , err := client .Issues .Get (ctx , owner , repo , issueNumber )
314315 if err != nil {
315316 return nil , fmt .Errorf ("failed to get issue: %w" , err )
@@ -324,6 +325,18 @@ func GetIssue(ctx context.Context, client *github.Client, owner string, repo str
324325 return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue: %s" , string (body ))), nil
325326 }
326327
328+ if flags .LockdownMode {
329+ if issue .User != nil {
330+ shouldRemoveContent , err := lockdown .ShouldRemoveContent (ctx , gqlClient , * issue .User .Login , owner , repo )
331+ if err != nil {
332+ return mcp .NewToolResultError (fmt .Sprintf ("failed to check lockdown mode: %v" , err )), nil
333+ }
334+ if shouldRemoveContent {
335+ return mcp .NewToolResultError ("access to issue details is restricted by lockdown mode" ), nil
336+ }
337+ }
338+ }
339+
327340 // Sanitize title/body on response
328341 if issue != nil {
329342 if issue .Title != nil {
@@ -342,7 +355,7 @@ func GetIssue(ctx context.Context, client *github.Client, owner string, repo str
342355 return mcp .NewToolResultText (string (r )), nil
343356}
344357
345- func GetIssueComments (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int , pagination PaginationParams ) (* mcp.CallToolResult , error ) {
358+ func GetIssueComments (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int , pagination PaginationParams , _ FeatureFlags ) (* mcp.CallToolResult , error ) {
346359 opts := & github.IssueListCommentsOptions {
347360 ListOptions : github.ListOptions {
348361 Page : pagination .Page ,
@@ -372,7 +385,7 @@ func GetIssueComments(ctx context.Context, client *github.Client, owner string,
372385 return mcp .NewToolResultText (string (r )), nil
373386}
374387
375- func GetSubIssues (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int , pagination PaginationParams ) (* mcp.CallToolResult , error ) {
388+ func GetSubIssues (ctx context.Context , client * github.Client , owner string , repo string , issueNumber int , pagination PaginationParams , _ FeatureFlags ) (* mcp.CallToolResult , error ) {
376389 opts := & github.IssueListOptions {
377390 ListOptions : github.ListOptions {
378391 Page : pagination .Page ,
@@ -407,7 +420,7 @@ func GetSubIssues(ctx context.Context, client *github.Client, owner string, repo
407420 return mcp .NewToolResultText (string (r )), nil
408421}
409422
410- func GetIssueLabels (ctx context.Context , client * githubv4.Client , owner string , repo string , issueNumber int ) (* mcp.CallToolResult , error ) {
423+ func GetIssueLabels (ctx context.Context , client * githubv4.Client , owner string , repo string , issueNumber int , _ FeatureFlags ) (* mcp.CallToolResult , error ) {
411424 // Get current labels on the issue using GraphQL
412425 var query struct {
413426 Repository struct {
0 commit comments