Stats Analytics MCP Server
Provides read-only analytics over a SQLite database, including schema inspection, safe SELECT queries, column profiling, statistical group comparisons, correlation analysis, and p-value adjustments.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Stats Analytics MCP Server
A read-only analytics server for AI assistants. It lets an assistant explore a SQL database and run statistical comparisons that come back with effect sizes, confidence intervals and plain warnings, not just a p-value.
Built with Python and the official MCP SDK (2.x).
Why this exists
Most "chat with your database" tools only write SQL. When someone asks "did variant B work better?", they get a p-value and little else. This server makes the careful version the default: every statistical tool returns the size of the effect, an interval around it, and warnings about small samples, skew and causal claims.
Related MCP server: sqlite-analyst
Example
On the included demo data, an A/B test with 1,500 customers per group:
Variant A | Variant B | |
Conversion | 11.5% | 13.7% |
The compare_proportions tool reports a rate difference (A minus B) of -2.3 points with a 95% interval of -4.6 to +0.1 points, Fisher’s exact p = 0.069, and a reminder to check that assignment was random. The interval includes zero, so the data does not settle the question. The tool shows that instead of declaring a winner.
Tools
Tool | What it does |
| Tables, columns and row counts |
| One read-only SELECT, with a row limit and a time limit |
| Missing values, quantiles or top values for one column |
| Numeric column across two groups: Welch t-test, Mann-Whitney, mean difference with 95% CI, Hedges' g, Cliff's delta |
| 0/1 outcome across two groups: rate difference (Newcombe CI), odds ratio, relative risk, Fisher's exact test |
| Pearson (with 95% CI) and Spearman |
| Holm, Benjamini-Hochberg or Bonferroni correction |
There is also a prompt, rigorous_comparison, that walks an assistant through a careful comparison.
Security design
The server has no LLM inside and never writes. Several independent layers protect the database, and the tests check that each layer holds when the others are skipped.
Risk | What the server does |
Writes or schema changes | The file is opened read-only, |
SQL injection through tool arguments | Table and column names are checked against the real schema before use, and values are bound parameters |
Multiple statements, | Rejected by the SQL parser (sqlglot) and by the authorizer |
Runaway queries | 5 second limit, row cap of 1,000, SQLite limits on string length and SQL length |
Prompt injection hidden in data | Text cells are cleaned of control characters and cut to 200 characters. Every result carries a note that the values are untrusted data |
Open HTTP server | Over HTTP the server needs a bearer token, compares it in constant time, refuses to listen on a non-loopback address without one, and caps request size at 64 KB |
Container | Non-root user, no write access needed, port published to localhost only |
What this does not do: no filter can fully stop a model from being influenced by text inside data. The note and the shortened cells reduce the risk and do not remove it. Do not point this at a database that holds secrets.
Quick start
You need uv.
git clone https://github.com/Hamed-Ghaseminezhad/stats-analytics-mcp-server
cd stats-analytics-mcp-server
uv sync
uv run python scripts/make_demo_db.py data/demo.db
uv run python examples/client.py data/demo.db
uv run pytestClaude Desktop
{
"mcpServers": {
"stats-analytics": {
"command": "uv",
"args": ["--directory", "/ABSOLUTE/PATH/stats-analytics-mcp-server", "run",
"stats-analytics-mcp-server", "--db", "/ABSOLUTE/PATH/data/demo.db"]
}
}
}HTTP server
export MCP_AUTH_TOKEN="$(openssl rand -hex 24)" # at least 24 characters
uv run stats-analytics-mcp-server --db data/demo.db --transport streamable-http
# listening on http://127.0.0.1:8000/mcpTest it with the demo client: uv run python examples/client.py http://127.0.0.1:8000/mcp
Docker
docker build -t stats-analytics-mcp .
export MCP_AUTH_TOKEN="$(openssl rand -hex 24)"
docker run --rm -p 127.0.0.1:8000:8000 -e MCP_AUTH_TOKEN \
--read-only --cap-drop ALL --security-opt no-new-privileges stats-analytics-mcpTo use your own SQLite file, mount it read-only:
-v "$(pwd)/mydata.db:/data/my.db:ro" -e STATS_DB_PATH=/data/my.db
Postman
New, then MCP, then HTTP.
URL:
http://localhost:8000/mcpAuthorization tab: type Bearer Token, paste your
MCP_AUTH_TOKEN.Connect, pick a tool, fill the arguments, Run.
Limits
SQLite only, one database per server.
Statistics assume independent observations. Repeated measures per customer need a different method.
Group tests compare two groups at a time.
Development
uv run ruff check src tests scripts
uv run pytestTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
A statistical analyst in your AI chat: bring data and a question, get a citable, re-runnable report.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables safe exploration and analysis of SQLite databases through guarded read-only queries, schema inspection, aggregations, and CSV imports.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to explore and query SQLite databases through read-only tools, with defense-in-depth sandboxing preventing any data modifications.MIT
- AlicenseAqualityCmaintenanceEnables AI agents to safely explore and query a SQLite database in read-only mode, allowing them to inspect schema and run analytical SQL queries without risking data modification.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to safely query PostgreSQL or SQLite databases read-only through AST-validated guardrails, schema introspection, and statistical table profiling. It returns results as Markdown tables, JSON audit reports, and database health checks.MIT