Qiskit Mcp Server

by barvhaim

295 downloads
Not rated
GitHub

About

Unofficial MCP Server for Qiskit (an open-source SDK for working with quantum computers)

Details

Author
barvhaim
Downloads
295
Categories
Other

- Create quantum circuits with specified qubits and classical bits.
- Add basic gates (H, X, Y, Z, CX) and advanced gates (rotation, Clifford, swap).
- Execute circuits on the BasicSimulator with configurable shots.
- Retrieve circuit information, text visualization, and Mermaid diagrams.
- Analyze state vectors, compute density matrices, and optimize circuits.
- Implement Quantum Fourier Transform and variational quantum circuits.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Qiskit Mcp Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The server exposes MCP tools that can be invoked by LLMs. Users create circuits with create_quantum_circuit, add gates with add_gates or add_advanced_gates, run simulations with run_circuit, and analyze results with tools like analyze_statevector. Each tool accepts specific parameters such as circuit name, qubits, gates, and shot count.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "qiskit mcp server": {
            "qiskit-mcp-server": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/path/to/qiskit-mcp-server",
                    "run",
                    "main.py"
                ]
            }
        }
    }
}

McpServers

{
    "qiskit-mcp-server": {
        "command": "uv",
        "args": [
            "--directory",
            "/path/to/qiskit-mcp-server",
            "run",
            "main.py"
        ]
    }
}

Qiskit MCP Server
Unofficial Model Context Protocol (MCP) server that enables LLMs to build and execute quantum circuits using Qiskit.

Features

The server provides 13 MCP tools for comprehensive quantum circuit operations:

Core Tools (8)
1. create_quantum_circuit
Create a new quantum circuit with specified qubits and classical bits.

Parameters:

num_qubits (int): Number of quantum bits
num_classical_bits (int, optional): Number of classical bits (defaults to num_qubits)
name (string, optional): Custom name for the circuit (auto-generated if not provided)
2. add_gates
Add quantum gates to an existing circuit.

Parameters:

circuit_name (string): Name of the circuit to modify
gates (array): List of gate operations
Supported gates:

h: Hadamard gate - {'type': 'h', 'qubits': [0]}
x: Pauli-X gate - {'type': 'x', 'qubits': [0]}
y: Pauli-Y gate - {'type': 'y', 'qubits': [0]}
z: Pauli-Z gate - {'type': 'z', 'qubits': [0]}
cx: CNOT gate - {'type': 'cx', 'qubits': [0, 1]}
measure: Measure specific qubit - {'type': 'measure', 'qubits': [0], 'classical_bit': 0}
measure_all: Measure all qubits - {'type': 'measure_all'}
3. run_circuit
Execute a quantum circuit on the BasicSimulator.

Parameters:

circuit_name (string): Name of the circuit to run
shots (int, optional): Number of measurement shots (default: 1000)
Returns: JSON with measurement results and counts

4. get_circuit_info
Get detailed information about a circuit.

Parameters:

circuit_name (string): Name of the circuit
Returns: JSON with circuit properties (qubits, depth, gate counts, etc.)

5. visualize_circuit
Get a text visualization of the quantum circuit.

Parameters:

circuit_name (string): Name of the circuit
Returns: ASCII art representation of the circuit

6. visualize_circuit_mermaid
Generate a Mermaid flowchart diagram of the quantum circuit.

Parameters:

circuit_name (string): Name of the circuit to visualize
Returns: Mermaid flowchart syntax representing the quantum circuit

7. list_circuits
List all created circuits with basic information.

Returns: JSON with all circuit names and their properties

Advanced Tools (6)
8. analyze_statevector
Analyze the quantum state vector of a circuit.

Parameters:

circuit_name (string): Name of the circuit to analyze
Returns: JSON with probabilities, amplitudes, and state analysis

9. compute_density_matrix
Compute and analyze the density matrix including purity and entanglement.

Parameters:

circuit_name (string): Name of the circuit to analyze
Returns: JSON with purity, entropy, and entanglement information

10. optimize_circuit
Optimize a quantum circuit using Qiskit transpiler passes.

Parameters:

circuit_name (string): Name of the circuit to optimize
optimization_level (int): Optimization level 0-3
Returns: JSON with optimization results and performance metrics

11. add_advanced_gates
Add advanced quantum gates beyond basic H, X, Y, Z, CX.

Parameters:

circuit_name (string): Name of the circuit to modify
gates (array): List of advanced gate operations
Supported advanced gates:

Rotation gates: rx, ry, rz, rxx, ryy, rzz
Universal gate: u
Clifford gates: s, sdg, t, tdg
swap: SWAP gate
12. create_variational_circuit
Create a variational quantum circuit for quantum machine learning.

Parameters:

num_qubits (int): Number of qubits
num_layers (int): Number of layers (default: 1)
entanglement (string): Entanglement pattern ('full', 'linear', 'circular')
name (string, optional): Custom name for the circuit
Returns: Success message with circuit details and parameter count

13. implement_qft
Implement Quantum Fourier Transform circuit.

Parameters:

num_qubits (int): Number of qubits for QFT
inverse (bool): Whether to implement inverse QFT (default: false)
name (string, optional): Custom name for the circuit
Returns: Success message with QFT circuit details

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.