QPanda3 Runtime MCP Server
QPanda3 Runtime MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to interact with Origin Quantum computing services through QPanda3 Runtime.
Features
Account Management: Configure and manage Origin Quantum cloud account authentication
Device Management: List and query available QPU devices
Quantum Computing Tasks: Execute sampling and estimation tasks
Batch Operations: Run multiple circuits efficiently
Multi-Objective Decisions: CircuitObservableBinding for complex optimization
Task Management: Query task status, retrieve results, cancel tasks
Example Circuits: Provides common quantum circuit example resources
Documentation
Document | Description |
English documentation site | |
Chinese documentation site | |
Complete beginner's guide - START HERE | |
Detailed installation instructions | |
Fast setup for experienced users | |
Environment and client configuration | |
Detailed feature documentation | |
Auto-generated API documentation |
Installation
One-Click Setup (Recommended)
The project provides setup scripts that automate the entire process:
Linux / macOS:
git clone https://github.com/OriginQ/qpanda3-runtime-mcp-server.git
cd qpanda3-runtime-mcp-server
chmod +x scripts/setup_configure.sh
./scripts/setup_configure.shWindows (PowerShell):
git clone https://github.com/OriginQ/qpanda3-runtime-mcp-server.git
cd qpanda3-runtime-mcp-server
.\scripts\setup_configure.ps1The script handles everything: dependency setup, API key configuration, and MCP client setup.
See Installation Guide for manual install options.
Quick Start
# 1. Configure your API key
cp .env.example .env
# Edit .env and set QPANDA3_API_KEY=your_api_key_here
# 2. Run the server
.venv/bin/python -m qpanda3_runtime_mcp_server # Linux/macOS
# .venv\Scripts\python.exe -m qpanda3_runtime_mcp_server # WindowsSee Configuration for MCP client setup and advanced options.
MCP Tools
Account Management
Tool | Description |
| Configure Origin Quantum cloud account authentication |
| List saved account information (session-based) |
| Get currently active account information |
Device Management
Tool | Description |
| List all available QPU (Quantum Processing Unit) devices |
| Get detailed properties of a specific QPU device |
Quantum Computing Tasks
Tool | Description |
| Execute quantum circuit sampling task on a QPU device |
| Execute expectation estimation task for a quantum circuit |
| Batch execute multiple quantum circuit sampling tasks |
| Batch execute estimation tasks for multiple circuits with one observable |
Multi-Objective Decision (CircuitObservableBinding)
Tool | Description |
| Create a binding for multiple circuits and observables |
| Add Cartesian product combination rule (all combinations) |
| Add one-to-one combination rule (paired combinations) |
| Execute estimation using the created binding |
| List all stored CircuitObservableBinding objects |
| Delete a stored CircuitObservableBinding object |
Task Management
Tool | Description |
| Get the execution status of a task ( |
| Get the computation results of a completed task |
| Cancel a running or pending task |
| List user's recent quantum computing tasks |
MCP Resources
Resource URI | Description |
| Service status |
| Bell state circuit example |
| GHZ state circuit example |
| Random number generator circuit |
| Superposition circuit example |
Example Usage
Configure Account
# Auto-configure via environment variables
# Or call explicitly
await setup_origin_quantum_account_tool(
api_key="your_api_key"
)List Devices
devices = await list_qpu_devices_tool()
print(f"Available devices: {devices['total_devices']}")Execute Sampling Task
# Bell state circuit
circuit = """QINIT 2
CREG 2
H q[0]
CNOT q[0],q[1]
MEASURE q[0],c[0]
MEASURE q[1],c[1]"""
result = await sample_tool(
circuit=circuit,
device_id="20",
shots=1000
)
task_id = result["task_id"]
# Check status and get results
status = await get_task_status_tool(task_id)
if status["task_status"] == "DONE":
results = await get_task_results_tool(task_id)
print(f"Measurement results: {results['results']}")Configure in AI Coding Platforms
Auto-configure: Use
./scripts/setup_configure.sh --mcp claude-desktop(or--mcp cline,--mcp cursor, etc.)
All clients use the same config format (replace /path/to/... with your actual path):
{
"mcpServers": {
"qpanda3-runtime": {
"command": "/path/to/qpanda3-runtime-mcp-server/.venv/bin/python",
"args": ["-m", "qpanda3_runtime_mcp_server"],
"cwd": "/path/to/qpanda3-runtime-mcp-server",
"env": { "QPANDA3_API_KEY": "your_api_key_here" }
}
}
}Client | Config File Location |
Claude Code |
|
Claude Desktop | macOS: |
Cline |
|
Cursor |
|
Windsurf |
|
For more clients (Trae etc.), see Configuration Guide.
Development
Install Development Dependencies
uv sync --extra dev --extra testRun Tests
uv run pytestCode Linting
uv run ruff check .
uv run mypy src/Build Documentation
# Install documentation dependencies
uv sync --extra docs
# Build documentation (English + Chinese)
./scripts/build-docs.sh
# Local preview with live reload (language switching supported)
mkdocs serveProject Structure
qpanda3-runtime-mcp-server/
├── src/
│ └── qpanda3_runtime_mcp_server/
│ ├── __init__.py # Package entry point
│ ├── server.py # MCP server definition
│ ├── runtime.py # QPanda3 Runtime core logic
│ └── utils.py # Utility functions
├── scripts/
│ ├── setup_configure.sh # One-click setup (Linux/macOS)
│ ├── setup_configure.ps1 # One-click setup (Windows PowerShell)
│ ├── setup_configure.bat # One-click setup (Windows CMD)
│ ├── build-docs.sh # Build all documentation
│ └── serve-docs.sh # Serve docs with live reload
├── tests/
│ ├── __init__.py
│ ├── conftest.py # pytest configuration
│ ├── test_server.py # Server tests
│ └── test_runtime.py # Runtime tests
├── docs/
│ ├── *.md # English documentation (default)
│ └── cn/ # Chinese documentation
├── mkdocs.yml # MkDocs configuration (i18n)
├── .github/
│ └── workflows/ # GitHub Actions workflows
├── pyproject.toml # Project configuration
├── README.md # Project documentation
├── LICENSE # Apache 2.0 License
├── .env.example # Environment variable example
└── .gitignore # Git ignore fileNotes
Default Server: The server connects to
https://qpanda3-runtime.qpanda.cnby default. SetQPANDA3_SERVER_URLto override.Channel: The server uses the qcloud channel by default
Async Support: All tool functions are
asyncfunctionsError Handling: All functions return dictionaries containing a
statusfieldType Hints: Python type hints are used for better code readability
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Related Links
Contributing
See Contributing Guide for details.
Changelog
See Changelog for version history.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/OriginQ/qpanda3-runtime-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server