Prototype for Tool Filtering #1
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC - Prototype for MCP Tool Filtering
The problem outlined below is not unique to the GitHub MCP Server; but this server has a lot of tools that are well understood by the community (and there's many more to implement!) so this felt like an ideal place for prototyping.
Problem
MCP Servers conventionally expose all tools they are capable of; which clients discover via tools/list. There are a number of problems with this:
Additionally, there are use cases in which a user may wish to have multiple instances of the same MCP Server, with differing configurations and tools available.
Proposal
Standardize
--include-tools
and--exclude-tools
arguments when invokingstdio
transport CLI tools.--include-tools
applies an allowlist approach; only exposing the tools specified by the user--exclude-tools
applies a denylist approach; exposing all tools except those specified by the userBy providing these as arguments to the process itself, we ensure the server itself does not register these tools.
tools/list
Example Usage
In this branch, I have hacked filtering into the GitHub MCP Server. In Cursor's MCP configuration, I specify two instances of this server, with different tools available:
Thus Cursor shows the filtered tools which are available:
Pros
mcp.json
)--read-only
or--exclude-super-admin-tools
)Cons
Alternatives