@@ -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,7 +297,7 @@ 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" :
301302 return GetIssueComments (ctx , client , owner , repo , issueNumber , pagination )
302303 case "get_sub_issues" :
@@ -309,7 +310,7 @@ Options are:
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,13 @@ 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 .LockdownEnabled {
329+ shouldFilter := lockdown .ShouldRemoveContent (ctx , gqlClient , * issue .User .Login , * issue .Repository .Owner .Login , * issue .Repository .Name )
330+ if shouldFilter {
331+ return mcp .NewToolResultError ("access to issue details is restricted by lockdown mode" ), nil
332+ }
333+ }
334+
327335 // Sanitize title/body on response
328336 if issue != nil {
329337 if issue .Title != nil {
0 commit comments