mplus-mcp
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., "@mplus-mcp Run a growth model on my longitudinal data and compare fit"
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.
mplus-mcp
An MCP server that drives Mplus: it prepares data, writes and runs input files, and reads the output back as tables instead of several hundred lines of fixed-width text.
Works with the licensed executable and with Mplus Demo (which caps the model at 6 dependent and 2 independent variables).
繁體中文說明請見 README.zh-TW.md。
Tools
Tool | What it does |
| Which executable is in use, its version, demo limits |
| Syntax reference by topic (model, mixture, invariance, errors …) |
| CSV/Excel/SPSS/Stata → an Mplus |
| Input syntax for cfa, efa, path, sem, mediation, growth, lpa, lca, invariance, twolevel |
| Write syntax to a file, run it, summarise the output |
| Run an existing |
| Re-read any |
| One section verbatim (TECH1, residuals, random starts …) |
| Fit indices side by side, with a scaled chi-square difference test |
| Read back factor scores / class probabilities, optionally as CSV |
Related MCP server: JeffersonStats
Install
Needs uv and an installation of Mplus. The demo build works too.
Claude Code
claude mcp add mplus -- uvx --from git+https://github.com/Ian3738/mplus-mcp mplus-mcpClaude Desktop
Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/,
Windows: %APPDATA%\Claude\):
{
"mcpServers": {
"mplus": {
"command": "uvx",
"args": ["--from", "git+https://github.com/Ian3738/mplus-mcp", "mplus-mcp"]
}
}
}If the client cannot find uvx, give the absolute path (which uvx).
From a clone
git clone https://github.com/Ian3738/mplus-mcp
cd mplus-mcp
uv sync
claude mcp add mplus -- "$(pwd)/run-server.sh"run-server.sh exists for two situations a bare uv run does not handle: GUI
clients that start without uv on PATH, and clones inside iCloud Drive, where
the virtualenv has to live outside the synced folder.
Configuration
Variable | Default | Purpose |
| first executable found (see below) | Path to the Mplus executable. Set it to prefer a licensed copy over the demo. |
|
| Where runs go when no folder is given |
Searched automatically: mplus / mpdemo on PATH, /Applications/Mplus/mplus,
/Applications/MplusDemo/mpdemo, /usr/local/bin/mplus, /opt/mplus/mplus,
C:\Program Files\Mplus\Mplus.exe.
Reading .sav files needs one extra package: add --extra spss to uv sync, or
use uvx --from "git+https://github.com/Ian3738/mplus-mcp[spss]" mplus-mcp.
Verify the setup by asking the model to call mplus_status.
How a session goes
data_prepare(path="ses.csv")
→ writes ses.dat, reports that `motivation` became `motivat`, hands back
NAMES = id sex y1 y2 y3 y4 x1 x2; MISSING = ALL (-999);
build_syntax(model_type="cfa", data_file="ses.dat",
names="id sex y1-y4 x1 x2",
factors={"F1": ["y1", "y2", "y3", "y4"]})
→ the input file as text
run_syntax(syntax=..., workdir="/path/holding/ses.dat", name="cfa1")
→ status, fit table, parameter estimates, any warnings, and cfa1.out on disk
compare_fit(out_paths=["cfa1.out", "cfa2.out"], chisq_diff=True)Notes on Mplus itself
Data files are resolved relative to the folder the input file runs in, so the server always runs with the working directory set to the
.inpfolder and refers to data by its bare file name. That is what makes folder names with spaces work.Input lines are capped at 90 characters;
run_syntaxfolds longer ones.Variable names are capped at 8 characters;
data_preparerenames and reports.A run that fails still writes an
.out, so the error is parsed and returned with the well-known causes attached where they apply.
Licence
MIT
Available Tools
10 toolsbuild_syntaxA
Write Mplus input syntax for a standard model family (cfa, efa, path, sem, mediation, growth, lpa, lca, invariance, twolevel, custom). Returns the syntax as text - it does not run it. Read it, adjust it, then pass it to run_syntax. Anything the template does not cover goes in model_extra, analysis_extra or model_constraint.
Inputs: names (required), data_file (required), model_type (required), x, +36 more.
compare_fitA
Put the fit statistics of several .out files side by side - class enumeration, measurement invariance, nested model comparisons. With chisq_diff it also runs the chi-square difference test between consecutive models, scaled for MLR when Mplus reported a scaling correction factor.
Inputs: out_paths (required), labels, chisq_diff.
data_prepareA
Convert a CSV, Excel, SPSS (.sav), Stata (.dta) or parquet file into an Mplus .dat file: numeric only, no header, missing values flagged, names cut to 8 characters. Returns the DATA and VARIABLE block to paste into an input file, plus a per-variable summary and a note of anything that was renamed or recoded.
Inputs: path (required), sep, sheet, header, +8 more.
mplus_statusA
Report which Mplus executable will be used, its version, and any demo-version limits. Call this first when a run fails for reasons that look like the installation rather than the model.
Inputs: no named parameters.
output_sectionA
Return one section of an .out file verbatim, for anything the summary does not parse - TECH1, TECH4, residuals, sample statistics, random-start loglikelihoods. Call without section to list the sections in the file.
Inputs: out_path (required), section, max_chars.
output_summaryA
Summarise an Mplus .out file that already exists: status, warnings, fit, parameter estimates, and whatever else include asks for. Use it on output produced outside this server, or to re-read a run without repeating it.
Inputs: out_path (required), include, max_rows.
run_fileA
Run an Mplus input file that already exists on disk and summarise the output. Use this for .inp files written by hand or by the Mplus editor.
Inputs: inp_path (required), include, timeout, max_rows.
run_syntaxA
Write Mplus input syntax to a file, run it, and summarise the output. Long lines are folded to the 90-character limit first. The .inp and .out stay on disk. Use include to ask for more of the output than the default fit table, parameter estimates and warnings.
Inputs: syntax (required), name, include, timeout, +2 more.
savedata_readA
Read the file a SAVEDATA command wrote - factor scores, class probabilities, most likely class membership - using the column layout Mplus recorded at the end of the .out file. Optionally write it out as a CSV for use in R or Excel.
Inputs: out_path (required), rows, to_csv.
syntax_helpA
Mplus syntax reference by topic: overview, data, variable, analysis, model, mediation, cfa, invariance, growth, mixture, multilevel, output, fit, montecarlo, errors, demo. Call with no topic to list them. Use it before writing syntax for a model family you have not written recently.
Inputs: topic.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool has a clearly distinct role in the Mplus workflow: installation status, syntax reference, data conversion, syntax generation, execution from text versus file, parsed output summarization versus raw sections, cross-file comparison, and savedata ingestion. No two tools overlap enough to cause selection ambiguity.
All names are lowercase snake_case and readable, but they mix verb-first forms (build_syntax, run_syntax, run_file, compare_fit), output_* prefixed forms, and noun-verb forms (data_prepare, savedata_read). The functional prefixes help, but the ordering is not consistent enough for a higher score.
Ten tools is well within the ideal range and each one maps to a distinct stage of the Mplus analysis lifecycle. None of the tools feel redundant or unnecessary for the server's stated purpose.
The set covers the full workflow: checking installation, syntax help, data preparation, syntax generation, running new or existing input files, summarizing output, retrieving raw output sections, comparing model fits, and reading SAVEDATA files. There are no obvious dead ends or significant missing operations.
Related MCP Connectors
Query your data in plain English or SQL, build datasets, and fit Bayesian models.
Read, analyze, and safely edit Microsoft Project MPP files.
Messy CSV, JSON, Excel, SPSS/Stata/SAS and PDF tables to typed Parquet; inspect, query, join.
Create and evaluate versioned decision models with reproducible results and declared assumptions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEconometrics MCP server for regression, causal inference, time series, panel data, machine learning, and broader statistical analysis workflows.122 PyPI10MIT
- FlicenseNot gradedqualityDmaintenanceEnables comprehensive statistical analysis including descriptive statistics, hypothesis testing, regression, and more via a FastMCP-based API.3-
- AlicenseNot gradedqualityBmaintenanceEnables AI-native statistical analysis and reproducible research workflows through MCP, including natural language planning, protocol-based analysis, Python/R cross-validation, and publication-ready figure generation.MIT
- AlicenseAqualityBmaintenanceEnables design-correct, conversational analysis of NHANES public-use data by automating file discovery, merging, weight selection, pooling, survey variance estimation, and mortality-linked Cox models.1528 PyPI2MIT