MCP Tool Filter

v1.0.0Developer Toolsstable

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.

mcp-tool-filtermcpai-integration
Share:
45
Stars
0
Downloads
0
Weekly
0/5

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

Reduce 1000+ tools to 10-20 relevant ones in under 10ms
Use semantic filtering for faster, focused agent interactions
Portkey-AI

Maintainer

LicenseMIT
Languagetex
Versionv1.0.0
UpdatedMay 12, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-tool-filter

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

Install the package

Add @portkey-ai/mcp-tool-filter to your Node.js project.

npm install @portkey-ai/mcp-tool-filter
2

Import 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' }
});
3

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);
4

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
5

(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.

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.

Quick Config Preview

{ "mcpServers": { "mcp-tool-filter": { "command": "npx", "args": ["-y", "mcp-tool-filter"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides