QPanda3 Runtime MCP Server
QPanda3 Runtime MCP サーバー
AI アシスタントが QPanda3 Runtime を通じて Origin Quantum コンピューティングサービスと対話できるようにする Model Context Protocol (MCP) サーバーです。
機能
アカウント管理: Origin Quantum クラウドアカウントの認証を設定および管理
デバイス管理: 利用可能な QPU デバイスを一覧表示および照会
量子コンピューティングタスク: サンプリングおよび推定タスクの実行
バッチ操作: 複数の回路を効率的に実行
多目的決定: 複雑な最適化のための CircuitObservableBinding
タスク管理: タスクステータスの照会、結果の取得、タスクのキャンセル
サンプル回路: 一般的な量子回路のサンプルリソースを提供
ドキュメント
ドキュメント | 説明 |
英語ドキュメントサイト | |
中国語ドキュメントサイト | |
初心者向け完全ガイド - ここから開始 | |
詳細なインストール手順 | |
経験者向けの高速セットアップ | |
環境およびクライアントの設定 | |
詳細な機能ドキュメント | |
自動生成された 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.shWindows (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 # WindowsMCP クライアントの設定および高度なオプションについては、設定を参照してください。
MCP ツール
アカウント管理
ツール | 説明 |
| Origin Quantum クラウドアカウントの認証を設定 |
| 保存されたアカウント情報を一覧表示(セッションベース) |
| 現在アクティブなアカウント情報を取得 |
デバイス管理
ツール | 説明 |
| 利用可能なすべての QPU(量子処理ユニット)デバイスを一覧表示 |
| 特定の QPU デバイスの詳細プロパティを取得 |
量子コンピューティングタスク
ツール | 説明 |
| QPU デバイスで量子回路サンプリングタスクを実行 |
| 量子回路の期待値推定タスクを実行 |
| 複数の量子回路サンプリングタスクをバッチ実行 |
| 1 つの観測量を使用して複数の回路の推定タスクをバッチ実行 |
多目的決定 (CircuitObservableBinding)
ツール | 説明 |
| 複数の回路と観測量のバインディングを作成 |
| デカルト積の組み合わせルールを追加(すべての組み合わせ) |
| 1 対 1 の組み合わせルールを追加(ペアの組み合わせ) |
| 作成したバインディングを使用して推定を実行 |
| 保存されているすべての CircuitObservableBinding オブジェクトを一覧表示 |
| 保存されている CircuitObservableBinding オブジェクトを削除 |
タスク管理
ツール | 説明 |
| タスクの実行ステータスを取得 ( |
| 完了したタスクの計算結果を取得 |
| 実行中または保留中のタスクをキャンセル |
| ユーザーの最近の量子コンピューティングタスクを一覧表示 |
MCP リソース
リソース URI | 説明 |
| サービスステータス |
| ベル状態回路の例 |
| GHZ 状態回路の例 |
| 乱数生成回路 |
| 重ね合わせ回路の例 |
使用例
アカウントの設定
# 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 Desktop | macOS: |
Cline |
|
Cursor |
|
Windsurf |
|
その他のクライアント(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注意事項
デフォルトサーバー: サーバーはデフォルトで
https://qpanda3-runtime.qpanda.cnに接続します。上書きするにはQPANDA3_SERVER_URLを設定してください。チャネル: サーバーはデフォルトで qcloud チャネルを使用します。
非同期サポート: すべてのツール関数は
async関数です。エラー処理: すべての関数は
statusフィールドを含む辞書を返します。型ヒント: コードの可読性を高めるために Python の型ヒントが使用されています。
ライセンス
このプロジェクトは Apache License 2.0 の下でライセンスされています。詳細は LICENSE ファイルを参照してください。
関連リンク
貢献
詳細は 貢献ガイド を参照してください。
変更履歴
バージョン履歴については 変更履歴 を参照してください。
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