
Qiskit IBM Runtime MCP Server
io.github.Qiskit由 GitHub 帳號 Qiskit 發布v0.6.2更新於 Oct 28, 2026
MCP server for IBM Quantum computing services through Qiskit IBM Runtime
概覽
讓助理透過 Qiskit IBM Runtime 在 IBM Quantum 後端建立、提交與監控量子電路,並檢視後端、校準資料與作業。
- 可以做什麼
- 建立並執行電路:提交 EstimatorV2 期望值與 SamplerV2 取樣作業(含誤差緩解),查詢狀態、取得結果或取消作業。
- 檢視後端:列出可用後端、找出最空閒的後端,讀取屬性、耦合圖與校準資料。
- 挑選量子位元:依即時校準資料排序最佳線性位元鏈與高連通子圖。
- 管理帳戶與配額:設定 IBM Quantum 帳戶,列出、檢視或刪除已儲存帳戶,查詢目前執行個體、可用執行個體與用量。
- 使用內建資源:現成的 Bell、GHZ、隨機與疊加態電路,以及服務狀態。
- 適用情境
- 適合讓助理探索 IBM Quantum 硬體、為實驗挑選優質量子位元,或在對話中直接提交並追蹤 Estimator 與 Sampler 作業。也適合在佔用後端前查看排隊長度、校準品質與剩餘配額。
- 執行需求
- 以本機 Python 套件執行(需 Python 3.10 以上),可用 uvx 或 pip 啟動。需要 IBM Quantum 帳戶與 API 權杖,透過 QISKIT_IBM_TOKEN 環境變數、已儲存的憑證檔案或設定工具提供。可選設定 QISKIT_IBM_RUNTIME_MCP_INSTANCE 為執行個體 CRN 以略過較慢的執行個體查詢。需要連線至 IBM Quantum 的網路;部分查詢可用 fake 後端離線完成。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Qiskit IBM Runtime MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Qiskit IBM Runtime MCP Server
A comprehensive Model Context Protocol (MCP) server that provides AI assistants with access to IBM Quantum computing services through Qiskit IBM Runtime. This server enables quantum circuit creation, execution, and management directly from AI conversations.
Features
- Circuit Execution with Primitives: Run circuits using EstimatorV2 (expectation values) and SamplerV2 (measurement sampling) with built-in error mitigation
- Quantum Backend Management: List, inspect, and get calibration data for quantum backends
- Qubit Optimization: Find optimal qubit chains and subgraphs based on real-time calibration data
- Job Management: Monitor, cancel, and retrieve job results
- Account Management: Easy setup and configuration of IBM Quantum accounts
Prerequisites
- Python 3.10 or higher
- IBM Quantum account (free at quantum.cloud.ibm.com)
- IBM Quantum API token
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:
-
Get your IBM Quantum token (if you don't have saved credentials):
- Visit IBM Quantum
- Find your API key. From the dashboard, create your API key, then copy it to a secure location so you can use it for authentication. More information
-
Configure your credentials (choose one method):
Option A: Environment Variable (Recommended)
Option B: Save Credentials Locally
This stores your credentials in
~/.qiskit/qiskit-ibm.jsonOption C: Pass Token Directly
Credential Resolution Priority: The server looks for credentials in this order:
- Explicit token passed to
setup_ibm_quantum_account_tool() QISKIT_IBM_TOKENenvironment variable- Saved credentials in
~/.qiskit/qiskit-ibm.json
Instance Configuration (Optional): To speed up service initialization, you can specify your IBM Quantum instance:
- Set
QISKIT_IBM_RUNTIME_MCP_INSTANCEenvironment variable with your instance CRN - This skips the automatic instance lookup which can be slow
- Find your instance CRN in IBM Quantum Platform
Instance Priority:
- If you saved credentials with an instance (via
save_account(instance="...")), the SDK uses it automatically QISKIT_IBM_RUNTIME_MCP_INSTANCEoverrides any instance saved in credentials- If neither is set, the SDK performs a slow lookup across all instances
Note:
QISKIT_IBM_RUNTIME_MCP_INSTANCEis an MCP server-specific variable, not a standard Qiskit SDK environment variable. - Explicit token passed to
Quick Start
Running the Server
The server will start and listen for MCP connections.
Basic Usage Examples
Async Usage (Library)
Sync Usage (Scripts, Jupyter)
For frameworks that don't support async operations, all async functions have a .sync attribute:
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
These are the names MCP clients see in tools/list. Hosts can add a prefix to them (for example mcp__<server>__<tool>), so check how your client shows the name before you write an allowlist or a permission rule. The Python functions in qiskit_ibm_runtime_mcp_server.ibm_runtime (see Sync Usage) have the same names without the _tool suffix.
setup_ibm_quantum_account_tool(token: str = "", channel: str = "ibm_quantum_platform")
Configure IBM Quantum account with API token.
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.
list_backends_tool()
Get list of available quantum backends.
Returns: Array of backend information including:
- Name, status, queue length
- Number of qubits, coupling map
- Simulator vs. hardware designation
least_busy_backend_tool()
Get the current least busy IBM Quantum backend available.
Returns: The backend with the fewest number of pending jobs
get_backend_properties_tool(backend_name: str)
Get detailed properties of specific backend.
Returns: Complete backend configuration including:
- Hardware specifications
- Gate set and coupling map
- Current operational status
- Queue information
get_coupling_map_tool(backend_name: str)
Get the coupling map (qubit connectivity) for a backend with detailed analysis.
Supports both real backends (requires credentials) and fake backends (no credentials needed).
Use fake_ prefix for offline testing (e.g., fake_sherbrooke, fake_brisbane).
Parameters:
backend_name: Name of the backend (e.g.,ibm_brisbaneorfake_sherbrooke)
Returns: Connectivity information including:
edges: List of [control, target] qubit connection pairsadjacency_list: Neighbor mapping for each qubitbidirectional: Whether all connections work in both directionsnum_qubits: Total qubit count
Use cases:
- Circuit optimization and qubit mapping
- SWAP gate minimization planning
- Offline testing with fake backends
get_backend_calibration_tool(backend_name: str, qubit_indices: list[int] | None = None)
Get calibration data for a backend including T1, T2 coherence times and error rates.
Parameters:
backend_name: Name of the backend (e.g.,ibm_brisbane)qubit_indices(optional): List of specific qubit indices. If not provided, returns data for the first 10 qubits.
Returns: Calibration data including:
- T1 and T2 coherence times (in microseconds)
- Qubit frequency (in GHz)
- Readout errors for each qubit
- Gate errors for common gates (x, sx, cx, etc.)
faulty_qubits: List of non-operational qubit indicesfaulty_gates: List of non-operational gates with affected qubits- Last calibration timestamp
Note: For static backend info (processor_type, backend_version, quantum_volume), use get_backend_properties_tool instead.
find_optimal_qubit_chains_tool(backend_name, chain_length, num_results, metric)
Find optimal linear qubit chains for quantum experiments based on connectivity and calibration data.
Algorithmically identifies the best qubit chains by combining coupling map connectivity with real-time calibration data. Essential for experiments requiring linear qubit arrangements.
Parameters:
backend_name: Name of the backend (e.g.,ibm_brisbane)chain_length: Number of qubits in the chain (default: 5, range: 2-20)num_results: Number of top chains to return (default: 5, max: 20)metric: Scoring metric to optimize:two_qubit_error: Minimize sum of CX/ECR gate errors (default)readout_error: Minimize sum of measurement errorscombined: Weighted combination of gate errors, readout, and coherence
Returns: Ranked chains with detailed metrics:
qubits: Ordered list of qubit indices in the chainscore: Total score (lower is better)qubit_details: T1, T2, readout_error for each qubitedge_errors: Two-qubit gate error for each connection
Use cases:
- Select qubits for variational quantum algorithms (VQE, QAOA)
- Plan linear qubit layouts for error correction experiments
- Identify high-fidelity qubit paths for state transfer
- Optimize qubit selection for 1D physics simulations
find_optimal_qv_qubits_tool(backend_name, num_qubits, num_results, metric)
Find optimal qubit subgraphs for Quantum Volume experiments.
Unlike linear chains, Quantum Volume benefits from densely connected qubit sets where qubits can interact with minimal SWAP operations. This tool finds connected subgraphs and ranks them by connectivity and calibration quality.
Parameters:
backend_name: Name of the backend (e.g.,ibm_brisbane)num_qubits: Number of qubits in the subgraph (default: 5, range: 2-10)num_results: Number of top subgraphs to return (default: 5, max: 20)metric: Scoring metric to optimize:qv_optimized: Balanced scoring for QV (connectivity + errors + coherence) (default)connectivity: Maximize internal edges and minimize path lengthsgate_error: Minimize total two-qubit gate errors on internal edges
Returns: Ranked subgraphs with detailed metrics:
qubits: List of qubit indices in the subgraph (sorted)score: Total score (lower is better)internal_edges: Number of edges within the subgraphconnectivity_ratio: internal_edges / max_possible_edgesaverage_path_length: Mean shortest path between qubit pairsqubit_details: T1, T2, readout_error for each qubitedge_errors: Two-qubit gate error for each internal edge
Use cases:
- Select optimal qubits for Quantum Volume experiments
- Find densely connected regions for random circuit sampling
- Identify high-quality qubit clusters for variational algorithms
- Plan qubit allocation for algorithms requiring all-to-all connectivity
list_my_jobs_tool(limit: int = 10)
Get list of recent jobs from your account.
Parameters:
limit: The N of jobs to retrieve
get_job_status_tool(job_id: str)
Check status of submitted job.
Parameters:
job_id: The ID of the job to get its status
Returns: Current job status, creation date, backend info
Job Status Values:
INITIALIZING: Job is being preparedQUEUED: Job is waiting in the queueRUNNING: Job is currently executingDONE: Job completed successfullyCANCELLED: Job was cancelledERROR: Job failed with an error
get_job_results_tool(job_id: str)
Retrieve measurement results from a completed quantum job.
Parameters:
job_id: The ID of the completed job
Returns: Dictionary containing:
status: "success", "pending", or "error"job_id: The job IDjob_status: Current status of the jobcounts: Dictionary of measurement outcomes and their counts (e.g.,{"00": 2048, "11": 2048})shots: Total number of shots executedbackend: Name of the backend usedexecution_time: Quantum execution time in seconds (if available)message: Status message
Example workflow:
cancel_job_tool(job_id: str)
Cancel a running or queued job.
Parameters:
job_id: The ID of the job to cancel
run_estimator_tool(circuit, observables, ...)
Run a quantum circuit using the Qiskit Runtime EstimatorV2 primitive. Computes expectation values of observables with built-in error mitigation.
Parameters:
circuit: Quantum circuit (OpenQASM 3.0/2.0 string or base64-encoded QPY)observables: Observable(s) to measure. Accepts:- Single Pauli string:
"ZZ" - List of Pauli strings:
["IIXY", "ZZII"] - Weighted Hamiltonian:
[("XX", 0.5), ("ZZ", -0.3)]
- Single Pauli string:
parameter_values(optional): Values for parameterized circuitsbackend_name(optional): Backend name. If not provided, uses the least busy backend.circuit_format:"auto"(default),"qasm3", or"qpy"optimization_level: Transpilation level 0-3 (default: 1)resilience_level: Error mitigation level 0-2 (default: 1)zne_mitigation: Enable Zero Noise Extrapolation (default: True)zne_noise_factors(optional): Noise factors for ZNE (default: (1, 1.5, 2))
Returns: Job submission status including job_id, backend, and error_mitigation summary.
Note: Jobs run asynchronously. Use get_job_status_tool to monitor and get_job_results_tool to retrieve expectation values.
run_sampler_tool(circuit, ...)
Run a quantum circuit using the Qiskit Runtime SamplerV2 primitive. Returns measurement outcome samples with built-in error mitigation.
Parameters:
circuit: Quantum circuit (OpenQASM 3.0/2.0 string or base64-encoded QPY). Must include measurement operations.backend_name(optional): Backend name. If not provided, uses the least busy backend.shots: Number of measurement repetitions (default: 4096)circuit_format:"auto"(default),"qasm3", or"qpy"dynamical_decoupling: Suppress decoherence during idle periods (default: True)dd_sequence: DD pulse sequence:"XX","XpXm", or"XY4"(default)twirling: Pauli twirling on 2-qubit gates (default: True)measure_twirling: Measurement twirling for readout error mitigation (default: True)
Returns: Job submission status including job_id, backend, shots, and error_mitigation summary.
Note: Jobs run asynchronously. Use get_job_status_tool to monitor and get_job_results_tool to retrieve measurement counts.
list_saved_accounts_tool()
List all IBM Quantum accounts saved on disk.
Returns: Dictionary containing:
status: "success" or "error"accounts: Dictionary of saved accounts (keyed by account name)- Each account contains: channel, url, token (masked for security)
message: Status message
Note: Tokens are masked in the response, showing only the last 4 characters.
delete_saved_account_tool(account_name: str)
Delete a saved IBM Quantum account from disk.
WARNING: This permanently removes credentials from ~/.qiskit/qiskit-ibm.json. The operation cannot be undone.
Parameters:
account_name: Name of the saved account to delete. Uselist_saved_accounts_tool()to find available names.
Returns: Dictionary containing:
status: "success" or "error"deleted: Boolean indicating if deletion was successfulmessage: Status message
active_account_info_tool()
Get information about the currently active IBM Quantum account.
Returns: Dictionary containing:
status: "success" or "error"account_info: Account details including channel, url, token (masked for security)
Note: Tokens are masked in the response, showing only the last 4 characters.
active_instance_info_tool()
Get the Cloud Resource Name (CRN) of the currently active instance.
Returns: Dictionary containing:
status: "success" or "error"instance_crn: The CRN string identifying the active instance
available_instances_tool()
List all IBM Quantum instances available to the active account.
Returns: Dictionary containing:
status: "success" or "error"instances: List of available instances with CRN, plan, name, and pricing infototal_instances: Count of available instances
usage_info_tool()
Get usage statistics and quota information for the active instance.
Returns: Dictionary containing:
status: "success" or "error"usage: Usage metrics including:usage_consumed_seconds: Time consumed this periodusage_limit_seconds: Total quota for the periodusage_remaining_seconds: Remaining quotausage_limit_reached: Boolean indicating if limit is reachedusage_period: Current billing period
Resources
ibm://status
Get current IBM Quantum service status and connection info.
circuits://bell-state
Pre-built 2-qubit Bell state circuit creating |Phi+> = (|00> + |11>)/sqrt(2). Pass the returned circuit field directly to run_sampler_tool. Expected results: ~50% '00' and ~50% '11'.
circuits://ghz-state
Pre-built 3-qubit GHZ state circuit creating (|000> + |111>)/sqrt(2). Expected results: ~50% '000' and ~50% '111'.
circuits://random
Pre-built 4-qubit quantum random number generator. Each qubit is put in superposition and measured. Expected results: all 16 outcomes with ~6.25% probability each.
circuits://superposition
Simplest quantum circuit: single qubit Hadamard gate creating (|0> + |1>)/sqrt(2). Expected results: ~50% '0' and ~50% '1'.
Security Considerations
- Store IBM Quantum tokens securely: Never commit tokens to version control
- Use environment variables for production deployments: Set
QISKIT_IBM_TOKENenvironment variable - Credential Priority: The server automatically resolves credentials in this order:
- Explicit token parameter (highest priority)
QISKIT_IBM_TOKENenvironment variable- Saved credentials in
~/.qiskit/qiskit-ibm.json(lowest priority)
- Token Validation: The server rejects placeholder values like
<PASSWORD>,<TOKEN>, etc., to prevent accidental credential corruption - Implement rate limiting for production use: Monitor API request frequency
- Monitor quantum resource consumption: Track job submissions and backend usage
Contributing
Contributions are welcome! Areas for improvement:
- Additional error mitigation/correction techniques
- Other qiskit-ibm-runtime features
Other ways of testing and debugging the server
Note: to launch the MCP inspector you will need to have
nodeandnpm
-
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.,
Testing
This project includes comprehensive unit and integration tests.
Running Tests
Quick test run:
Manual test commands:
Test Structure
tests/test_server.py- Unit tests for server functionstests/test_sync.py- Unit tests for synchronous executiontests/test_integration.py- Integration teststests/conftest.py- Test fixtures and configuration
Test Coverage
The test suite covers:
- ✅ Service initialization and account setup
- ✅ Backend listing, calibration, and analysis
- ✅ Circuit execution with EstimatorV2 and SamplerV2 primitives
- ✅ Job management and monitoring
- ✅ Synchronous execution (
.syncmethods) - ✅ Error handling and input validation
- ✅ Integration scenarios
- ✅ Resource and tool handlers
來源:qiskit-ibm-runtime-mcp-server/README.md,提交 b763581
工具
0版本歷史
2- v0.6.2最新Oct 8, 2026
- v0.6.1Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分