MCPR logo

MCPR

by phisanti

Runs persistent, interactive R sessions for AI-assisted code execution, plotting, workspace inspection, and collaborative analysis.

Install MCPR

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for phisanti/MCPR, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

phisanti/MCPR exposes live R environments to AI agents through MCP tools, keeping workspace state across successive operations. It starts with a private R session and can optionally attach to an R console that a person has already started. Agents can execute arbitrary R code, render plots for users or analysis, inspect session state, and manage available sessions. Use it for exploratory analysis and other workflows where rerunning a complete script for every change would be impractical.

Use cases

  • Run iterative data analysis while preserving objects between agent requests
  • Execute R code in a human's active console
  • Render plots for a user or return images for agent analysis
  • Attach to, detach from, and inspect available R sessions
  • Develop multi-step models without rerunning an entire script

Key features

  • Persistent private R workspace
  • Arbitrary R code execution with structured results
  • User- and agent-targeted plot rendering
  • Optional live-session attachment
  • Session listing and lifecycle controls
  • JSON-RPC 2.0 communication over nanonext sockets

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 1d ago

Recent health check succeeded.

13/14 checks healthy over the last 79d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars27Stargazers on the source repository.
Last commit5d agoMost recent push to the default branch.
Directory activity7 viewsConfig copies, upvotes, and views on AllMCPs.

How MCPR works

What phisanti/MCPR does

phisanti/MCPR connects MCP-compatible AI agents with persistent R sessions. Rather than starting a new Rscript process for each request, the server maintains an R workspace where objects, loaded packages, computed results, and other session state can remain available between tool calls.

The default arrangement gives the agent a private R session owned by the MCPR server. This supports iterative analysis, including data preparation, modelling, validation, and follow-up changes to existing results. MCPR can also work alongside a human in an interactive R console by attaching the agent to a session started with mcpr_session_start().

How it works

The agent launches MCPR::mcpr_server(), normally through an MCP client configuration. Ordinary tools operate on the currently active session without requiring a session identifier on every call. Session routing is controlled separately through manage_r_sessions.

MCPR uses JSON-RPC 2.0 messaging over nanonext sockets. For graphics, it uses httpgd when available for off-screen rendering and can fall back to standard R graphics devices. Agent-targeted images include metadata and token usage information, with image handling intended to avoid oversized payloads.

A human can run mcpr_session_start() inside an existing R console. The agent can then list sessions, join a selected session, detach back to its private workspace, or create and close an MCPR-owned secondary session.

Setup and configuration

R is required. Install the package from GitHub, for example:

r
if (!require("remotes")) install.packages("remotes")
remotes::install_github("phisanti/MCPR")

The install_mcpr() helper can install the MCP configuration for Claude, Gemini, Copilot, or Codex:

r
library(MCPR)
install_mcpr(agent = "claude")

Manual configuration can launch the server with:

config.json
{
  "mcpServers": {
    "mcpr": {
      "command": "R",
      "args": ["--quiet", "--slave", "-e", "MCPR::mcpr_server()"]
    }
  }
}

The documented configuration locations are Claude Desktop settings, Gemini global or project-local settings, VS Code MCP configuration for Copilot, and Codex's global TOML configuration. Paths vary by operating system.

Tools and capabilities

  • execute_r_code(code) evaluates an R expression string in the active session and returns structured results, printed output, warnings, and errors.
  • show_plot(expr, target, width, height, format) evaluates plotting code. User-targeted output goes to the active graphics device; agent-targeted output returns a base64-encoded image with metadata and token information.
  • manage_r_sessions(action, session) lists sessions, joins a human session, starts an MCPR-owned secondary session, detaches to private/local execution, or closes an MCPR-owned secondary session.
  • view provides session inspection as part of the server's tool set.

The tools are deliberately separate: code execution, graphics, inspection, and session attachment can be composed without passing a session argument to every ordinary operation.

Limitations and notes

MCPR is marked as experimental. Its installation requires R and a GitHub package installation path. Session attachment is optional; without it, operations run in the server's private R process. Secondary sessions created by MCPR can be closed through session management, while the workflow also supports returning to the private session with detach.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCPR

phisanti/MCPR is an MCP server that connects AI agents to live R environments through persistent sessions. Its main tools execute R code, render plots for users or agents, inspect session state, and manage attachment to human or secondary R sessions. It keeps workspace state available across multi-step analysis instead of launching a fresh R process per command.

Install R and the MCPR package from GitHub, then configure the server with `install_mcpr()` or an MCP client entry that launches `R --quiet --slave -e MCPR::mcpr_server()`. The helper supports Claude, Gemini, Copilot, and Codex configuration.

Run `mcpr_session_start()` in the R console you want to share, then use `manage_r_sessions('list')` followed by `manage_r_sessions('join', session=ID)`. Use `manage_r_sessions('detach')` to return ordinary tools to the private session.

Yes, `show_plot` can return a base64-encoded image for agent analysis. Set `target` to `agent` and provide dimensions and a format; the default user target sends the plot to the active graphics device instead.

Yes, it can be used with Cursor through its standard MCP server configuration. The server is launched as an R command, while the documented convenience setup specifically targets Claude, Gemini, Copilot, and Codex.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCPR AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/phisanti-mcpr?style=directory)](https://allmcps.com/mcp/phisanti-mcpr)
HTML Embed
<a href="https://allmcps.com/mcp/phisanti-mcpr"><img src="https://allmcps.com/api/badge/phisanti-mcpr?style=directory" alt="MCPR on AllMCPs" /></a>