
Qiskit MCP Server
io.github.Qiskit由 GitHub 帳號 Qiskit 發布v0.3.2更新於 Oct 24, 2026
MCP server for Qiskit quantum computing with circuit serialization utilities
概覽
本機 MCP 伺服器,讓助理對 Qiskit 量子電路進行轉譯、分析,並轉換成面向硬體的格式。
- 可以做什麼
- 依可設定的最佳化等級、基礎閘預設集與耦合圖拓撲轉譯量子電路
- 在不轉譯的情況下分析電路結構、閘數量與深度
- 比較 0 至 3 各最佳化等級的結果
- 從 OpenQASM 2.0/3.0 載入電路,並在 QASM 與 base64 編碼的 QPY 之間匯出或轉換
- 讀取關於轉譯器能力、基礎閘與拓撲的參考資源
- 適用情境
- 適合處理量子電路與 Qiskit 的情境:為特定硬體目標最佳化電路、檢視電路深度與閘組成,或在執行前挑選合適的最佳化等級。
- 執行需求
- 以 Python 套件(qiskit-mcp-server,透過 uvx 或 uv run 啟動)在本機以 stdio 執行;需要 Python 3.10 以上版本,以及 uv 套件管理員或 pip。未宣告帳號、API 金鑰或標頭。選用環境變數 QISKIT_MCP_MAX_QUBITS 與 QISKIT_MCP_MAX_GATES 可提高預設的 100 量子位元與 10,000 閘上限。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Qiskit MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Qiskit MCP Server
A Model Context Protocol (MCP) server that provides quantum circuit transpilation capabilities using Qiskit's pass managers. This server enables AI assistants to optimize quantum circuits for various hardware targets.
Features
- Circuit Transpilation: Transpile quantum circuits with configurable optimization levels (0-3)
- Preset Basis Gates: Support for IBM Eagle, IBM Heron, ion trap, and other basis gate sets
- Topology Support: Built-in support for linear, ring, grid, and custom coupling maps
- Circuit Analysis: Analyze circuit complexity without transpilation
- Optimization Comparison: Compare results across all optimization levels
- Dual API: Supports both async (MCP) and sync (Jupyter, scripts) usage
Prerequisites
- Python 3.10 or higher
- uv package manager (recommended) or pip
Installation
From PyPI (when published)
From Source
Quick Start
Running the MCP Server
Claude Desktop Configuration
Add to your Claude Desktop configuration (claude_desktop_config.json):
Usage Examples
Async Usage (MCP Server / FastAPI)
Using QPY Format
Sync Usage (Scripts, Jupyter)
Compare Optimization Levels
LangChain Integration Example:
Note: To run LangChain examples you will need to install the dependencies:
For more LLM providers (Anthropic, Google, Ollama, Watsonx) and detailed examples including Jupyter notebooks, see the examples/ directory.
API Reference
Tools
Resources
Core Functions
transpile_circuit(circuit, optimization_level=2, basis_gates=None, coupling_map=None, initial_layout=None, seed_transpiler=None, circuit_format="qasm3")
Transpile a quantum circuit using Qiskit's preset pass managers.
Parameters:
circuit: Quantum circuit as QASM3 string, base64-encoded QPY, or QASM2 string (max 100 qubits, 10,000 gates)optimization_level: 0-3 (default: 2)- 0: No optimization, only basis gate decomposition (fastest)
- 1: Light optimization with default layout
- 2: Medium optimization with noise-aware layout (recommended)
- 3: Heavy optimization for best results (can be slow for large circuits)
basis_gates: List of gate names or preset ("ibm_default", "ibm_heron", etc.)coupling_map: List of edges or topology name ("linear", "ring", "grid", "full")initial_layout: List of physical qubit indices (length must match circuit qubits)seed_transpiler: Random seed for reproducibilitycircuit_format: Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3". When "qasm3" is specified, QASM2 is also accepted as a fallback.
Returns: Dictionary with original/transpiled circuit info and optimization metrics
Note: Level 3 optimization can be very slow for circuits with >20 qubits or >500 gates. Use level 2 for faster results with good quality.
analyze_circuit(circuit, circuit_format="qasm3")
Analyze circuit structure and complexity.
Returns: Dictionary with gate counts, depth, and categorization (single/two/multi-qubit gates)
compare_optimization_levels(circuit, circuit_format="qasm3")
Compare transpilation results across all optimization levels.
Returns: Dictionary comparing depth, size, and gates for levels 0-3
Circuit Format Support
The server supports two circuit formats for input:
QPY output: All tools return circuits in QPY format (base64-encoded) for precision when chaining tools/servers.
When to use each format:
- QASM3 (input): Best for human-readable circuits and initial input
- QPY (input/output): Best for preserving exact numerical parameters when chaining tools/servers
Converting QPY to Human-Readable QASM3
To view a QPY circuit output in human-readable format, use the qpy_to_qasm3 utility:
Converting QASM3 to QPY
To convert a QASM circuit to QPY format (for full fidelity when chaining tools), use qasm3_to_qpy:
Available Basis Gate Sets
You can also provide a custom list of gate names for other hardware targets.
Available Topologies
Limits and Performance
Circuit Size Limits
To ensure reliable performance, the server enforces the following limits:
Circuits exceeding these limits will return an error with a descriptive message.
You can override these limits via environment variables:
Performance Recommendations
Tips:
- Use level 2 for most use cases (best balance of quality and speed)
- Use level 3 only when circuit quality is critical AND circuit is small (<20 qubits, <500 gates)
- Use level 0 or 1 for rapid prototyping and development
- The
compare_optimization_levelstool helps identify the best level for your specific circuit
Transpilation Stages
The Qiskit transpiler processes circuits through six stages:
- init: Decompose multi-qubit gates to 1 and 2-qubit operations
- layout: Map virtual qubits to physical qubits
- routing: Insert SWAP gates for hardware connectivity
- translation: Convert to target basis gates
- optimization: Reduce gate count and circuit depth
- scheduling: Add timing and delay instructions
Testing
Development
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md guide in the root of the repository.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
來源:qiskit-mcp-server/README.md,提交 373be19
工具
0版本歷史
2- v0.3.2最新Oct 8, 2026
- v0.3.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分