mv_agent_server() starts a Model Context Protocol
(MCP) server that lets an AI assistant such as Claude run item response
theory analyses on the data in one project folder. The assistant reads
your data, fits and compares models, checks items, tests for differential
item functioning, scores people, draws plots, explains the results and
writes an HTML report, all with mirtverse. Every step is also written as
R code, so save_script leaves a script that reproduces the analysis.
Usage
mv_agent_server(
project = NULL,
transport = c("stdio", "http"),
allow_run = NULL,
host = "127.0.0.1",
port = 8766,
token = NULL,
timeout = 600
)Arguments
- project
path to the project folder that holds the data. By default the
MIRTVERSE_PROJECTenvironment variable when it is set (the.mcp.jsonwritten bymv_agent_init()sets it), otherwise the working directory, which for the plugin is the folder Claude Code was opened in.- transport
"stdio"(the client starts the server) or"http"(a URL the client connects to).- allow_run
logical; allow the
run_rtool, which runs R code the assistant writes. Defaults toTRUEfor stdio andFALSEfor HTTP.- host, port, token
where the HTTP server listens; see
mv_mcp_server().- timeout
seconds a single
run_rcall may take.
Details
Fitted models live in the R session of the server and are saved in the
project's .mirtverse-mcp/models folder, so they survive a restart.
Files the server writes (plots, scores, reports, scripts) go to the
mirtverse-output folder of the project. Your data files are only read,
never changed.
You normally do not call mv_agent_server() yourself. The mirtverse
plugin for Claude Code starts it in the folder you work in; for other
clients, mv_mcp_config() with mode = "analysis" prints the settings,
and mv_agent_init() sets up a folder for Claude Code without the plugin.
See also
mv_agent_init(), mv_mcp_config(), and the "mirtverse agent
for Claude" article on the website.