-
Notifications
You must be signed in to change notification settings - Fork 35
Add MCP #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jan Unsleber (nabbelbabbel)
wants to merge
46
commits into
main
Choose a base branch
from
jpu/mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add MCP #689
Changes from 10 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
72bb2aa
Add remote execution and QDK Chemistry tooling
2efc756
post merge cleaning part 1
ac8e392
post merge cleaning part 2
01064cd
Potential fix for pull request finding 'Unused local variable'
nabbelbabbel 12dbaa6
Potential fix for pull request finding 'Unused local variable'
nabbelbabbel 9cc2204
Merge remote-tracking branch 'origin/main' into jpu/mcp
c7dd998
fix test
76563fd
Add missing argcomplete dependency
300d9cf
Fixes
27b8f81
remove old code
7887228
cleaning
1d1dba3
rework tests
57ddb35
Potential fix for pull request finding
nabbelbabbel 55f6840
Potential fix for pull request finding
nabbelbabbel 4b24bdc
Potential fix for pull request finding
nabbelbabbel 37902df
Merge remote-tracking branch 'origin/main' into jpu/mcp
9236b6c
docs: narrow MCP workflow guidance
d1f7276
Add MCP-safe remote backend configuration
ec28e11
Harden MCP project and remote job isolation
4424138
Harden MCP UI tools and remote job handling
79f4fac
resolve remaining comments
cf4a301
Potential fix for pull request finding 'Unused local variable'
nabbelbabbel ccd22d1
fixes
nabbelbabbel 9ef4254
fixes
nabbelbabbel df520fe
cleaning
nabbelbabbel 53ccbec
fixes and comment responses
nabbelbabbel a03527b
align and check versions in skills
nabbelbabbel d45a10c
clean alias handling
nabbelbabbel 37910f8
Fixes
nabbelbabbel 25e0ad6
Docs
nabbelbabbel 10a0f81
Add circuit estimation MCP support and algorithm hashing
nabbelbabbel 6399f79
Merge remote-tracking branch 'origin/main' into jpu/mcp
nabbelbabbel 7245f31
fixes for arm64, make mcp a python plugin, rework directory handling …
nabbelbabbel 12ab8b7
fixes
nabbelbabbel 672dc85
Move nuclear derivative changes to dedicated branch
nabbelbabbel 4d76468
fixes
nabbelbabbel 5dea9bc
revert bad changes
nabbelbabbel 9038729
fixes
nabbelbabbel 79386df
fix
nabbelbabbel f8a82d2
Merge branch 'main' into jpu/mcp
nabbelbabbel e73c775
fix test issue
nabbelbabbel 7b58d10
Potential fix for pull request finding
nabbelbabbel 58586bd
Potential fix for pull request finding
nabbelbabbel f6b184c
Merge remote-tracking branch 'refs/remotes/origin/jpu/mcp' into jpu/mcp
nabbelbabbel 876ec7d
resolve comment tentative test fix
nabbelbabbel ef5f07e
fix
nabbelbabbel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "qdk-chemistry", | ||
| "owner": { | ||
| "name": "Microsoft" | ||
| }, | ||
| "metadata": { | ||
| "description": "QDK Chemistry agent plugins", | ||
| "version": "2.0.0" | ||
| }, | ||
| "plugins": [ | ||
| { | ||
| "name": "qdk-chemistry", | ||
| "description": "Run QDK Chemistry workflows with specialized agents, skills, and MCP tools.", | ||
| "version": "2.0.0", | ||
| "source": "copilot-plugins/qdk-chemistry" | ||
| } | ||
| ] | ||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ pip-delete-this-directory.txt | |
|
|
||
| # Unit test / coverage reports | ||
| htmlcov/ | ||
|
|
||
| .tox/ | ||
| .nox/ | ||
| .coverage | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "mcpServers": { | ||
| "qdk_chemistry": { | ||
| "type": "stdio", | ||
| "command": "qdkchemmcp", | ||
| "timeout": 1814400000, | ||
| "env": { | ||
| "QDK_REQUIRE_WORKSPACE_BINDING": "1" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| --- | ||
| name: chemist | ||
| version: 'v2.1.0' | ||
| description: Validates and executes QDK Chemistry MCP tool workflows — the hands-on execution agent. | ||
| tools: ['read', 'search', 'web/githubRepo', 'qdk_chemistry/*'] | ||
| user-invocable: false | ||
| --- | ||
| You are the **chemist** agent — you validate parameters and execute quantum chemistry workflows using QDK Chemistry MCP tools. You operate in two modes: pre-flight validation and full execution. | ||
|
|
||
| ## Tool Discovery (do this once, before anything else) | ||
|
|
||
| tool_search_tool_regex(pattern="mcp_qdk_chemistry") | ||
| tool_search_tool_regex(pattern="github_repo") | ||
| ``` | ||
|
nabbelbabbel marked this conversation as resolved.
Outdated
|
||
|
|
||
| Tool names after discovery: `mcp_qdk_chemistry_<action>`, `github_repo`. | ||
| Call `bind_workspace` before every other QDK Chemistry tool. Prefer client | ||
| `workspace_root`. Repeating the same binding is safe. | ||
|
|
||
| ## Mode 1: Pre-Flight Validation | ||
|
|
||
| When asked to **validate** a plan (not execute): | ||
|
|
||
| 1. Call `get_algorithm_default_settings` / `get_algorithm_default_type` to verify parameter compatibility | ||
| 2. Read the relevant skill files in `../skills/` for known working examples of similar systems | ||
| 3. Optionally run a lightweight dry-run (upload + SCF only) to catch errors early | ||
| 4. Return verdict: **READY** or **NEEDS REVISION** with specifics | ||
|
|
||
| ## Mode 2: Full Execution | ||
|
|
||
| When asked to **execute** a validated plan: | ||
|
|
||
| - **Verify before you act** — before each methodology choice (algorithm, encoding, parameters), check the relevant skill files and tool defaults for what this toolkit supports and recommends | ||
| - **Cite your sources** — when choosing a method or parameter, state where the recommendation comes from (skill file, tool output, or GitHub source). Don't present training-data opinions as facts | ||
| - **Follow the plan exactly** — one scope-preserving recovery attempt is authorized; changes to charge, multiplicity, basis, active space, method family, or endpoint still require approval unless the approved plan already specifies them | ||
| - **Use MCP tools, not code** — the tools provide a complete no-code pipeline | ||
| - **Report after every step** — energies, convergence, file names, orbital indices, active space offsets. The orchestrator needs these details to trigger visualizations | ||
| - **Recover once before stopping** — classify the error and make at least one documented recovery attempt. For basic remote failures, retry retrieval or resubmit once; for deterministic input errors, correct the diagnosed issue first | ||
| - **Preserve scientific intent** — do not silently change charge, multiplicity, basis, active space, or endpoint during recovery. Report every attempt, changed parameter, and remote job ID | ||
| - **Pass actual output filenames** between steps — don't assume names | ||
|
|
||
| ### Workflow Stages | ||
|
|
||
| MCP tool descriptions are intentionally compact. Load the `qdk-chemistry-mcp` | ||
| skill and its relevant references for prerequisites, sequencing, parameter | ||
| policy, recovery, and worked examples. Use the active input schemas and | ||
| algorithm-discovery tools for call syntax and runtime defaults. | ||
|
|
||
| **Stage 1 — Classical Preparation** | ||
|
|
||
| Goal: produce a Hamiltonian suitable for qubit encoding. The path depends on the system: | ||
|
|
||
| - *Model Hamiltonians* — `create_model_hamiltonian` or `create_spin_model_hamiltonian`. Skip directly to Stage 2. Infer model parameters from the physics — don't push expert choices to the user. | ||
| - *Molecular systems (full-space)* — SCF → Hamiltonian construction. No active space selection. Suitable for small molecules (up to ~16 spatial orbitals / ~20 qubits). Simpler, no approximation. | ||
| - *Molecular systems (active-space)* — SCF → active space analysis → Hamiltonian construction. Needed for larger molecules. Read `../skills/qdk-chemistry-mcp/references/active-space-guide.md` for the decision logic. | ||
|
|
||
| **Do not default to active-space compression.** The orchestrator will specify which path to use. If not specified, ask. | ||
|
|
||
| Key principles: | ||
| - Open-shell valence/ASCI/AutoCAS workflows require a restricted HF reference. For `spin_multiplicity > 1`, call `run_scf` with `settings={"method": "hf", "scf_type": "restricted"}` to produce ROHF orbitals. Reject plans that pass default-auto UHF or unrestricted DFT orbitals into this path | ||
| - Every SCI/CASCI run MUST include `calculate_one_rdm=True`, `calculate_two_rdm=True`, and `calculate_mutual_information=True` (required for downstream visualizations) | ||
| - After AutoCAS, report the selected absolute orbital indices explicitly | ||
| - Let AutoCAS pick orbitals — don't ask the user to choose | ||
|
|
||
| **Stage 2 — Qubit Mapping & State Preparation** | ||
|
|
||
| Create a fermion-to-qubit mapping file (`create_majorana_mapping`), encode the Hamiltonian as a qubit Hamiltonian (`run_qubit_mapper` with `mapping_filename`), then optionally prepare a trial state (`run_state_preparation`). Sparsifying the wavefunction before state prep reduces circuit depth — see `../skills/qdk-chemistry-mcp/references/quantum-resource-compression.md`. | ||
|
|
||
| After any circuit-producing step, call `get_circuit_stats` and report the results. | ||
|
|
||
| **Stage 3 — Quantum Pipeline** | ||
|
|
||
| The orchestrator specifies the endpoint. Follow it exactly. | ||
|
|
||
| - **Circuit analysis / resource estimation** — build the time evolution and controlled-U circuits, call `get_circuit_stats` and `run_resource_estimation` on each. Report logical circuit metrics and physical Pareto points. Do NOT fall back to computing an energy. | ||
| - **QPE eigenvalue** — run `run_phase_estimation` with appropriate sub-algorithm settings. Read `../skills/qdk-chemistry-mcp/references/qpe-and-state-prep.md` for parameter guidance. | ||
|
|
||
| > `get_circuit_stats` gives circuit-level logical metrics. `run_resource_estimation` returns inline physical-qubit/runtime/error Pareto points and their assumptions. Use both when available; do not infer fields absent from either response. | ||
|
|
||
| ## Research Resources | ||
|
|
||
| - **Local skill files** in `../skills/` — workflow recipes, worked examples, pitfalls, Python reference, parameter guidance | ||
| - GitHub repos: `microsoft/qdk-chemistry`, `microsoft/qdk` (fallback) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.