Skip to main content

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
  • 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_BASE directly 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)

pip install qt4-doc-mcp-server

From Source

git clone https://github.com/jztan/qt4-doc-mcp-server.git
cd qt4-doc-mcp-server
uv sync --locked

Setup Qt Documentation

# Automated setup (recommended)
python scripts/prepare_qt48_docs.py --segments 4

# This will:
# - Download Qt 4.8.4 source archive
# - Extract HTML documentation
# - Create .env with sensible defaults
# - Copy GFDL license file

Quick Start Commands

# 1. Install
pip install qt4-doc-mcp-server

# 2. Setup Qt docs
python scripts/prepare_qt48_docs.py --segments 4

# 3. Build search index
qt-doc-build-index

# 4. Start server
qt-doc-mcp

# 5. Verify health
curl -s http://127.0.0.1:8000/health

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:

qt-doc-cli "accessible applications" --limit 5

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.

⚙️ Configuration

Create a .env file in the repo root. The helper script writes sensible defaults; adjust as needed:

Variable Default Purpose
QT_DOC_BASE required Absolute path to one Qt 4.8, Qt 5, or Qt 6 HTML documentation root. The server detects the active docset.
QT_DOC_STATE_DIR $QT_DOC_BASE/.index Optional writable directory for the FTS index and Markdown cache. Use this when the documentation root is read-only.
PREINDEX_DOCS true Build search index automatically at startup if not present.
PRECONVERT_MD false Warm the Markdown cache automatically at MCP startup.
SERVER_HOST 127.0.0.1 Bind address for the FastMCP server (0.0.0.0 for containers).
SERVER_PORT 8000 TCP port for streamable HTTP transport.
MCP_LOG_LEVEL WARNING Logging verbosity (DEBUG/INFO/WARNING/ERROR).
MD_CACHE_SIZE 512 In-memory CachedDoc LRU capacity (counts pages).
DEFAULT_MAX_MARKDOWN_LENGTH 20000 Default maximum characters returned per request (prevents token limit issues).

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:

qt-doc-mcp --transport stdio

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):

code --add-mcp '{"name":"qt-docs","type":"http","url":"http://127.0.0.1:8000/mcp"}'

Using Command Palette:

  1. Open Command Palette (Cmd/Ctrl+Shift+P)
  2. Run MCP: Open User Configuration (for global) or MCP: Open Workspace Folder Configuration (for project-specific)
  3. Add the configuration:
    {
      "servers": {
        "qt-docs": {
          "type": "http",
          "url": "http://127.0.0.1:8000/mcp"
        }
      }
    }
    
  4. 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):

{
  "servers": {
    "qt-docs": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}
Claude Code

Add to Claude Code using the CLI command:

claude mcp add --transport http qt-docs http://127.0.0.1:8000/mcp

Or configure manually in your Claude Code settings file (~/.claude.json):

{
  "mcpServers": {
    "qt-docs": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}
Codex CLI

Add to Codex CLI using the command:

codex mcp add qt-docs -- npx -y mcp-client-http http://127.0.0.1:8000/mcp

Or configure manually in ~/.codex/config.toml:

[mcp_servers.qt-docs]
command = "npx"
args = ["-y", "mcp-client-http", "http://127.0.0.1:8000/mcp"]

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:

  1. Create or edit .kiro/settings/mcp.json in your workspace:
    {
      "mcpServers": {
        "qt-docs": {
          "command": "npx",
          "args": [
            "-y",
            "mcp-client-http",
            "http://127.0.0.1:8000/mcp"
          ],
          "disabled": false
        }
      }
    }
    
  2. 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:

{
  "mcpServers": {
    "qt-docs": {
      "type": "http",
      "url": "http://127.0.0.1:8000/mcp"
    }
  }
}

For clients that require a command-based approach with HTTP bridge:

{
  "mcpServers": {
    "qt-docs": {
      "command": "npx",
      "args": ["-y", "mcp-client-http", "http://127.0.0.1:8000/mcp"]
    }
  }
}

🛠️ Available Tools

The server provides 2 MCP tools for working with the active local Qt documentation set:

  1. read_documentation - Read and convert pages from the active Qt documentation set to Markdown

    • Fragment extraction (#details, #public-functions)
    • Pagination with start_index and max_length
    • Section-only mode for targeted content
    • Returns Markdown with normalized links and GFDL attribution
  2. 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

📄 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.FDL and preserve notices.
  • See THIRD_PARTY_NOTICES.md for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qt4_doc_mcp_server-0.6.1.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qt4_doc_mcp_server-0.6.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file qt4_doc_mcp_server-0.6.1.tar.gz.

File metadata

  • Download URL: qt4_doc_mcp_server-0.6.1.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for qt4_doc_mcp_server-0.6.1.tar.gz
Algorithm Hash digest
SHA256 6e10447d8a51d4266fd1d288bd32a5ed9f4c5a641c725468e76a2edbfa2cec89
MD5 ec16ea234341e166bdbee54fadea6af4
BLAKE2b-256 fc81f3e56174a692459b8f175c1d397309fac1ed839d3ce993d9f7877ed6c751

See more details on using hashes here.

File details

Details for the file qt4_doc_mcp_server-0.6.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qt4_doc_mcp_server-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96b5f922fe2529e0c243f50ec3f7ac91c35e003843f35c7e0921e9c05c060170
MD5 65b28800b85dc4ad836b716a728a4068
BLAKE2b-256 0c4b54e3d36a7bf9abc94419bf5fcb016614fb450af2b05b03045fc7dcc28ed6

See more details on using hashes here.

Release history Release notifications | RSS feed

0.7.0

2 files

This release

0.6.1 This release

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page