
Qiskit IBM Transpiler MCP Server
io.github.Qiskit由 GitHub 帳號 Qiskit 發布v0.4.1更新於 Oct 24, 2026
MCP server for AI Transpiler IBM Quantum services
概覽
本機 MCP 伺服器,讓助理使用 Qiskit 的 AI 轉譯流程為 IBM Quantum 後端轉譯與最佳化量子電路。
- 可以做什麼
- 以 API 權杖或已儲存的憑證設定 IBM Quantum 帳戶
- 依後端耦合圖進行路由,並可設定佈局與最佳化偏好
- 執行結合啟發式與 AI 轉譯流程的端到端混合管線
- 對 Clifford、線性函數、置換與 Pauli 網路電路區塊進行合成
- 接受 QASM 3.0 或 base64 QPY 輸入,回傳 QPY 及最佳化前後的深度與雙量子位元閘指標
- 適用情境
- 適合在處理 Qiskit 電路時,希望助理針對特定 IBM Quantum 後端完成路由或最佳化,或串接多個 AI 合成流程並比較電路指標,而不必自行撰寫轉譯程式碼的情境。
- 執行需求
- 以 Python 套件形式透過 stdio 在本機執行(Python 3.10 至 3.14 以下,可用 uvx 或 pip 啟動)。需要 IBM Quantum API 權杖,透過 QISKIT_IBM_TOKEN 環境變數或 Qiskit 憑證檔提供,並需要有效的後端名稱。僅支援桌面環境。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Qiskit IBM Transpiler MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
qiskit-ibm-transpiler-mcp-server
MCP server for Qiskit transpiler. It supports AI routing, AI Clifford synthesis, AI Linear Function synthesis, AI Permutation synthesis, and AI Pauli Network synthesis using QASM 3.0 as the input/output tools format.
Features
- AI transpiler: Perform machine learning-based optimizations in both routing and synthesis passes
- QPY output: Returns base64-encoded QPY format for precision when chaining tools/servers
- Dual input format: Accepts both QASM 3.0 strings and base64-encoded QPY as input
Prerequisites
- python>=3.10 and <3.14
- qiskit-ibm-transpiler==0.15.0
- fastmcp>=2.12.4
Installation
Install from PyPI
The easiest way to install is via pip:
Install from Source
This project recommends using 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
- Initialize or sync the project:
Quick Start
Running the Server
The server will start and listen for MCP connections.
Sync Usage (Scripts, Jupyter)
For frameworks that don't support async operations:
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.
Other ways of testing and debugging the server
-
From a terminal, go into the cloned repo directory
-
Switch to the virtual environment
-
Run the MCP Inspector:
-
Open your browser to the URL shown in the console message e.g.,
Note: to launch the MCP inspector you will need to have
nodeandnpm
API Reference
Tools
Setup IBM Account
Configure IBM Quantum account with API token.
setup_ibm_quantum_account_tool(token: Optional[str] = None, channel: str = "ibm_quantum_platform")
Parameters:
token(optional): IBM Quantum API token. If not provided, the function will:- Check for
QISKIT_IBM_TOKENenvironment variable - Use saved credentials from
~/.qiskit/qiskit-ibm.json
- Check for
channel: Service channel (default:"ibm_quantum_platform")
Returns: Setup status and account information
Note: If you already have saved credentials or have set the QISKIT_IBM_TOKEN environment variable, you can call this function without parameters or skip it entirely and use other functions directly.
AI Routing
Route input quantum circuit. It inserts SWAP operations on a circuit to make two-qubits operations compatible with a given coupling map that restricts the pair of qubits on which operations can be applied. You may want to execute routing pass before any other AI transpiling synthesis pass.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Qiskit Runtime Service backend name on which to map the input circuit synthesisoptimization_level(optional): The potential optimization level to apply during the transpilation process. Valid values are [1,2,3], where 1 is the least optimization (and fastest), and 3 the most optimization (and most time-intensive)layout_mode(optional): Specifies how to handle the layout selection. It can assume the following values:"keep": This respects the layout set by the previous transpiler passes. Typically used when the circuit must be run on specific qubits of the device. It often produces worse results because it has less room for optimization"improve": It is useful when you have a good initial guess for the layout"optimize": This is the default mode. It works best for general circuits where you might not have good layout guesses. This mode ignores previous layout selections
optimization_preferences(optional): Indicates what you want to reduce through optimization: number of cnot gates (n_cnots), number of gates (n_gates), number of cnots layers (cnot_layers), number of layers (layers), and/or noise (noise)local_mode(optional): determines where the AIRouting pass runs. If False, AIRouting runs remotely through the Qiskit Transpiler Service. If True, the package tries to run the pass in your local environment with a fallback to cloud mode if the required dependencies are not foundcoupling_map(optional): List of qubit pairs representing the backend topology. If provided, overrides the backend's coupling map. Useful for targeting a specific subset of qubitscircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
Note: Currently, only the local mode execution is available
Hybrid AI Transpile
Transpile a quantum circuit using a hybrid pass manager that combines Qiskit's heuristic optimization with AI-powered transpiler passes. This provides end-to-end transpilation in a single unified pipeline.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Target IBM Quantum backend (e.g., 'ibm_boston', 'ibm_fez')ai_optimization_level(optional): Optimization level (1-3) for AI components. Higher values yield better results but require more computational resourcesoptimization_level(optional): Optimization level (1-3) for heuristic components in the PassManagerai_layout_mode(optional): Specifies how the AI routing component handles layout selection:"keep": Respects the layout set by previous transpiler passes"improve": Uses prior layouts as starting points for optimization"optimize": Default; ignores previous layout selections for general circuits. Note: Ifinitial_layoutis provided with 'optimize', it automatically converts to 'improve' to leverage the user-provided layout
initial_layout(optional): List of physical qubit indices specifying where to place virtual qubits. For example,[0, 1, 5, 6, 7]maps virtual qubit 0 to physical qubit 0, virtual qubit 1 to physical qubit 1, etc.coupling_map(optional): List of qubit pairs representing the backend topology. If provided, overrides the backend's coupling map. Useful for targeting a specific subset of qubitscircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
AI Clifford synthesis
Synthesis for Clifford circuits (blocks of H, S, and CX gates). Currently, up to nine qubit blocks.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Qiskit Runtime Service backend name on which to map the input circuit synthesisreplace_only_if_better(optional): By default, the synthesis will replace the original sub-circuit only if the synthesized sub-circuit improves the original (currently only checking CNOT count), but this can be forced to always replace the circuit by setting replace_only_if_better=Falselocal_mode(optional): determines where the AI Clifford synthesis runs. If False, AI Clifford synthesis runs remotely through the Qiskit Transpiler Service. If True, the package tries to run the pass in your local environment with a fallback to cloud mode if the required dependencies are not foundcircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
Note: Currently, only the local mode execution is available
AI Linear Function synthesis
Synthesis for Linear Function circuits (blocks of CX and SWAP gates). Currently, up to nine qubit blocks.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Qiskit Runtime Service backend name on which to map the input circuit synthesisreplace_only_if_better(optional): By default, the synthesis will replace the original sub-circuit only if the synthesized sub-circuit improves the original (currently only checking CNOT count), but this can be forced to always replace the circuit by setting replace_only_if_better=Falselocal_mode(optional): determines where the Linear Function synthesis pass runs. If False, Linear Function synthesis runs remotely through the Qiskit Transpiler Service. If True, the package tries to run the pass in your local environment with a fallback to cloud mode if the required dependencies are not foundcircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
Note: Currently, only the local mode execution is available
AI Permutation synthesis
Synthesis for Permutation circuits (blocks of SWAP gates). Currently available for 65, 33, and 27 qubit blocks.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Qiskit Runtime Service backend name on which to map the input circuit synthesisreplace_only_if_better(optional): By default, the synthesis will replace the original sub-circuit only if the synthesized sub-circuit improves the original (currently only checking CNOT count), but this can be forced to always replace the circuit by setting replace_only_if_better=Falselocal_mode(optional): determines where the AI Permutation synthesis pass runs. If False, AI Permutation synthesis runs remotely through the Qiskit Transpiler Service. If True, the package tries to run the pass in your local environment with a fallback to cloud mode if the required dependencies are not foundcircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
Note: Currently, only the local mode execution is available
AI Pauli Network synthesis
Synthesis for Pauli Network circuits (blocks of H, S, SX, CX, RX, RY and RZ gates). Currently, up to six qubit blocks.
Parameters:
circuit: quantum circuit as QASM 3.0 string or base64-encoded QPYbackend_name: Qiskit Runtime Service backend name on which to map the input circuit synthesisreplace_only_if_better(optional): By default, the synthesis will replace the original sub-circuit only if the synthesized sub-circuit improves the original (currently only checking CNOT count), but this can be forced to always replace the circuit by setting replace_only_if_better=Falselocal_mode(optional): determines where the AI Pauli Network synthesis pass runs. If False, AI Pauli Network synthesis runs remotely through the Qiskit Transpiler Service. If True, the package tries to run the pass in your local environment with a fallback to cloud mode if the required dependencies are not foundcircuit_format(optional): Format of the input circuit ("qasm3" or "qpy"). Defaults to "qasm3"
Returns: Dictionary with:
status: "success" or "error"circuit_qpy: Base64-encoded QPY formatoriginal_circuit: Metrics for the input circuit (num_qubits, depth, size, two_qubit_gates)optimized_circuit: Metrics for the optimized circuit (num_qubits, depth, size, two_qubit_gates)improvements: Calculated improvements (depth_reduction, two_qubit_gate_reduction)
Note: Currently, only the local mode execution is available
Testing
This project includes comprehensive unit and integration tests.
Running Tests
Quick test run:
Manual test commands:
Test Structure
tests/integration/test_qta.py- Integration tests for async server functionstests/integration/test_sync.py- Integration tests for sync server functionstests/integration/test_mcp_server.py- Generic integration teststests/unit/test_qta.py- Unit tests for async server functionstests/unit/test_sync.py- Unit tests for sync server functionstests/unit/test_utils.py- Unit tests for utils functionstests/unit/test_qiskit_runtime_service_provider.py- Unit tests for QiskitRuntimeServiceProvider Singletontests/conftest.py- Test fixtures and configurationtests/utils/helpers.py- Helper functions to compute 2-qubits count and depth improvement for integration teststests/qasm/- Three QASM 3.0 test cases in /qasm folder (2 valid, 1 malformed)
Test Coverage
The test suite covers:
- ✅ Service initialization and account setup
- ✅ AI synthesis passes (mocked and real)
- ✅ Error handling and validation
- ✅ Integration scenarios (mocked and real)
- ✅ Tool handlers
Areas for improvement
- Integrate Collections for complete AI synthesis pass
來源:qiskit-ibm-transpiler-mcp-server/README.md,提交 373be19
工具
0版本歷史
1- v0.4.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分