Qmd Wrapper
๐ฆ Rust CLI wrapper for QMD MCP server. Remote HTTP access, zero dependencies. Static binary (~3.6MB), session persistence, full CLI parity. Perfect for server deployments without Node.js.
Ask AI about Qmd Wrapper
Powered by Claude ยท Grounded in docs
I know everything about Qmd Wrapper. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
QMD Wrapper
English | ็ฎไฝไธญๆ
A Rust-based command-line wrapper for the QMD (Query Markup Documents) MCP server, enabling remote access to QMD search functionality via HTTP.
Features
- ๐ Remote MCP Access - Connect to QMD servers over HTTP with full CLI parity
- ๐ฆ Statically Linked - Single binary with zero runtime dependencies (musl)
- ๐พ Session Persistence - Automatic session management across CLI invocations
- ๐ Fast & Lightweight - ~3.6MB binary with LTO optimization
- ๐ Secure by Default - rustls TLS backend, no OpenSSL dependencies
- ๐ฏ Interactive Setup - Guided configuration with health checks
Quick Start
1. Download
# From releases page
wget https://github.com/tidyinfo/qmd-wrapper/releases/latest/download/qmd
# Make executable
chmod +x qmd
2. Configure
# Connect to remote QMD server
./qmd connect --hostname <server-host> --port <server-port>
# Example
./qmd connect --hostname 192.168.1.100 --port 8181
3. Use
# Search documents
./qmd search "your query" --json
# Get status
./qmd status
# Retrieve document
./qmd get path/to/file.md
Installation
From Pre-built Binary
- Download the latest release from Releases
- Place in your PATH:
sudo cp qmd /usr/local/bin/
From Source
Prerequisites:
- Rust 1.92 or later
- musl-tools (for static linking)
# Clone repository
git clone https://github.com/tidyinfo/qmd-wrapper.git
cd qmd-wrapper
# Install Rust (if needed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable
# Add musl target
rustup target add x86_64-unknown-linux-musl
# Install musl tools (Debian/Ubuntu)
sudo apt-get install musl-tools musl-dev
# Build static binary
cargo build --release --target x86_64-unknown-linux-musl
# Binary location
ls -lh target/x86_64-unknown-linux-musl/release/qmd
Configuration
Server Connection
# Non-interactive mode
./qmd connect --hostname example.com --port 8181
# Interactive mode (with prompts)
./qmd connect
Config File Locations
The wrapper searches for configuration in the following order:
./qmd.toml(same directory as binary)./config.toml(same directory as binary)/etc/qmd/config.toml~/.config/qmd/config.toml~/.qmd.toml
Configuration Format
[server]
host = "localhost"
port = 8181
session_id = "auto-generated-after-first-connect"
Commands
Search Commands
# Keyword search (BM25)
./qmd search "query" [options]
# Query expansion + reranking (if supported)
./qmd query "query" [options]
# Vector similarity search (if supported)
./qmd vsearch "query" [options]
Search Options:
| Option | Description | Default |
|---|---|---|
-n, --num <NUM> | Number of results | 5 |
--all | Return all matches | false |
--min-score <SCORE> | Minimum similarity score | 0 |
--full | Output full document | false |
--line-numbers | Add line numbers | false |
--files | Output docid,score,filepath,context | false |
--json | JSON output | false |
--csv | CSV output | false |
--md | Markdown output | false |
--xml | XML output | false |
-c, --collection <NAME> | Filter by collection | - |
--index <NAME> | Custom index name | index |
Document Retrieval
# Get single document
./qmd get <file>[:line] [-l N] [--from N]
# Get multiple documents by glob pattern
./qmd multi-get <pattern> [-l N] [--max-bytes N]
# List collections or files
./qmd ls [collection[/path]]
Index Management
# Show index status
./qmd status
# Re-index all collections
./qmd update [--pull]
# Create vector embeddings
./qmd embed [-f]
# Cleanup cache and orphaned data
./qmd cleanup
Collection Management
# List collections
./qmd collection list
# Add collection
./qmd collection add [path] --name <name> --mask <pattern>
# Remove collection
./qmd collection remove <name>
# Rename collection
./qmd collection rename <old> <new>
Context Management
# List contexts
./qmd context list
# Add context
./qmd context add [path] "text"
# Remove context
./qmd context rm <path>
Examples
Basic Search Workflow
# 1. Connect to server
./qmd connect --hostname qmd.example.com --port 8181
# 2. Check index status
./qmd status
# 3. Search for documents
./qmd search "machine learning" --json -n 10
# 4. Get full document
./qmd get docs/ml-basics.md --full
# 5. Search with filters
./qmd search "neural networks" --min-score 0.7 --collection research
Advanced Usage
# Export results as CSV
./qmd search "API design" --csv > results.csv
# Get document from specific line
./qmd get src/main.rs:100 -l 50
# Batch retrieve files
./qmd multi-get "docs/*.md" --max-bytes 50000
# Full-text search with line numbers
./qmd search "configuration" --full --line-numbers
Architecture
โโโโโโโโโโโโโโโโโโโ HTTP POST โโโโโโโโโโโโโโโโโโโโโโโ
โ qmd wrapper โ โโโโโโโโโโโโโโโโโ> โ QMD MCP Server โ
โ (Rust CLI) โ JSON-RPC โ (Node.js + Bun) โ
โ โ <โโโโโโโโโโโโโโโโโ โ http://host:port โ
โ - CLI parsing โ MCP Response โ โ
โ - Session mgmt โ โ - Tool registry โ
โ - Config mgmt โ โ - Search engine โ
โ โ โ - Vector DB โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
Session Management
The MCP HTTP transport requires session initialization:
- First Command: Automatically calls
initializeendpoint - Session ID: Extracted from
Mcp-Session-Idresponse header - Persistence: Saved to config file for reuse
- Subsequent Commands: Reuse cached session ID
- Server Restart: Automatically re-initializes on session mismatch
Troubleshooting
Connection Issues
# Test server health
curl http://host:port/health
# Expected response
{"status":"ok","uptime":N}
Session Problems
# Reset session (edit config file)
# Remove the session_id line from qmd.toml
Common Errors
| Error | Cause | Solution |
|---|---|---|
Failed to connect | Server offline | Check server status |
Server already initialized | Session mismatch | Delete session_id from config |
Tool not found | Unsupported tool | Check server capabilities |
Development
Project Structure
qmd-wrapper/
โโโ Cargo.toml # Dependencies
โโโ src/
โ โโโ main.rs # Entry point
โ โโโ cli.rs # CLI definitions
โ โโโ config.rs # Configuration
โ โโโ mcp_client.rs # MCP client
โโโ dist/ # Built binaries
โโโ README.md # This file
Build Commands
# Debug build
cargo build
# Release build (dynamic)
cargo build --release
# Static build (musl)
cargo build --release --target x86_64-unknown-linux-musl
# Run tests
cargo test
# Format code
cargo fmt
# Lint
cargo clippy
Dependencies
| Crate | Version | Purpose |
|---|---|---|
| clap | 4.5 | CLI parsing |
| reqwest | 0.12 | HTTP client |
| tokio | 1 | Async runtime |
| serde | 1.0 | Serialization |
| toml | 0.8 | Config parsing |
| dialoguer | 0.11 | Interactive prompts |
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Acknowledgments
- QMD - The original QMD project
- Model Context Protocol - MCP specification
- clap - Excellent CLI library
็ฎไฝไธญๆ
QMD Wrapper ๆฏไธไธชๅบไบ Rust ็ๅฝไปค่กๅทฅๅ ท๏ผ็จไบ่ฟ็จ่ฎฟ้ฎ QMD (Query Markup Documents) MCP ๆๅกๅจใ
ไธป่ฆ็นๆง
- ๐ ่ฟ็จ MCP ่ฎฟ้ฎ - ้่ฟ HTTP ่ฟๆฅ QMD ๆๅกๅจ๏ผๆฏๆๅฎๆด CLI ๅ่ฝ
- ๐ฆ ้ๆ้พๆฅ - ๅไธไบ่ฟๅถๆไปถ๏ผ้ถ่ฟ่กๆถไพ่ต
- ๐พ ไผ่ฏๆไน ๅ - ่ชๅจ็ฎก็ไผ่ฏ็ถๆ
- ๐ ๅฟซ้่ฝป้ - ็บฆ 3.6MB๏ผLTO ไผๅ
- ๐ ๅฎๅ จ้ป่ฎค - rustls TLS๏ผๆ ้ OpenSSL
- ๐ฏ ไบคไบ้ ็ฝฎ - ๅผๅฏผๅผ้ ็ฝฎๅๅฅๅบทๆฃๆฅ
ๅฟซ้ๅผๅง
# 1. ไธ่ฝฝ
wget https://github.com/tidyinfo/qmd-wrapper/releases/latest/download/qmd
chmod +x qmd
# 2. ้
็ฝฎ
./qmd connect --hostname 192.168.1.100 --port 8181
# 3. ไฝฟ็จ
./qmd search "ๆฅ่ฏขๅ
ๅฎน" --json
ๅฎๆดๆๆกฃ
่ฏฆ็ปไฝฟ็จ่ฏดๆ่ฏทๅ่ไธๆน็่ฑๆๆๆกฃ้จๅใ
ๅธธ่ง้ฎ้ข
Q: ๅฆไฝ้็ฝฎไผ่ฏ๏ผ
A: ็ผ่พ qmd.toml ๆไปถ๏ผๅ ้ค session_id ่กใ
Q: ๆฏๆๅชไบๆ็ดข้้กน๏ผ
A: ๆฏๆ -n, --json, --csv, --full, --min-score ็ญ๏ผ่ฏฆ่งไธๆน Commands ้จๅใ
Q: ๅฆไฝๆๅปบ้ๆไบ่ฟๅถ๏ผ
A: ไฝฟ็จๅฝไปค cargo build --release --target x86_64-unknown-linux-muslใ
ๆๆฏๆฏๆ
ๅฆๆ้ฎ้ข๏ผ่ฏทๆไบค GitHub Issueใ
