
Qt4 Doc Mcp Server
io.github.jztan由 GitHub 帳號 jztan 發布v0.7.0更新於 Oct 24, 2026
Offline MCP server for local Qt 4.8, Qt 5, and Qt 6 documentation with full-text search.
概覽
一個離線 MCP 伺服器,讓助理搜尋並閱讀本機安裝的 Qt 4.8、Qt 5 或 Qt 6 HTML 文件集。
- 可以做什麼
- 對目前啟用的 Qt 文件集做全文搜尋,回傳依相關性排序的結果與附有醒目提示的片段,結果數量可設定(預設 10,最多 50)。讀取轉換為 Markdown 的文件頁面,可只擷取指定章節或將長頁面分頁。頁面以相對於文件根目錄的 Markdown 路徑識別,而非線上網址。
- 適用情境
- 適合在開發 Qt 4.8、Qt 5 或 Qt 6 程式碼時,讓助理從本機既有的文件中查找類別、函式與指南,不需連網。一次只服務一份文件集。
- 執行需求
- 本機程序,需要 Python 3.11+(或使用已發佈的 Docker 映像),並在 QT_DOC_BASE 指定既有的 Qt HTML 文件根目錄。文件、快取與搜尋索引約需 500 MB 磁碟空間,需要支援 FTS5 的 SQLite。若文件目錄為唯讀,需設定 QT_DOC_STATE_DIR。預設在 127.0.0.1:8000 以 HTTP 執行,加上參數可改用 stdio。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Qt4 Doc Mcp Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Qt Documentation MCP Server
mcp-name: io.github.jztan/qt4-doc-mcp-server
[PyPI Version] [License] [Python Version] [GitHub Issues] [CI] [Downloads]
Bring locally installed Qt 4.8, Qt 5, or Qt 6 documentation to your AI coding assistant. Works offline with one selected documentation set at a time.
Tool Reference | Changelog | Contributing | Troubleshooting
✨ Features
- 🔌 Offline-First - Works entirely with local documentation
- 🔍 Full-Text Search - Find what you need across all Qt docs
- ⚡ Smart Caching - Fast responses for repeated queries
- 🎯 Fragment Support - Extract specific sections when needed
- 🛠️ MCP Standard - Compatible with Claude, VS Code, and other MCP clients
📦 Prerequisites
- Python 3.11+ required (not needed when using the Docker image)
- Qt HTML Documentation for one supported release (Qt 4.8, Qt 5, or Qt 6)
- The included helper downloads Qt 4.8.4 only.
- Point
QT_DOC_BASEdirectly at an existing Qt 5/6 offline documentation root.
- ~500MB disk space for docs + cache + search index
- SQLite with FTS5 support (included in Python 3.11+ by default)
🚀 Installation
From PyPI (Recommended)
From Source
Setup Qt Documentation
The helper script ships with the repo, not the PyPI package. Installed from PyPI only? Download the docs manually instead:
Then create a .env with QT_DOC_BASE pointing at that directory (see Configuration below).
Quick Start Commands
The legacy qt4-doc-mcp-server command remains available as an alias for existing client configurations.
Agent-friendly FTS CLI
After building the index, agents can search and receive materialized absolute Markdown paths:
The command reads the same .env settings as the server. Before searching, it automatically builds a missing/outdated FTS index and fully warms an incomplete Markdown cache. It then prints each result's title, absolute .md path, and FTS snippet to stdout; preparation messages, errors, and warnings go to stderr. Use qt-doc-warm-md --force after changing documentation in place.
🐳 Docker
Prebuilt multi-arch images (amd64/arm64) are published to GitHub Container Registry on every release. The container is offline-only: you mount your prepared Qt doc/html directory read-only at /docs, and all derived state (Markdown cache and search index) lives in a volume at /data.
Using only the published image, without cloning this repo? Download the Qt 4.8.4 docs directly instead of running the prepare script:
Any existing Qt 5 or Qt 6 doc/html tree (from the Qt installer or distro documentation packages) works as the mount source too.
First start converts and indexes the documentation into the /data volume; subsequent starts reuse it. Depending on the docset size, the first start can take a minute or two before the health endpoint responds.
Docker Compose
With docs in the default ./qt4-docs-html location, no configuration is needed:
For docs elsewhere (including Qt 5 or Qt 6 doc/html trees, which the server also supports), point QT_DOC_HTML_PATH at them. If port 8000 is taken on the host, set HOST_PORT in the same file (with plain docker run, change the left side of -p instead):
Or use the convenience script, which checks Docker is running, creates .env.docker on first run, builds and starts the service, and waits for the health endpoint:
Point your MCP client at http://127.0.0.1:8000/mcp (streamable HTTP). Qt documentation is licensed under GFDL 1.3; the container serves your local copy and never redistributes it.
⚙️ Configuration
These settings apply to native (pip or source) runs. In Docker they are already set inside the container (QT_DOC_BASE=/docs, QT_DOC_STATE_DIR=/data, SERVER_HOST=0.0.0.0); the QT_DOC_HTML_PATH variable in .env.docker is not a server setting, just the host path mounted at /docs.
Create a .env file in the repo root. The helper script writes sensible defaults; adjust as needed:
The tools identify documents by their exact root-relative Markdown path, not an online URL. For example, use qcompleter.md for a Qt 4 page, qtdoc/accessible.md for a Qt 5/6 global page, or qtcore/qobject.md for a Qt 5/6 Core page. By default, each docset stores its own index and Markdown cache under $QT_DOC_BASE/.index/, so switching QT_DOC_BASE reuses its existing derived state. Set QT_DOC_STATE_DIR to relocate both to a writable directory. The Markdown cache mirrors the documentation tree: for example, qtcore/qobject.md is cached as .index/md/qtcore/qobject.md plus qobject.meta.json with the default state directory.
🔌 MCP Client Setup
By default, the server exposes an HTTP endpoint at http://127.0.0.1:8000/mcp. Register it with your preferred MCP-compatible agent using the instructions below.
Stdio transport
Run the server over stdio instead of HTTP with:
For stdio-only MCP clients, configure that command with args: ["--transport", "stdio"]. Startup indexing and Markdown-cache progress are written to stderr, leaving stdout exclusively for MCP protocol messages.
Visual Studio Code (Native MCP Support)
VS Code has built-in MCP support via GitHub Copilot (requires VS Code 1.102+).
Using CLI (Quickest):
Using Command Palette:
- Open Command Palette (
Cmd/Ctrl+Shift+P) - Run
MCP: Open User Configuration(for global) orMCP: Open Workspace Folder Configuration(for project-specific) - Add the configuration:
- Save the file. VS Code will automatically load the MCP server.
Manual Configuration:
Create .vscode/mcp.json in your workspace (or mcp.json in your user profile directory):
Claude Code
Add to Claude Code using the CLI command:
Or configure manually in your Claude Code settings file (~/.claude.json):
Codex CLI
Add to Codex CLI using the command:
Or configure manually in ~/.codex/config.toml:
Note: Codex CLI primarily supports stdio-based MCP servers. The above uses mcp-client-http as a bridge for HTTP transport.
Kiro
Kiro primarily supports stdio-based MCP servers. For HTTP servers, use an HTTP-to-stdio bridge:
- Create or edit
.kiro/settings/mcp.jsonin your workspace: - Save the file and restart Kiro. The active Qt documentation tools will appear in the MCP panel.
Note: Direct HTTP transport support in Kiro is limited. The above configuration uses mcp-client-http as a bridge to connect to HTTP MCP servers.
Generic MCP Clients
Most MCP clients use a standard configuration format. For HTTP servers:
For clients that require a command-based approach with HTTP bridge:
🛠️ Available Tools
The server provides 2 MCP tools for working with the active local Qt documentation set:
-
read_documentation- Read and convert pages from the active Qt documentation set to Markdown- Fragment extraction (
#details,#public-functions) - Pagination with
start_indexandmax_length - Section-only mode for targeted content
- Returns Markdown with normalized links and GFDL attribution
- Fragment extraction (
-
search_documentation- Full-text search across the active Qt documentation set- SQLite FTS5 with BM25 relevance ranking
- Context snippets with highlighted matches
- Configurable result limits (default: 10, max: 50)
For detailed API documentation including parameters, return values, examples, and error handling, see the Tool Reference.
📚 Related Resources
- Model Context Protocol Specification
- Qt Documentation
- FastMCP Framework
- Tool Reference
- Changelog
- Contributing Guide
- Troubleshooting Guide
📄 License
- Code: MIT License (see
LICENSE). - Qt Documentation: © The Qt Company Ltd. and contributors, licensed under GFDL 1.3. This server
converts locally obtained docs and includes attribution in outputs. If you
redistribute a local mirror, include
LICENSE.FDLand preserve notices. - See
THIRD_PARTY_NOTICES.mdfor more details.
來源:README.md,提交 9998403
工具
0版本歷史
1- v0.7.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分