QMD MCP

io.github.X1pheR由 GitHub 账号 X1pheR 发布v0.2.2更新于 Oct 24, 2026

Local QMD search and bounded index maintenance through a Streamable HTTP MCP server.

已验证STDIO仅桌面文件与存储知识与记忆

概览

AI 生成的概览

一个本地 Docker 托管的 MCP 服务器,让助手搜索 Markdown 知识库并执行有边界的索引维护任务。

可以做什么
在已配置的 Markdown 集合中搜索并检索文档,另有单独的重排序查询路径,可选返回精确源文件路径以便交给文件系统处理。查看索引与运行时状态,包括定时嵌入和存储准入状态。启动有边界的异步重建索引与嵌入任务,并报告近期管理任务。通过配置让某些集合仅做词法检索,或将其排除在嵌入任务之外。
适用场景
适合维护本地 Markdown 知识库或文档库、希望助手在其中搜索并取回原文,同时以受控方式重建索引和生成嵌入而非开放 shell 的场景。适用于可信网络上的自托管、单写入者部署。
运行要求
需要 Docker 和已发布的容器镜像(linux/amd64 或 linux/arm64)、挂载的 Markdown 内容目录、index.yml 集合配置,以及可写的索引与模型缓存数据卷。MCP 端点通过本地端口的 Streamable HTTP 提供;未声明认证或 API 密钥。
安装前请注意
MCP 传输层不提供认证,应仅绑定回环地址或置于可信网络、认证网关之后。管理工具会启动重建索引和嵌入任务,写入索引并占用 CPU 与内存;同一时间只运行一个任务,每个索引应只有一个写入者。源集合应只读挂载。文档检索默认返回内部文本,向用户暴露需显式确认标志。

安装

在 SourceWeft 中

  1. 打开 控制台中的 QMD MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

QMD MCP

[OpenSSF Scorecard] [OpenSSF Best Practices] [M8ven Live Monitored]

QMD MCP packages QMD as a long-running Streamable HTTP MCP server. It provides QMD search and document retrieval together with bounded index-maintenance operations, without exposing arbitrary shell execution.

This is a community-maintained integration. It is not affiliated with, endorsed by, or officially maintained by the upstream QMD project.

Feedback and contributions

Use GitHub Issues for bug reports and feature requests and pull requests for proposed changes. See CONTRIBUTING.md for the development workflow, test requirements, and coding conventions. Security issues must follow the private process in SECURITY.md.

Release changes are recorded in CHANGELOG.md.

Quick start

Release images are published on GitHub Container Registry (GHCR):

text
ghcr.io/x1pher/qmd-mcp:v0.2.2

Published packages are public, so Docker does not need a GitHub login to pull an accepted release.

For production deployments, select the stable version tag from an accepted GitHub Release. Retain its resolved digest as immutable provenance and rollback evidence.

The image supports linux/amd64 and linux/arm64. Each platform image retains only its matching QMD native llama runtime to keep the image bounded.

1. Create the directories

bash
mkdir -p qmd/config qmd/contentcd qmd

Put the Markdown files you want QMD to index in content/.

2. Create config/index.yml

yaml
global_context: >-  This is a local Markdown knowledge base. Search results are discovery evidence;  read the source document before relying on a material claim.
collections:  docs:    path: /vault    pattern: "**/*.md"    ignore:      - "notes/**"
  notes:    path: /vault/notes    pattern: "**/*.md"    includeByDefault: false
  history:    path: /vault/logs    pattern: "history.md"    includeByDefault: false    embedding: false

path values refer to paths inside the container. The Compose example below mounts ./content at /vault.

embedding: false is a QMD MCP wrapper extension for collections that should remain lexical-only. The files are still indexed and available to explicit lexical (lex) searches, but they are excluded from embedding health and manual start_embed jobs. Use it for large append-only logs or other exact-lookup material where repeatedly rebuilding vectors adds cost without useful semantic recall.

3. Create compose.yml

yaml
services:  qmd-mcp:    image: ghcr.io/x1pher/qmd-mcp:v0.2.2    container_name: qmd-mcp    environment:      QMD_FORCE_CPU: "1"      QMD_REFRESH_INTERVAL_MINUTES: "15"      QMD_REFRESH_INITIAL_DELAY_SECONDS: "120"    ports:      - "127.0.0.1:8181:8181"    volumes:      - ./content:/vault:ro      - ./config:/config:ro      - qmd-data:/data    healthcheck:      test:        - CMD        - node        - -e        - >-          fetch('http://127.0.0.1:8181/health')          .then(r=>process.exit(r.ok?0:1))          .catch(()=>process.exit(1))      interval: 30s      timeout: 10s      retries: 5      start_period: 30s    restart: unless-stopped
volumes:  qmd-data:

The example binds the HTTP port to loopback only. If another container must call QMD MCP directly, attach both containers to a shared Docker network and use the QMD service name instead of exposing it broadly on the host.

QMD_FORCE_CPU=1 gives a predictable CPU-only deployment. Remove it or set it to 0 if you deliberately want QMD to probe for supported acceleration.

4. Start the container

bash
docker compose up -d

Check the service:

bash
curl --fail http://127.0.0.1:8181/health

The Streamable HTTP MCP endpoint is:

text
http://127.0.0.1:8181/mcp

Docker CLI alternative

You can run the same release without Compose:

bash
docker volume create qmd-data
docker run -d \  --name qmd-mcp \  --restart unless-stopped \  -p 127.0.0.1:8181:8181 \  -e QMD_FORCE_CPU=1 \  -e QMD_REFRESH_INTERVAL_MINUTES=15 \  -e QMD_REFRESH_INITIAL_DELAY_SECONDS=120 \  -v "$PWD/content:/vault:ro" \  -v "$PWD/config:/config:ro" \  -v qmd-data:/data \  ghcr.io/x1pher/qmd-mcp:v0.2.2

What QMD MCP provides

QMD MCP keeps QMD's read-oriented MCP tools and adds bounded administration operations:

  • health reports index and runtime state;
  • start_update starts a bounded asynchronous filesystem reindex job;
  • start_embed starts a bounded asynchronous embedding job;
  • job_status reports recent administration jobs;
  • scheduled refresh updates the lexical/index state only; embeddings run explicitly through start_embed, while embedding: false collections remain lexical-only;
  • routine query runs with reranking disabled;
  • query_reranked provides a separate CPU-heavy reranked path;
  • query results can include an exact source_relative_path for authoritative filesystem handoff when QMD_SOURCE_RELATIVE_ROOT is configured and the source path resolves unambiguously;
  • document retrieval returns internal text by default; user-visible MCP resource exposure requires both exposeToUser=true and confirmUserApprovedExposure=true, and preview/show/open/render/inspect intent is not approval.

Only one administration job runs at a time. Completed jobs are retained in memory with a bounded history. See docs/tools.md for the complete nine-tool reference, including access level and side effects.

Runtime paths

The container uses these stable paths:

PathPurpose
/config/index.ymlQMD collection configuration
/data/index.sqliteQMD index database
/data/homeRuntime home directory
/data/cacheModel and runtime cache

Source collections should normally be mounted read-only. /data must remain writable because it contains the rebuildable index and model/runtime cache.

Configuration

The Dockerfile provides working defaults for the normal runtime paths and HTTP listener. Override only the settings your deployment needs.

VariableDefaultPurpose
QMD_HTTP_HOST0.0.0.0HTTP listen address inside the container
QMD_HTTP_PORT8181HTTP listen port
QMD_CONFIG_PATH/config/index.ymlQMD collection configuration file
INDEX_PATH/data/index.sqliteQMD index database
QMD_SOURCE_RELATIVE_ROOTunsetOptional common source root. When set, query results include exact, collision-safe source_relative_path values relative to this root.
QMD_DEFAULT_COLLECTIONunsetDefault collection for start_embed; otherwise the first configured collection is used
QMD_FORCE_CPU0Set to 1 to disable acceleration probing and force CPU use
QMD_EMBED_PARALLELISMunsetOptional QMD embedding parallelism override
QMD_EMBED_MAX_DOCS_PER_BATCH8Default maximum documents per manual or scheduled embedding batch; accepted range 1-32
QMD_EMBED_MAX_BATCH_MB16Default maximum manual or scheduled embedding batch size in MiB; accepted range 1-128
QMD_EMBED_MAX_DURATION_MS3600000Maximum embedding session length; accepted range 60000-7200000 ms
QMD_EMBED_INTERVAL_MINUTES0Automatic embedding check interval; 0 disables all embedding timers. Integer 0-1440 minutes
QMD_EMBED_INITIAL_DELAY_SECONDS120First automatic embedding check delay; integer 0-3600 seconds
QMD_REFRESH_INTERVAL_MINUTES15Scheduled index-refresh interval; refresh never starts embedding. 0 disables it, maximum 1440
QMD_REFRESH_INITIAL_DELAY_SECONDS120Delay before the first scheduled refresh; accepted range 0-3600

Invalid bounded numeric values fail at startup instead of being silently accepted. QMD_SOURCE_RELATIVE_ROOT never exposes its absolute path; only a relative source path is returned, and ambiguous normalized-path collisions return null rather than guessing.

Automatic embedding

Automatic embedding is disabled by default. Set a positive QMD_EMBED_INTERVAL_MINUTES to enable periodic checks after QMD_EMBED_INITIAL_DELAY_SECONDS.

Each check selects pending work using the effective collection embedding policy. Missing embedding means enabled; default search selection and QMD_DEFAULT_COLLECTION do not limit the scheduler. One scheduled_embed job processes eligible collections sequentially under the same maintenance claim as manual jobs and refresh. Across admitted checks, the first eligible collection rotates in process memory so one collection cannot consume every shared deadline indefinitely. Busy or active-query checks skip without queuing work. Policy and pending work are rechecked before each collection.

Scheduled embedding is resumable across cooperative deadlines. Successfully embedded chunks of an unfinished document are retained as internal checkpoints for the exact model/fingerprint, remain pending until the full document is complete, and are skipped on the next scheduled attempt. Incomplete checkpoint groups are excluded from vector-search results. Manual embedding keeps the previous atomic cleanup behavior for an interrupted incomplete document. Results preserve per-collection outcomes and current aggregate pending work. Cooperative deadline cancellation is reported as deadline debt rather than a model failure; genuine embedding failures keep their existing error handling. Successful/no-op/skipped checks are quiet; incomplete runs log a compact summary without document content.

MCP health and HTTP /health expose scheduledEmbedding enablement, interval, initial delay, last outcome, next planned check and reused embedding bounds. State is process-local and resets on restart. The next check is a plan, not a promised job start. scheduledRefresh.embeddingAutomatic: false describes refresh only: refresh remains update-only.

The scheduler uses one shared cooperative time budget. Its optional AbortSignal is forwarded through the pinned SDK, embedding session and native loops. After observing abort, no new document preparation, retry or native evaluation starts. Already-started native calls are awaited, including parallel workers. Completed scheduled chunks are checkpointed for later resume instead of being recomputed; an incomplete checkpoint group is not search-visible until all expected chunks exist. Shutdown clears scheduler timers and waits for actual maintenance completion before closing the store. A cooperative deadline cannot hard-limit an in-flight native call's wall-clock duration. Manual embedding retains its per-collection session duration and atomic incomplete-document cleanup; the absent duration default is 3600000 ms.

Use one server writer per index; other replicas or direct CLI writers are outside the process-local claim. Batch bytes are a packing target, not a RAM ceiling. Deployments must supply appropriate CPU/RAM/swap limits and embedding parallelism. Query deferral applies at admission and between collections; queries arriving during a collection keep the existing behavior.

Security model

  • The container runs as the upstream Node image's unprivileged node user.
  • Source collections should normally be mounted read-only.
  • Index and cache state remain separate from source content.
  • Administration is limited to the exposed job operations. The wrapper calls the QMD store API directly; it does not invoke QMD CLI update hooks or expose arbitrary shell execution.
  • MCP request bodies are capped at 1 MiB before JSON parsing.
  • Error messages redact configured index and config paths.
  • MCP transport is not an authentication layer. Keep it on a trusted network boundary or place it behind an authenticated MCP gateway.
  • Production deployments should select a stable version tag instead of a branch, latest, or another moving tag; retain the resolved digest as artifact evidence.

See SECURITY.md for vulnerability reporting and deployment guidance and docs/SECURE-DEVELOPMENT.md for the secure-design principles, common weakness classes, and review expectations applied to the project.

Upstream relationship

This repository is not a fork of the full QMD source tree. It consumes an exact @tobilu/qmd package version and applies a small fail-closed compatibility patch set during image build. The build fails if an expected upstream patch target no longer matches exactly.

See UPSTREAM.md for the current upstream version, patch inventory, and update process. Automatic embedding acceptance maps the behavioral and image checks.

Validation

The container build is the primary validation boundary. It installs the locked dependency set, applies every upstream patch, runs the complete unit/property test suite, performs JavaScript syntax checks, and prunes development-only dependencies before the runtime stage. CI also starts the image, initializes the MCP protocol, verifies the exact nine-tool surface, runs a real index update against a temporary Markdown collection, and verifies the resulting document count.

Dependency and base-image updates are proposed by Dependabot. A QMD update is accepted only after the image build and functional release acceptance pass against the proposed version.

Releases

Versions use SemVer tags such as v0.2.0. A release must point to an exact CI-green commit. The tag-triggered Release workflow:

  1. verifies that the tag matches package.json;
  2. builds the linux/amd64 and linux/arm64 images and publishes one multi-architecture tag;
  3. publishes it to GHCR;
  4. records the immutable image digest;
  5. publishes SBOM/provenance and a GitHub attestation;
  6. creates the corresponding GitHub Release.

Normal CI does not publish images or releases. Release tags are immutable and are never reused for a different commit.

License

QMD MCP's original wrapper code is MIT licensed. QMD and bundled dependencies retain their own licenses. See LICENSE and UPSTREAM.md.

Storage-aware maintenance admission

All maintenance shares the existing single-job owner and now checks local full I/O and memory PSI avg10 before starting. Defaults defer at 5% and wait five minutes after pressure; this is workload admission, not an alert-threshold change. Read/query service remains available. Scheduled embedding checks again between collections and preserves committed progress. Refresh yields to active queries. A one-minute quiet period separates jobs; partial/failed work backs off per kind for 30, 60 then at most120 minutes, so embedding debt does not starve ordinary refresh forever. Restart uses the existing initial startup delays.

health.storageAdmission exposes the last decision and cooldowns. QMD_IO_PSI_FULL_AVG10_MAX and QMD_MEMORY_PSI_FULL_AVG10_MAX configure bounded integer thresholds. Missing/malformed PSI defers rather than silently accepting work. An optional QMD_STORAGE_THROTTLE_FILE is a deployment-owned read-only atomic JSON cache: schemaVersion:1, ISO8601 observedAt, nonnegative numeric throttledIOs. Any positive throttling defers; a configured missing/stale/malformed cache also defers. Default maximum age is10 minutes (QMD_STORAGE_THROTTLE_MAX_AGE_MS). No cloud credentials, API client, network request or producer is added to QMD; operators own sampling/delivery and must not configure the cache before its producer is accepted. Unconfigured cloud coverage is explicit in health. Normal15-minute refresh and30-minute embedding cadence remains deployment-owned.

QMD_PRESSURE_ROOT may select an operator-owned absolute read-only directory containing io and memory PSI files; default /proc/pressure. Integration tests mount deterministic healthy/degraded fixtures outside /proc, preserving Docker proc-safety confinement. Production uses the real kernel pressure interface.

来源:README.md,提交 b25d9d4

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v0.2.2最新Oct 2, 2026
  2. v0.2.0Oct 1, 2026
  3. v0.1.3Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分