Quantum Computation MCP Server
Enables natural language quantum computing by converting English queries to quantum circuits via OpenAI and executing them on IBM Quantum backends or simulators.
README
Quantum Computation MCP Server ππ¬
A powerful Model Context Protocol (MCP) server that enables natural language quantum computation using OpenAI and IBM Quantum services.
Features β¨
- Natural Language Processing: Convert English queries to quantum circuits using OpenAI GPT-4
- IBM Quantum Integration: Execute quantum circuits on real IBM quantum computers
- Multiple Quantum Algorithms: Support for Bell states, QFT, Grover's algorithm, and more
- Real-time Results: Get quantum computation results with detailed analysis
- Backend Management: List and select optimal quantum backends
- Circuit Visualization: ASCII art quantum circuit diagrams
Supported Quantum Operations π¬
- Bell States: Create maximally entangled quantum states
- Quantum Fourier Transform (QFT): Apply discrete Fourier transform to quantum amplitudes
- Grover's Algorithm: Quantum search with quadratic speedup
- Quantum Random Number Generation: True quantum randomness
- Custom Circuits: Define your own quantum operations (other algorithms will be added soon!)
Installation π οΈ
Prerequisites
- Python 3.8+
- OpenAI API Key - Get from OpenAI Platform
- IBM Quantum Account - Sign up at IBM Quantum Network
Install Dependencies
# Clone the repository
git clone https://github.com/armaasinghn/QuantumComputeMCPServer.git
# Install dependencies
pip install -r requirements.txt
Quick Start π
1. Start the MCP Server
python server.py
2. Connect from Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"quantum-computation": {
"command": "python",
"args": ["path/to/quantum_mcp_server.py"],
"env": {}
}
}
}
3. Use in Claude
Ask Claude to use the quantum computation tools:
"Create a Bell state and run it on IBM Quantum using my API keys"
API Keys Setup π
OpenAI API Key
- Visit OpenAI Platform
- Create a new API key
- Keep it secure - never commit to version control
IBM Quantum Token
- Sign up at IBM Quantum Network
- Go to your Account Settings
- Copy your API token
- Keep it secure - never commit to version control
π Available Tools
The quantum-mcp-server exposes a set of powerful tools for quantum computation via the MCP (Multi-Modal Control Protocol) interface. These tools support natural language input, automatic circuit generation, and backend selection using Qiskit, IBM Quantum, and OpenAI.
πΉ quantum_compute
Description:
Executes a quantum computation described in natural language.
Input Schema:
{
"query": "Create a Bell state using 2 qubits",
"shots": 1024
}
Features:
- Parses natural language to identify quantum operations
- Supports Bell states, QFT, Grover's algorithm, teleportation, VQE, QAOA, and more
- Automatically selects between IBM Quantum hardware and local simulator
- Returns measurement results, circuit diagram, backend details, and analysis
πΉ list_quantum_backends
Description:
Lists all available IBM Quantum backends (hardware + simulators).
Input Schema:
{}
Features:
- Displays backend name, number of qubits, operational status, and type (simulator/real device)
- Useful for backend selection and monitoring availability
πΉ quantum_circuit_info
Description:
Provides technical and educational information about supported quantum operations.
Input Schema:
{
"operation": "qft"
}
Features:
- Explains concepts like Bell state, QFT, Grover, Teleportation, VQE, QAOA, etc.
- Helpful for students, researchers, and developers working with quantum circuits
Example Output π
π Quantum Computation Results
================================
π Original Query: "Create a Bell state with maximum entanglement"
π¬ Operation: bell_state
π’ Qubits Used: 2
π» Backend: ibm_brisbane
π― Shots: 1024
π Measurement Results:
|00β©: 512 (50.0%)
|11β©: 512 (50.0%)
π§ Circuit Properties:
β’ Depth: 2
β’ Width: 2
π Analysis:
β’ Bell state created successfully
β’ Shows quantum entanglement between qubits
β’ Expect roughly equal probabilities for |00β© and |11β©
π¨ Circuit Visualization:
βββββ βββ
q_0: β€ H ββββ βββ€Mββββ
ββββββββ΄ββββ₯ββββ
q_1: ββββββ€ X βββ«ββ€Mβ
βββββ β ββ₯β
c: 2/ββββββββββββ©βββ©β
0 1
β
Quantum computation completed successfully!
Architecture ποΈ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Claude/MCP β β Quantum MCP β β IBM Quantum β
β Client βββββΊβ Server βββββΊβ Backend β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β OpenAI API β
β (GPT-4) β
βββββββββββββββββββ
Advanced Configuration βοΈ
Environment Variables
export OPENAI_API_KEY="your-openai-key"
export IBM_QUANTUM_TOKEN="your-ibm-token"
export QUANTUM_BACKEND="ibm_brisbane" # Optional: specify preferred backend
export LOG_LEVEL="INFO" # DEBUG, INFO, WARNING, ERROR
Custom Circuit Parameters
The server accepts various parameters for different quantum operations:
{
"query": "Run Grover search for 2 marked items in 4-qubit space",
"openai_key": "...",
"ibm_token": "...",
"shots": 2048,
"custom_parameters": {
"marked_items": [3, 7],
"iterations": 2
}
}
Error Handling π‘οΈ
The server includes comprehensive error handling:
- Invalid API Keys: Clear error messages with setup instructions
- Backend Unavailable: Automatic fallback to simulators
- Circuit Errors: Validation and error correction
- Network Issues: Retry logic with exponential backoff
Security Best Practices π
- Never commit API keys to version control
- Use environment variables for sensitive data
- Rotate keys regularly
- Monitor API usage for unusual activity
- Use least-privilege access when possible
Contributing π€
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
# Clone and setup development environment
git clone https://github.com/armaasinghn/QuantumComputeMCPServer.git
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -r requirements.txt
pip install -e .
# Run tests
python -m pytest tests/
Troubleshooting π§
Common Issues
-
"Services failed to initialize"
- Check API keys are valid and not expired
- Verify network connectivity
- Ensure IBM Quantum account is active
-
"No backends available"
- IBM Quantum systems may be in maintenance
- Try using simulator backends
- Check your IBM Quantum access level
-
"Circuit execution failed"
- Circuit may be too large for available backends
- Try reducing the number of qubits
- Use circuit optimization options
Debug Mode
LOG_LEVEL=DEBUG python quantum_mcp_server.py
Performance Tips π
- Use simulators for development and testing
- Optimize circuits before real hardware execution
- Batch multiple circuits when possible
- Monitor queue times on IBM backends
- Use appropriate shot counts (1024 is usually sufficient)
Roadmap πΊοΈ
- [ ] Support for more quantum algorithms (QAOA, VQE)
- [ ] Integration with other quantum cloud providers
- [ ] Quantum error correction support
- [ ] Circuit optimization recommendations
- [ ] Quantum machine learning algorithms
- [ ] Interactive circuit building
- [ ] Real-time collaboration features
Acknowledgments π
- IBM Quantum for quantum computing infrastructure
- OpenAI for natural language processing
- Qiskit for quantum computing framework
- Model Context Protocol for the MCP specification
- Anthropic for Claude and MCP tools
Disclaimer
This project was originally developed using an earlier version of the IBM platform, which has since been deprecated. As the current platform requires credit card verificationβwhich I do not possessβtesting and further development have been temporarily halted.
Please note that the functionality of this application is significantly enhanced when used with the paid versions of IBM's server capabilities and similar services, such as OpenAI.
Built with β€οΈ for the quantum computing community
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.