Skip to main content

sim-tools-mcp

PyPI Python 3.12+ ci License: MIT

PyPI: pypi.org/project/sim-tools-mcp · Solver & surrogate: cooling-surrogate · Portfolio & proof: zuhalsicimkaradavut.com · Author: Zuhal Karadavut (Zuhal Sicim · @zuhalsicim)

Install and Connect (MCP)

pip install sim-tools-mcp

Add to Claude Desktop, Cursor, or any stdio MCP client:

{
  "mcpServers": {
    "sim-tools": {
      "command": "sim-tools-mcp"
    }
  }
}

An MCP server that lets an AI agent use my cooling-surrogate pipeline: run the finite-volume solver, ask the surrogate, sweep one input, check an answer against physics, and compare surrogate and solver. I built it to answer one question.

Can an agent use a simulation and its fast surrogate through tool calls without ever getting a surrogate number it should not trust? Here, yes. Of 694 calls the surrogate must not answer (invalid, malformed, outside the training box, or failing a physics check), it answered 0. With the int8 copy that the gate in cooling-surrogate blocked loaded on purpose, 71 of 200 answers failed a physics check, all 71 went to the solver, and no answer that fails a check reached the agent. A scripted agent found the warmest mould temperature for an 8 s cooling time in 7 tool calls and 475 ms, 0.032 K below the solver's own answer; the solver alone took 13 calls and 2.59 s. A surrogate call over stdio takes 2.30 ms at the median. The numbers are in results/, and CI checks on every push that the results section below matches them.

To reproduce: pip install -r requirements-dev.txt && pip install -e . --no-deps, then python -m bench.run_all and python -m bench.readme (CPU only; the whole measurement took 239 s on one AMD CPU under Windows 11). Details under Run it.

The question

Can an agent work with a simulation and its fast surrogate through tool calls, without ever getting a surrogate number it should not trust, and what does each call cost?

The surrogate in cooling-surrogate is much faster than the solver, but it is only valid inside the box of inputs it was trained on, and only when its answer passes the physics checks. A person reads that in the README. An agent only sees the tool list and what the calls return, so the tools have to carry those rules themselves.

What I measured

Every number in this section is written by python -m bench.readme from the files in results/, which python -m bench.run_all produces. CI fails if the two disagree.

I asked the scripted agent for the warmest mould temperature that keeps a 2 mm part at or under 8 s of cooling. It answered 44.00 °C after 7 tool calls. The solver's own answer, found by bisection without the tools, is 44.032 °C, so the agent is 0.032 K below it, inside the 0.05 K step it searched with. Its last calls ran the solver on both sides of the answer to confirm it. On this run the surrogate put the crossing one step too high and the solver check moved it down. With one predict_cooling call per bisection step it took 17 calls. The solver alone took 13 calls and 2.59 s, where the sweep plan took 475 ms.

With a 12 s budget the answer lies above 60 °C, where the surrogate was never trained. The same plan answered 76.15 °C (solver: 76.156 °C) in 6 calls; 56 of its 97 sweep points were answered by the solver, each one marked as such. It still took only 1.37 s, against 3.01 s for the solver alone, because a sweep hands all its out-of-box points to the solver as one batch.

Of 694 calls the surrogate must not answer (invalid, malformed, outside the training box, or failing a physics check), it answered 0. 74 hand-written calls of that kind were all handled as planned (74 of 74): 59 refused with a code, a reason and a hint, the rest answered by the solver. 1,000 random calls matched an independent check of the limits every time (0 mismatches). With a broken model loaded on purpose, the int8 copy my gate in cooling-surrogate blocked, 71 of 200 answers inside the box failed a physics check and went to the solver; 0 answers that fail a check came back.

Every tool answer equals the direct library call: 134 of 134 comparisons on 22 fixed cases, exact float equality after the JSON round trip, including against cooling-surrogate's own HTTP service, with MKL on one thread as the service is configured (see Limits). A second server process gave byte-identical answers and result ids (45 of 45), and repeated calls came from the result store (45 of 45, 0 solver runs).

Over stdio a surrogate call takes 2.30 ms at the median against 0.31 ms for the bare library call, so the protocol and the guards add about 1.99 ms. A solver call takes 221 ms (library 221 ms). Starting the server takes 4.01 s.

1. The agent session

A deterministic client follows a fixed plan, no language model. One fresh server per run. Time is what the client waited for tool calls, without server start.

A 2 mm wall, melt 230 °C: what is the warmest mould temperature between 20 and 60 °C that keeps the cooling time at or below 8 s? Solver answer: 44.0317 °C.

plan tool calls solver runs time answer off by confirmed by the solver
two sweeps, then check 7 2 475 ms 44.0000 °C -0.0317 K yes (stepped down)
one point per call 17 2 474 ms 44.0234 °C -0.0082 K yes (stepped down)
solver only 13 12 2.59 s 44.0234 °C -0.0082 K yes

The same part with a 12 s cycle budget: what is the warmest mould temperature between 20 and 95 °C that keeps the cooling time at or below 12 s? The surrogate was trained up to 60 °C only. Solver answer: 76.1559 °C.

plan tool calls solver runs time answer off by confirmed by the solver
two sweeps, then check 6 58 1.37 s 76.1500 °C -0.0059 K yes
one point per call 17 13 3.08 s 76.1401 °C -0.0158 K yes
solver only 14 13 3.01 s 76.1401 °C -0.0158 K yes

2. Safety

Hand-written bad calls, by kind. The surrogate column must be zero everywhere.

kind calls as planned refused solver surrogate
physically meaningless numbers 35 35 35 0 0
wrong types, missing or extra fields, bad ids 21 21 21 0 0
valid, outside the training box 16 16 2 14 0
inside the box, surrogate answer fails a check 1 1 0 1 0
valid, but the wall never cools enough 1 1 1 0 0

Random calls to predict_cooling (seed 7): each input in the box, outside it, physically invalid, malformed or missing, at fixed odds.

outcome calls
refused, invalid_input 395
surrogate 380
solver, out_of_box 225

Physics guard, inside the box only, every answer then put through check_physics:

model served calls surrogate answers failing a check sent to the solver answers returned failing a check
version 1, promoted 200 1 1 0
int8 copy, blocked by the gate 200 71 71 0

3. Correctness

comparison checked equal
run_solver = physics.solve 22 22
predict_cooling = library guard and fallback 22 22
predict_cooling = cooling-surrogate HTTP service 22 22
compare_with_solver = metrics.errors 22 22
check_physics = checks.run_all 44 44
sweep_parameter = library guard on the batch 2 2

A sweep answers in one batch, and batching changes the floating-point path a little: sweep points differ from the same points asked one by one by at most 2.9e-07 relative.

4. Latency

Median and 95th percentile over 200 calls (15 for the solver rows), new inputs on every call. Library is cooling_surrogate called directly; tool layer is the same call through ToolBox in-process; MCP is the client's wait for the answer from the server subprocess over stdio.

call library tool layer MCP, median MCP, p95 answer size
describe_model - 0.01 ms 1.57 ms 1.96 ms 3,236 chars
predict_cooling, inside the box 0.31 ms 0.40 ms 2.30 ms 3.48 ms 609 chars
predict_cooling, same call again (result store) - 0.02 ms 1.59 ms 2.28 ms 605 chars
sweep_parameter, 41 points inside the box 0.94 ms 1.29 ms 4.35 ms 6.00 ms 2,481 chars
check_physics on a stored answer 0.11 ms 0.15 ms 2.12 ms 3.00 ms 1,151 chars
predict_cooling, outside the box (solver) 220 ms 221 ms 230 ms 249 ms 649 chars
run_solver 221 ms 217 ms 221 ms 249 ms 507 chars
compare_with_solver 222 ms 217 ms 224 ms 256 ms 921 chars

Server start, three runs: 3.93 s, 4.01 s, 4.04 s. Machine: AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD, Windows 11, Python 3.12.16, mcp 2.3.0, torch 2.15.0+cpu, numpy 2.5.5, one torch thread. Whole measurement: 239 s.

How it works

tool what it does runs the solver
describe_model every input with unit, allowed range and training box; model version and hashes; the checks no
predict_cooling cooling time and heat removed for one case, surrogate with solver fallback only when needed
sweep_parameter the same over a grid of one input, in one call for the points that need it, in one batch
run_solver the finite-volume solver, verified against the exact series in cooling-surrogate yes
check_physics the five physics checks on an earlier answer, by its result_id, with the worst value of each no
compare_with_solver surrogate and solver on one case, and the surrogate's error yes

Every input carries its unit in its name (melt_temp_c, thickness_mm, htc_w_m2k, ...), and the JSON schema the agent sees gives its allowed range and the training box. Types are strict: "230" or true for a temperature is refused, not converted. A refused call comes back with ok: false, MCP's is_error flag, a code, a reason that names the field and what is allowed, and a hint for the next call. For an invalid call nothing is computed.

predict_cooling and sweep_parameter use the same guard as cooling-surrogate's HTTP service, in the same order. If any input is outside the training box, the solver answers. If the surrogate's answer fails one of the five physics checks, the solver answers. The answer says which one answered and why (source, fallback_reason, outside_training_box, surrogate_failed_checks). With on_out_of_box: "refuse" an agent that cannot wait for the solver gets a refusal instead, and still no surrogate number.

Each answer reports its cost: wall time, solver runs, surrogate evaluations, and whether it came from the result store. Answers depend only on the arguments and the model, so each one gets a result_id, a hash of the tool, the arguments, the weights and the library commit. The same call again returns the same id and the same answer from the store without running anything. check_physics takes that id, so an agent never has to send profiles back.

I wrote the server on the SDK's low-level Server, not the decorator layer. That way the schemas the agent sees are exactly the ones in tools.py, and a bad argument comes back as a refusal the agent can read, not as a protocol error. All tools are marked read-only and idempotent.

src/cooling_surrogate is an unchanged copy of eight files of cooling-surrogate at commit 58b7397 (MIT licence, copied with it). It is copied, not installed, because that repository is not packaged for pip. UPSTREAM.json holds the SHA-256 of every file, a test checks them, and CI compares them with a fresh clone of that commit. The model in src/sim_tools_mcp/model_v1 is version 1 of cooling-surrogate's full run, the one its gate promoted. The server refuses to start if the weights' hash is not the registered one.

The measurements live in bench/: correctness.py, safety.py (with the bad calls in cases.py), latency.py, and agent.py with session.py for the scripted agent.

Run it

Python 3.12, CPU only.

python -m venv .venv
.venv/bin/pip install -r requirements-dev.txt      # Windows: .venv\Scripts\pip
.venv/bin/pip install -e . --no-deps
.venv/bin/python -m pytest -q
.venv/bin/python -m bench.run_all                  # writes results/
.venv/bin/python -m bench.readme                   # rewrites the results part of this README

To use it from an MCP host, start it over stdio:

{
  "mcpServers": {
    "cooling": { "command": "/path/to/sim-tools-mcp/.venv/bin/python", "args": ["-m", "sim_tools_mcp"] }
  }
}

CI (.github/workflows/ci.yml) runs lint, the tests, the README check, the comparison of the copied files with cooling-surrogate, and a small version of the whole measurement.

Limits

  • The agent is a script, not a language model. It shows that the tools are enough to answer the question and how many calls each plan needs. It says nothing about how well a model would choose a plan. I did not run it with a model.
  • I ran the server only with the SDK's own client, not inside a desktop host.
  • The physics is cooling-surrogate's: a one-dimensional wall with constant properties. Its README lists what that leaves out.
  • The latency numbers come from one machine, one torch thread and stdio. Over HTTP or on other hardware they will differ.
  • cooling-surrogate's HTTP service sets one torch thread when it starts, but torch passes that to MKL only for the thread that starts it. The service answers in request threads, where MKL then uses every core, and on some Intel CPUs (CI's Xeon 8370C runners) heat removed differs from the library call in its last digits. The measurement and the tests set MKL_NUM_THREADS=1 before torch loads (bench/__init__.py), so the service is compared as it is configured. Started without that setting on such a CPU, it can differ in those digits.
  • The result store lives in the server process. It is lost on restart, and check_physics only knows ids from the same process. It keeps the last 4,096 answers.
  • The guard checks each input against its own range, as in cooling-surrogate. A combination that is rare inside the box is not flagged.
  • The physical limits are those of cooling-surrogate's HTTP service. A wall that loses heat very slowly passes them, and the solver then runs to its time limit before the tool refuses with solver_failed.
  • The bad calls and the fuzz odds are mine. They cover the mistakes I could think of, not every input.

MIT licence.

Metadata

Release files for sim-tools-mcp 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sim-tools-mcp 1.0.1
File Size Uploaded Provenance Actions
sim_tools_mcp-1.0.1.tar.gz 930.7 kB With provenance Details for sim_tools_mcp-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sim-tools-mcp 1.0.1
File Interpreter ABI Platform Actions
sim_tools_mcp-1.0.1-py3-none-any.whl Python 3 none any Details for sim_tools_mcp-1.0.1-py3-none-any.whl

Total release size: 1.9 MB

Release files / sim_tools_mcp-1.0.1.tar.gz

Download URL sim_tools_mcp-1.0.1.tar.gz
Size 930.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4cfa0278cf992356d66dce78c777618c8c1d0afb247a2ce12083d1d133809e53
BLAKE2b-256 checksum
How to use checksums
b0755f9bf2cb5ff3caf02b4ac0e72a88c659b58c92248a5ab6c4212345c04062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / sim_tools_mcp-1.0.1-py3-none-any.whl

Download URL sim_tools_mcp-1.0.1-py3-none-any.whl
Size 922.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6ee357b828bb7d9b65db1df32f24b0e26965860d82006e5561897463835bd22
BLAKE2b-256 checksum
How to use checksums
8d94d0724cfd69a6a0bfa739c2ed00b6ee1ee70089034bb846429f72c9bc56d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for sim-tools-mcp 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sim_tools_mcp-1.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page