tool-filter-mcp
MCP proxy server that filters tools from upstream MCP servers via regex-based deny list.
Maintained: ✅ Yes (Fall 2025)
Why use this?
For effective context engineering, we want to minimize useless tokens. Most major agents right now (e.g. Claude Code) do NOT remove tool descriptions from the context. Even though the tool is completely denied and unused, the model will still get its entire description and still try to call the tool (and get error messages). For big MCPs, such as github, supabase, jetbrains IDE, atlassian, this is catastrophic to the context and leads to context pollution by 40-60k of useless tokens. You wanted your agent to be able to see jira ticket descriptions? Please also have these 44 useless tools to edit assignees on confluence pages.
This MCP completely solves the issue without introducing any overhead. This project is fully vibe-coded with claude. Contributions welcome!
Features
Tool Filtering: Block specific tools using regex patterns
Tool Discovery: List available tools with multiple output formats (table, JSON, names)
Header Pass-Through: Add custom HTTP headers for authentication
Zero Latency: Cached tool list, minimal overhead
Fail-Fast: Immediate error on connection issues or invalid patterns
Transparent Proxying: Forwards allowed tool calls to upstream without modification
Installation
Usage
Basic Example (HTTP/SSE)
Filter tools matching .*_file$ pattern from an HTTP MCP server:
Basic Example (stdio)
Filter tools from a local stdio MCP server:
With Environment Variables (stdio)
Pass environment variables to the upstream stdio server:
Multiple Patterns
Use comma-separated patterns:
With Authentication Headers
Add custom headers for authentication:
Headers support environment variable expansion (if not yet expanded by your app):
List Available Tools
Discover what tools are available before setting up filters:
With Claude Code
HTTP/SSE Upstream Server
Add to your .mcp.json:
With authentication headers (supports environment variable expansion):
Stdio Upstream Server
With multiple arguments to the upstream server:
With arguments that start with dashes (like uvx):
With environment variables for the upstream stdio server:
CLI Options
Tool list
Print the list of available tools without starting a proxy server
--list-tools: List available tools from upstream and exit--format <type>: Output format for--list-tools(default:table)table: Human-readable table with descriptions (truncated to 100 chars)json: Full JSON output with complete schemasnames: Comma-separated tool names for easy copy-paste
Connection Mode (mutually exclusive)
To start the proxy server, you must specify exactly one of:
--upstream <url>: Connect to upstream HTTP/SSE MCP server--upstream-stdio: Spawn and connect to upstream stdio MCP serverRequires command and arguments after
--separatorExample:
--upstream-stdio -- npx zen-mcp-server
Common Options
--deny <patterns>: Comma-separated regex patterns for tools to filter
HTTP/SSE Mode Options
Only applicable with --upstream:
--header <name:value>: Custom HTTP header to pass to upstream server (can be repeated for multiple headers)Format:
--header "Header-Name: value"Supports environment variable expansion:
$VARor${VAR}Example:
--header "Authorization: Bearer $TOKEN"
Stdio Mode Options
Only applicable with --upstream-stdio:
--env <KEY=value>: Environment variable to pass to the upstream stdio server (can be repeated for multiple variables)Format:
--env "KEY=value"Example:
--env "API_KEY=secret" --env "DEBUG=true"
After the
--separator, provide the command and all its argumentsEverything after
--is passed to the upstream serverSupports arguments starting with dashes (like
--from,--config, etc.)Example:
--upstream-stdio -- uvx --from git+https://... package-name
Requirements
Node.js >= 20.0.0
Upstream MCP server with:
SSE or Streamable HTTP transport (for
--upstream), ORstdio transport (for
--upstream-stdio)
License
MIT