qmcp
Semantic search server for code and documentation using Qdrant vector database. Supports multi-language indexing, live updates, and natural language queries.
README
qmcp - QDrant MCP Server for OpenCode
Semantic search server for code and documentation using Qdrant vector database.
Language: English | Русский
Features
- Semantic Search: Find code and documentation using natural language queries
- Multi-language Support: Python, Go, JavaScript, TypeScript, Java, C#, Markdown
- Live Updates: File watcher for automatic reindexing
- Incremental Indexing: Only index changed files
- Gitignore Support: Respects
.gitignore- excludesnode_modules,__pycache__,.venv, build artifacts, etc. - Cleanup: Remove stale vectors for deleted/changed files
- Diagnostics: Introspection tools to understand what's indexed
- OpenCode Skill: Natural language interface for Qdrant management
Installation
Via PyPI (Recommended)
pip install qmcp-qdrant
Via uv
uv tool install qmcp-qdrant
From Source
git clone https://github.com/BigKAA/qmcp.git
cd qmcp
make install
Updating
Via uv (Recommended)
uv tool upgrade qmcp-qdrant
Via pip
pip install --upgrade qmcp-qdrant
Quick Start
1. Ensure Qdrant is running
For Kubernetes deployment, see Qdrant on Kubernetes.
2. Add MCP Server to OpenCode
opencode mcp add qmcp-qdrant qmcp-qdrant
⚠️ Note: Environment variables must be set in
~/.config/opencode/opencode.jsonconfig file.
Configuration
| Environment Variable | Default | Description |
|---|---|---|
QDRANT_URL |
http://localhost:6333 |
Qdrant server URL |
QDRANT_API_KEY |
(none) | Qdrant API key (optional) |
EMBEDDING_MODEL |
BAAI/bge-small-en-v1.5 |
Embedding model |
EMBEDDING_CACHE_DIR |
(system temp) | Custom directory for model cache |
WATCH_PATHS |
/data/repo |
Baseline paths to watch automatically on server startup |
BATCH_SIZE |
50 |
Batch size for indexing |
DEBOUNCE_SECONDS |
5 |
Debounce delay |
LOG_LEVEL |
INFO |
Logging level |
LOG_FORMAT |
text |
Log format (text or json) |
💡 Model Cache: Set
EMBEDDING_CACHE_DIRto persist models across restarts. First launch downloads the model (~13MB), subsequent launches use cached version.
💡 WATCH_PATHS examples:
- Single path:
WATCH_PATHS=/home/user/project- Multiple paths:
WATCH_PATHS=/home/user/project,/home/user/docs- JSON array:
WATCH_PATHS=["/home/user/project", "/home/user/docs"]
3. That's It!
OpenCode will automatically discover and use the semantic search tools.
Manual Configuration (Alternative)
If opencode mcp add doesn't work, edit ~/.config/opencode/opencode.json directly:
{
"mcp": {
"qmcp-qdrant": {
"type": "local",
"command": ["qmcp-qdrant"],
"environment": {
"QDRANT_URL": "http://192.168.218.190:6333",
"WATCH_PATHS": "/home/user/shared-docs,/home/user/shared-snippets"
}
}
}
}
For Python module:
{
"mcp": {
"qmcp-qdrant": {
"type": "local",
"command": ["python", "-m", "qmcp.server"],
"environment": {
"QDRANT_URL": "http://192.168.218.190:6333",
"WATCH_PATHS": "/home/user/shared-docs,/home/user/shared-snippets"
}
}
}
}
Indexing Notes
⚠️ Important: Full indexing and reindexing of large projects can take a significant amount of time (minutes to hours depending on project size).
For large codebases, prefer:
- Incremental reindex (
mode="incremental") - only updates changed files based on content hashes - File watcher - enables automatic live updates when files change
Automatic Indexing Strategy
qmcp supports automatic indexing on two levels:
- Server startup level — on MCP startup, the server automatically tries to start a watcher for
WATCH_PATHS. - Workspace session level — because one global MCP server can be shared across multiple repositories, agents should check the watcher state for the current workspace and call
qdrant_watch_ensure(paths=[workspace_root])when the workspace path is missing.
Recommended OpenCode flow for every new workspace:
status = qdrant_get_status()
# If watcher is not active or the current repo is not covered,
# safely extend the watcher without dropping other projects.
qdrant_watch_ensure(paths=["/absolute/path/to/current/workspace"])
qdrant_watch_ensure merges the current workspace with already watched paths and WATCH_PATHS, making it safe for a single global MCP shared by multiple projects.
MCP Tools
Search & Indexing
| Tool | Description |
|---|---|
qdrant_search |
Semantic search in code/docs |
qdrant_index_directory |
Index a directory |
qdrant_reindex |
Reindex (full or incremental) |
💡 Tip: Use
qdrant_searchwith filters for precise results:
chunk_type— filter by code type (function_def, class_def, etc.)symbol_name— find exact symbol by namelanguage— filter by programming languageSee docs/STRUCTURED_METADATA.md for detailed examples.
Collection Management
| Tool | Description |
|---|---|
qdrant_list_collections |
List all collections |
qdrant_get_collection_info |
Get collection info |
qdrant_delete_collection |
Delete collection |
Diagnostics & Introspection
| Tool | Description |
|---|---|
qdrant_diagnose_collection |
Full collection diagnostics - vectors, files, types, issues |
qdrant_list_indexed_files |
Paginated list of indexed files with metadata |
qdrant_diff_collection |
Compare Qdrant state with filesystem (orphans, missing, modified) |
Maintenance
| Tool | Description |
|---|---|
qdrant_cleanup |
Clean stale vectors (dry-run supported) |
qdrant_watch_start |
Start file watcher |
qdrant_watch_ensure |
Ensure workspace path is watched without dropping other projects |
qdrant_watch_stop |
Stop file watcher |
qdrant_get_status |
Server status |
Diagnostic Tools Usage Examples
# Diagnose a collection - see what's indexed, file types, issues
qdrant_diagnose_collection(collection="myproject")
# List indexed files with pagination
qdrant_list_indexed_files(collection="myproject", limit=50, offset=0)
# Filter by file type
qdrant_list_indexed_files(collection="myproject", file_type=".py")
# Compare Qdrant state with filesystem
qdrant_diff_collection(collection="myproject", repo_path="/path/to/repo")
OpenCode Skill
The project includes an OpenCode skill for natural language management of Qdrant.
Installation
# Copy skill to OpenCode skills directory
cp -r skills/qmcp-manager ~/.config/opencode/skills/
Usage
Once installed, OpenCode will automatically activate the skill when you ask questions like:
| Query | What Happens |
|---|---|
what's indexed in my Qdrant? |
Diagnoses collection and shows stats |
show collection stats |
Lists all collections with vector counts |
clean up orphans in my index |
Finds and previews deletion of orphaned vectors |
diagnose my index |
Full diagnostics with issues and file list |
compare index with /path/to/repo |
Shows orphans, missing, and modified files |
find missing files |
Lists files on disk but not indexed |
is my index up to date? |
Compares hashes to detect changes |
Workflows Provided by Skill
- Quick Status - Check collection state with
qdrant_list_collections - Full Diagnostics - Detailed analysis with
qdrant_diagnose_collection - Diff - Compare Qdrant with filesystem using
qdrant_diff_collection - Safe Cleanup - Preview with dry-run, then confirm deletion
- Smart Reindex - Incremental updates based on file hashes
Skill Location
skills/qmcp-manager/SKILL.md
Manage MCP Servers
opencode mcp list # List all MCP servers
opencode mcp debug qmcp-qdrant # Debug connection issues
opencode mcp logout qmcp-qdrant # Remove MCP server
Development
make install # Install dependencies
make test # Run tests
make lint # Lint code
make format # Format code
make mcp-dev # Run with MCP inspector
Troubleshooting
If you encounter issues, see the Troubleshooting Guide for:
- Embedding Model Issues —
indexed_vectors_count: 0diagnosis and fix - Connection Problems — Qdrant connection troubleshooting
- Search Returns No Results — Empty search results debugging
License
Apache 2.0
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。