Skip to content

Conversation

@hongkongkiwi
Copy link

@hongkongkiwi hongkongkiwi commented Jan 25, 2026

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 server
  • enabledTools: List of tool names to include (whitelist mode)
  • disabledResources: List of resource URIs to exclude
  • enabledResources: List of resource URIs to include (whitelist mode)
  • disabledPrompts: List of prompt names to exclude
  • enabledPrompts: List of prompt names to include (whitelist mode)

CLI Updates

  • mcp status <server> now shows detailed filtering configuration
  • mcp status summary view shows per-server filtering indicators like "2 tools, 1 resource"

Use Cases

  • Disable potentially dangerous tools like deploy, delete, or merge operations
  • Limit AI assistants to only the tools they need for their specific task
  • Reduce context by hiding unnecessary capabilities

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 filtering
  • src/core/types/client.ts: Added serverConfig to OutboundConnection
  • src/core/server/mcpServerLifecycleManager.ts: Store config on connection
  • src/core/capabilities/capabilityAggregator.ts: Added filterCapabilities function

CLI Updates

  • src/commands/mcp/status.ts: Added filtering display and getFilteringSummary function
  • src/commands/mcp/status.test.ts: New test file with 17 tests

Tests

  • src/core/capabilities/capabilityAggregator.test.ts: Added 9 filtering tests
  • Total: 26 new tests (2947 tests passing)

Documentation

  • docs/en/reference/mcp-servers.md: Added "Selective Capability Filtering" section
  • docs/zh/reference/mcp-servers.md: Added Chinese translation of "Selective Capability Filtering" section
  • docs/public/schemas/v1.0.0/mcp-config.json: Updated JSON schema
  • mcp.json.example: Added filtering examples

Test Plan

✅ All 2947 existing tests pass
✅ ESLint checks pass
✅ TypeScript compilation successful

🤖 Generated with Claude Code

hongkongkiwi and others added 2 commits January 25, 2026 19:10
…prompt filtering

Add the ability to selectively disable or enable specific tools, resources,
and prompts from individual MCP servers while keeping the server enabled.

Features:
- disabledTools: List of tool names to exclude from the server
- enabledTools: List of tool names to include (whitelist mode)
- disabledResources: List of resource URIs to exclude
- enabledResources: List of resource URIs to include (whitelist mode)
- disabledPrompts: List of prompt names to exclude
- enabledPrompts: List of prompt names to include (whitelist mode)

Use cases:
- Disable potentially dangerous tools like deploy, delete, or merge operations
- Limit AI assistants to only the tools they need for their specific task
- Reduce context by hiding unnecessary capabilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…iltering

Add comprehensive unit tests for the new disabledTools, enabledTools,
disabledResources, enabledResources, disabledPrompts, and enabledPrompts
filtering functionality.

Tests cover:
- Filtering out disabled tools
- Whitelisting with enabledTools
- Filtering disabled/enabled resources
- Filtering disabled/enabled prompts
- Passing through all capabilities when no server config
- Filtering multiple capability types simultaneously
- Priority: enabled takes precedence over disabled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
hongkongkiwi and others added 2 commits January 25, 2026 19:19
…utput

Update `mcp status <server>` to display disabled/enabled tools, resources,
and prompts configuration for each server.

Output now shows:
- Enabled Tools / Disabled Tools
- Enabled Resources / Disabled Resources
- Enabled Prompts / Disabled Prompts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add filtering indicators to the summary view in `mcp status` output.
Each server now shows Filtering: "N tools, M resources, K prompts"
with (enabled) suffix for whitelisted items.

Add 10 unit tests for getFilteringSummary function covering:
- No filtering case
- Disabled/enabled tools/resources/prompts
- Multiple filtering types combination
- Pluralization (1 tool vs 2 tools)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@xizhibei
Copy link
Contributor

Thank you for your contribution. The implementation of the feature looks great. I now need some time to review and think about the requirement itself.

@hongkongkiwi
Copy link
Author

This one is especially important I think as tools grow in usage and popularity.

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.

2 participants