This guide covers how to manage your Origin Quantum account through the MCP server.
The QPanda3 Runtime MCP Server provides tools for managing your Origin Quantum account authentication. The server uses session-based authentication, meaning credentials are maintained for the duration of the session.
| Tool | Description |
|---|---|
setup_origin_quantum_account_tool |
Configure account credentials |
list_saved_accounts_tool |
List session account information |
active_account_info_tool |
Get current active account details |
The easiest way to configure your account is through environment variables:
export QPANDA3_API_KEY="your_api_key"
export QPANDA3_SERVER_URL="https://your_server:8080"Then simply call the setup tool without arguments:
result = await setup_origin_quantum_account_tool()You can also provide credentials directly:
result = await setup_origin_quantum_account_tool(
api_key="your_api_key",
server_url="https://your_server:8080"
)Create a config.yml file:
api_key: 'your_api_key_here'
server_url: 'https://your_server_url_here'Then reference it:
result = await setup_origin_quantum_account_tool(
config_path="./config.yml"
)accounts = await list_saved_accounts_tool()
print(accounts)Example output:
{
"status": "success",
"accounts": [
{
"name": "current_session",
"channel": "qcloud",
"connected": true
}
],
"message": "QPanda3 Runtime uses session-based authentication"
}info = await active_account_info_tool()
print(info)Example output:
{
"status": "success",
"account": {
"channel": "qcloud",
"connected": true,
"server_url": "https://your_server:8080"
}
}The server uses the qcloud channel, which connects to Origin Quantum's cloud platform.
No credentials provided:
{
"status": "error",
"message": "No credentials provided. Please provide api_key and server_url..."
}Authentication failed:
{
"status": "error",
"message": "Failed to setup account: Authentication failed..."
}result = await setup_origin_quantum_account_tool(
api_key="your_key",
server_url="https://your_server"
)
if result["status"] == "error":
print(f"Error: {result['message']}")
else:
print(f"Connected! Available devices: {result['available_devices']}")- Use environment variables for credentials in production
- Never hardcode credentials in your source code
- Use the qcloud channel for all workloads
- Verify connection after setting up the account
- Check available devices to ensure the connection is working
# 1. Set up account
result = await setup_origin_quantum_account_tool(
api_key="your_key",
server_url="https://your_server"
)
if result["status"] != "success":
raise Exception(f"Failed to connect: {result['message']}")
print(f"Connected to {result['channel']} channel")
print(f"Available devices: {result['available_devices']}")
# 2. Verify connection
info = await active_account_info_tool()
print(f"Active account: {info['account']['channel']}")
# 3. List devices to verify access
devices = await list_qpu_devices_tool()
print(f"Found {devices['total_devices']} devices")