Stats & R MCP Server
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 & R MCP Server
An MCP (Model Context Protocol) server that gives Claude access to a comprehensive statistics knowledge base and R library expertise for research projects.
What It Does
When connected to Claude (via Claude Desktop, Claude Code, or the API), this server provides:
Tools (14 tools Claude can call)
Tool | Purpose |
| Recommends the right test based on your study design |
| Deep-dive into any test — assumptions, R code, effect sizes |
| Browse all 29 tests by category |
| Step-by-step assumption checking with R code |
| Complete R analysis script from study parameters |
| Sample size / power calculations with R code |
| Effect size formulas and R code |
| Convert between effect size metrics (d, r, η², f, OR) |
| Missing data diagnosis and imputation with R code |
| Correction methods (Bonferroni, Holm, Tukey, FDR) with R code |
| Mediation, moderation, and moderated mediation with R code |
| Detailed info on 34 R packages |
| Package recommendations by task |
| Browse the full R package database |
Resources (read-only knowledge bases)
stats://knowledge-base— Decision table + all test detailsstats://r-packages— Complete R package referencestats://sample-sizes— Sample size rules of thumb
Prompts (workflow templates)
research_analysis_workflow— Full analysis pipeline from question to APA reportstatistical_test_selection— Interactive test selection guider_package_recommendation— Package recommendations for a task
Related MCP server: statistician-mcp
Statistical Tests Covered
Comparing Means: t-tests (independent, paired, Welch's), ANOVA (one-way, two-way, repeated measures)
Correlation: Pearson, Spearman
Categorical: Chi-square, Fisher's exact
Regression: Linear, multiple, logistic, ordinal, Poisson
Nonparametric: Mann-Whitney U, Kruskal-Wallis, Friedman
Mixed Models: LMM (lmer), GLMM (glmer)
Survival: Cox regression, Kaplan-Meier, log-rank
Multivariate: PCA, Exploratory Factor Analysis
R Packages Covered
tidyverse, ggplot2, dplyr, lme4, lmerTest, car, emmeans, performance, effectsize, survival, survminer, broom, psych, rstatix, pwr, report, brms, gt, gtsummary, mice, naniar, lavaan, mediation, interactions, and more (34 total)
Setup
Prerequisites
Python 3.10+
uv (recommended) or pip
Install
# Clone or copy the project
cd stats-r-mcp
# Using uv (recommended)
uv venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
uv pip install -e .
# Or using pip
pip install -e .Connect to Claude Desktop
Add this to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"stats-r-research": {
"command": "uv",
"args": [
"--directory", "/FULL/PATH/TO/stats-r-mcp",
"run", "server.py"
]
}
}
}Replace /FULL/PATH/TO/stats-r-mcp with the actual path on your machine.
Alternative (using python directly):
{
"mcpServers": {
"stats-r-research": {
"command": "/FULL/PATH/TO/stats-r-mcp/.venv/bin/python",
"args": ["/FULL/PATH/TO/stats-r-mcp/server.py"]
}
}
}Connect to Claude Code
claude mcp add stats-r-research -- uv --directory /FULL/PATH/TO/stats-r-mcp run server.pyTest with MCP Inspector
cd stats-r-mcp
uv run mcp dev server.pyThis opens a browser-based inspector where you can test all tools interactively.
Example Usage
Once connected, you can ask Claude things like:
"I have pre and post scores for 45 patients across 3 treatment groups. What test should I use?"
"Generate an R script for a mixed-design ANOVA with treatment as between-subjects and time as within-subjects"
"What R packages do I need for survival analysis?"
"How do I check the assumptions for a linear mixed model?"
"I need to calculate sample size for a two-sample t-test with a medium effect size"
"Walk me through a complete analysis for my RCT data"
Extending the Knowledge Base
The server is designed to be easily extended. To add new tests or packages, edit the STATISTICAL_TESTS or R_PACKAGES_DB dictionaries in server.py. Each entry follows a consistent schema so new additions integrate automatically with all tools.
License
MIT
Tool 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
SEO research, Search Console, GA4 and PPC tools for Claude and ChatGPT.
Run UX research from Claude — create card sort studies, list studies, pull headline stats.
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Claude-powered AI tools: research, write, code, analyze, translate, debate, pitch, score, and more.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceAnalyze survey data (.sav, .csv, .xlsx) through Claude — crosstabs with significance testing, ANOVA, correlation, gap analysis, and publication-ready Excel exports. Upload once, analyze unlimited.-
- AlicenseNot gradedqualityDmaintenanceProvides a virtual statistician for AI agents, offering real statistical methods such as design of experiments, hypothesis testing, regression, and process control. It includes an advisor tool to recommend appropriate analyses and generates plain-language interpretations of results.MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to run verified statistical and analytics computations—including hypothesis tests, A/B testing, descriptive summaries, and sample-size planning—directly on local CSV, TSV, Excel, and Parquet files of any size. Results include effect sizes, confidence intervals, plain-English interpretations, and assumption warnings, with optional independent checks.2373 npmMIT
- AlicenseBqualityBmaintenanceEnables AI agents to safely execute statistical analyses, parse results into Markdown and JSON, and generate publication-ready charts through a local IBM SPSS Statistics installation on macOS and Windows.5137 PyPI1MIT