AI工具向量搜索服务器

Tool Box MCP Server是一个集成了向量搜索和知识图谱的AI工具中央注册表,用于智能工具发现和链式调用。

  • by Adriftnote
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 Adriftnote/tool-box-mcp

使用说明

工具箱MCP服务器

人工智能工具的中央注册表 矢量搜索+知识图谱 用于智能工具发现和链接。

特性

  • 向量搜索:通过ChromaDB发现语义工具
  • 知识图谱:工具关系和依赖关系遍历
  • 工具链:通过数据转换执行多步骤MCP工具管道
  • 渐进式披露:只加载所需内容,节省90%以上的代币
  • 统一注册表:MCP服务器、技能、工具、命令在一个地方

快速开始

# Clone
git clone https://github.com/Adriftnote/tool-box-mcp.git
cd tool-box-mcp

# Install dependencies
npm install

# Run setup (initializes ChromaDB and sample data)
./scripts/setup.sh

# Start server
npm start

工具(共11个)

工具 说明
toolhub_search 通过自然语言查询查找工具
toolhub_expand 通过知识图谱探索工具依赖关系
toolhub_cluster 获取任务的完整工具集
toolhub_register 向注册表添加新工具
toolhub_delete 从注册表中删除工具
toolhub_list 列出所有已注册的工具
toolhub_execute 从查询自动生成并执行链
toolhub_chain 执行顺序MCP工具管道
toolhub_prepare_chain 执行前分析链(模式、技能、转换)
toolhub_discover 从MCP服务器刷新可链接工具
toolhub_chainable 列出可用于链接的工具

安装

先决条件

  • Node.js 18+
  • Python 3.8+(适用于ChromaDB)
  • pip(Python包管理器)

步骤1:克隆并安装

git clone https://github.com/Adriftnote/tool-box-mcp.git
cd tool-box-mcp
npm install

步骤2:运行安装程序

# This installs Python dependencies and initializes ChromaDB
./scripts/setup.sh

步骤3:配置MCP客户端

添加到您的Claude Code或MCP客户端设置中:

{
  "mcpServers": {
    "tool-box": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/tool-box-mcp/dist/index.js"]
    }
  }
}

配置

数据文件

安装后,在中配置这些文件 data/ 目录:

文件 目的
mcp-config.json 与MCP服务器链接
knowledge-graph.json 工具关系
chromadb/ 矢量搜索数据库

环境变量(可选)

用环境变量覆盖默认路径:

TOOLHUB_GRAPH_PATH       # Knowledge Graph JSON path
TOOLHUB_MCP_CONFIG       # MCP config path
TOOLHUB_PYTHON_PATH      # Python interpreter path

使用示例

1.搜索工具

toolhub_search({
  query: "data analysis excel",
  limit: 10,
  include_graph: true
})

2.执行工具链

toolhub_chain({
  mcpPath: [
    {
      toolName: "sqlite_read_query",
      toolArgs: "{\"query\": \"SELECT * FROM metrics LIMIT 10\"}",
      outputTransform: "sqlite→2d"
    },
    {
      toolName: "document_create_excel",
      toolArgs: "{\"filepath\": \"/tmp/report.xlsx\", \"content\": \"CHAIN_RESULT\"}"
    }
  ]
})

3.注册新工具

toolhub_register({
  name: "my-mcp-server",
  type: "MCP_Server",
  description: "My custom MCP server for data processing"
})

建筑

┌─────────────────────────────────────────────┐
│  Claude Code / AI Agent                     │
└─────────────────────────────────────────────┘
                    │ MCP Call
                    ▼
┌─────────────────────────────────────────────┐
│  Tool Box MCP Server                        │
│  ┌─────────────────────────────────────┐   │
│  │ HybridSearchService                 │   │
│  │ ├─ VectorSearchService (ChromaDB)   │   │
│  │ └─ GraphSearchService (JSON)        │   │
│  ├─────────────────────────────────────┤   │
│  │ ToolDiscoveryService                │   │
│  │ └─ Chain Execution + Transforms     │   │
│  └─────────────────────────────────────┘   │
└─────────────────────────────────────────────┘
         │                    │
         ▼                    ▼
┌───────────────┐    ┌───────────────┐
│  ChromaDB     │    │  Knowledge    │
│  (data/)      │    │  Graph JSON   │
└───────────────┘    └───────────────┘

数据转换

链数据流的内置转换:

转换 描述
sqlite→2d SQLite结果转换为二维数组
json→object 将JSON字符串解析为对象
object→array 将对象包裹在数组中
flatten 扁平嵌套数组
first 提取第一个元素
keys 获取对象密钥
values 获取对象值

发展

# Build from source
npm run build

# Run server
npm start

# Type check
npm run typecheck

项目结构

tool-box-mcp/
├── dist/                 # Compiled JavaScript (included)
├── src/
│   ├── index.ts          # Main server entry
│   ├── schemas/          # Zod input schemas
│   └── services/         # Search, chain, transform services
├── scripts/
│   ├── setup.sh          # Initial setup script
│   └── register-tool.py  # Tool registration utility
├── data/
│   ├── chromadb/         # Vector database
│   ├── knowledge-graph.json
│   └── mcp-config.json
└── package.json

故障排除

“未找到ChromaDB”

pip install chromadb sentence-transformers

“找不到Python”

设置Python路径:

export TOOLHUB_PYTHON_PATH=/usr/bin/python3

“未找到工具”

运行安装程序以初始化示例数据:

./scripts/setup.sh

许可证

国际学生中心