Quantum Code Validator
Used to store and retrieve version-specific reference documentation and metadata for quantum computing libraries to facilitate static code validation and method lookup.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Quantum Code Validatorvalidate this PennyLane snippet: qml.RX(0.5, wires=0); qml.CNOT(wires=[0, 1])"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Quantum Code Validator
A Model Context Protocol (MCP) server for validating quantum computing library code. Currently supports PennyLane, with plans to expand support for other quantum computing libraries in the future.
Overview
The Quantum Code Validator is a tool that helps developers ensure their quantum computing code is valid and follows the correct usage patterns for various quantum libraries. It provides static validation of quantum code against official documentation and offers reference documentation lookup capabilities.
Related MCP server: mcp-qiskit
Features
Static Code Validation: Validates quantum code by:
Checking code syntax using Python's
astmoduleVerifying code compilation using
py_compileComparing quantum library method usage against official documentation
Reference Documentation Lookup: Retrieves method documentation for specific versions of quantum libraries
Version-Specific Validation: Supports validation against specific versions of quantum libraries
Extensible Architecture: Designed to support multiple quantum computing libraries
Current Support
PennyLane: Full support for static validation and reference documentation lookup
Supported versions: v0.35.0 - v0.41.1
Planned Support
The following quantum computing libraries are planned for future support:
Qulacs
Qiskit
Cirq
cuQuantum
And more...
Usage
The server provides two main tools:
validate_quantum_method_by_static:# Example usage result = validate_quantum_method_by_static( code="your_quantum_code_here", version="v0.41.1" # Optional )request_quantum_method_reference:# Example usage docs = request_quantum_method_reference( method_name="qml.CNOT", # Method name without arguments version="v0.41.1" # Optional )
Installation
1. Install with uv
git clone https://github.com/yourusername/quantum-code-validator.git
cd quantum-code-validatorCreate and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activateInstall uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | shInstall dependencies using uv:
uv syncRun the server:
uv run src/server.py
Setting MCP Server
1. Local MCP Server by uv
1.1 Load and Parse PennyLane Source Code
Load basic information from PennyLane's source code and save it as JSON files by version. The PennyLane version will be the one installed in the execution environment, so please switch it using the uv command as needed.
uv run scripts/parse_pennylane_api.py ./refdocs/pennylane/raw/v0.41.1.json1.2 Format Source Code to Document
Next, we will use an LLM to format the basic information extracted in Step 1 into document information that can be accessed on MCP. Please specify the PennyLane versions to be converted into documents as a comma-separated list. Note that this process uses an LLM, so the "OPENAI_API_KEY" environment variable must be set, and there is a cost of approximately $2.50 per version. The formatting results will be saved in "./refdocs/pennylane/formatted".
uv run scripts/format_docs_by_llm.py v0.41.0,v0.41.11.3 Setup MCP Server on Local
Finally, by configuring the mcp.json file according to the platform and starting the MCP server, the tool becomes available for use with the target tool. As a reference, a link to the documentation on how to configure it for Claude Desktop is provided.
{
"mcpServers": {
"quantum-code-validator": {
"command": "uv",
"args": [
"--directory",
"/your/mcp/server/directory/quantum-code-validator",
"run",
"server.py",
"--transport",
"stdio"
]
}
}
}License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
The OpenZeppelin Solidity Contracts MCP server integrates OpenZeppelin's security and style rules into AI-driven development workflows, enabling AI assistants to generate safe, correct, and production-ready smart contracts. It automatically validates generated code against OpenZeppelin standards (including imports, modifiers, naming conventions, and security checks) and supports various contract types including ERC-20, ERC-721, ERC-1155, Stablecoins, RWA, Governor, and Account contracts through prompt-driven workflows.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
The official Svelte MCP server providing docs and autofixing tools for Svelte development
Official DevSpeak MCP server — translate technical text into formal specs from any AI IDE or agent
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides LLMs with access to Equinox documentation and tools to validate Equinox module code. It supports both online documentation fetching from GitHub and offline access through local files.3MIT
- AlicenseNot gradedqualityCmaintenanceMCP server exposing Qiskit quantum computing functionality through the Model Context Protocol. Enables LLMs to create, manipulate, and execute quantum circuits via standardized MCP tools and resources.MIT
- FlicenseAqualityDmaintenanceUnofficial Model Context Protocol (MCP) server that enables LLMs to build and execute quantum circuits using Qiskit.137-
- FlicenseNot gradedqualityDmaintenanceMCP server that provides code validation rules and analysis for various stacks/frameworks, enabling automated code reviews and reporting directly from VS Code and other editors.-