R mcptools MCP Server
An R package that implements the Model Context Protocol, enabling R to function as an MCP server (allowing AI assistants to execute R code in your sessions) and as an MCP client (integrating third-party MCP servers with R applications).
Get this MCP server
An R package that implements the Model Context Protocol, enabling R to function as an MCP server (allowing AI assistants to execute R code in your sessions) and as an MCP client (integrating third-party MCP servers with R applications).
Installation
CRAN
install.packages("mcptools")
Development version
pak::pak("posit-dev/mcptools")
Configuration
Claude Desktop
{
"mcpServers": {
"r-mcptools": {
"command": "Rscript",
"args": ["-e", "mcptools::mcp_server()"]
}
}
}
GitHub MCP Server Example
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
Features
- R as MCP server - allows AI assistants to execute R code in your interactive R sessions
- R as MCP client - integrates third-party MCP servers with ellmer chats
- Compatible with Claude Desktop, Claude Code, VS Code GitHub Copilot, and Positron Assistant
- Session configuration with mcp_session() for connecting to specific R projects
- Integration with shinychat and querychat applications
- Uses Claude Desktop configuration file format for third-party MCP servers
Environment Variables
Optional
GITHUB_PERSONAL_ACCESS_TOKEN- GitHub personal access token for the GitHub MCP server example
Usage Examples
From what year is the earliest recorded sample in the `forested` data in my Positron session?
What issues are open on posit-dev/mcptools?
Notes
This package was previously named 'acquaint'. Users should migrate from acquaint::mcp_server() to btw::btw_mcp_server() and from acquaint::mcp_session() to btw::btw_mcp_session(). The package integrates well with the btw package for documentation and environment inspection tools. The configuration file for MCP clients is located at ~/.config/mcptools/config.json by default.