QML
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"des137-qml-mcp": {
"command": "python",
"args": [
"server.py"
],
"env": {
"QML_MCP_LOG_LEVEL": "INFO",
"QML_MCP_QUANTUM_MAX_SHOTS": "100000",
"QML_MCP_QUANTUM_MAX_QUBITS": "10",
"QML_MCP_QUANTUM_DEFAULT_SHOTS": "1024",
"QML_MCP_ENABLE_DETAILED_ERRORS": "true"
}
}
}
}You deploy and run the QML-MCP server to execute quantum circuits, compute quantum kernels, and train quantum machine learning models. This MCP server lets you perform quantum ML tasks with configurable safety limits and structured logging, all accessible through a standard MCP client workflow.
How to use
You interact with the server through an MCP client to run quantum circuits, compute kernels, train a variational quantum classifier, and evaluate models. Use the available tools to perform practical ML tasks such as executing a circuit to obtain measurement results, building a quantum kernel matrix for ML pipelines, training a VQC on labeled data, and evaluating a trained model on test data. You can rely on the server’s safety limits and detailed error messages to diagnose issues and ensure proper usage.
Key workflows you can perform include: running a quantum circuit to obtain measurement results for a given circuit and shot count, computing a quantum kernel matrix for training and testing data, training a Variational Quantum Classifier with your dataset, and evaluating the final model on a test set. Each workflow returns results or a trained model that you can persist and reuse in subsequent experiments.
How to install
Prerequisites: ensure you have Python 3.10 or newer and a compatible package manager. You will install the package in editable mode and can also install development dependencies if needed.
pip install -e .
For development work, install with development extras to include testing and tooling.
pip install -e ".[dev]"
Configuration and usage notes
Configure runtime behavior using environment variables. You can set maximums for shots and qubits, default shots, logging level, and error trace inclusion to tailor performance and diagnostics to your needs.
Key environment variables you may configure include: QML_MCP_QUANTUM_MAX_SHOTS, QML_MCP_QUANTUM_MAX_QUBITS, QML_MCP_QUANTUM_DEFAULT_SHOTS, QML_MCP_LOG_LEVEL, and QML_MCP_ENABLE_DETAILED_ERRORS. Use sensible values to balance accuracy, speed, and safety.
Running the server
Start the server by launching the Python script that serves MCP requests.
python server.py
Safety and limits
The server enforces configurable safety limits to prevent resource overuse. You can cap the number of qubits per circuit and the maximum number of shots per run. All inputs are validated and error messages include tracebacks when detailed reporting is enabled.
Notes on requirements and compatibility
This server depends on Python >= 3.10 and a compatible set of MCP and Qiskit components. Ensure your environment satisfies these requirements before running the server.
Testing and validation
You can run the test suite to validate behavior and ensure that components such as configuration validation and ML utility functions operate correctly.
Available tools
run_quantum_circuit
Execute a quantum circuit and obtain measurement results with configurable shots.
compute_quantum_kernel
Compute a quantum kernel matrix using a specified feature map for ML tasks.
train_vqc
Train a Variational Quantum Classifier on labeled data and return a trained model.
evaluate_model
Evaluate a trained quantum ML model on test data and provide performance metrics.