qiskit-sim-mcp

qiskit-sim-mcp

This MCP server enables Claude Desktop to create, visualize, and simulate quantum circuits using Qiskit and Qiskit Aer, with support for preset circuits, custom QASM, and noise modeling.

Category
访问服务器

README

qiskit-sim-mcp

A Model Context Protocol (MCP) server that lets Claude Desktop create, visualize, and simulate quantum circuits using Qiskit and Qiskit Aer.

What It Does

Once connected to Claude Desktop, you can have natural conversations like:

  • "Create a Bell state and simulate it with 1024 shots"
  • "Show me the GHZ circuit diagram"
  • "Run the Bell state with high noise and explain what changed"
  • "Create a custom circuit from this QASM string"

Claude will call the underlying tools automatically — no manual tool invocation needed.

Features

  • 3 Tools: create_circuit, visualize_circuit, run_simulation
  • 5 Preset Circuits: Bell state, GHZ-3, Superposition, Deutsch-Jozsa, Random-4
  • Custom QASM: Accepts any valid OpenQASM 2.0 string
  • Noise Modeling: Ideal, low noise (p=0.001), high noise (p=0.01) via depolarizing error
  • 1 Resource: resource://noise-presets — lists available noise configurations
  • 1 Prompt: simulate_walkthrough — guided conversation template

Requirements

Setup

1. Clone the Repository

git clone <repo-url>
cd qiskit-sim-mcp

2. Install Dependencies

pip install -e .

This installs mcp[cli], qiskit, and qiskit-aer into your Python environment.

3. Verify the Installation

python -c "
import asyncio
from quantum_mcp_demo.server import mcp

tools    = asyncio.run(mcp.list_tools())
resources = asyncio.run(mcp.list_resources())
prompts  = asyncio.run(mcp.list_prompts())

print('Tools:',     [t.name for t in tools])
print('Resources:', [r.uri  for r in resources])
print('Prompts:',   [p.name for p in prompts])
"

Expected output:

Tools: ['create_circuit', 'visualize_circuit', 'run_simulation']
Resources: [AnyUrl('resource://noise-presets')]
Prompts: ['simulate_walkthrough']

4. Test with MCP Inspector (Optional)

uv run mcp dev src/quantum_mcp_demo/server.py

Open http://localhost:6274 in your browser. Use the Tools tab to call each tool manually before connecting to Claude Desktop.

5. Connect to Claude Desktop

Find your Claude Desktop config file:

OS Path
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json

Add this entry inside the mcpServers object:

{
  "mcpServers": {
    "qiskit-sim-mcp": {
      "command": "/opt/anaconda3/bin/python",
      "args": [
        "-m",
        "quantum_mcp_demo.server"
      ]
    }
  }
}

Note: Replace /opt/anaconda3/bin/python with your actual Python path. Run which python to find it.

6. Restart Claude Desktop

Quit Claude Desktop completely (Cmd+Q on macOS), then reopen it. In a new conversation, the hammer icon (🔨) in the chat input confirms MCP tools are loaded.

Usage Examples

Bell State Simulation

"Create a Bell state circuit, show me the diagram, then simulate it 1024 times with ideal and high noise."

Claude will call:

  1. create_circuit(preset="bell") → gets a circuit_id
  2. visualize_circuit(circuit_id=...) → shows the H + CNOT gate diagram
  3. run_simulation(circuit_id=..., shots=1024, noise_preset="ideal") → ~50% |00⟩, ~50% |11⟩
  4. run_simulation(circuit_id=..., shots=1024, noise_preset="high_noise") → degraded counts, |01⟩ and |10⟩ appear

Custom QASM Circuit

"Run this circuit: OPENQASM 2.0; include "qelib1.inc"; qreg q[2]; creg c[2]; h q[0]; cx q[0],q[1]; measure q -> c;"

Claude parses the QASM string and runs it through the same simulation pipeline.

Noise Comparison

"Compare the GHZ state under ideal vs high noise — what does the noise do to the entanglement?"

Project Structure

src/quantum_mcp_demo/
├── server.py              # MCP server entry point
├── circuits/
│   ├── presets.py         # 5 named preset circuits
│   └── store.py           # In-memory circuit storage (UUID-keyed)
├── tools/
│   ├── create_circuit.py  # Tool: create from preset or QASM
│   ├── visualize.py       # Tool: HTML diagram + gate JSON
│   └── simulate.py        # Tool: AerSimulator + noise modeling
├── resources/
│   └── noise_presets.py   # Resource: noise configuration list
├── prompts/
│   └── walkthrough.py     # Prompt: guided simulation conversation
└── utils/
    ├── serialization.py   # numpy → Python int conversion
    └── errors.py          # MCP error response builder

Preset Circuits

Preset Qubits Demonstrates
bell 2 Entanglement — 50/50 split on |00⟩ and |11⟩
ghz_3 3 Multi-qubit entanglement
superposition 1 Equal superposition via Hadamard
deutsch_jozsa 3 Quantum algorithm — interference
random_4 4 Noise stress test — fixed-seed random gates

Noise Presets

Preset Depolarizing p Description
ideal none Perfect simulation
low_noise 0.001 Realistic near-term device
high_noise 0.01 Aggressive noise — visible degradation

Troubleshooting

Claude Desktop doesn't show the hammer icon

  • Quit and fully relaunch Claude Desktop after editing the config
  • Check the config JSON is valid (no trailing commas)
  • Verify the Python path: which python

python -m quantum_mcp_demo.server fails

  • Make sure you ran pip install -e . from the project root
  • Confirm Python version: python --version (needs 3.13+)

Port conflict when running MCP Inspector

kill -9 $(lsof -t -i :6274) 2>/dev/null; kill -9 $(lsof -t -i :6277) 2>/dev/null

Simulation returns unexpected counts

  • Shot count mismatches are caught automatically and returned as isError: true
  • Try reducing shots (e.g. 512) if you see errors

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选