article
README
🚀 @lishenxydlgzs/simple-files-vectorstore
这是一个提供文件语义搜索能力的模型上下文协议(MCP)服务器。该服务器会对指定目录进行监控,并生成文件内容的向量嵌入,以此实现对文档的语义搜索。
🚀 快速开始
安装与使用
您需要在 MCP 设置文件中添加如下内容:
{
"mcpServers": {
"files-vectorstore": {
"command": "npx",
"args": [
"-y",
"@lishenxydlgzs/simple-files-vectorstore"
],
"env": {
"WATCH_DIRECTORIES": "/path/to/your/directories"
},
"disabled": false,
"autoApprove": []
}
}
}
MCP 设置文件的具体位置如下:
- VSCode Cline 扩展:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Claude Desktop 应用程序:
~/Library/Application Support/Claude/claude_desktop_config.json
✨ 主要特性
- 支持大语言模型(LLM)的文件内容分析
- 提供高效的语义搜索能力
- 具备可扩展性,支持大量文档的索引和检索
📦 安装指南
服务器需要通过环境变量进行配置,以下是详细说明:
必要的环境变量
您必须使用其中一种方法指定要监控的目录:
WATCH_DIRECTORIES:以逗号分隔的目录列表WATCH_CONFIG_FILE:包含watchList数组的 JSON 配置文件路径
使用 WATCH_DIRECTORIES 的示例
{
"mcpServers": {
"files-vectorstore": {
"command": "npx",
"args": [
"-y",
"@lishenxydlgzs/simple-files-vectorstore"
],
"env": {
"WATCH_DIRECTORIES": "/path/to/dir1,/path/to/dir2"
},
"disabled": false,
"autoApprove": []
}
}
}
使用 WATCH_CONFIG_FILE 的示例
{
"mcpServers": {
"files-vectorstore": {
"command": "npx",
"args": [
"-y",
"@lishenxydlgzs/simple-files-vectorstore"
],
"env": {
"WATCH_CONFIG_FILE": "/path/to/watch-config.json"
},
"disabled": false,
"autoApprove": []
}
}
}
watch 配置文件应具有以下结构:
{
"watchList": [
"/path/to/dir1",
"/path/to/dir2",
"/path/to/specific/file.txt"
]
}
可选环境变量
CHUNK_SIZE:文本块的大小(默认:1000)CHUNK_OVERLAP:块之间的重叠量(默认:200)IGNORE_FILE:类似 .gitignore 样式的文件路径,用于排除文件/目录
包含所有可选参数的示例
{
"mcpServers": {
"files-vectorstore": {
"command": "npx",
"args": [
"-y",
"@lishenxydlgzs/simple-files-vectorstore"
],
"env": {
"WATCH_DIRECTORIES": "/path/to/dir1,/path/to/dir2",
"CHUNK_SIZE": "2000",
"CHUNK_OVERLAP": "200",
"IGNORE_FILE": "/path/to/ignore-file.txt"
},
"disabled": false,
"autoApprove": []
}
}
}
📚 详细文档
MCP 工具
搜索工具(Search Tool)
- 名称:
search - 参数:
query:要搜索的查询字符串maxResults:最大返回结果数,默认为5
- 响应:
{
"results": [
{
"id": string,
"score": number,
"content": string
}
]
}
- 示例:
curl -X POST http://localhost:1234/mcp/v1/tools/search \
-H "Content-Type: application/json" \
-d '{"query":"查询字符串", "maxResults":5}'
扫码联系在线客服