Skip to content

Releases: Portkey-AI/mcp-tool-filter

v1.0.0 - First Stable Release

03 Nov 06:30
02ac174

Choose a tag to compare

🎉 First Stable Release!

Highlights

  • Ultra-fast semantic tool filtering - <10ms filtering latency for 1000+ tools
  • 🎯 Local & API embeddings - Choose between local embeddings (fast & private) or API embeddings (highest accuracy)
  • 📊 Performance optimizations - 6-8x faster dot product, smart top-K selection, true LRU cache
  • 🔄 Flexible input - Accepts chat completion messages or raw strings
  • 🎛️ Highly configurable - Tune scoring thresholds, top-k, always-include tools

Features

Core Functionality

  • Local embeddings support using @xenova/transformers
  • API embeddings support (OpenAI, Voyage, Cohere)
  • Semantic tool filtering with cosine similarity
  • Context caching for performance optimization
  • Support for chat messages and string inputs
  • Configurable filtering options (topK, minScore, alwaysInclude, exclude)
  • Performance metrics and debug logging
  • Comprehensive documentation and examples
  • includeServerDescription option for better high-level intent queries

Performance Optimizations

  • Loop-Unrolled Dot Product: 6-8x faster vector similarity computation
  • Smart Top-K Selection: Hybrid algorithm optimized for different workloads
  • True LRU Cache: 20-40% better cache hit rates
  • In-Place Vector Normalization: ~30% reduction in memory allocations
  • Set-Based Exclusion: O(1) exclusion checking
  • Overall: 50-80% faster filtering for typical workloads

Installation

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

Quick Start

import { MCPToolFilter } from '@portkey-ai/mcp-tool-filter';

// Initialize with local embeddings (recommended)
const filter = new MCPToolFilter({
  embedding: { provider: 'local' }
});

await filter.initialize(mcpServers);

// Filter tools based on context
const result = await filter.filter("Search my emails for the Q4 budget");
console.log(result.tools); // Top 20 most relevant tools

Documentation

See the README for comprehensive documentation, examples, and benchmarks.

What's Changed

See CHANGELOG.md for details.