promptmc 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. promptmc-0.3.0/LICENSE +21 -0
  2. promptmc-0.3.0/PKG-INFO +154 -0
  3. promptmc-0.3.0/README.md +115 -0
  4. promptmc-0.3.0/examples/batch_spec.yaml +14 -0
  5. promptmc-0.3.0/examples/input.xml +30 -0
  6. promptmc-0.3.0/examples/mcp/README.md +41 -0
  7. promptmc-0.3.0/pyproject.toml +164 -0
  8. promptmc-0.3.0/src/promptmc/__init__.py +22 -0
  9. promptmc-0.3.0/src/promptmc/_typing.py +5 -0
  10. promptmc-0.3.0/src/promptmc/assistant.py +460 -0
  11. promptmc-0.3.0/src/promptmc/batch.py +478 -0
  12. promptmc-0.3.0/src/promptmc/benchmarks/__init__.py +13 -0
  13. promptmc-0.3.0/src/promptmc/benchmarks/_types.py +21 -0
  14. promptmc-0.3.0/src/promptmc/benchmarks/godiva.py +52 -0
  15. promptmc-0.3.0/src/promptmc/benchmarks/pwr_pin.py +117 -0
  16. promptmc-0.3.0/src/promptmc/cli.py +97 -0
  17. promptmc-0.3.0/src/promptmc/commands/__init__.py +3 -0
  18. promptmc-0.3.0/src/promptmc/commands/analyze.py +39 -0
  19. promptmc-0.3.0/src/promptmc/commands/batch.py +77 -0
  20. promptmc-0.3.0/src/promptmc/commands/common.py +36 -0
  21. promptmc-0.3.0/src/promptmc/commands/configure.py +68 -0
  22. promptmc-0.3.0/src/promptmc/commands/info.py +88 -0
  23. promptmc-0.3.0/src/promptmc/commands/plan.py +83 -0
  24. promptmc-0.3.0/src/promptmc/commands/run.py +103 -0
  25. promptmc-0.3.0/src/promptmc/commands/templates.py +81 -0
  26. promptmc-0.3.0/src/promptmc/commands/validate.py +84 -0
  27. promptmc-0.3.0/src/promptmc/errors.py +234 -0
  28. promptmc-0.3.0/src/promptmc/examples/uo2_criticality/README.md +46 -0
  29. promptmc-0.3.0/src/promptmc/examples/uo2_criticality/geometry.xml +7 -0
  30. promptmc-0.3.0/src/promptmc/examples/uo2_criticality/materials.xml +14 -0
  31. promptmc-0.3.0/src/promptmc/examples/uo2_criticality/settings.xml +12 -0
  32. promptmc-0.3.0/src/promptmc/geometry/__init__.py +53 -0
  33. promptmc-0.3.0/src/promptmc/geometry/materials.py +52 -0
  34. promptmc-0.3.0/src/promptmc/geometry/primitives.py +216 -0
  35. promptmc-0.3.0/src/promptmc/geometry/tallies.py +50 -0
  36. promptmc-0.3.0/src/promptmc/geometry/xml_serializer.py +312 -0
  37. promptmc-0.3.0/src/promptmc/mcp/__init__.py +11 -0
  38. promptmc-0.3.0/src/promptmc/mcp/resources.py +86 -0
  39. promptmc-0.3.0/src/promptmc/mcp/schemas.py +225 -0
  40. promptmc-0.3.0/src/promptmc/mcp/server.py +113 -0
  41. promptmc-0.3.0/src/promptmc/mcp/tools.py +778 -0
  42. promptmc-0.3.0/src/promptmc/openmc_integration.py +290 -0
  43. promptmc-0.3.0/src/promptmc/progress.py +587 -0
  44. promptmc-0.3.0/src/promptmc/resources.py +270 -0
  45. promptmc-0.3.0/src/promptmc/schema.py +431 -0
  46. promptmc-0.3.0/src/promptmc/telemetry.py +337 -0
  47. promptmc-0.3.0/src/promptmc/templates.py +376 -0
  48. promptmc-0.3.0/src/promptmc/visualization.py +355 -0
promptmc-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PromptMC Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: promptmc
3
+ Version: 0.3.0
4
+ Summary: AI Assistant and CLI for OpenMC simulation workflows
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: openmc,monte-carlo,nuclear,simulation,mcp
8
+ Author: PromptMC Contributors
9
+ Requires-Python: >=3.10,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Provides-Extra: telemetry
21
+ Requires-Dist: defusedxml (>=0.7.1,<0.8.0)
22
+ Requires-Dist: google-genai (>=0.1.0)
23
+ Requires-Dist: h5py (>=3.11.0,<4.0.0)
24
+ Requires-Dist: mcp (>=1.0.0)
25
+ Requires-Dist: opentelemetry-api (>=1.26.0,<2.0.0) ; extra == "telemetry"
26
+ Requires-Dist: opentelemetry-exporter-otlp (>=1.26.0,<2.0.0) ; extra == "telemetry"
27
+ Requires-Dist: opentelemetry-sdk (>=1.26.0,<2.0.0) ; extra == "telemetry"
28
+ Requires-Dist: psutil (>=6.0.0,<7.0.0)
29
+ Requires-Dist: pydantic (>=2.8.0,<3.0.0)
30
+ Requires-Dist: pyyaml (>=6.0.0,<7.0.0)
31
+ Requires-Dist: rich (>=13.7.0,<14.0.0)
32
+ Requires-Dist: tenacity (>=9.1.4,<10.0.0)
33
+ Requires-Dist: typer[all] (>=0.12.0)
34
+ Project-URL: Changelog, https://github.com/rjonace/promptmc/blob/main/CHANGELOG.md
35
+ Project-URL: Issues, https://github.com/rjonace/promptmc/issues
36
+ Project-URL: Repository, https://github.com/rjonace/promptmc
37
+ Description-Content-Type: text/markdown
38
+
39
+ <p align="center">
40
+ <img src="docs/assets/logo.svg" alt="PromptMC logo" width="140">
41
+ </p>
42
+
43
+ <h1 align="center">PromptMC</h1>
44
+
45
+ <p align="center">
46
+ <img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python">
47
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
48
+ <img src="https://img.shields.io/github/actions/workflow/status/rjonace/promptmc/ci.yml" alt="CI">
49
+ </p>
50
+
51
+ [OpenMC](https://docs.openmc.org/en/stable/) is powerful but can be painful to use: you hand-write XML, manage batch runs, and read results out of [HDF5](https://www.hdfgroup.org/solutions/hdf5/). It would be great if we could safely use AI to reduce that friction.
52
+
53
+ PromptMC does that by providing infrastructure and tooling that allows both AI LLM assistants and humans to interact with OpenMC through typed, schema-driven workflows.
54
+
55
+ It works like a grammar checker between an AI LLM assistant and OpenMC: your AI proposes a configuration, PromptMC validates XML structure and supported schema constraints before the simulator runs, and catches malformed inputs early.
56
+
57
+ Because AI [hallucination](https://link.springer.com/article/10.1007/s10676-024-09775-5) is a valid concern in reactor physics, the system is designed with deterministic blast walls. Every configuration (from a human, the deterministic local planner, or AI) is validated against the same typed [Pydantic](https://docs.pydantic.dev/) schemas before it reaches the simulator.
58
+
59
+ ## What you can do
60
+
61
+ Most planning and schema-validation workflows work without OpenMC installed; execution, geometry-debug checks, and 2D plot rendering require OpenMC.
62
+
63
+ **Without OpenMC installed:**
64
+ - Describe a simulation in plain English → a validated plan and `settings.xml` (the default planner uses no generative AI)
65
+ - Validate XML structure and PromptMC's supported OpenMC schemas
66
+ - Drive planning and schema validation from an AI client via the MCP server
67
+
68
+ **With OpenMC installed:**
69
+ - Run simulations (subprocess or Python API)
70
+ - Run geometry-debug overlap checks and generate 2D slice plots inside your AI chat client
71
+ - Parse [statepoint and tally](https://docs.openmc.org/en/stable/usersguide/tallies.html) outputs without touching HDF5
72
+
73
+ ## Installation
74
+
75
+ **Prerequisites:**
76
+ - Python 3.10 or higher
77
+ - Pip
78
+
79
+ **PromptMC** can be installed using pip. Use the following commands to install PromptMC:
80
+
81
+ ```bash
82
+ pip install promptmc # core (includes CLI, MCP server, and Gemini planner)
83
+ pip install promptmc[telemetry] # + OpenTelemetry tracing
84
+ ```
85
+
86
+ **OpenMC** (required for simulation execution, geometry-debug checks, and plot rendering) can be installed via Conda, Spack, Docker, or build from source per [docs.openmc.org](https://docs.openmc.org/en/stable/quickinstall.html). Planning and XML/schema validation work without it.
87
+
88
+ **[Cross-section data](https://www.nndc.bnl.gov/endf/)** (for running simulations):
89
+
90
+ ```bash
91
+ pip install openmc-data-downloader
92
+ openmc_data_downloader -l TENDL-2019 -i U235 U238 O16 H1 -d cross_sections
93
+ export OPENMC_CROSS_SECTIONS=$(pwd)/cross_sections/cross_sections.xml
94
+ ```
95
+
96
+ See [installation](docs/installation.md) for more details.
97
+
98
+ ## MCP server
99
+
100
+ PromptMC exposes a [Model Context Protocol](https://modelcontextprotocol.io) server so AI assistants can run OpenMC workflows natively — validation, plotting, execution, and result parsing from inside your LLM chat client, such as Claude Desktop, Cursor, and Google Antigravity.
101
+
102
+ **[Tools](https://modelcontextprotocol.io/docs/concepts/tools):** `openmc_validate`, `openmc_schema_check`, `openmc_template`, `openmc_list_templates`, `openmc_run`, `openmc_analyze`, `openmc_plot` (2D slice, returned to the chat client), `openmc_geometry_debug`, `openmc_check_installation`, `openmc_check_cross_sections`.
103
+
104
+ [Resources](https://modelcontextprotocol.io/docs/concepts/resources) expose the configured cross-sections path, the session's tool-call history, and the bundled examples.
105
+
106
+ **Setup:** see the [MCP server configuration guide](docs/mcp.md) for per-client steps (Claude Desktop/Code, Cursor, Google Antigravity, VS Code).
107
+
108
+ ## CLI
109
+
110
+ By default, `plan` uses a deterministic local planner, needing no API key, no network, no generative AI. The optional `--llm` flag calls Google Gemini (set GEMINI_API_KEY), which can interpret more open-ended natural-language requests. Customize the model name with GEMINI_MODEL (defaults to gemini-3.5-flash).
111
+
112
+ ```bash
113
+ promptmc plan "concrete shielding calculation with 1 million particles"
114
+ promptmc plan "pin cell criticality with 50k particles" --write
115
+ promptmc template criticality --particles 10000 # generate settings.xml
116
+ promptmc validate input.xml --schema
117
+ promptmc run input.xml --threads 4 # needs OpenMC
118
+ promptmc batch batch_spec.yaml --parallel threads --workers 4
119
+ promptmc analyze ./output --json results.json
120
+ promptmc info # environment status
121
+ ```
122
+
123
+ Full options in the [CLI reference](docs/cli-reference.md).
124
+
125
+ ## Safety
126
+
127
+ PromptMC is an engineering-assist tool that keeps a human in the loop. It is not a substitute for professional engineering judgment, independent verification and validation, or regulatory review, and is not for safety, licensing, or other regulated decisions. Reproducing a published benchmark is not qualification for safety analysis. Provided as-is (see [LICENSE](LICENSE)).
128
+
129
+ The goal is not autonomous reactor design; the goal is safer, faster OpenMC iteration.
130
+
131
+ ## Documentation
132
+
133
+ - [Installation](docs/installation.md) — setup paths for PromptMC, OpenMC, and nuclear data
134
+ - [MCP server](docs/mcp.md) — connecting AI assistants (Claude Desktop/Code, Cursor, Antigravity, VS Code)
135
+ - [CLI reference](docs/cli-reference.md) — commands, flags, environment variables
136
+ - [Python API](docs/python-api.md) — scripting PromptMC
137
+ - [Templates](docs/cli-reference.md#templates) · [Telemetry](docs/telemetry-and-audit.md)
138
+ - [Examples](src/promptmc/examples/uo2_criticality/README.md) · [MCP example](examples/mcp/README.md)
139
+ - [Roadmap](ROADMAP.md) · [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md)
140
+
141
+ ## About
142
+
143
+ I studied nuclear engineering at MIT over 20 years ago, running MCNP 4 for my senior thesis. Though I left during my senior year, I eventually went back to university to get a degree in Computer Science, and I have spent the last 11 years working as a software engineer and site reliability engineer at a major FAANG cloud provider.
144
+
145
+ PromptMC bridges those two worlds. It is also, for me, an exploration of using agentic programming to build software for fun but still holding professional production principles and standards.
146
+
147
+ ## Contributions and Support
148
+
149
+ I welcome contributions! Please ensure all checks pass (`pytest`, `ruff check`, `mypy src/`) before opening a PR.
150
+ - **License:** MIT
151
+ - **Documentation:** [GitHub Repository](https://github.com/rjonace/promptmc)
152
+ - **Issues and Discussions:** [GitHub Issues](https://github.com/rjonace/promptmc/issues)
153
+ - **Roadmap:** [ROADMAP.md](ROADMAP.md) for planned features and scope.
154
+
@@ -0,0 +1,115 @@
1
+ <p align="center">
2
+ <img src="docs/assets/logo.svg" alt="PromptMC logo" width="140">
3
+ </p>
4
+
5
+ <h1 align="center">PromptMC</h1>
6
+
7
+ <p align="center">
8
+ <img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python">
9
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
10
+ <img src="https://img.shields.io/github/actions/workflow/status/rjonace/promptmc/ci.yml" alt="CI">
11
+ </p>
12
+
13
+ [OpenMC](https://docs.openmc.org/en/stable/) is powerful but can be painful to use: you hand-write XML, manage batch runs, and read results out of [HDF5](https://www.hdfgroup.org/solutions/hdf5/). It would be great if we could safely use AI to reduce that friction.
14
+
15
+ PromptMC does that by providing infrastructure and tooling that allows both AI LLM assistants and humans to interact with OpenMC through typed, schema-driven workflows.
16
+
17
+ It works like a grammar checker between an AI LLM assistant and OpenMC: your AI proposes a configuration, PromptMC validates XML structure and supported schema constraints before the simulator runs, and catches malformed inputs early.
18
+
19
+ Because AI [hallucination](https://link.springer.com/article/10.1007/s10676-024-09775-5) is a valid concern in reactor physics, the system is designed with deterministic blast walls. Every configuration (from a human, the deterministic local planner, or AI) is validated against the same typed [Pydantic](https://docs.pydantic.dev/) schemas before it reaches the simulator.
20
+
21
+ ## What you can do
22
+
23
+ Most planning and schema-validation workflows work without OpenMC installed; execution, geometry-debug checks, and 2D plot rendering require OpenMC.
24
+
25
+ **Without OpenMC installed:**
26
+ - Describe a simulation in plain English → a validated plan and `settings.xml` (the default planner uses no generative AI)
27
+ - Validate XML structure and PromptMC's supported OpenMC schemas
28
+ - Drive planning and schema validation from an AI client via the MCP server
29
+
30
+ **With OpenMC installed:**
31
+ - Run simulations (subprocess or Python API)
32
+ - Run geometry-debug overlap checks and generate 2D slice plots inside your AI chat client
33
+ - Parse [statepoint and tally](https://docs.openmc.org/en/stable/usersguide/tallies.html) outputs without touching HDF5
34
+
35
+ ## Installation
36
+
37
+ **Prerequisites:**
38
+ - Python 3.10 or higher
39
+ - Pip
40
+
41
+ **PromptMC** can be installed using pip. Use the following commands to install PromptMC:
42
+
43
+ ```bash
44
+ pip install promptmc # core (includes CLI, MCP server, and Gemini planner)
45
+ pip install promptmc[telemetry] # + OpenTelemetry tracing
46
+ ```
47
+
48
+ **OpenMC** (required for simulation execution, geometry-debug checks, and plot rendering) can be installed via Conda, Spack, Docker, or build from source per [docs.openmc.org](https://docs.openmc.org/en/stable/quickinstall.html). Planning and XML/schema validation work without it.
49
+
50
+ **[Cross-section data](https://www.nndc.bnl.gov/endf/)** (for running simulations):
51
+
52
+ ```bash
53
+ pip install openmc-data-downloader
54
+ openmc_data_downloader -l TENDL-2019 -i U235 U238 O16 H1 -d cross_sections
55
+ export OPENMC_CROSS_SECTIONS=$(pwd)/cross_sections/cross_sections.xml
56
+ ```
57
+
58
+ See [installation](docs/installation.md) for more details.
59
+
60
+ ## MCP server
61
+
62
+ PromptMC exposes a [Model Context Protocol](https://modelcontextprotocol.io) server so AI assistants can run OpenMC workflows natively — validation, plotting, execution, and result parsing from inside your LLM chat client, such as Claude Desktop, Cursor, and Google Antigravity.
63
+
64
+ **[Tools](https://modelcontextprotocol.io/docs/concepts/tools):** `openmc_validate`, `openmc_schema_check`, `openmc_template`, `openmc_list_templates`, `openmc_run`, `openmc_analyze`, `openmc_plot` (2D slice, returned to the chat client), `openmc_geometry_debug`, `openmc_check_installation`, `openmc_check_cross_sections`.
65
+
66
+ [Resources](https://modelcontextprotocol.io/docs/concepts/resources) expose the configured cross-sections path, the session's tool-call history, and the bundled examples.
67
+
68
+ **Setup:** see the [MCP server configuration guide](docs/mcp.md) for per-client steps (Claude Desktop/Code, Cursor, Google Antigravity, VS Code).
69
+
70
+ ## CLI
71
+
72
+ By default, `plan` uses a deterministic local planner, needing no API key, no network, no generative AI. The optional `--llm` flag calls Google Gemini (set GEMINI_API_KEY), which can interpret more open-ended natural-language requests. Customize the model name with GEMINI_MODEL (defaults to gemini-3.5-flash).
73
+
74
+ ```bash
75
+ promptmc plan "concrete shielding calculation with 1 million particles"
76
+ promptmc plan "pin cell criticality with 50k particles" --write
77
+ promptmc template criticality --particles 10000 # generate settings.xml
78
+ promptmc validate input.xml --schema
79
+ promptmc run input.xml --threads 4 # needs OpenMC
80
+ promptmc batch batch_spec.yaml --parallel threads --workers 4
81
+ promptmc analyze ./output --json results.json
82
+ promptmc info # environment status
83
+ ```
84
+
85
+ Full options in the [CLI reference](docs/cli-reference.md).
86
+
87
+ ## Safety
88
+
89
+ PromptMC is an engineering-assist tool that keeps a human in the loop. It is not a substitute for professional engineering judgment, independent verification and validation, or regulatory review, and is not for safety, licensing, or other regulated decisions. Reproducing a published benchmark is not qualification for safety analysis. Provided as-is (see [LICENSE](LICENSE)).
90
+
91
+ The goal is not autonomous reactor design; the goal is safer, faster OpenMC iteration.
92
+
93
+ ## Documentation
94
+
95
+ - [Installation](docs/installation.md) — setup paths for PromptMC, OpenMC, and nuclear data
96
+ - [MCP server](docs/mcp.md) — connecting AI assistants (Claude Desktop/Code, Cursor, Antigravity, VS Code)
97
+ - [CLI reference](docs/cli-reference.md) — commands, flags, environment variables
98
+ - [Python API](docs/python-api.md) — scripting PromptMC
99
+ - [Templates](docs/cli-reference.md#templates) · [Telemetry](docs/telemetry-and-audit.md)
100
+ - [Examples](src/promptmc/examples/uo2_criticality/README.md) · [MCP example](examples/mcp/README.md)
101
+ - [Roadmap](ROADMAP.md) · [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md)
102
+
103
+ ## About
104
+
105
+ I studied nuclear engineering at MIT over 20 years ago, running MCNP 4 for my senior thesis. Though I left during my senior year, I eventually went back to university to get a degree in Computer Science, and I have spent the last 11 years working as a software engineer and site reliability engineer at a major FAANG cloud provider.
106
+
107
+ PromptMC bridges those two worlds. It is also, for me, an exploration of using agentic programming to build software for fun but still holding professional production principles and standards.
108
+
109
+ ## Contributions and Support
110
+
111
+ I welcome contributions! Please ensure all checks pass (`pytest`, `ruff check`, `mypy src/`) before opening a PR.
112
+ - **License:** MIT
113
+ - **Documentation:** [GitHub Repository](https://github.com/rjonace/promptmc)
114
+ - **Issues and Discussions:** [GitHub Issues](https://github.com/rjonace/promptmc/issues)
115
+ - **Roadmap:** [ROADMAP.md](ROADMAP.md) for planned features and scope.
@@ -0,0 +1,14 @@
1
+ name: parameter-sweep-example
2
+ description: Example batch specification for parameter sweep simulations
3
+ base_input: ./input.xml
4
+ output_root: ./batch_results
5
+ threads_per_job: 2
6
+ parameter_sweeps:
7
+ - particles: 1000
8
+ batches: 50
9
+ - particles: 5000
10
+ batches: 50
11
+ - particles: 10000
12
+ batches: 100
13
+ - particles: 50000
14
+ batches: 200
@@ -0,0 +1,30 @@
1
+ <?xml version="1.0"?>
2
+ <settings>
3
+ <!-- Run control -->
4
+ <run_mode>eigenvalue</run_mode>
5
+ <batches>100</batches>
6
+ <inactive>10</inactive>
7
+ <particles>10000</particles>
8
+
9
+ <!-- Energy mode -->
10
+ <energy_mode>
11
+ <type>MG</type>
12
+ <method>CE</method>
13
+ </energy_mode>
14
+
15
+ <!-- Source definition -->
16
+ <source>
17
+ <type>point</type>
18
+ <space>
19
+ <type>point</type>
20
+ <parameters>0 0 0</parameters>
21
+ </space>
22
+ </source>
23
+
24
+ <!-- Output settings -->
25
+ <output>
26
+ <path>results</path>
27
+ <tallies>true</tallies>
28
+ <summary>true</summary>
29
+ </output>
30
+ </settings>
@@ -0,0 +1,41 @@
1
+ # MCP Demo: UO2 Criticality Benchmark
2
+
3
+ This demonstrates running the bundled UO2 example through PromptMC's [MCP](https://modelcontextprotocol.io) server.
4
+
5
+ ## Connect
6
+
7
+ Configure an MCP-capable assistant (Claude Desktop, Claude Code, Cursor,
8
+ Google Antigravity, VS Code with Copilot) using the per-client
9
+ setup in the [MCP server configuration guide](../../docs/mcp.md). The client
10
+ launches the `promptmc-mcp` server for you over stdio — you don't run it by
11
+ hand. Set `OPENMC_CROSS_SECTIONS` in that config so this example can execute
12
+ and plot.
13
+
14
+ To smoke-test the command outside a client:
15
+
16
+ ```bash
17
+ export OPENMC_CROSS_SECTIONS=/path/to/cross_sections.xml
18
+ promptmc-mcp # serves MCP over stdio; Ctrl-C to exit
19
+ ```
20
+
21
+ ## Driving the demo
22
+
23
+ You don't type the tool calls below — you prompt the assistant in plain English
24
+ and it picks the tools. For example:
25
+
26
+ > Validate and run the bundled UO2 criticality example with 4 threads, then
27
+ > show me k-effective and an xy slice of the geometry.
28
+
29
+ The assistant would carry that out with roughly these calls:
30
+
31
+ 1. **Check installation**: `openmc_check_installation` → confirms OpenMC is available
32
+ 2. **Check cross sections**: `openmc_check_cross_sections` → confirms `OPENMC_CROSS_SECTIONS` is set
33
+ 3. **Validate inputs**: `openmc_validate { "input_path": "examples/uo2_criticality" }`
34
+ 4. **Schema check**: `openmc_schema_check { "input_path": "examples/uo2_criticality" }`
35
+ 5. **Run simulation**: `openmc_run { "input_path": "examples/uo2_criticality", "threads": 4 }`
36
+ 6. **Analyze results**: `openmc_analyze { "output_path": "examples/uo2_criticality" }`
37
+ 7. **Plot geometry**: `openmc_plot { "geometry_xml_path": "examples/uo2_criticality", "basis": "xy" }`
38
+
39
+ The `promptmc://history` resource records each tool call made during the
40
+ session, and `promptmc://examples/uo2_criticality` lists the files in the
41
+ bundled example.
@@ -0,0 +1,164 @@
1
+ [tool.poetry]
2
+ name = "promptmc"
3
+ version = "0.3.0"
4
+ description = "AI Assistant and CLI for OpenMC simulation workflows"
5
+ authors = ["PromptMC Contributors"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ repository = "https://github.com/rjonace/promptmc"
9
+ keywords = ["openmc", "monte-carlo", "nuclear", "simulation", "mcp"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Science/Research",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3.10",
15
+ "Programming Language :: Python :: 3.11",
16
+ "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Scientific/Engineering :: Physics",
19
+ ]
20
+ packages = [{include = "promptmc", from = "src"}]
21
+ include = [{ path = "examples", format = ["sdist"] }]
22
+
23
+ [tool.poetry.urls]
24
+ "Changelog" = "https://github.com/rjonace/promptmc/blob/main/CHANGELOG.md"
25
+ "Issues" = "https://github.com/rjonace/promptmc/issues"
26
+
27
+ [tool.poetry.dependencies]
28
+ python = "^3.10"
29
+ typer = {extras = ["all"], version = ">=0.12.0"}
30
+ rich = "^13.7.0"
31
+ pydantic = "^2.8.0"
32
+ h5py = "^3.11.0"
33
+ pyyaml = "^6.0.0"
34
+ psutil = "^6.0.0"
35
+ defusedxml = "^0.7.1"
36
+ opentelemetry-api = {version = "^1.26.0", optional = true}
37
+ opentelemetry-sdk = {version = "^1.26.0", optional = true}
38
+ opentelemetry-exporter-otlp = {version = "^1.26.0", optional = true}
39
+ tenacity = "^9.1.4"
40
+ mcp = ">=1.0.0"
41
+ google-genai = ">=0.1.0"
42
+
43
+ [tool.poetry.extras]
44
+ telemetry = ["opentelemetry-api", "opentelemetry-sdk", "opentelemetry-exporter-otlp"]
45
+
46
+ [tool.poetry.group.dev.dependencies]
47
+ pytest = "^8.2.0"
48
+ pytest-cov = "^5.0.0"
49
+ mypy = "^1.10.0"
50
+ ruff = "^0.5.0"
51
+ pre-commit = "^3.7.0"
52
+ bandit = "^1.7.9"
53
+ types-PyYAML = "^6.0.0"
54
+ types-psutil = "^6.0.0"
55
+ types-defusedxml = "^0.7.0"
56
+ hypothesis = "^6.100.0"
57
+
58
+ [tool.poetry.scripts]
59
+ promptmc = "promptmc.cli:app"
60
+ promptmc-mcp = "promptmc.mcp.server:main"
61
+
62
+ [build-system]
63
+ requires = ["poetry-core"]
64
+ build-backend = "poetry.core.masonry.api"
65
+
66
+ [tool.ruff]
67
+ target-version = "py310"
68
+ line-length = 80
69
+
70
+ [tool.ruff.lint]
71
+ select = [
72
+ "E", # pycodestyle errors
73
+ "W", # pycodestyle warnings
74
+ "F", # pyflakes
75
+ "I", # isort
76
+ "B", # flake8-bugbear
77
+ "C4", # flake8-comprehensions
78
+ "UP", # pyupgrade
79
+ "ARG", # flake8-unused-arguments
80
+ "SIM", # flake8-simplify
81
+ "D", # pydocstyle (Google convention)
82
+ ]
83
+ ignore = [
84
+ "B008", # Function calls in argument defaults (Typer pattern)
85
+ "D100", # Missing docstring in public module (handled per-file)
86
+ "D104", # Missing docstring in public package
87
+ "D107", # Missing docstring in __init__ (use class docstring)
88
+ "D203", # Conflicts with D211 (no-blank-line-before-class)
89
+ "D213", # Conflicts with D212 (multi-line-summary-first-line)
90
+ "E501", # Line too long (formatter handles code; strings are exempt per Google style)
91
+ ]
92
+
93
+ [tool.ruff.lint.pydocstyle]
94
+ convention = "google"
95
+
96
+ [tool.ruff.lint.per-file-ignores]
97
+ "src/promptmc/cli.py" = ["ARG001", "D103", "E501"]
98
+ "src/promptmc/templates.py" = ["ARG002"]
99
+ "src/promptmc/openmc_integration.py" = ["ARG002"]
100
+ "tests/*" = ["ARG001", "ARG002", "D100", "D101", "D102", "D103"]
101
+
102
+ [tool.ruff.format]
103
+ quote-style = "double"
104
+ indent-style = "space"
105
+ skip-magic-trailing-comma = false
106
+ line-ending = "auto"
107
+
108
+ [tool.mypy]
109
+ python_version = "3.10"
110
+ warn_return_any = true
111
+ warn_unused_configs = true
112
+ disallow_untyped_defs = true
113
+ disallow_incomplete_defs = true
114
+ check_untyped_defs = true
115
+ no_implicit_optional = true
116
+ warn_redundant_casts = true
117
+ warn_unused_ignores = true
118
+ warn_no_return = true
119
+ strict_equality = true
120
+
121
+ [[tool.mypy.overrides]]
122
+ module = [
123
+ "openmc.*",
124
+ "h5py.*",
125
+ "opentelemetry.*",
126
+ "mcp.*",
127
+ ]
128
+ ignore_missing_imports = true
129
+
130
+ [[tool.mypy.overrides]]
131
+ module = "promptmc.telemetry"
132
+ warn_unused_ignores = false
133
+
134
+ [tool.pytest.ini_options]
135
+ testpaths = ["tests"]
136
+ python_files = ["test_*.py"]
137
+ python_classes = ["Test*"]
138
+ python_functions = ["test_*"]
139
+ addopts = [
140
+ "--cov=promptmc",
141
+ "--cov-report=term-missing",
142
+ "--cov-report=html",
143
+ "--strict-markers",
144
+ ]
145
+ markers = [
146
+ "integration: MCP integration tests",
147
+ "requires_openmc: Tests that require openmc to be importable/installed",
148
+ "requires_openmc_data: Tests that require openmc with cross-section data installed",
149
+ ]
150
+
151
+ [tool.coverage.run]
152
+ source = ["src"]
153
+ omit = ["*/tests/*", "*/test_*.py"]
154
+
155
+ [tool.coverage.report]
156
+ exclude_lines = [
157
+ "pragma: no cover",
158
+ "def __repr__",
159
+ "raise AssertionError",
160
+ "raise NotImplementedError",
161
+ "if __name__ == .__main__.:",
162
+ "if TYPE_CHECKING:",
163
+ "@abstractmethod",
164
+ ]
@@ -0,0 +1,22 @@
1
+ """PromptMC: AI Assistant and CLI for OpenMC workflows."""
2
+
3
+ from promptmc.batch import BatchRunner, ParallelConfig, ParallelMode
4
+ from promptmc.openmc_integration import (
5
+ ExecutionMode,
6
+ OpenMCInstaller,
7
+ OpenMCRunner,
8
+ OpenMCValidator,
9
+ )
10
+
11
+ __version__ = "0.3.0"
12
+
13
+ __all__ = [
14
+ "__version__",
15
+ "BatchRunner",
16
+ "ExecutionMode",
17
+ "OpenMCInstaller",
18
+ "OpenMCRunner",
19
+ "OpenMCValidator",
20
+ "ParallelConfig",
21
+ "ParallelMode",
22
+ ]
@@ -0,0 +1,5 @@
1
+ """Common type aliases for PromptMC."""
2
+
3
+ from pathlib import Path
4
+
5
+ PathLike = str | Path