Together, these functions implement a model context protocol server for your R session.
Configuration
mcp_server()
should be configured with the MCP clients via the Rscript
command. For example, to use with Claude Desktop, paste the following in your
Claude Desktop configuration (on macOS, at
file.edit("~/Library/Application Support/Claude/claude_desktop_config.json")
):
{
"mcpServers": {
"r-acquaint": {
"command": "Rscript",
"args": ["-e", "acquaint::mcp_server()"]
}
}
}
Or, to use with Claude Code, you might type in a terminal:
mcp_server() is not intended for interactive use.
The server interfaces with the MCP client on behalf of your R session.
Use mcp_session()
to make your R session available to the server.
Place a call to acquaint::mcp_session()
in your .Rprofile
, perhaps with
usethis::edit_r_profile()
, to make every interactive R session you start
available to the server.
Examples
if (interactive()) {
mcp_session()
}