工作区qdrant mcp
 ](https://github.com/ChrisGVE/workspace-qdrant-mcp/releases)     
AI助手的项目范围矢量数据库,提供混合语义+关键字搜索和自动项目检测。
特性
- 混合搜索 -使用互序融合将语义相似性与关键字匹配相结合
- 项目检测 -自动Git存储库感知和项目范围的集合
- 7 MCP工具 -搜索、检索、规则、存储、grep、列表、嵌入
- 代码智能 -树型语义组块+LSP集成用于活动项目
- 代码图 -带有算法的关系图(PageRank、社区检测、介数中心性)
- 高性能CLI -锈基
wqm命令行工具 - 后台守护程序 -
memexd用于连续的文件监控和处理
快速开始
先决条件
- Qdrant -
docker run -d -p 6333:6333 -v qdrant_storage:/qdrant/storage qdrant/qdrant - C编译器 -首次使用时编译树保姆语法所必需的。树型语法作为C源代码分发,并在本地编译。
- macOS: xcode-select --install (Xcode命令行工具) - Linux: apt install build-essential (Debian/Ubuntu)或 dnf groupinstall "Development Tools" (Fedora) - 视窗:安装 Visual Studio生成工具 使用C++工作负载
安装
选项1:自制(推荐——macOS和Linux)
brew install ChrisGVE/tap/workspace-qdrant
brew services start workspace-qdrant选项2:预构建二进制文件
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/ChrisGVE/workspace-qdrant-mcp/main/scripts/download-install.sh | bash
# Windows (PowerShell)
irm https://raw.githubusercontent.com/ChrisGVE/workspace-qdrant-mcp/main/scripts/download-install.ps1 | iex安装 wqm 和 memexd 到 ~/.local/bin (Linux/macOS)或 %LOCALAPPDATA%\wqm\bin (Windows)。
选项3:从源代码构建
git clone https://github.com/ChrisGVE/workspace-qdrant-mcp.git
cd workspace-qdrant-mcp
./install.sh看 安装参考 了解详细说明和平台特定注意事项。对于Windows,请参阅 Windows安装指南.
配置MCP
克劳德桌面版 (claude_desktop_config.json):
{
"mcpServers": {
"workspace-qdrant-mcp": {
"command": "node",
"args": ["/path/to/workspace-qdrant-mcp/src/typescript/mcp-server/dist/index.js"],
"env": {
"QDRANT_URL": "http://localhost:6333"
}
}
}
}克劳德代码:
claude mcp add workspace-qdrant-mcp -- node /path/to/workspace-qdrant-mcp/src/typescript/mcp-server/dist/index.js验证
wqm --version
wqm status healthCLAUDE.md集成
将以下内容添加到您的项目中 CLAUDE.md (或您的全球 ~/.claude/CLAUDE.md)因此,Claude Code主动使用工作区qdrant:
## workspace-qdrant
The `workspace-qdrant` MCP server provides codebase-aware search, a library knowledge base, a scratchpad for accumulated insights, and persistent behavioral rules. The tool schemas are self-describing; these instructions cover *when* and *how* to use them.
### Primary Search and Knowledge Base
**Use `workspace-qdrant` first whenever context is uncertain** — first session on a project, returning after a significant gap, or exploring an unfamiliar subsystem. It is faster and more accurate than walking files manually, and it retrieves findings from prior sessions that would otherwise be lost.
**Three-step protocol:**
1. **Search** with `workspace-qdrant` (`search`, `grep`, `list`, or `retrieve`)
2. **Fall back** to `Grep`, `Glob`, `WebSearch` only when workspace-qdrant is insufficient or unavailable
3. **Store** any new findings, analysis, or design rationale via `store` so they are retrievable in future sessions
When a fresh handover or strong prior context already covers what you need, skip the exploratory search — but always store new findings at the end.
**Collections and their purpose:**
- `projects` — indexed codebase; use `scope="project"` (current project) or `scope="all"` (across all projects)
- `libraries` — external reference docs, API specs, third-party documentation; add via `store` with `collection="libraries"` and search with `includeLibraries=true`
- `scratchpad` — analysis, design rationale, research transcripts, architectural insights; complements session handovers by building a growing, semantically searchable knowledge layer across sessions
- `rules` — persistent behavioral rules; load at session start via `rules` → `action="list"`
**Practical notes:**
- Use `grep` for exact strings or regex; `list` with `format="summary"` to explore project structure
- Store external docs or specs into `libraries` so they are searchable alongside code
- Use the scratchpad to record *why* decisions were made, not just *what* was done — future sessions can retrieve the reasoning
### Sub-Agents
Sub-agents start with only the prompt you give them — they have no session history or handover context. They must always use `workspace-qdrant` first for any code exploration, without exception. Include this verbatim in every agent prompt:
> "You have no prior context about this codebase. Use `workspace-qdrant` as your mandatory first tool for ALL code searches — symbols, functions, architecture, patterns, prior findings. Use `search`, `grep`, `list`, or `retrieve` before touching any file with Read/Grep/Glob. Store any new findings, analysis, or design rationale via `store` (scratchpad for insights, libraries for reference docs) so they persist for future sessions."
### Project Registration
At session start, check whether the current project is registered with workspace-qdrant. If it is not, ask the user whether they want to register it (do not register silently). Once registered, the daemon handles file watching and ingestion automatically — no further action is needed.
### Behavioral Rules
The `rules` tool manages persistent rules that are injected into context across sessions. Rules are **user-initiated only** — add rules when the user explicitly instructs you to, never autonomously. Use `action="list"` at session start to load active rules.
### Issue Reporting
workspace-qdrant is under active development. If you encounter errors, unexpected behavior, or limitations with any workspace-qdrant tool, report them as GitHub issues at https://github.com/ChrisGVE/workspace-qdrant-mcp/issues using the `gh` CLI.MCP工具
| 工具 | 目的 |
|---|---|
search | 跨索引内容的混合语义+关键字搜索 |
retrieve | 按ID或元数据过滤器直接查找文档 |
rules | 管理持久行为规则 |
store | 存储内容、注册项目、保存笔记 |
grep | 使用FTS5进行精确的子字符串或正则表达式搜索 |
list | 列出项目文件和文件夹结构 |
看 MCP工具参考 用于参数和示例。
集合
| 收集 | 目的 | 隔离 |
|---|---|---|
projects | 项目代码和文档 | 多租户 tenant_id |
libraries | 参考文件(书籍、论文、文档) | 多租户 library_name |
rules | 行为规则和偏好 | 多租户 project_id |
scratchpad | 临时工作存储 | 每次会话 |
CLI参考
# Service management
wqm service start # Start background daemon
wqm service status # Check daemon status
wqm status health # System health check
# Search and content
wqm search "query" # Search collections
wqm ingest file path.py # Ingest a file
wqm rules list # List behavioral rules
# Project and library
wqm project list # List registered projects
wqm project watch pause # Pause file watchers
wqm library list # List libraries
wqm tags list # List tags with counts
# Administration
wqm admin collections list # List collections
wqm admin rebuild all # Rebuild all indexes
wqm admin backup create # Backup snapshots
wqm admin stats overview # Search analytics
# Code graph
wqm graph stats --tenant # Node/edge counts
wqm graph query --node-id --tenant --hops 2 # Related nodes
wqm graph impact --symbol --tenant # Impact analysis
wqm graph pagerank --tenant --top-k 20 # PageRank centrality
# Setup
wqm init completions zsh # Shell completions
wqm init man install # Install man pages
wqm init hooks install # Install Claude Code hooks (respects CLAUDE_CONFIG_DIR)
# Queue and monitoring
wqm queue stats # Queue statistics看 CLI参考 以获取完整的文档。
配置
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
QDRANT_URL | http://localhost:6333 | Qdrant服务器URL |
QDRANT_API_KEY | - | API密钥(Qdrant Cloud必需) |
FASTEMBED_MODEL | all-MiniLM-L6-v2 | 嵌入模型 |
Claude代码集成
wqm init hooks 读写Claude Code的 settings.jsonThe 位置解析自:
| 变量 | 默认值 | 描述 |
|---|---|---|
CLAUDE_CONFIG_DIR | ~/.claude | Claude Code使用的配置目录 wqm init hooks install/uninstall/status。为Claude Code Enterprise或任何非默认安装设置此设置。 |
示例——克劳德代码企业:
export CLAUDE_CONFIG_DIR=~/.config/claude/claude-ent
wqm init hooks install可观测性
守护进程公开度量和跟踪。默认情况下,这两个选项都是禁用的。
普罗米修斯(/metrics,拉)
通过config或env-var启用,然后抓取:
# in the daemon config
observability:
telemetry:
prometheus:
enabled: true
port: 9464
bind: 0.0.0.0或者:
WQM_PROMETHEUS_ENABLED=true WQM_PROMETHEUS_PORT=9464 memexd --foreground
curl http://localhost:9464/metrics | head这 --metrics-port CLI标志是一个强制执行的快捷方式 enabled=true 并覆盖端口。请参阅 docs/observability/prometheus-scrape-example.yaml 为了一个 scrape_configs 片段和 docs/observability/memexd-telemetry-dashboard.json 对于Grafana 10 仪表板。
OTLP轨迹(推送)
#[tracing::instrument] 跨越队列处理器、监视器、gRPC、, 在以下情况下通过OTLP/gRPC导出路径、嵌入路径和Qdrant路径:
observability:
telemetry:
service_name: memexd
otlp:
enabled: true
endpoint: http://collector.example:4317
protocol: grpc # http/protobuf is also recognized (logs a warning)
sample_rate: 0.1我们尊重标准的OpenTetry环境变量: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_HEADERS, OTEL_TRACES_SAMPLER_ARG.
OTLP指标导出为 不 目前已实现——普罗米修斯 规范度量表面。
建筑
+-----------------+
| Claude/Client |
+--------+--------+
|
+--------v--------+
| MCP Server | (TypeScript)
+--------+--------+
|
+--------------+--------------+
| |
+--------v--------+ +--------v--------+
| Rust Daemon | | Qdrant |
| (memexd) | | Vector Database |
+--------+--------+ +-----------------+
|
+--------v--------+
| File Watcher |
| Code Graph |
| Embeddings |
+-----------------+Rust守护进程处理文件监视、嵌入生成、代码图提取和队列处理。为了保持一致性,所有写入都通过守护进程路由。
文档
用户指南:
参考:
看 文档索引 获取规范、ADR和开发人员资源。
发展
# TypeScript MCP server
cd src/typescript/mcp-server && npm install && npm run build && npm test
# Rust daemon and CLI (from src/rust/)
cargo build --release
cargo test
# Graph benchmarks
cargo bench --package workspace-qdrant-core --bench graph_bench
# Binaries output to:
# - target/release/wqm
# - target/release/memexd贡献
看 贡献.md 用于开发设置和指南。
许可证
MIT许可证-请参阅 许可证 了解详情。
______________________________________________________________________
*灵感源自 克劳德qdrant mcp*
