acquaint implements a Model Context Protocol (MCP) for your R session. When configured with acquaint, tools like Claude Desktop and Claude Code can:
- Peruse the documentation of packages you have installed,
- Check out the objects in your global environment, and
- Retrieve metadata about your session and platform.
IMPORTANT: This is an early proof of concept. Use at your own risk!
You can install the development version of acquaint like so:
pak::pak("simonpcouch/acquaint")acquaint can be hooked up to any application that supports MCP. For
example, to use with Claude Desktop, you might paste the following in
your Claude Desktop configuration (on macOS, at
~/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:
claude mcp add -s "user" r-acquaint Rscript -e "acquaint::mcp_server()"Then, in your R session, call acquaint::mcp_session().
In Claude Desktop, I’ll write the following:
Using the R packages I have installed, write code to download data on flights in/out of Chicago airports in 2024.
In a typical chat interface, I’d be wary of two failure points here:
- The model doesn’t know which packages I have installed.
- If the model correctly guesses which packages I have installed, there may not be enough information about how to use the packages baked into its weights to write correct code.
Through first searching through my installed packages, Claude can locate
the anyflights package, which seems like a reasonable solution. The
model then discovers the package’s anyflights() function and reads its
documentation, and can pattern-match from there to write the correct
code.
