Quantum Code Validator
A server for validating quantum computing library code, with support for PennyLane.
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.
Features
- Static Code Validation: Validates quantum code by:
- Checking code syntax using Python's
astmodule - Verifying code compilation using
py_compile - Comparing quantum library method usage against official documentation
- Checking code syntax using Python's
- 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-validator
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install dependencies using uv:
uv sync -
Run 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.json
1.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.1
1.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.
Servidores relacionados
Scout Monitoring MCP
patrocinadorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
patrocinadorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
MKP
Model Kontext Protocol Server for Kubernetes that allows LLM-powered applications to interact with Kubernetes clusters through native Go implementation with direct API integration and comprehensive resource management.
PromptEasy.EU
The first EU-sovereign, version-controlled prompt library that natively exposes your team’s templates as a managed MCP Server for agentic discovery.
Super Secret MCP Server
A fun tool to generate random combinations of US States and signature soups.
MCP Java Decompiler Server
Decompile Java class files from file paths, package names, or JAR files using a JavaScript port of the CFR decompiler.
Jakarta Migration MCP
Specialized tools for analyzing and migrating Java applications from Java EE 8 (javax.*) to Jakarta EE 9+ (jakarta.*).
Codebase Context Dumper
Easily provide codebase context to Large Language Models (LLMs).
d2-mcp
Create, validate, and render diagrams from D2 (Declarative Diagramming) code into SVG and PNG formats.
SuperCollider MCP Server
An MCP server for the SuperCollider programming language that executes synths using supercolliderjs.
mcpproxy-go
Open-source local MCP proxy server. Routes multiple MCP servers through a single endpoint with BM25 tool filtering, quarantine security, activity logging, and web UI.
mcp-of-mcps
MCP of MCPs is a meta-server that merges all your MCP servers into a single smart endpoint. It gives AI agents instant tool discovery, selective schema loading, and massively cheaper execution, so you stop wasting tokens and time. With persistent tool metadata, semantic search, and direct code execution between tools, it turns chaotic multi-server setups into a fast, efficient, hallucination-free workflow. It also automatically analyzes the tools output schemas if not exist and preserves them across sessions for consistent behavior.