MCP Tool Filter
Ultra-fast semantic tool filtering for MCP (Model Context Protocol) servers using embedding similarity. Reduce your tool context from 1000+ tools down to the most relevant 10-20 tools in under 10ms.
What is MCP Tool Filter?
MCP Tool Filter is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ultra-fast semantic tool filtering for mcp (model context protocol) servers using embedding similarity. reduce your tool context from 1000+ tools down to the most relevant 10-20 tools in under 10ms.
Ultra-fast semantic tool filtering for MCP (Model Context Protocol) servers using embedding similarity. Reduce your tool context from 1000+ tools down to the most relevant 10-20 tools in under 10ms.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Ultra-fast semantic tool filtering for MCP (Model Context Pr
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-tool-filterConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Tool Filter
MCP Tool Filter is a TypeScript library from Portkey AI that uses embedding similarity to semantically filter large sets of MCP tools down to the most relevant subset for a given user query. It can reduce a pool of 1000+ tools to the top 10-20 most relevant in under 10ms using local embeddings (no API key required), or optionally via OpenAI, Voyage, or Cohere embedding APIs. It is designed to be embedded into MCP proxy servers or orchestration layers where tool context would otherwise exceed LLM context limits.
Prerequisites
- Node.js 18 or higher
- npm or yarn for package installation
- Optional: OpenAI, Voyage, or Cohere API key if using API-based embeddings (local embeddings require no key)
- MCP servers whose tool lists you want to filter
Install the package
Add @portkey-ai/mcp-tool-filter to your Node.js project.
npm install @portkey-ai/mcp-tool-filterImport and initialize the filter
Import MCPToolFilter in your TypeScript or JavaScript code and initialize it with the local embedding provider. The embedding model (~25MB) is downloaded automatically on first use.
import { MCPToolFilter } from '@portkey-ai/mcp-tool-filter';
const filter = new MCPToolFilter({
embedding: { provider: 'local' }
});Load your MCP server tool definitions
Pass your MCP server configurations to the filter's initialize method. This step builds the embedding index over all available tools.
const mcpServers = [
{
name: 'filesystem',
tools: [ /* tool definitions from your MCP servers */ ]
}
];
await filter.initialize(mcpServers);Filter tools for each user query
Call filter.filter() with the user's query to get back only the most relevant tools, along with performance metrics.
const result = await filter.filter(
"Search my emails for the Q4 budget discussion"
);
console.log(result.tools); // Top relevant tools
console.log(result.metrics.totalTime); // e.g., 8ms(Optional) Configure API-based embeddings
To use OpenAI embeddings instead of local, set your API key in the environment and change the provider in the constructor.
export OPENAI_API_KEY=your_openai_api_key
// In code:
const filter = new MCPToolFilter({
embedding: {
provider: 'openai',
model: 'text-embedding-3-small'
}
});MCP Tool Filter Examples
Client configuration
Example TypeScript snippet showing MCPToolFilter integrated into an MCP proxy to reduce tool context before passing to an LLM.
{
"note": "mcp-tool-filter is a library, not a standalone MCP server. Integrate it into your proxy or orchestration layer.",
"example": {
"package": "@portkey-ai/mcp-tool-filter",
"embedding": { "provider": "local" },
"topK": 20,
"minScore": 0.3
}
}Prompts to try
Example queries you would pass to filter.filter() to retrieve contextually relevant tools from a large pool.
- "Search my emails for the Q4 budget discussion"
- "Create a new GitHub issue for the authentication bug"
- "Query the production database for last week's orders"
- "Send a Slack message to the #engineering channel"
- "Read the contents of config.yaml"Troubleshooting MCP Tool Filter
First call is slow or hangs on model download
The local embedding model (~25MB) is downloaded on first use. Ensure your machine has internet access. Subsequent calls will use the cached model and run in under 10ms.
filter() returns an empty tools array
Check that minScore (default 0.3) is not too high for your tool descriptions. Lower it to 0.1 and verify your tool definitions have descriptive names and descriptions that relate to the query.
TypeScript compilation error when importing MCPToolFilter
Ensure your tsconfig.json has "moduleResolution": "node16" or "bundler" and "esModuleInterop": true. The package is ESM-compatible and requires Node.js 18+.
Frequently Asked Questions about MCP Tool Filter
What is MCP Tool Filter?
MCP Tool Filter is a Model Context Protocol (MCP) server that ultra-fast semantic tool filtering for mcp (model context protocol) servers using embedding similarity. reduce your tool context from 1000+ tools down to the most relevant 10-20 tools in under 10ms. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP Tool Filter?
Follow the installation instructions on the MCP Tool Filter GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Tool Filter?
MCP Tool Filter works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Tool Filter free to use?
Yes, MCP Tool Filter is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
MCP Tool Filter Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP Tool Filter? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP Tool Filter in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP Tool Filter?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.