
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 分