Prototype for Tool Filtering - #1
Open
almostwhitehat wants to merge 2 commits into
Open
almostwhitehat wants to merge 2 commits into
almostwhitehat wants to merge 2 commits into
Conversation
|
Nice. I did something similar in a Git MCP I've been using for exactly this reason:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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-toolsand--exclude-toolsarguments when invokingstdiotransport CLI tools.--include-toolsapplies an allowlist approach; only exposing the tools specified by the user--exclude-toolsapplies 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/listExample 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-onlyor--exclude-super-admin-tools)Cons
Alternatives