English | ็ฎไฝไธญๆ
A Rust-based command-line wrapper for the QMD (Query Markup Documents) MCP server, enabling remote access to QMD search functionality via HTTP.
- ๐ 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
# From releases page
wget https://github.com/tidyinfo/qmd-wrapper/releases/latest/download/qmd
# Make executable
chmod +x qmd# Connect to remote QMD server
./qmd connect --hostname <server-host> --port <server-port>
# Example
./qmd connect --hostname 192.168.1.100 --port 8181# Search documents
./qmd search "your query" --json
# Get status
./qmd status
# Retrieve document
./qmd get path/to/file.md- Download the latest release from Releases
- Place in your PATH:
sudo cp qmd /usr/local/bin/
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# Non-interactive mode
./qmd connect --hostname example.com --port 8181
# Interactive mode (with prompts)
./qmd connectThe 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
[server]
host = "localhost"
port = 8181
session_id = "auto-generated-after-first-connect"# 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 |
# 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]]# 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# 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># List contexts
./qmd context list
# Add context
./qmd context add [path] "text"
# Remove context
./qmd context rm <path># 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# 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โโโโโโโโโโโโโโโโโโโ 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 โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
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
# Test server health
curl http://host:port/health
# Expected response
{"status":"ok","uptime":N}# Reset session (edit config file)
# Remove the session_id line from qmd.toml| 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 |
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
# 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| 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 |
MIT License - see LICENSE file for details.
- 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
- 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ใ