cfast-mcp 0.1.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.
- cfast_mcp-0.1.0/.github/workflows/python-publish.yml +61 -0
- cfast_mcp-0.1.0/.github/workflows/test.yml +166 -0
- cfast_mcp-0.1.0/.github/workflows/typing.yml +27 -0
- cfast_mcp-0.1.0/.gitignore +223 -0
- cfast_mcp-0.1.0/.pre-commit-config.yaml +8 -0
- cfast_mcp-0.1.0/CLAUDE.md +116 -0
- cfast_mcp-0.1.0/LICENSE +21 -0
- cfast_mcp-0.1.0/Makefile +57 -0
- cfast_mcp-0.1.0/PKG-INFO +116 -0
- cfast_mcp-0.1.0/README.md +58 -0
- cfast_mcp-0.1.0/main.py +14 -0
- cfast_mcp-0.1.0/pyproject.toml +147 -0
- cfast_mcp-0.1.0/src/cfast_mcp/__init__.py +6 -0
- cfast_mcp-0.1.0/src/cfast_mcp/errors.py +63 -0
- cfast_mcp-0.1.0/src/cfast_mcp/registry.py +73 -0
- cfast_mcp-0.1.0/src/cfast_mcp/serialization.py +76 -0
- cfast_mcp-0.1.0/src/cfast_mcp/server.py +25 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/__init__.py +36 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/ceiling_floor_vents.py +157 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/compartments.py +217 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/devices.py +229 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/fires.py +212 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/materials.py +144 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/mechanical_vents.py +203 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/model.py +268 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/simulation.py +77 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/surface_connections.py +130 -0
- cfast_mcp-0.1.0/src/cfast_mcp/tools/wall_vents.py +181 -0
- cfast_mcp-0.1.0/tests/conftest.py +58 -0
- cfast_mcp-0.1.0/tests/test_ceiling_floor_vents.py +41 -0
- cfast_mcp-0.1.0/tests/test_compartments.py +56 -0
- cfast_mcp-0.1.0/tests/test_devices.py +78 -0
- cfast_mcp-0.1.0/tests/test_errors.py +59 -0
- cfast_mcp-0.1.0/tests/test_fires.py +85 -0
- cfast_mcp-0.1.0/tests/test_materials.py +63 -0
- cfast_mcp-0.1.0/tests/test_mechanical_vents.py +35 -0
- cfast_mcp-0.1.0/tests/test_model.py +55 -0
- cfast_mcp-0.1.0/tests/test_registry.py +63 -0
- cfast_mcp-0.1.0/tests/test_run.py +65 -0
- cfast_mcp-0.1.0/tests/test_serialization.py +62 -0
- cfast_mcp-0.1.0/tests/test_simulation.py +24 -0
- cfast_mcp-0.1.0/tests/test_surface_connections.py +56 -0
- cfast_mcp-0.1.0/tests/test_wall_vents.py +90 -0
- cfast_mcp-0.1.0/uv.lock +1885 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v6
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-python@v6
|
|
26
|
+
with:
|
|
27
|
+
python-version: "3.x"
|
|
28
|
+
|
|
29
|
+
- name: Build release distributions
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install build
|
|
32
|
+
python -m build
|
|
33
|
+
|
|
34
|
+
- name: Upload distributions
|
|
35
|
+
uses: actions/upload-artifact@v7
|
|
36
|
+
with:
|
|
37
|
+
name: release-dists
|
|
38
|
+
path: dist/
|
|
39
|
+
|
|
40
|
+
pypi-publish:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
needs:
|
|
43
|
+
- release-build
|
|
44
|
+
permissions:
|
|
45
|
+
id-token: write
|
|
46
|
+
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
url: https://pypi.org/project/cfast-mcp/
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- name: Retrieve release distributions
|
|
53
|
+
uses: actions/download-artifact@v8
|
|
54
|
+
with:
|
|
55
|
+
name: release-dists
|
|
56
|
+
path: dist/
|
|
57
|
+
|
|
58
|
+
- name: Publish release distributions to PyPI
|
|
59
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
60
|
+
with:
|
|
61
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# This workflow runs the test suite on Linux and Windows with Python version 3.10 to version 3.14.
|
|
2
|
+
# and CFAST 7.7.7.
|
|
3
|
+
#
|
|
4
|
+
# Strategy:
|
|
5
|
+
# - Linux: compile CFAST 7.7.7 from source with gcc
|
|
6
|
+
# - Windows: extract the pre-built binary from the official CFAST 7.7.7 installer
|
|
7
|
+
#
|
|
8
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
9
|
+
|
|
10
|
+
name: Test
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
push:
|
|
15
|
+
branches: [ "main" ]
|
|
16
|
+
paths:
|
|
17
|
+
- 'src/**'
|
|
18
|
+
- 'tests/**'
|
|
19
|
+
- 'pyproject.toml'
|
|
20
|
+
- 'uv.lock'
|
|
21
|
+
- '.github/workflows/test.yml'
|
|
22
|
+
|
|
23
|
+
pull_request:
|
|
24
|
+
branches: [ "main" ]
|
|
25
|
+
paths:
|
|
26
|
+
- 'src/**'
|
|
27
|
+
- 'tests/**'
|
|
28
|
+
- 'pyproject.toml'
|
|
29
|
+
- 'uv.lock'
|
|
30
|
+
- '.github/workflows/test.yml'
|
|
31
|
+
|
|
32
|
+
env:
|
|
33
|
+
CFAST_VERSION: "7.7.7"
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
test:
|
|
37
|
+
runs-on: ${{ matrix.os }}
|
|
38
|
+
strategy:
|
|
39
|
+
fail-fast: false
|
|
40
|
+
matrix:
|
|
41
|
+
os: [ubuntu-latest, windows-latest]
|
|
42
|
+
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.10", "3.14"]') || fromJSON('["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
|
|
43
|
+
include:
|
|
44
|
+
- os: ubuntu-latest
|
|
45
|
+
cfast-tag: "CFAST-7.7.7"
|
|
46
|
+
build-dir: gnu_linux
|
|
47
|
+
build-script: make_cfast.sh
|
|
48
|
+
binary-name: cfast7_linux
|
|
49
|
+
- os: windows-latest
|
|
50
|
+
installer-url: "https://github.com/firemodels/cfast/releases/download/CFAST-7.7.7/CFAST-7.7.7_SMV-6.11.1.exe"
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v6
|
|
54
|
+
|
|
55
|
+
- name: Install uv
|
|
56
|
+
uses: astral-sh/setup-uv@v7
|
|
57
|
+
with:
|
|
58
|
+
enable-cache: true
|
|
59
|
+
cache-dependency-glob: "uv.lock"
|
|
60
|
+
|
|
61
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
62
|
+
run: uv python install ${{ matrix.python-version }}
|
|
63
|
+
|
|
64
|
+
- name: Install python dependencies
|
|
65
|
+
run: uv sync --extra dev
|
|
66
|
+
|
|
67
|
+
- name: Cache CFAST binary (Linux)
|
|
68
|
+
if: runner.os == 'Linux'
|
|
69
|
+
id: cache-cfast-linux
|
|
70
|
+
uses: actions/cache@v5
|
|
71
|
+
with:
|
|
72
|
+
path: ~/cfast-cache/cfast-${{ env.CFAST_VERSION }}-linux-gcc
|
|
73
|
+
key: cfast-${{ env.CFAST_VERSION }}-linux-gcc-${{ hashFiles('.github/workflows/test.yml') }}
|
|
74
|
+
|
|
75
|
+
- name: Install gfortran
|
|
76
|
+
if: runner.os == 'Linux' && steps.cache-cfast-linux.outputs.cache-hit != 'true'
|
|
77
|
+
uses: fortran-lang/setup-fortran@v1
|
|
78
|
+
with:
|
|
79
|
+
compiler: gcc
|
|
80
|
+
|
|
81
|
+
- name: Build CFAST from source (Linux)
|
|
82
|
+
if: runner.os == 'Linux' && steps.cache-cfast-linux.outputs.cache-hit != 'true'
|
|
83
|
+
shell: bash
|
|
84
|
+
run: |
|
|
85
|
+
git clone --depth 1 --branch ${{ matrix.cfast-tag }} https://github.com/firemodels/cfast.git cfast-src
|
|
86
|
+
cd cfast-src/Build/CFAST/${{ matrix.build-dir }}
|
|
87
|
+
chmod +x ${{ matrix.build-script }}
|
|
88
|
+
./${{ matrix.build-script }}
|
|
89
|
+
mkdir -p ~/cfast-cache
|
|
90
|
+
cp ${{ matrix.binary-name }} ~/cfast-cache/cfast-${{ env.CFAST_VERSION }}-linux-gcc
|
|
91
|
+
chmod +x ~/cfast-cache/cfast-${{ env.CFAST_VERSION }}-linux-gcc
|
|
92
|
+
|
|
93
|
+
- name: Install CFAST to system path (Linux)
|
|
94
|
+
if: runner.os == 'Linux'
|
|
95
|
+
run: |
|
|
96
|
+
sudo cp ~/cfast-cache/cfast-${{ env.CFAST_VERSION }}-linux-gcc /usr/bin/cfast
|
|
97
|
+
sudo chmod +x /usr/bin/cfast
|
|
98
|
+
|
|
99
|
+
- name: Cache CFAST binary (Windows)
|
|
100
|
+
if: runner.os == 'Windows'
|
|
101
|
+
id: cache-cfast-windows
|
|
102
|
+
uses: actions/cache@v5
|
|
103
|
+
with:
|
|
104
|
+
path: ~/cfast-cache/cfast-${{ env.CFAST_VERSION }}-windows
|
|
105
|
+
key: cfast-installer-${{ env.CFAST_VERSION }}-windows-${{ hashFiles('.github/workflows/test.yml') }}
|
|
106
|
+
|
|
107
|
+
- name: Download and extract CFAST installer (Windows)
|
|
108
|
+
if: runner.os == 'Windows' && steps.cache-cfast-windows.outputs.cache-hit != 'true'
|
|
109
|
+
shell: pwsh
|
|
110
|
+
run: |
|
|
111
|
+
# Download the installer
|
|
112
|
+
$installerUrl = "${{ matrix.installer-url }}"
|
|
113
|
+
$installerPath = "$env:TEMP\cfast-installer.exe"
|
|
114
|
+
Write-Host "Downloading CFAST installer from $installerUrl"
|
|
115
|
+
Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath
|
|
116
|
+
|
|
117
|
+
# Extract with 7-Zip (pre-installed on GitHub runners)
|
|
118
|
+
$extractDir = "$env:TEMP\cfast-extracted"
|
|
119
|
+
7z x $installerPath -o"$extractDir" -y
|
|
120
|
+
|
|
121
|
+
# Display extracted contents for debugging
|
|
122
|
+
Write-Host "--- Extracted contents ---"
|
|
123
|
+
Get-ChildItem -Recurse $extractDir | ForEach-Object { Write-Host $_.FullName }
|
|
124
|
+
Write-Host "--- End contents ---"
|
|
125
|
+
|
|
126
|
+
# Find the CFAST executable (exclude smokeview, uninstaller, cdata)
|
|
127
|
+
$cfastExe = Get-ChildItem -Recurse -Path $extractDir -Filter "cfast*.exe" |
|
|
128
|
+
Where-Object { $_.Name -notmatch "uninstall|setup|smokeview|smv|cdata" } |
|
|
129
|
+
Select-Object -First 1
|
|
130
|
+
|
|
131
|
+
if (-not $cfastExe) {
|
|
132
|
+
Write-Error "Could not find cfast executable in extracted installer"
|
|
133
|
+
exit 1
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
Write-Host "Found CFAST executable: $($cfastExe.FullName)"
|
|
137
|
+
|
|
138
|
+
# Copy to cache
|
|
139
|
+
$cacheDir = "$env:USERPROFILE\cfast-cache"
|
|
140
|
+
if (-not (Test-Path $cacheDir)) { New-Item -ItemType Directory -Path $cacheDir }
|
|
141
|
+
Copy-Item $cfastExe.FullName "$cacheDir\cfast-${{ env.CFAST_VERSION }}-windows"
|
|
142
|
+
|
|
143
|
+
- name: Install CFAST to system path (Windows)
|
|
144
|
+
if: runner.os == 'Windows'
|
|
145
|
+
run: |
|
|
146
|
+
copy "$env:USERPROFILE\cfast-cache\cfast-${{ env.CFAST_VERSION }}-windows" "C:\Windows\System32\cfast.exe"
|
|
147
|
+
|
|
148
|
+
- name: Verify CFAST installation
|
|
149
|
+
shell: bash
|
|
150
|
+
run: |
|
|
151
|
+
if [ "${{ runner.os }}" = "Windows" ]; then
|
|
152
|
+
where cfast
|
|
153
|
+
else
|
|
154
|
+
which cfast
|
|
155
|
+
fi
|
|
156
|
+
cfast
|
|
157
|
+
|
|
158
|
+
- name: Run tests
|
|
159
|
+
run: uv run pytest --cov=src/cfast_mcp --cov-report=xml --cov-report=term-missing
|
|
160
|
+
|
|
161
|
+
- name: Upload results to Codecov
|
|
162
|
+
uses: codecov/codecov-action@v6
|
|
163
|
+
with:
|
|
164
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
165
|
+
flags: cfast-${{ env.CFAST_VERSION }}-py3.14-${{ matrix.os }}
|
|
166
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Typing
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v6
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v7
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
run: uv python install 3.14
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: uv sync --extra dev
|
|
25
|
+
|
|
26
|
+
- name: Run mypy type check
|
|
27
|
+
run: uv run mypy src/
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
*.lcov
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
.python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
# Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
# poetry.lock
|
|
110
|
+
# poetry.toml
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
115
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
116
|
+
# pdm.lock
|
|
117
|
+
# pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# pixi
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
123
|
+
# pixi.lock
|
|
124
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
125
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
126
|
+
.pixi/*
|
|
127
|
+
!.pixi/config.toml
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule*
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# mkdocs documentation
|
|
170
|
+
/site
|
|
171
|
+
|
|
172
|
+
# mypy
|
|
173
|
+
.mypy_cache/
|
|
174
|
+
.dmypy.json
|
|
175
|
+
dmypy.json
|
|
176
|
+
|
|
177
|
+
# Pyre type checker
|
|
178
|
+
.pyre/
|
|
179
|
+
|
|
180
|
+
# pytype static type analyzer
|
|
181
|
+
.pytype/
|
|
182
|
+
|
|
183
|
+
# Cython debug symbols
|
|
184
|
+
cython_debug/
|
|
185
|
+
|
|
186
|
+
# PyCharm
|
|
187
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
188
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
190
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
191
|
+
# .idea/
|
|
192
|
+
|
|
193
|
+
# Abstra
|
|
194
|
+
# Abstra is an AI-powered process automation framework.
|
|
195
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
196
|
+
# Learn more at https://abstra.io/docs
|
|
197
|
+
.abstra/
|
|
198
|
+
|
|
199
|
+
# Visual Studio Code
|
|
200
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
201
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
202
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
203
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
204
|
+
.vscode/
|
|
205
|
+
# Temporary file for partial code execution
|
|
206
|
+
tempCodeRunnerFile.py
|
|
207
|
+
|
|
208
|
+
# Claude Code local settings
|
|
209
|
+
.claude/
|
|
210
|
+
|
|
211
|
+
# Ruff stuff:
|
|
212
|
+
.ruff_cache/
|
|
213
|
+
|
|
214
|
+
# PyPI configuration file
|
|
215
|
+
.pypirc
|
|
216
|
+
|
|
217
|
+
# Marimo
|
|
218
|
+
marimo/_static/
|
|
219
|
+
marimo/_lsp/
|
|
220
|
+
__marimo__/
|
|
221
|
+
|
|
222
|
+
# Streamlit
|
|
223
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## What this is
|
|
6
|
+
|
|
7
|
+
An MCP server built around [pycfast](https://github.com/bewygs/pycfast), a Python interface for CFAST (Consolidated Fire and Smoke Transport, NIST). It exposes tools that let an LLM build a CFAST model step by step, inspect it, run it, and read results.
|
|
8
|
+
|
|
9
|
+
The pycfast source is available locally at `/home/bwygas/pycfast`. Read it directly to check signatures, defaults, and validation logic.
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv sync --extra dev # Install package + dev dependencies (Python 3.10+)
|
|
15
|
+
uv run cfast-mcp # Run the server (console script)
|
|
16
|
+
uv run main.py # Run the server (repo-root shim)
|
|
17
|
+
uv run mcp dev main.py # MCP inspector UI
|
|
18
|
+
uv run ruff check --fix . # Lint
|
|
19
|
+
uv run ruff format . # Format
|
|
20
|
+
uv run mypy src/ # Type-check
|
|
21
|
+
uv run pytest # Run all tests (CFAST-dependent ones skip if no binary)
|
|
22
|
+
uv run pytest -m local # Run only the tests requiring the CFAST binary
|
|
23
|
+
uv run pytest --cov # Coverage
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Run a single test:
|
|
27
|
+
```bash
|
|
28
|
+
uv run pytest tests/test_model.py::test_create_model -v
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Pre-commit hooks run `ruff check --fix` and `ruff format`.
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
main.py # repo-root shim — re-exports server.mcp for `mcp dev`
|
|
37
|
+
src/cfast_mcp/
|
|
38
|
+
server.py # builds FastMCP("cfast"), registers tools, main()
|
|
39
|
+
registry.py # ModelRegistry: model_id -> ModelEntry, in memory
|
|
40
|
+
errors.py # guard(): pycfast exceptions -> ToolError with hints
|
|
41
|
+
serialization.py # bounded DataFrame summaries (never full dumps)
|
|
42
|
+
tools/ # the 22 @mcp.tool() definitions, one module per component
|
|
43
|
+
__init__.py # register_tools(): wires all sub-registrars
|
|
44
|
+
model.py # create_model, inspect_model, run_model, get_results, get_model_files
|
|
45
|
+
simulation.py # update_simulation
|
|
46
|
+
materials.py # add_material, update_material
|
|
47
|
+
compartments.py # add_compartment, update_compartment
|
|
48
|
+
wall_vents.py # add_wall_vent, update_wall_vent
|
|
49
|
+
ceiling_floor_vents.py # add_ceiling_floor_vent, update_ceiling_floor_vent
|
|
50
|
+
mechanical_vents.py # add_mechanical_vent, update_mechanical_vent
|
|
51
|
+
fires.py # add_fire, update_fire
|
|
52
|
+
devices.py # add_device, update_device
|
|
53
|
+
surface_connections.py # add_surface_connection, update_surface_connection
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Tools
|
|
57
|
+
|
|
58
|
+
| Tool | Purpose |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `create_model` | New model + first compartment, returns `model_id` |
|
|
61
|
+
| `update_simulation` | Edit the simulation environment (title, time, ambient conditions); only provided params change |
|
|
62
|
+
| `add_material` | Add a `Material`; must exist before a compartment references it |
|
|
63
|
+
| `update_material` | Edit an existing `Material` by id (thermophysical props); only provided params change |
|
|
64
|
+
| `add_compartment` | Add a `Compartment`; must exist before vents/fires reference it |
|
|
65
|
+
| `update_compartment` | Edit an existing `Compartment` by id (e.g. attach surfaces to the first one); only provided params change |
|
|
66
|
+
| `add_wall_vent` | Add a `WallVent`; `comp_b` may be `"OUTSIDE"` |
|
|
67
|
+
| `update_wall_vent` | Edit an existing `WallVent` by id (geometry; connection via both `comp_a`+`comp_b`); only provided params change |
|
|
68
|
+
| `add_ceiling_floor_vent` | Add a `CeilingFloorVent` (vertical flow); `comp_bottom` may be `"OUTSIDE"` |
|
|
69
|
+
| `update_ceiling_floor_vent` | Edit an existing `CeilingFloorVent` by id (connection via both `comp_top`+`comp_bottom`); only provided params change |
|
|
70
|
+
| `add_mechanical_vent` | Add a `MechanicalVent` (fan); `comp_from`/`comp_to` may be `"OUTSIDE"` |
|
|
71
|
+
| `update_mechanical_vent` | Edit an existing `MechanicalVent` by id (connection via both `comp_from`+`comp_to`); only provided params change |
|
|
72
|
+
| `add_fire` | Add a `Fire`; `data_table` columns: TIME, HRR, HEIGHT, AREA, CO_YIELD, SOOT_YIELD, HCN_YIELD, HCL_YIELD, TRACE_YIELD |
|
|
73
|
+
| `update_fire` | Edit an existing `Fire` by instance id (HRR curve, chemistry, location, comp_id); only provided params change |
|
|
74
|
+
| `add_device` | Add a `Device` (target `PLATE`/`CYLINDER` or detector `HEAT_DETECTOR`/`SMOKE_DETECTOR`/`SPRINKLER`); pycfast validates per-type requirements |
|
|
75
|
+
| `update_device` | Edit an existing `Device` by id; only provided params change |
|
|
76
|
+
| `add_surface_connection` | Add a `SurfaceConnection` (`WALL`/`FLOOR` conductive heat transfer); no id |
|
|
77
|
+
| `update_surface_connection` | Edit a `SurfaceConnection` by 0-based index (it has no id); only provided params change |
|
|
78
|
+
| `inspect_model` | `model.summary()`, optionally the `.in` file |
|
|
79
|
+
| `run_model` | Run CFAST, store results in the registry |
|
|
80
|
+
| `get_results` | Bounded read of stored results (preview or per-column stats) |
|
|
81
|
+
| `get_model_files` | List the model's on-disk files and their working directory |
|
|
82
|
+
|
|
83
|
+
### Constraints inherited from pycfast
|
|
84
|
+
|
|
85
|
+
- The registry is stateful: a `model_id` (`m1`, `m2`, ...) is returned at creation and passed to every subsequent tool. It lives for the server process lifetime only.
|
|
86
|
+
- `CFASTModel` is immutable: `model.add(component)` returns a new model. Every `add_*` tool must reassign with `registry.set(model_id, ...)`.
|
|
87
|
+
- A model cannot be empty: `CFASTModel.__init__` requires at least one compartment and validates immediately, so `create_model` takes the first compartment's parameters directly.
|
|
88
|
+
- `add()` validates dependencies on every call. Required order: materials, then compartments, then wall vents and fires. `guard()` in `errors.py` turns the resulting `ValueError` into a message saying what to add first.
|
|
89
|
+
- `view_cfast_input_file()` requires a prior `save()`. `inspect_model(show_input_file=True)` saves first and passes `pretty_print=False` to avoid ANSI codes in MCP responses.
|
|
90
|
+
- Generated `.in`/output files live in a single per-process temp directory owned by the registry (`work_path`/`close`), created lazily on the first `save()`/`run()` and removed at interpreter exit. Each model's files are named `{model_id}.*`. `run_model` reports the directory and `get_model_files` lists it.
|
|
91
|
+
- `run()` returns `None` on silent CFAST failure (no exception); `run_model` raises `ToolError` in that case.
|
|
92
|
+
- pycfast has no component-removal methods; do not implement `remove_*` tools.
|
|
93
|
+
- Component ids must be unique within their type; duplicates raise `ValueError("Duplicate id ...")`.
|
|
94
|
+
- `face` for wall vents: `FRONT`, `REAR`, `LEFT`, `RIGHT` (not `BACK`).
|
|
95
|
+
- CFAST names (title, material names) should be alphanumeric; `sanitize_cfast_title_and_material` exists in pycfast if needed.
|
|
96
|
+
- `run()` resolves the CFAST binary via the `cfast_exe` parameter, the `CFAST` environment variable, then `cfast` on the PATH. `model.run(timeout=...)` takes seconds.
|
|
97
|
+
|
|
98
|
+
### Tests
|
|
99
|
+
|
|
100
|
+
- Unit tests (`test_errors.py`, `test_registry.py`, `test_serialization.py`): pure helpers, no MCP involved.
|
|
101
|
+
- Integration tests (one file per component, e.g. `test_model.py`, `test_compartments.py`, `test_fires.py`, ...): tools called in process through `FastMCP.call_tool` (see `tests/conftest.py`); no CFAST binary needed.
|
|
102
|
+
- End-to-end tests (`test_run.py`): real CFAST run; marked `@pytest.mark.local` and skipped automatically when the binary is unavailable.
|
|
103
|
+
|
|
104
|
+
Do not retest pycfast's own validation or the mcp library — only the tool layer (argument handling, registry updates, error translation).
|
|
105
|
+
|
|
106
|
+
## Standards
|
|
107
|
+
|
|
108
|
+
- Ruff: line-length 88, rules E, W, F, I, B, C4, UP, D (numpy docstrings)
|
|
109
|
+
- MyPy: strict options, Python 3.11 target
|
|
110
|
+
- Tool docstrings are the LLM interface: numpydoc, with units and defaults written as in pycfast ("Default units: m, default value: 0 m"). Reuse pycfast's own parameter descriptions where possible.
|
|
111
|
+
|
|
112
|
+
## Future scope
|
|
113
|
+
|
|
114
|
+
Deliberate omissions (kept simple, can be added uniformly later): the vent open/close-criterion machinery (`open_close_criterion`/`time`/`fraction`/`set_point`/`device_id`/`pre_fraction`/`post_fraction`) on all vent types; the DIAG-only device fields (`adiabatic`, `convection_coefficients`); multi-layer compartment materials. Known pycfast limitation: `update_material_params`'s selector parameter is named `material`, which shadows the descriptive-name field, so `update_material` cannot edit the name (only thermophysical props).
|
|
115
|
+
|
|
116
|
+
Still out of scope: `import_model_from_file`, `list_models`/`delete_model`, MCP Resources and Prompts.
|
cfast_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Benoît WYGAS.
|
|
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.
|
cfast_mcp-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.PHONY: help
|
|
2
|
+
|
|
3
|
+
help:
|
|
4
|
+
@echo "Usage:"
|
|
5
|
+
@echo " make install Install the package with dev dependencies"
|
|
6
|
+
@echo " make run Run the MCP server"
|
|
7
|
+
@echo " make test Run all tests (CFAST-dependent ones skip if no binary)"
|
|
8
|
+
@echo " make test-local Run only the tests requiring the CFAST binary"
|
|
9
|
+
@echo " make cov Run tests with coverage report"
|
|
10
|
+
@echo " make check Lint the code with ruff"
|
|
11
|
+
@echo " make format Format the code with ruff"
|
|
12
|
+
@echo " make type Type check the code with mypy"
|
|
13
|
+
@echo " make clean Clean build artifacts and cache"
|
|
14
|
+
@echo " make pre-commit Run pre-commit hooks"
|
|
15
|
+
@echo " make allci Run all CI steps (check, format, type, test)"
|
|
16
|
+
|
|
17
|
+
install:
|
|
18
|
+
uv sync --extra dev
|
|
19
|
+
|
|
20
|
+
run:
|
|
21
|
+
uv run cfast-mcp
|
|
22
|
+
|
|
23
|
+
test:
|
|
24
|
+
uv run pytest
|
|
25
|
+
|
|
26
|
+
test-local:
|
|
27
|
+
uv run pytest -m local
|
|
28
|
+
|
|
29
|
+
cov:
|
|
30
|
+
uv run pytest --cov
|
|
31
|
+
|
|
32
|
+
check:
|
|
33
|
+
uv run ruff check --fix .
|
|
34
|
+
|
|
35
|
+
format:
|
|
36
|
+
uv run ruff format .
|
|
37
|
+
|
|
38
|
+
type:
|
|
39
|
+
uv run mypy src/
|
|
40
|
+
|
|
41
|
+
clean:
|
|
42
|
+
rm -rf build/
|
|
43
|
+
rm -rf dist/
|
|
44
|
+
rm -rf *.egg-info/
|
|
45
|
+
rm -rf htmlcov/
|
|
46
|
+
rm -rf .coverage
|
|
47
|
+
rm -rf .pytest_cache/
|
|
48
|
+
rm -rf .ruff_cache/
|
|
49
|
+
rm -rf .mypy_cache/
|
|
50
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
51
|
+
find . -type f -name "*.pyc" -delete
|
|
52
|
+
|
|
53
|
+
pre-commit:
|
|
54
|
+
uv run pre-commit run --all-files
|
|
55
|
+
|
|
56
|
+
allci: check format type cov
|
|
57
|
+
@echo "All CI steps completed!"
|