Skip to content

Conversation

@m-y-mo
Copy link
Contributor

@m-y-mo m-y-mo commented Oct 10, 2025

The github mcp server got too many tools and can cause error when it is used with other toolboxes

Copilot AI review requested due to automatic review settings October 10, 2025 08:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for optional headers in the GitHub MCP server configuration to allow restricting toolsets and control the server's capabilities. This addresses issues where the GitHub MCP server provides too many tools, potentially causing conflicts when used alongside other toolboxes.

  • Added optional_headers configuration support to server parameters
  • Implemented environment variable substitution for optional headers with graceful fallback when variables are missing
  • Enhanced error handling to skip undefined environment variables in optional headers

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
toolboxes/github_official.yaml Added optional headers for GitHub MCP toolset and readonly mode configuration
taskflows/examples/example_large_list_result_iter.yaml Added example usage setting GITHUB_MCP_TOOLSETS to restrict to pull_requests only
mcp_utils.py Implemented optional_headers processing logic with environment variable substitution and error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

mcp_utils.py Outdated
optional_headers[k] = swap_env(v)
except LookupError as e:
del optional_headers[k]
pass
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pass statement after del is redundant and should be removed for cleaner code.

Suggested change
pass

Copilot uses AI. Check for mistakes.
mcp_utils.py Outdated
except LookupError as e:
del optional_headers[k]
pass
headers.update(optional_headers)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential AttributeError if headers is None. The code should check if headers exists before calling update(), or initialize it as an empty dict if None.

Copilot uses AI. Check for mistakes.
mcp_utils.py Outdated
Comment on lines 349 to 350
del optional_headers[k]
pass
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pass statement after del is redundant and should be removed for cleaner code.

Copilot uses AI. Check for mistakes.
mcp_utils.py Outdated
except LookupError as e:
del optional_headers[k]
pass
headers.update(optional_headers)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential AttributeError if headers is None. The code should check if headers exists before calling update(), or initialize it as an empty dict if None.

Copilot uses AI. Check for mistakes.
p-
p- previously approved these changes Oct 10, 2025
toolboxes:
- github_official
env:
GITHUB_MCP_TOOLSETS: pull_requests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GITHUB_MCP_TOOLSETS: pull_requests
GITHUB_MCP_TOOLSETS: pull_requests # See more available toolsets at: https://github.com/github/github-mcp-server?tab=readme-ov-file#configuration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only add if you think it's necessary (unfortunately, there seems to be no perfect list with all toolsets - at least not in this simple form)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be more complete docs: https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md as you can see it gets bloated quite a lot compare to the one on readme (default is "all") It is also pretty rubbish in that it doesn't really tells you what header to use. I just have to guest and hope that it is the same as the url

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the link in the github_official.yaml file instead as that seems to be a better place for it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@m-y-mo m-y-mo merged commit 2c8d07b into main Oct 10, 2025
3 checks passed
@m-y-mo m-y-mo deleted the restrict_gh_mcp_toolset branch October 10, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants