feat(selective-capability-filtering): add fine-grained tool/resource/prompt filtering #223
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.
Summary
Add the ability to selectively disable or enable specific tools, resources, and prompts from individual MCP servers while keeping the server enabled.
Features
Core Capability Filtering
disabledTools: List of tool names to exclude from the serverenabledTools: List of tool names to include (whitelist mode)disabledResources: List of resource URIs to excludeenabledResources: List of resource URIs to include (whitelist mode)disabledPrompts: List of prompt names to excludeenabledPrompts: List of prompt names to include (whitelist mode)CLI Updates
mcp status <server>now shows detailed filtering configurationmcp statussummary view shows per-server filtering indicators like "2 tools, 1 resource"Use Cases
Example Configuration
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "disabledTools": ["create_pull_request", "merge_pull_request"], "disabledPrompts": ["review_code"] }, "production-deploy": { "command": "npx", "args": ["-y", "@trigger.dev/server"], "disabledTools": ["deploy", "rollback"] }, "limited-server": { "command": "npx", "args": ["-y", "some-mcp-server"], "enabledTools": ["safe_tool_1", "safe_tool_2"], "enabledPrompts": ["safe_prompt"] } } }Changes
Core Implementation
src/core/types/transport.ts: Added schema fields for filteringsrc/core/types/client.ts: Added serverConfig to OutboundConnectionsrc/core/server/mcpServerLifecycleManager.ts: Store config on connectionsrc/core/capabilities/capabilityAggregator.ts: Added filterCapabilities functionCLI Updates
src/commands/mcp/status.ts: Added filtering display and getFilteringSummary functionsrc/commands/mcp/status.test.ts: New test file with 17 testsTests
src/core/capabilities/capabilityAggregator.test.ts: Added 9 filtering testsDocumentation
docs/en/reference/mcp-servers.md: Added "Selective Capability Filtering" sectiondocs/zh/reference/mcp-servers.md: Added Chinese translation of "Selective Capability Filtering" sectiondocs/public/schemas/v1.0.0/mcp-config.json: Updated JSON schemamcp.json.example: Added filtering examplesTest Plan
✅ All 2947 existing tests pass
✅ ESLint checks pass
✅ TypeScript compilation successful
🤖 Generated with Claude Code