Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

simtest-funnel-mcp

A local MCP server that lets AI agents (Claude Code, Claude Desktop, any MCP client) compare signals stored in local CSV files with the funnel (tolerance-tube) algorithm of simtest-funnel, a port of LBNL Funnel.

The server reads the files itself, so raw samples never enter the model's context. It is stateless: every call names the files it reads, and no network connection is opened. describe_signals and compare_signals are read-only; plot_signals writes exactly the plot file it is given (and nothing at all without output_path). Transport: stdio.

Platform note: simtest-funnel is currently published to PyPI only as a Linux x86-64 / CPython 3.12 wheel, so uvx simtest-funnel-mcp works only there until cross-platform wheels are published. From a checkout of this repository it works wherever the Rust extension builds.

Tools

describe_signals(path, columns=None, max_columns=100)

Time column (and how it was chosen), row count, time start/end/span, sampling (uniform or not; min/median/max step), per-column min/max/range and data problems (non-numeric or empty cells, time not non-decreasing). Use it to choose columns and tolerances. At most max_columns columns and as many problems are listed; columns_total, columns_selected, columns_omitted and problems_omitted state the rest. columns filters by exact name or glob pattern (*, ?, [...]), e.g. ["*.port.signal"].

compare_signals(reference_path, test_path, ...)

Argument Default Meaning
columns all common columns Signal columns to compare: exact names or glob patterns (*, ?, [...], matched against the columns of both files)
tolerances one set, library default List of sets: optional unique label plus any of the six coefficients
column_tolerances none {column: coefficients} overrides, applied per axis
x_range unbounded {"lo": .., "hi": ..} time window; finite bounds, omit one for unbounded
max_intervals 5 Violation intervals listed per failing row (largest deviation first)
max_rows 100 Rows returned (errors, then failures, then passes); totals always cover all rows
include_snippet false Add a pytest file reproducing the returned rows (for CI), in the structured field snippet

The result has one row per (column, tolerance set) with verdict (pass / fail / error), the library status code, points outside the tube, fractions of points and span outside, the worst deviation and, for failures only, the violation intervals. Missing columns, bad data and other per-column problems are reported in their rows instead of failing the call. Both structured content and a short text rendering are returned. Time values are never rounded in the structured content; the text prints them with enough digits to tell adjacent samples apart.

A column passes when every test point inside the compared time range (x_range intersected with the reference time span) lies inside the tube and, within x_range, both files cover the same time span. If one file covers more time than the other within x_range, the row has verdict error with status MISSING_REFERENCE (test extends beyond the reference) or MISSING_TEST (the reverse), still reports points_compared / points_outside, and its problem text names both time spans and the exact x_range that compares the overlap.

plot_signals(reference_path, test_path, column, ...)

Draws ONE comparison - one signal column, one tolerance set - and returns a PNG preview (800 x 450 px) inline as MCP image content, so the model can look at it. SVG is never returned inline (it would reach the model as text).

Argument Default Meaning
column required The one signal column to plot (exact name, no glob patterns)
tolerance library default One tolerance set: optional label plus any of the six coefficients (one entry of compare_signals tolerances)
x_range unbounded As in compare_signals; also the time window shown (zoom)
output_path none Write the plot here: .svg (document) or .png (1600 x 900 px). Omit for the preview only
overwrite false Replace output_path if it exists (refused otherwise)
max_intervals 5 Violation intervals listed in the result row (all are drawn)

The plot shows the reference (dark grey, dashed), the test (blue, solid), the tolerance tube (grey band between thin lower and upper bound lines) and every region where the test leaves the tube (red shading, with x markers on the violating test points). The title states the column, the verdict, the points outside and the non-zero resolved tolerances; the axes are labelled with the time column and the signal column; a legend sits below the axes. The background is white, so plots stay readable on light and dark pages (on a dark page they appear as a light card).

The comparison runs on the full data with exactly the semantics of compare_signals; the result carries the same summary row (plus the file written, the preview size and how many points were drawn), never sample values. For drawing, reference and test are reduced to the min/max of 1000 time buckets, keeping the worst point of every violation interval, so a plot never hides a violation: every violation interval is shaded (at least ~3 px wide, even for a single sample) and contains a marked test point. Tube bounds are drawn with all their points; for tubes above 20 000 points the grey band (not the bound lines) is embedded in the SVG as a 200 dpi image to keep the file small. A column that cannot be compared (missing, bad data, differing time spans, non-monotonic time) is an error and nothing is written.

Output files: the directory must already exist (none is created); the file must lie inside the client's workspace roots, or, when the client declares no roots, inside the server's working directory; a symbolic link must point to a file with the same extension; an existing file is refused unless overwrite=true. The file is written only after rendering succeeded, so a failed call writes nothing. Output is deterministic: the same input gives byte-identical SVG and PNG files (with the same matplotlib version), so plots can be kept in a repository and diffed. SVG text is embedded as paths (bundled DejaVu Sans), so files look the same everywhere.

Plots are rendered with matplotlib (headless, imported only on the first plot_signals call, so server start-up is not slowed). It adds about 24 MB of wheels (~77 MB installed). matplotlib keeps a font cache in its cache directory (~/.cache/matplotlib, or $MPLCONFIGDIR), created on first use in an environment; that is the only other file touched.

Pytest snippet

With include_snippet=true the result carries a self-contained pytest module (structured field snippet, sent once; the text rendering only points to it) that asserts the observed status of every returned row; rows omitted by max_rows are listed as a comment, and the snippet is capped at 64 kB. It embeds the server's CSV reader verbatim. Data paths under the first workspace root (else the server's working directory) are written relative to it and resolved at run time against $SIMTEST_FUNNEL_DATA_ROOT, defaulting to the current directory, so run pytest from the same place in a CI checkout. Files outside that base keep their absolute path, with a comment that they will not resolve elsewhere.

CSV dialect

Comma-separated, one header row (UTF-8, optional BOM). Lines whose first non-blank character is # and blank lines are ignored; a # anywhere else is data (e.g. a column a#1). A data row with more fields than the header is an error naming the row and line; a trailing delimiter on every line, header included, is accepted (the empty last column is dropped). Short rows count as empty cells. The time column is the first column named time (case-insensitive), otherwise the first column; the choice is echoed back. Other columns whose name differs from time only by case are ordinary signal columns.

Tolerances

Six coefficients, x = time axis, y = signal value. At each reference sample the tube half-widths are

half_x = max(atolx, rtolx * time_span_ref, ltolx * |t|)
half_y = max(atoly, rtoly * value_range_ref, ltoly * |y_ref|)
  • atol*: absolute (time units / signal units)
  • rtol*: fraction of the reference time span / value range
  • ltol*: fraction of the local |t| / |y_ref|

If a half-width comes out effectively zero (< 1e-10), e.g. rtoly alone on a constant reference (value range 0), it falls back to rtol * max|reference value| on that axis (when rtol > 0), and finally to 1e-10. For constant or near-constant signals give atoly explicitly.

Omitted coefficients are resolved by the library, per axis: an axis with no coefficient given gets rtol = 0.002; an axis with any coefficient given uses 0 for its others; an explicit 0 counts as given. The six resolved values are always echoed back.

Tolerance in x widens the tube along time, so a test signal shifted or delayed by up to half_x still passes; steep edges and small timing offsets then do not cause false failures.

"1 % in y, 0.5 s in x" is {"rtoly": 0.01, "atolx": 0.5} (or ltoly for 1 % of the local value).

Registering the server

Claude Code

Once published to PyPI:

claude mcp add simtest-funnel -- uvx simtest-funnel-mcp

From a checkout of this repository (use --scope user to make it available in every project):

claude mcp add simtest-funnel -- uv run --directory /path/to/simtest-funnel --quiet simtest-funnel-mcp

Inside this repository nothing needs to be registered: the checked-in .mcp.json starts the server with uv run from the workspace (Claude Code asks for approval the first time).

Claude Desktop

Add to claude_desktop_config.json (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "simtest-funnel": {
      "command": "uvx",
      "args": ["simtest-funnel-mcp"]
    }
  }
}

or, from a checkout:

{
  "mcpServers": {
    "simtest-funnel": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/simtest-funnel", "--quiet", "simtest-funnel-mcp"]
    }
  }
}

Use absolute paths in tool calls. When the client declares workspace roots, the server refuses paths outside them and resolves relative paths against the first root. Only local file:// roots (empty host or localhost) are used; other roots are ignored with a note in the result.

Development

make build          # builds the native simtest-funnel module
make test-python    # includes python/simtest-funnel-mcp/tests (incl. stdio end-to-end)
make lint-python    # mypy --strict
uv run simtest-funnel-mcp   # start the server on stdio

Metadata

Release files for simtest-funnel-mcp 1.0.0b13

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

Source distribution (sdist)

Source distribution for simtest-funnel-mcp 1.0.0b13
File Size Uploaded Provenance Actions
simtest_funnel_mcp-1.0.0b13.tar.gz 49.2 kB Without provenance Details for simtest_funnel_mcp-1.0.0b13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simtest-funnel-mcp 1.0.0b13
File Interpreter ABI Platform Actions
simtest_funnel_mcp-1.0.0b13-py3-none-any.whl Python 3 none any Details for simtest_funnel_mcp-1.0.0b13-py3-none-any.whl

Total release size: 89.0 kB

Release files / simtest_funnel_mcp-1.0.0b13.tar.gz

Download URL simtest_funnel_mcp-1.0.0b13.tar.gz
Size 49.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2d8406d34f6dab9bdb038b726a4b75ae6bca958472e79dfcd1230e4475936aa7
BLAKE2b-256 checksum
How to use checksums
743d8fffef4f43f0d45d471dd714cfd40f669c3959af091c76dbc504c314f8c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / simtest_funnel_mcp-1.0.0b13-py3-none-any.whl

Download URL simtest_funnel_mcp-1.0.0b13-py3-none-any.whl
Size 39.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e0a7c0b02dfaf6de6441d11f7cd362b7c9f991236876245656a72a42ca53bc8
BLAKE2b-256 checksum
How to use checksums
c2874bc32d490a04d332cc51919ee583b7f7010e0fa2e3ab997bf269a7614d14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for simtest-funnel-mcp 1.0.0b13

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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