Token导航 LogoToken导航TokenDH.com
Tool Search MCP logo
搜索检索未说明官方级别未说明来源级核验

Tool Search MCP

MCP Server

一个高性能的客户端工具搜索服务,用于动态搜索和加载相关的MCP工具,减少令牌使用并提高性能。

工具数

0

提示词数

0

GitHub Stars

2

资源数

0
搜索TypeScriptClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ImBIOS

提供方

ImBIOS

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

工具搜索MCP

⚠️ 警告:此项目仍处于实验阶段(v0.0.1)。API和功能可能会发生变化。

Claude Code的高性能客户端工具搜索服务,可动态搜索和加载相关的MCP工具,而不是一次加载所有工具。使用Ollama嵌入的语义搜索技术构建,用于智能工具匹配。

🎯 关键利益

技术优势

  • 代币减少97.4%:基准显示,每次查询平均节省约12950个令牌
  • 100%刀具选择精度:使用基于嵌入的搜索,所有主要测试用例都通过
  • 更快的上下文窗口:较小的工具有效载荷意味着实际对话的空间更大
  • 智能工具发现:语义搜索即使在自然语言查询中也能找到合适的工具
  • 多种搜索方法:在嵌入(最准确)、BM25(最快)或正则表达式(轻量级)之间进行选择

业务影响

  • 降低API成本:更少的代币=更低的Claude API账单
  • 更好的性能:通过优化工具选择加快响应时间
  • 可扩展性:加载数百台MCP服务器而不达到上下文限制
  • 开发者体验:自然语言工具发现感觉更直观

基准结果

方法快速模式(5次测试)扩展(113次测试)速度
嵌入100%88.5%311ms
BM2580%81.4%1ms
正则表达式80%79.6%7ms

最准确:嵌入 nomic-embed-text-v2-moe\ 速度最佳:BM25,具有亚毫秒响应

🚀 快速开始

# Run directly without installation
bun x github:ImBIOS/tool-search-mcp

# Or install locally
git clone https://github.com/ImBIOS/tool-search-mcp.git
cd tool-search-mcp
bun install
bun run dev

📋 先决条件

1.安装Olama

# Linux/macOS
curl -fsSL https://ollama.ai/install.sh | sh

# Start Ollama server
ollama serve

2.拉动嵌入模型

ollama pull nomic-embed-text-v2-moe

该模型针对生成嵌入进行了优化,并且比完整的LLM小得多。

⚡ 安装

# Clone and install
git clone https://github.com/ImBIOS/tool-search-mcp.git
cd tool-search-mcp
bun install

# Development mode (with hot reload)
bun run dev

# Production mode
bun run build
bun start

🔧 配置

快速配置(环境变量)

export MCP_CONFIG='{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "your-token" }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
    }
  }
}'

配置文件

export MCP_CONFIG_PATH=./mcp-config.json

哪里 mcp-config.json 包含:

{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub@latest", "--port", "8082"],
      "env": { "DSN": "postgres://user:pass@localhost/db" }
    }
  }
}

📊 用法

基本搜索

curl -X POST http://localhost:3000/search \
  -H "Content-Type: application/json" \
  -d '{"query": "read a file from disk", "topK": 3}'

答复:

{
  "type": "tool_result",
  "content": {
    "type": "tool_search_result",
    "tool_references": [
      { "type": "tool_reference", "tool_name": "read_file" },
      { "type": "tool_reference", "tool_name": "list_directory" },
      { "type": "tool_reference", "tool_name": "glob" }
    ]
  },
  "meta": {
    "model": "nomic-embed-text-v2-moe",
    "took": 45,
    "results": [...]
  }
}

健康检查

curl http://localhost:3000/health

答复:

{
  "status": "healthy",
  "ollamaConnected": true,
  "model": "nomic-embed-text-v2-moe",
  "toolsLoaded": 10
}

🧪 基准

运行全面的基准测试以验证工具搜索的准确性:

# Quick benchmark (5 primary tests, one per MCP)
bun run benchmark

# Extended benchmark (113 tests with variations)
bun run benchmark -e

# With Claude CLI validation
bun run benchmark -c

# With verbose output
bun run benchmark -v

# Full benchmark (all models and formats)
bun run benchmark --full

配置迁移

# Check current status
bun run config status

# Migrate to Tool Search MCP (regex - fastest)
bun run config migrate

# Migrate with embedding (most accurate)
bun run config migrate embedding

# Restore original config
bun run config restore

🏗️ 建筑

┌─────────────┐     ┌──────────────────┐     ┌─────────────┐
│ Claude Code │────▶│ Tool Search API  │────▶│   Ollama    │
│             │     │ (this service)   │     │ nomic-embed-│
│             │◀────│                  │◀────│ text-v2-moe │
└─────────────┘     └──────────────────┘     └─────────────┘
                          │
                          ▼
                   ┌──────────────┐
                   │   Tools DB   │
                   │ (embeddings) │
                   └──────────────┘
                          ▲
                          │
                   ┌──────────────┐
                   │   MCP        │
                   │   Servers    │
                   └──────────────┘

🔍 搜索方法

1.嵌入搜索(推荐)

使用具有余弦相似性的语义嵌入进行最准确的工具匹配。最适合自然语言查询。

{
  "type": "tool_search_tool_embedding"
}

2.BM25搜索(最快)

基于关键字的统计搜索。闪电般快,但措辞不够灵活。

{
  "type": "tool_search_tool_bm25_20251119"
}

3.正则表达式搜索(轻量级)

模式匹配与启发式评分。开销最小。

{
  "type": "tool_search_tool_regex_20251119"
}

📁 项目结构

tool-search-mcp/
├── src/
│   ├── benchmark/         # Benchmark suite
│   │   └── tests/         # Test cases per MCP
│   ├── cli/               # CLI tools
│   ├── search/            # Search engine implementations
│   └── index.ts           # Main entry point
├── package.json
└── README.md

🛠️ 发展

# Type checking
bun run check-types

# Formatting
bun run format:ws

# Build
bun run build

📝 许可证

麻省理工学院

🤝 贡献

欢迎投稿!请先阅读我们的投稿指南。

📧 支持

  • 在GitHub上打开一个问题
  • 电子邮件:imamuzzaki@gmail.com

🔗 相关链接

目录标签

目录标签

搜索TypeScriptClaude语义搜索本地部署工具匹配性能优化动态加载

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP