Skip to main content
Glama
Ian3738
by Ian3738

mplus-mcp

test License: MIT Python 3.12+ Mplus 8

一个驱动 Mplus 的 MCP 服务器:它准备数据、编写并运行输入文件,并将输出读回为表格,而不是数百行固定宽度的文本。

适用于授权可执行文件和 Mplus Demo(后者将模型限制为 6 个因变量和 2 个自变量)。

繁體中文說明請見 README.zh-TW.md


工具

工具

功能

mplus_status

正在使用的可执行文件、其版本、演示版限制

syntax_help

按主题分类的语法参考(模型、混合、不变性、错误……)

data_prepare

CSV/Excel/SPSS/Stata → Mplus .dat 文件及 VARIABLE 块

build_syntax

用于 cfa、efa、path、sem、mediation、growth、lpa、lca、invariance、twolevel 的输入语法

run_syntax

将语法写入文件、运行并总结输出

run_file

运行现有的 .inp 文件

output_summary

重新读取任意 .out 文件:拟合、估计、警告

output_section

逐字输出某个部分(TECH1、残差、随机起始值……)

compare_fit

并排比较拟合指数,并进行缩放卡方差异检验

savedata_read

读回因子得分/类别概率,可选输出为 CSV

Related MCP server: aigroup-econ-mcp

安装

需要 uv 和 Mplus 安装。演示版也可以。

Claude Code

claude mcp add mplus -- uvx --from git+https://github.com/Ian3738/mplus-mcp mplus-mcp

Claude Desktop

添加到 claude_desktop_config.jsonmacOS~/Library/Application Support/Claude/Windows%APPDATA%\Claude\):

{
  "mcpServers": {
    "mplus": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Ian3738/mplus-mcp", "mplus-mcp"]
    }
  }
}

如果客户端找不到 uvx,请提供绝对路径(which uvx)。

从克隆安装

git clone https://github.com/Ian3738/mplus-mcp
cd mplus-mcp
uv sync
claude mcp add mplus -- "$(pwd)/run-server.sh"

run-server.sh 用于处理裸 uv run 无法处理的两种情况:启动时 PATH 中没有 uv 的 GUI 客户端,以及位于 iCloud Drive 内的克隆,其中虚拟环境必须位于同步文件夹之外。

配置

变量

默认值

用途

MPLUS_MCP_BINARY

第一个找到的可执行文件(见下文)

Mplus 可执行文件的路径。设置它以优先使用授权版本而非演示版。

MPLUS_MCP_WORKDIR

~/Mplus-MCP

未指定文件夹时运行的位置

自动搜索:PATH 中的 mplus / mpdemo/Applications/Mplus/mplus/Applications/MplusDemo/mpdemo/usr/local/bin/mplus/opt/mplus/mplusC:\Program Files\Mplus\Mplus.exe

读取 .sav 文件需要一个额外的包:在 uv sync 中添加 --extra spss,或使用 uvx --from "git+https://github.com/Ian3738/mplus-mcp[spss]" mplus-mcp

通过让模型调用 mplus_status 来验证设置。

会话流程

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)

关于 Mplus 本身的说明

  • 数据文件相对于输入文件所在的文件夹进行解析,因此服务器始终将工作目录设置为 .inp 文件夹,并通过裸文件名引用数据。这就是带空格的文件夹名称也能正常工作的原因。

  • 输入行限制为 90 个字符;run_syntax 会折叠更长的行。

  • 变量名限制为 8 个字符;data_prepare 会重命名并报告。

  • 即使运行失败也会写入 .out 文件,因此会解析错误并返回,并在适用时附上已知原因。

许可证

MIT

A
license - permissive license
A
quality
C
maintenance

Maintenance

0Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Provides easy access to MLB, Baseball Savant, Statcast, and Fangraphs baseball data. Query detaile…

  • Structured analysis API and remote MCP tool for text, JSON records and numeric series.

  • IMF MCP — wraps IMF SDMX JSON REST API (dataservices.imf.org)

  • Provide structured access to ClinicalTrials.gov data for searching, retrieving, and analyzing clin…

View all MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    An MCP server for NONMEM pharmacometric modeling that provides structured access to model parsing, execution, and results analysis. It enables users to perform diagnostics, manage PsN workflows, and translate models to mrgsolve for PK simulations through natural language.
    22
    15
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables comprehensive statistical analysis including descriptive statistics, hypothesis testing, regression, and more via a FastMCP-based API.
    3

View all related MCP servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ian3738/mplus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server