MCP Stats Tools Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Stats Tools ServerRun a paired significance test on these two samples and report the p-values"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Stats Tools Server
A real Model Context Protocol server exposing three statistical tools — survival analysis, paired significance testing, and distribution drift detection — plus an evaluation harness measuring quality, latency, and cost. Built to close two specific gaps that kept recurring across job postings: hands-on MCP experience, and evaluation of AI-adjacent systems beyond just correctness.
app/tools.py app/server.py app/evaluate.py
pure logic --> MCP wiring --> quality checks (known ground truth)
no MCP (real protocol, latency (real timing, real calls)
involved real error contract) cost (illustrative, clearly labelled)Running it
pip install -r requirements.txt
make test # 18 tests
make evaluate # quality, latency, and cost report
make run # starts the server over stdioInspect it with the official tooling, no code changes needed:
npx @modelcontextprotocol/inspector python -m app.serverNothing here needs an API key or any paid service. The tools are deterministic statistics, not LLM calls.
Related MCP server: MCP ML Monitor
The tools
survival_analysis-- Kaplan-Meier curve(s), and a log-rank significance test when exactly two groups are given.compare_two_samples-- paired t-test and Wilcoxon signed-rank test, plus a bootstrap confidence interval on the mean difference.check_distribution_drift-- Kolmogorov-Smirnov test and Population Stability Index between a reference and current sample.
All three reuse the exact statistical methods validated in the sibling
supply-chain-decision-lab project, reimplemented here as self-contained
functions (no dependency on that repo) so this server can be launched
standalone -- a real requirement for an MCP server, not a style choice.
Evaluation: quality, latency, cost
app/evaluate.py is structured around the JD language it was built to
answer, kept genuinely separate because each is a different question:
Quality -- checked against known ground truth, the same discipline used
throughout this whole portfolio: two groups generated with a real hazard
difference must be flagged significant; two generated identically must not
be. A known 10-unit injected difference must be recovered by
compare_two_samples. A genuine distribution shift must be caught by
check_distribution_drift; a stable one must not. All five checks pass.
Latency -- measured by timing real calls through the actual
MCPServer.call_tool() path, not the bare Python function underneath it, so
protocol overhead (argument validation, result serialisation) is included in
what's reported. Representative numbers from one run: check_distribution_drift
~1.3ms, compare_two_samples ~9ms, survival_analysis ~40ms (it does
bootstrap resampling, so the ordering is expected, not a red flag).
Cost -- these tools are deterministic and local, not metered per-token
like an LLM call, so there is no real dollar figure to report honestly. What
is honest: converting measured latency into an illustrative monthly cost
using a clearly-labelled, made-up compute rate
(ILLUSTRATIVE_COMPUTE_RATE_USD_PER_VCPU_HOUR), demonstrating the
calculation a real deployment would run against its actual cloud invoice,
without pretending a fabricated number is a real one.
Bugs found while building this
Left in deliberately, same as every sibling project -- the process of finding these is part of what this project demonstrates.
dictreturn types silently produced no structured output. The MCP SDK needs enough type information to build a schema; a bare-> dictannotation doesn't provide it, so results came back only as JSON-in-text, notstructured_content-- not an error, just quietly less useful than it looked. Diagnosed by comparing against a working-> intexample, fixed by annotating withdict[str, Any].A plain
ValueErrorwas classified as a crash, not a reported error.tools.pyraises ordinaryValueErrorfor anticipated problems (mismatched lengths, too few observations) -- correct for a module tested independent of MCP, deliberately. But the SDK's contract treats any un-translated exception as anUnexpectedToolError(a real crash: full traceback logged, generic message reaches the caller), where its ownToolErroris reported cleanly. Fixed with one decorator inserver.pythat translatesValueErrorintoToolErrorat the protocol boundary, keepingtools.pyitself completely MCP-agnostic, so the separation between "logic" and "protocol contract" stays in exactly one place.A test asserted the wrong layer's contract. An early test expected
server.call_tool()to returnis_error=Truefor bad input. The SDK's own docstring says otherwise: called programmatically,call_tool()raisesToolErrorfor anticipated failures -- the gracefulis_error=Trueresult form only appears at the actual wire-protocol handler a live client connects through, a layer these in-process tests don't exercise. Fixed by asserting the real, documented behaviour (ToolErroris raised, and specifically not itsUnexpectedToolErrorsubclass) instead of a plausible-sounding but incorrect assumption.
Layout
app/tools.py pure statistical logic, zero MCP involved, independently tested
app/server.py MCP wiring: three tools, error-contract translation
app/evaluate.py quality / latency / cost harness
tests/test_tools.py 18 tests: logic + real protocol integrationWhat is not built
No LLM ever calls these tools in this repo -- that would need a real agent host (Claude Desktop, an ADK agent, etc.) wired to this server over stdio, which is a live-integration step outside what this project needed to prove.
Cost is illustrative by necessity, not measured against a real bill -- see above.
No SSE/HTTP transport is exercised, only stdio -- the MCP SDK supports both, and stdio is what a local tool-calling agent typically uses.
This server cannot be deployed
Maintenance
Related MCP Connectors
DriftOracle - 15 tools for model/data drift monitoring: PSI, KS-test, alerts, evidence packs.
Valid and reliable data engineering and statistical analysis without hallucinations.
The statistical analyst in your AI chat — validated, citable, re-runnable analysis of your data.
Data observability tools for engineering teams: alerts, freshness, schema drift, lineage, quality.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceProvides advanced evaluation tools for assessing AI safety, alignment, and performance of LLM outputs. Enables programmatic evaluation of quality, safety metrics like toxicity and PII detection, and operational metrics including carbon footprint and cost estimation.4Apache 2.0- FlicenseNot gradedqualityDmaintenanceMonitors ML models in production for data drift and performance degradation, providing automated alerts and retraining recommendations.-
- AlicenseNot gradedqualityAmaintenanceEnables LLM evaluation and observability by uploading documents, building test sets, running RAG pipelines, and automatically scoring answers for groundedness, hallucination risk, retrieval quality, latency, and cost, with tools exposed to MCP-compatible clients.1MIT
- AlicenseAqualityAmaintenanceEval-integrity statistics for AI benchmark claims — multiple-testing correction, power/MDE for model gaps, judge-bias and leaderboard-rank checks. Catches a benchmark number that won't survive a second look.9MIT