返回市场
简单文件向量存储

简单文件向量存储

作者:lishenxydlgzs36 星标更新:2025-04-01

项目介绍

@lishenxydlgzs/simple-files-vectorstore

这是一个提供文件语义搜索功能的Model Context Protocol (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桌面应用:~/Library/Application Support/Claude/claude_desktop_config.json

配置

该服务器需要通过环境变量进行配置:

必要的环境变量

您必须使用以下方法之一指定要监控的目录:

  • 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": []
    }
  }
}

监控配置文件应具有以下结构:

{
  "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": "500",
          "IGNORE_FILE": "/path/to/.gitignore"
        },
        "disabled": false,
        "autoApprove": []
      }
    }
  }

MCP工具

此服务器提供了以下MCP工具:

1. 搜索

在索引文件上执行语义搜索。

参数:

  • query(必需):搜索查询字符串
  • limit(可选):返回结果的最大数量(默认值:5,最大值:20)

示例响应:

[
  {
    "content": "匹配的文本内容",
    "source": "/path/to/file",
    "fileType": "markdown",
    "score": 0.85
  }
]

2. 获取统计信息

获取关于索引文件的统计信息。

参数:无

示例响应:

{
  "totalDocuments": 42,
  "watchedDirectories": ["/path/to/docs"],
  "processingFiles": []
}

特性

  • 实时文件监控和索引
  • 使用向量嵌入进行语义搜索
  • 支持多种文件类型
  • 可配置的块大小和重叠
  • 文件的后台处理
  • 自动处理文件更改和删除

仓库

GitHub仓库