
Mcp Qiskit
io.github.daedalus由 GitHub 帳號 daedalus 發布v0.1.1更新於 Oct 24, 2026
MCP server exposing Qiskit 2.3.1 quantum computing functionality
概覽
一個本機 MCP 伺服器,封裝 Qiskit 2.3.1,讓助理能建立、分析、繪製並在模擬器或 IBM 後端上執行量子電路。
- 可以做什麼
- 建立與修改電路:新建電路、加入單一或多個閘、加入量測,並在呼叫之間維持狀態,還可依最佳化層級或目標後端進行轉譯。分析電路:取得電路深度、列出可用量子閘、查看某個閘的定義。繪製電路:以 ASCII、文字、matplotlib 或 LaTeX 格式輸出。管理後端:依條件篩選列出後端、查詢狀態、讀取耦合對應、基礎閘與最大 shots 等設定。執行電路:執行單一電路或批次電路,可指定後端、shots 與隨機種子,回傳量測計數或態向量。
- 適用情境
- 適合讓助理協助 Qiskit 量子計算工作:建立貝爾態、Grover 或 Shor 等範例電路,檢查並繪製電路,以及在本地 Aer 模擬器或 IBM Quantum 硬體上執行,不必離開對話。
- 執行需求
- 以 stdio 本機程序執行;需安裝 PyPI 套件 mcp-qiskit 及 qiskit 附加相依套件。需要 Python 3.11 或更新版本、Qiskit 2.3.1、qiskit-aer 與 fastmcp,以及 Claude Desktop 或 Cursor 等 MCP 用戶端。預設 Aer 模擬器無需憑證;使用 IBM Quantum 後端需透過 IBM_QUANTUM_TOKEN 環境變數提供 IBM Quantum API 權杖,或以 Qiskit 儲存憑證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Qiskit,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-qiskit
MCP server exposing Qiskit 2.3.1 quantum computing functionality through the Model Context Protocol. Enables LLMs to create, manipulate, and execute quantum circuits via standardized MCP tools and resources.
[PyPI] [Python] [Ruff] [Tests][Ask DeepWiki]
mcp-name: io.github.daedalus/mcp-qiskit
Overview
This project provides a Model Context Protocol (MCP) server that exposes Qiskit quantum computing functionality to Large Language Models (LLMs). It allows AI assistants to:
- Create and manipulate quantum circuits
- Execute circuits on quantum simulators or real backends
- Analyze circuit properties (depth, gates, operations)
- Visualize circuits in various formats
- Manage quantum backends
Why Use This?
- LLM Integration: Enables AI assistants to perform quantum computing tasks without external tooling
- Standardized Interface: MCP provides a consistent tool-based interface for quantum operations
- Qiskit 2.3.1 Compatible: Specifically designed for Qiskit 2.3.1 with all its features
- Extensible: Easy to add new tools or backends
Installation
Prerequisites
- Python 3.11 or higher
- Qiskit 2.3.1
- A running MCP client (Claude Desktop, Cursor, etc.)
Install from PyPI
The [qiskit] extra installs the required Qiskit dependencies. Other extras available:
Install from Source
Quick Start
As a Python Library
As an MCP Server
Claude Desktop
Add to your claude_desktop_config.json:
Cursor
Add to your Cursor settings under MCP Servers:
Other MCP Clients
MCP Tools Reference
Circuit Creation Tools
create_quantum_circuit_tool
Creates an empty quantum circuit with specified number of qubits and classical bits.
Parameters:
num_qubits(int): Number of quantum bitsnum_classical_bits(int): Number of classical bits for measurements
Returns: Dictionary representing the circuit
Example:
add_gate_tool
Adds a quantum gate to a circuit. This tool maintains circuit state between calls.
Parameters:
circuit(dict, optional): The circuit to modify. If None, creates a new 8-qubit circuit with 8 classical bits automatically.gate_name(str): Name of the gate (e.g., "h", "x", "cx", "rx")qubits(list[int]): List of qubit indices to apply the gate to. Can be a single qubit (e.g.,[0]) or multiple qubits (e.g.,[0, 1, 2, 3]). When multiple qubits are specified for a single-qubit gate, the gate is applied to each qubit.params(list[float], optional): Parameters for parameterized gates
Supported Gates:
- Single-qubit:
h,x,y,z,s,t,sdg,tdg,i,id - Parameterized:
rx,ry,rz,u1,u2,u3,p - Multi-qubit:
cx,cy,cz,swap - Multi-controlled:
mcx,mct,mcp,ccx,toffoli,c3x,c3sx,c4x - Specialized:
rxx,ryy,rzz,ch,cswap,cu,crx,cry,crz
State Maintenance Pattern: Always pass the circuit returned by the previous call to maintain state:
Apply Single-Quantum Gate to Multiple Qubits:
When applying single-qubit gates (like h, x, y, z, etc.) to multiple qubits at once, use a list of qubit indices:
add_gates_tool
Adds multiple quantum gates to a circuit in a single call. This tool maintains circuit state between calls and reduces the number of tool calls needed.
Parameters:
circuit(dict, optional): The circuit to modify. If None, creates a new 8-qubit circuit with 8 classical bits automatically.gates(list[dict]): List of gate specifications, each containing:gate(str): Name of the gate (e.g., "h", "x", "cx", "rx")qubits(list[int]): Qubit indices to apply the gate toparams(list[float], optional): Parameters for parameterized gates
Example:
add_measurement_tool
Adds measurement operations to qubits. This tool maintains circuit state between calls.
Parameters:
circuit(dict, optional): The circuit to modify. If None, creates a new 8-qubit circuit with 8 classical bits automatically.qubits(list[int]): Qubit indices to measureclbits(list[int], optional): Classical bit indices to store results
Example:
Analysis Tools
get_circuit_depth_tool
Returns the depth (number of layers) of the circuit.
Parameters:
circuit(dict): The circuit to analyze
Returns: Integer representing circuit depth
list_available_gates_tool
Lists all available quantum gates in Qiskit.
Returns: List of gate name strings
get_gate_definition_tool
Gets detailed information about a quantum gate.
Parameters:
gate_name(str): Name of the gate
Returns: Dictionary with gate properties:
name: Gate namenum_qubits: Number of qubits the gate operates onnum_parameters: Number of parameters (0 for fixed gates)params: List of parameter values
Visualization Tools
draw_circuit_tool
Renders a circuit in various formats.
Parameters:
circuit(dict): The circuit to drawoutput_format(str): Output format - "ascii", "text", "mpl", "latex"
Returns: String representation of the circuit
Example Output (ASCII):
Backend Tools
list_backends_tool
Lists available quantum backends.
Parameters:
filters(dict, optional): Filter criteria (e.g.,{"status": "ONLINE"})
Returns: List of backend information dictionaries
get_backend_status_tool
Gets status information for a backend.
Parameters:
backend_name(str): Name of the backend
Returns: Dictionary with:
name: Backend namestatus: Status (ONLINE/OFFLINE)num_qubits: Number of qubits
get_backend_configuration_tool
Gets detailed configuration for a backend.
Parameters:
backend_name(str): Name of the backend
Returns: Dictionary with:
name: Backend namenum_qubits: Number of qubitscoupling_map: Qubit connectivity (if applicable)basis_gates: List of available basis gatesmax_shots: Maximum allowed shots
Execution Tools
run_circuit_tool
Executes a single quantum circuit.
Parameters:
circuit(dict): Circuit to executebackend_name(str, optional): Backend name (default: "aer_simulator")shots(int, optional): Number of measurement shots (default: 1024)seed(int, optional): Random seed for reproducibility
Returns: Dictionary with:
status: "COMPLETED" or error messagebackend: Backend usedshots: Number of shotscounts: Measurement outcome counts (if shots > 0)statevector: Statevector (if shots=None)time_taken: Execution time in seconds
Example:
run_circuits_tool
Executes multiple circuits in a batch.
Parameters:
circuits(list[dict]): List of circuits to executebackend_name(str, optional): Backend nameshots(int, optional): Number of shotsseed(int, optional): Random seed
Returns: List of result dictionaries
Example:
transpile_circuit_tool
Transpiles a circuit for optimization or specific backend.
Parameters:
circuit(dict): Circuit to transpileoptimization_level(int, optional): 0-3 (default: 1)basis_gates(list[str], optional): Target basis gates
Returns: Transpiled circuit dictionary
Example:
MCP Resources
resource://backends
Provides a list of available quantum backends. Updated dynamically based on available providers.
resource://gates
Provides a list of all available quantum gates in Qiskit.
Usage Examples
Create a Bell State
Run Grover's Algorithm
Draw and Analyze Circuit
Run Shor's Algorithm
See examples/shor_example.py for a complete implementation with factor extraction.
Shor's Algorithm with MCP Qiskit Tools
Build Shor's algorithm circuit to factor N=15 using the MCP Qiskit server tools:
Architecture
Module Responsibilities
- _circuit.py: Quantum circuit creation, gates, measurements, visualization
- _backend.py: Backend discovery, status, configuration
- _execution.py: Circuit execution, transpilation
- _mcp.py: FastMCP server definition, tool registration
Requirements
- Python 3.11+
- qiskit >= 2.3.1
- qiskit-aer >= 0.14.0
- fastmcp >= 2.0
Development
Setup
Running Tests
Code Quality
Pre-commit Hooks
Troubleshooting
API Keys and Credentials
This package supports two types of backends:
- Aer Simulator (default) - Runs locally, no API key required
- IBM Quantum - Requires an IBM Quantum API token
Using IBM Quantum Backends
To use IBM Quantum backends, you need to provide your API token:
Option 1: Environment Variable
Or in your Python code:
Option 2: Save Credentials via Qiskit
Getting an IBM Quantum Token:
- Create an account at IBM Quantum
- Go to Account > My Tokens
- Copy your API token
Environment Variable for MCP Server:
When running as an MCP server, set the environment variable before starting:
Or in your MCP client configuration:
Backend Not Found
If you get "Backend not found", ensure the backend name is correct:
Import Errors
Make sure Qiskit is properly installed:
MCP Connection Issues
Verify the server is running:
License
MIT License - see LICENSE file.
Contributing
Contributions are welcome! Please open an issue or submit a PR on GitHub.
Related Projects
- Qiskit - Quantum computing SDK
- FastMCP - MCP framework
- Model Context Protocol - Protocol specification
來源:README.md,提交 e36e72d
工具
0版本歷史
1- v0.1.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分