Skip to main content
Glama
OriginQ

QPanda3 Runtime MCP Server

by OriginQ

QPanda3 Runtime MCP サーバー

Python 3.10+ FastMCP License Documentation

AI アシスタントが QPanda3 Runtime を通じて Origin Quantum コンピューティングサービスと対話できるようにする Model Context Protocol (MCP) サーバーです。

機能

  • アカウント管理: Origin Quantum クラウドアカウントの認証を設定および管理

  • デバイス管理: 利用可能な QPU デバイスを一覧表示および照会

  • 量子コンピューティングタスク: サンプリングおよび推定タスクの実行

  • バッチ操作: 複数の回路を効率的に実行

  • 多目的決定: 複雑な最適化のための CircuitObservableBinding

  • タスク管理: タスクステータスの照会、結果の取得、タスクのキャンセル

  • サンプル回路: 一般的な量子回路のサンプルリソースを提供

ドキュメント

ドキュメント

説明

English Docs

英語ドキュメントサイト

中文文档

中国語ドキュメントサイト

Getting Started

初心者向け完全ガイド - ここから開始

Installation Guide

詳細なインストール手順

Quick Start

経験者向けの高速セットアップ

Configuration

環境およびクライアントの設定

User Guide

詳細な機能ドキュメント

API Reference

自動生成された API ドキュメント

インストール

ワンクリックセットアップ(推奨)

プロジェクトには、プロセス全体を自動化するセットアップスクリプトが用意されています:

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.sh

Windows (PowerShell):

git clone https://github.com/OriginQ/qpanda3-runtime-mcp-server.git
cd qpanda3-runtime-mcp-server
.\scripts\setup_configure.ps1

このスクリプトは、依存関係のセットアップ、API キーの設定、MCP クライアントのセットアップなど、すべてを処理します。

手動インストールオプションについては、インストールガイドを参照してください。

クイックスタート

# 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  # Windows

MCP クライアントの設定および高度なオプションについては、設定を参照してください。

MCP ツール

アカウント管理

ツール

説明

setup_origin_quantum_account_tool

Origin Quantum クラウドアカウントの認証を設定

list_saved_accounts_tool

保存されたアカウント情報を一覧表示(セッションベース)

active_account_info_tool

現在アクティブなアカウント情報を取得

デバイス管理

ツール

説明

list_qpu_devices_tool

利用可能なすべての QPU(量子処理ユニット)デバイスを一覧表示

get_qpu_properties_tool

特定の QPU デバイスの詳細プロパティを取得

量子コンピューティングタスク

ツール

説明

sample_tool

QPU デバイスで量子回路サンプリングタスクを実行

estimate_tool

量子回路の期待値推定タスクを実行

batch_sample_tool

複数の量子回路サンプリングタスクをバッチ実行

batch_estimate_tool

1 つの観測量を使用して複数の回路の推定タスクをバッチ実行

多目的決定 (CircuitObservableBinding)

ツール

説明

create_circuit_observable_binding_tool

複数の回路と観測量のバインディングを作成

add_product_rule_tool

デカルト積の組み合わせルールを追加(すべての組み合わせ)

add_zip_rule_tool

1 対 1 の組み合わせルールを追加(ペアの組み合わせ)

estimate_with_binding_tool

作成したバインディングを使用して推定を実行

list_bindings_tool

保存されているすべての CircuitObservableBinding オブジェクトを一覧表示

delete_binding_tool

保存されている CircuitObservableBinding オブジェクトを削除

タスク管理

ツール

説明

get_task_status_tool

タスクの実行ステータスを取得 (PENDING/RUNNING/DONE/FAILED/CANCELLED)

get_task_results_tool

完了したタスクの計算結果を取得

cancel_task_tool

実行中または保留中のタスクをキャンセル

list_my_tasks_tool

ユーザーの最近の量子コンピューティングタスクを一覧表示

MCP リソース

リソース URI

説明

qpanda://status

サービスステータス

circuits://bell-state

ベル状態回路の例

circuits://ghz-state

GHZ 状態回路の例

circuits://random

乱数生成回路

circuits://superposition

重ね合わせ回路の例

使用例

アカウントの設定

# Auto-configure via environment variables
# Or call explicitly
await setup_origin_quantum_account_tool(
    api_key="your_api_key"
)

デバイスの一覧表示

devices = await list_qpu_devices_tool()
print(f"Available devices: {devices['total_devices']}")

サンプリングタスクの実行

# 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']}")

AI コーディングプラットフォームでの設定

自動設定: ./scripts/setup_configure.sh --mcp claude-desktop (または --mcp cline, --mcp cursor など) を使用してください。

すべてのクライアントは同じ設定形式を使用します(/path/to/... を実際のパスに置き換えてください):

{
  "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" }
    }
  }
}

クライアント

設定ファイルの場所

Claude Code

~/.claude.json

Claude Desktop

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Cline

~/.vscode-server/data/User/globalStorage/saoudrizwan.cline/settings/cline_mcp_settings.json

Cursor

.cursor/mcp.json (プロジェクトルート)

Windsurf

~/.codeium/windsurf/mcp_config.json

その他のクライアント(Trae など)については、設定ガイドを参照してください。

開発

開発依存関係のインストール

uv sync --extra dev --extra test

テストの実行

uv run pytest

コードのリンティング

uv run ruff check .
uv run mypy src/

ドキュメントのビルド

# Install documentation dependencies
uv sync --extra docs

# Build documentation (English + Chinese)
./scripts/build-docs.sh

# Local preview with live reload (language switching supported)
mkdocs serve

プロジェクト構造

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 file

注意事項

  1. デフォルトサーバー: サーバーはデフォルトで https://qpanda3-runtime.qpanda.cn に接続します。上書きするには QPANDA3_SERVER_URL を設定してください。

  2. チャネル: サーバーはデフォルトで qcloud チャネルを使用します。

  3. 非同期サポート: すべてのツール関数は async 関数です。

  4. エラー処理: すべての関数は status フィールドを含む辞書を返します。

  5. 型ヒント: コードの可読性を高めるために Python の型ヒントが使用されています。

ライセンス

このプロジェクトは Apache License 2.0 の下でライセンスされています。詳細は LICENSE ファイルを参照してください。

関連リンク

貢献

詳細は 貢献ガイド を参照してください。

変更履歴

バージョン履歴については 変更履歴 を参照してください。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - A tier

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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