Skip to content

Conversation

@tommaso-moro
Copy link
Contributor

@tommaso-moro tommaso-moro commented Nov 11, 2025

Overview

This PR adds support for tool-specific MCP configuration via a new --tools flag:

  • Users can use the --tools to list which tools they would like to enable
  • Users can also use a mix of --tools, --toolsets, --read-only and --dynamic-toolsets and compose them in whatever way they'd like

Example

Default toolset case: no specific config

Behavior: the "default" toolsets are enabled if no preference is expressed (e.g. --toolsets, --tools, --read-only, dynamic)

✅ working as expected (screenshots) Screenshot 2025-11-24 at 16 25 43

Standard case: X-MCP-Tools only

Behavior: the tools are enabled

✅ working as expected (screenshots) Screenshot 2025-11-20 at 10 48 21

Case with both X-MCP-Tools and X-MCP-Toolsets

Behavior: both toolsets and tools are enabled

✅ working as expected (screenshots)

BEFORE (toolsets only)
Screenshot 2025-11-24 at 16 22 50

AFTER (toolsets + tools)
Screenshot 2025-11-24 at 16 23 51


Case with both X-MCP-Tools and readonly

Behavior: write tools are not enabled, readonly tools are enabled

✅ working as expected (screenshots)

issue_write is not being enabled (correct behavior)
Screenshot 2025-11-24 at 16 18 58


Case with both --tools and --dynamic-toolsets (local MCP only)

Behavior: the MCP starts with the 3 dynamic toolsets (enable_toolset, list_available_toolsets, get_toolset_tools) and the specified tools

✅ working as expected (screenshots) Screenshot 2025-11-24 at 16 19 43

Case with invalid tool name

Behavior: The MCP should throw an error and require the user to use a valid tool

✅ working as expected (screenshots) Screenshot 2025-11-24 at 16 20 46

@tommaso-moro tommaso-moro marked this pull request as ready for review November 21, 2025 09:21
@tommaso-moro tommaso-moro requested a review from a team as a code owner November 21, 2025 09:21
Copilot AI review requested due to automatic review settings November 21, 2025 09:21
Copilot finished reviewing on behalf of tommaso-moro November 21, 2025 09:24
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 introduces tool-specific configuration support via a new --tools flag, enabling users to specify individual tools instead of (or in addition to) toolsets. Users can now compose their MCP server configuration using --tools, --toolsets, --read-only, and --dynamic-toolsets flags in any combination.

Key changes:

  • Added --tools flag for specifying individual tools by name
  • Implemented additive composition logic where tools and toolsets can be combined
  • Maintained read-only mode enforcement (write tools are skipped even if explicitly requested)

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/toolsets/toolsets.go Added ToolDoesNotExistError, FindToolByName method to locate tools across all toolsets, and RegisterSpecificTools method to register individual tools with read-only mode support
pkg/github/tools.go Added CleanTools utility function to remove duplicates and trim whitespace from tool names
internal/ghmcp/server.go Added EnabledTools field to both MCPServerConfig and StdioServerConfig, updated NewMCPServer to handle tool registration additively with toolsets
cmd/github-mcp-server/main.go Added --tools flag, viper binding for the flag, and updated default toolset logic to only apply when neither tools nor toolsets are specified
go.mod Marked github.com/google/go-querystring as indirect dependency
README.md Added comprehensive documentation for --tools flag including examples with command line, environment variables, Docker usage, and composition patterns

Copy link
Contributor

@JoannaaKL JoannaaKL left a comment

Choose a reason for hiding this comment

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

Looks good, it would be great if you could add more tests showing different scenarios like toolsets + tools enabled, read only mode + write tools etc. ❤️

@tommaso-moro
Copy link
Contributor Author

@JoannaaKL good shout, I have added them to the PR description! :)

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.

4 participants