Qiskit Documentation MCP Server

io.github.Qiskit由 GitHub 帳號 Qiskit 發布v0.3.0更新於 Oct 24, 2026

MCP server for querying and retrieving Qiskit documentation, guides, and API references

已驗證STDIO僅桌面知識與記憶開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理搜尋與閱讀 Qiskit 文件、指南與 API 參考,並查詢 Qiskit 錯誤碼。

可以做什麼
以模糊比對搜尋 Qiskit 文件,可依範圍與結果數量篩選,回傳簡短摘要或全文。以 Markdown 形式取得任意文件頁面,支援長度限制與位移分頁以處理長頁面。依四位數字查詢 Qiskit 或 IBM Quantum 錯誤碼。瀏覽 SDK 模組、附加套件、指南、教學、API 套件與錯誤碼分類等資源清單,內容從線上網站地圖動態探索。
適用情境
適合在使用 Qiskit 或 IBM Quantum 時使用:撰寫量子電路、轉譯、使用 primitives 或排查錯誤碼,並希望助理查閱目前的官方文件而不是憑猜測回答。
執行需求
以 stdio 在本機執行;需要 Python 3.10 或更高版本,建議使用 uv 或 uvx(也可用 pip 安裝)。需要連網存取 IBM Quantum 文件網站。選用環境變數 QISKIT_DOCS_BASE 與 QISKIT_HTTP_TIMEOUT 可調整文件基礎位址與請求逾時。不需驗證或 API 權杖。
安裝前請注意
僅提供唯讀文件存取,不涉及帳號、付款或寫入操作。它會從設定的文件網站抓取頁面,因此請求會送往該第三方;修改 QISKIT_DOCS_BASE 會將其指向其他主機。回應會在本機快取一段可設定的時間。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Qiskit Documentation MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

qiskit-docs-mcp-server

[MCP Registry]

MCP server for querying and retrieving Qiskit documentation, guides, and API references.

Overview

The Qiskit Documentation MCP Server provides AI assistants and agents with seamless access to the complete Qiskit documentation ecosystem. It enables intelligent retrieval of SDK module documentation, implementation guides, and best practices through a standardized Model Context Protocol interface.

Key Features

  • 📚 Complete Documentation Access: Query all Qiskit SDK modules, addon packages, API references, guides, and tutorials
  • 🔄 Dynamic Content Discovery: Automatically discovers available documentation from the live sitemap — no manual updates needed when new content is published
  • 📖 Implementation Guides: Access best practices for optimization, error mitigation, dynamic circuits, and more
  • 🔍 Smart Search: Search across the entire Qiskit documentation with fuzzy matching
  • 🎯 No Authentication Required: Public documentation access without API tokens
  • 📝 Markdown Output: Clean, formatted documentation ready for AI consumption
  • ⚡ Fast Retrieval: Efficient HTTP-based documentation fetching with TTL caching and configurable timeouts

Components

Tools

The server implements three tools for documentation access:

ToolDescriptionParameters
search_docs_toolSearch the Qiskit documentation; returns short query-centered snippets by default so the response stays compact for repeated agent usequery: Search query string
scope: Search scope filter — all (default), documentation, api, learning, tutorials
top_k: Max results to return (default: 5, capped at 10)
detail: snippet (default, short excerpt per result) or full (full page body — prefer get_page_tool for a single page)
get_page_toolFetch any Qiskit documentation page and return as markdownurl: Full URL or relative path (e.g., guides/transpile, api/qiskit/circuit)
max_length: Max characters to return (default: 20000, 0 for unlimited)
offset: Character offset for pagination (default: 0)
lookup_error_code_toolLook up a Qiskit/IBM Quantum error codecode: 4-digit error code (e.g., 1002, 7001, 8004)

Resources

The server provides six resources for listing available documentation. Content lists for modules, addons, guides, tutorials, and API packages are dynamically discovered from the documentation sitemap and cached, with hardcoded fallback values used when the sitemap is unreachable.

Resource URIDescription
qiskit-docs://modulesList of all Qiskit SDK modules with URL paths
qiskit-docs://addonsList of Qiskit addon packages with URL paths
qiskit-docs://guidesList of implementation guides and best practices
qiskit-docs://tutorialsList of Qiskit tutorials with URL paths
qiskit-docs://api-packagesList of API packages (runtime, transpiler, REST APIs, etc.)
qiskit-docs://error-codesList of Qiskit error code categories

Resource Templates

Resource URIDescription
qiskit-docs://modules/{module_name}Documentation for a specific SDK module
qiskit-docs://guides/{guide_name}A specific implementation guide
qiskit-docs://addons/{addon_name}Documentation for a specific addon package

Prerequisites

Installation

Install from PyPI

The easiest way to install is via pip:

bash
pip install qiskit-docs-mcp-server

Or using uvx (recommended):

bash
uvx qiskit-docs-mcp-server

Install from Source

This project uses uv for virtual environments and dependencies management. If you don't have uv installed, check out the instructions in https://docs.astral.sh/uv/getting-started/installation/

Setting up the Project with uv
  1. Clone the repository:

    bash
    git clone https://github.com/Qiskit/mcp-servers.git
    cd mcp-servers/qiskit-docs-mcp-server
  2. Initialize or sync the project:

    bash
    # This will create a virtual environment and install dependencies
    uv sync

Configuration

Environment Variables

The server can be configured using environment variables:

VariableDescriptionDefault
QISKIT_DOCS_BASEBase URL for Qiskit documentationhttps://quantum.cloud.ibm.com/docs/
QISKIT_HTTP_TIMEOUTHTTP request timeout in seconds10.0
QISKIT_DOCS_CACHE_TTLPage cache TTL in seconds3600.0
QISKIT_SEARCH_CACHE_TTLSearch/JSON cache TTL in seconds300.0
QISKIT_SEARCH_BASE_URLSearch API base URLhttps://quantum.cloud.ibm.com/

Optional Configuration

Create a .env file in the project directory:

env
# Optional: Customize documentation URLs
QISKIT_DOCS_BASE=https://quantum.cloud.ibm.com/docs/
QISKIT_HTTP_TIMEOUT=15.0
QISKIT_DOCS_CACHE_TTL=3600.0
QISKIT_SEARCH_CACHE_TTL=300.0

Quick Start

Running the Server

bash
uv run qiskit-docs-mcp-server

The server will start and listen for MCP connections.

Using with MCP Clients

Claude Desktop Configuration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

json
{
  "mcpServers": {
    "qiskit-docs": {
      "command": "uvx",
      "args": ["qiskit-docs-mcp-server"]
    }
  }
}
Cline Configuration

Add to your Cline MCP settings:

json
{
  "mcpServers": {
    "qiskit-docs": {
      "command": "uvx",
      "args": ["qiskit-docs-mcp-server"]
    }
  }
}

LangChain Integration Example

Note: To run LangChain examples you will need to install the dependencies:

bash
pip install langchain-mcp-adapters langchain-openai langgraph
python
import asyncio

from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent

async def main():
    # Configure MCP client
    async with MultiServerMCPClient(
        {
            "qiskit-docs": {
                "command": "qiskit-docs-mcp-server",
                "args": [],
                "transport": "stdio",
            }
        }
    ) as client:
        # Create agent with LLM and MCP tools
        agent = create_react_agent(
            ChatOpenAI(model="gpt-4o"),
            client.get_tools(),
        )

        # Query documentation
        response = await agent.ainvoke(
            {"messages": [("user", "How do I create a quantum circuit in Qiskit?")]}
        )
        print(response["messages"][-1].content)

asyncio.run(main())

Usage Examples

Search Documentation

python
# Search returns short snippets (not full pages) — cheap to call inside an agent
result = await search_docs_tool("transpiler optimization")
print(f"Showing {result['returned_results']} of {result['total_results']} matches")
for item in result["results"]:
    print(f"- {item['title']}: {item['url']}")
    print(f"    {item['snippet']}")

# Then fetch the full content of the one page you want
page = await get_page_tool(result["results"][0]["url"])
print(page["documentation"])

Note (behavior change): search_docs_tool now returns short, query-centered snippets by default and caps results to top_k (default 5). In default (detail="snippet") mode each result carries a snippet field — not the full text body — and is limited to id, url, title, pageTitle, module, section, snippet. For the original behavior, pass detail="full": it restores each result's full text body and all upstream fields and returns every match by default (no top_k cap) — an explicit top_k still limits the count in full mode but is not clamped to the snippet-mode ceiling. Prefer get_page_tool for a single page's full content. total_results is the grand total of matches; returned_results is the count actually returned (equal to total_results in full mode unless you set an explicit top_k).

Fetch a Documentation Page

python
# Fetch circuit module API reference
result = await get_page_tool("api/qiskit/circuit")
print(result["documentation"])

# Fetch with pagination for large pages
result = await get_page_tool("api/qiskit/circuit", max_length=5000)
if result["has_more"]:
    next_page = await get_page_tool("api/qiskit/circuit", offset=result["next_offset"])

Look Up an Error Code

python
# Look up error code 1002
result = await lookup_error_code_tool("1002")
print(result["details"])

Available Documentation

SDK Modules

ModuleDescription
circuitQuantum circuit construction and manipulation
quantum_infoQuantum information theory utilities
transpilerCircuit transpilation and optimization
synthesisCircuit synthesis algorithms
dagcircuitDAG representation of quantum circuits
passmanagerTranspiler pass manager framework
convertersCircuit format converters
compilerHigh-level compilation routines
primitivesSampler and Estimator primitives
providersBackend providers and job management
resultJob result handling and analysis
visualizationCircuit and result visualization
qasm2OpenQASM 2.0 support
qasm3OpenQASM 3.0 support
qpyQiskit Python serialization format
utilsGeneral utility functions
exceptionsQiskit exception classes

Implementation Guides

GuideDescription
quick-startGet started with Qiskit
construct-circuitsBuild and manipulate quantum circuits
transpileTranspile circuits for target backends
transpiler-stagesUnderstand transpiler pipeline stages
configure-error-mitigationConfigure error mitigation for primitives
configure-error-suppressionConfigure error suppression techniques
primitivesUse Sampler and Estimator primitives
execution-modesJob, session, and batch execution modes
dynamic-circuitsMid-circuit measurements and classical control
functionsOverview of Qiskit Functions

See the qiskit-docs://guides resource for the complete list of 30+ available guides.

Features

Pagination Support

Large documentation pages are automatically paginated. Use max_length and offset to control content retrieval:

python
# Fetch first 5000 characters
result = await get_page_tool("api/qiskit/circuit", max_length=5000)
# result["has_more"] == True, result["next_offset"] == 5000

# Fetch unlimited content
result = await get_page_tool("api/qiskit/circuit", max_length=0)

Metadata Inclusion

All responses include rich metadata:

python
{
    "status": "success",
    "url": "https://quantum.cloud.ibm.com/docs/api/qiskit/circuit",
    "documentation": "...",
    "has_more": False,
    "total_length": 15420,
    "metadata": {
        "url": "https://quantum.cloud.ibm.com/docs/api/qiskit/circuit",
        "timestamp": "2026-03-03T03:00:00Z",
        "content_type": "markdown",
        "content_length": 15420
    }
}

Dynamic Sitemap Discovery

Resource lists (modules, addons, guides, tutorials, API packages) are automatically discovered from the live documentation sitemap at startup. This means the server adapts to new content without code changes. If the sitemap is unreachable, the server falls back to hardcoded values in constants.py.

To update the hardcoded fallback values from the live sitemap:

bash
cd qiskit-docs-mcp-server
uv run python scripts/update_fallback_constants.py

This prints updated constant lists that can be copied into constants.py.

HTML to Markdown Conversion

Documentation is automatically converted from HTML to clean Markdown format, optimized for AI consumption and human readability.

Development

Project Structure

src/qiskit_docs_mcp_server/
├── server.py           # MCP server definition (tools, resources, prompts)
├── data_fetcher.py     # Business logic for fetching and processing documentation
├── http.py             # HTTP infrastructure: client management, caching, retries
├── sitemap.py          # Dynamic sitemap discovery and page classification
├── html_processing.py  # HTML content extraction and markdown conversion
└── constants.py        # Configuration constants and hardcoded fallback values

scripts/
└── update_fallback_constants.py  # Regenerate fallback values from live sitemap

Running Tests

bash
# Run all tests
./run_tests.sh

# Or use pytest directly
uv run pytest tests/ -v

# Run with coverage
uv run pytest tests/ --cov=src --cov-report=html

Code Quality

bash
# Format code
uv run ruff format src/ tests/

# Lint code
uv run ruff check src/ tests/

# Type check
uv run mypy src/

Examples

See the examples/ directory for complete working examples:

Troubleshooting

Connection Issues

Problem: "Failed to fetch documentation" Solution: Check your internet connection and verify access to https://quantum.cloud.ibm.com/docs/

Timeout Errors

Problem: "Request timed out" Solution: Increase the timeout value:

bash
export QISKIT_HTTP_TIMEOUT=30.0

Page Not Found

Problem: "Failed to fetch" error from get_page_tool Solution: Use search_docs_tool to find the correct URL, or check the qiskit-docs://modules and qiskit-docs://guides resources for valid paths

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file in the repository root for guidelines.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Links

Support

For issues and questions:

來源:qiskit-docs-mcp-server/README.md,提交 373be19

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分