Connect RStudio to MCP-based LLM agents for interactive coding and analysis.
ClaudeR - The Modern Researcher's Toolkit
<b>Connect RStudio to Claude Code, Codex, Gemini CLI, or any MCP-based LLM agent for interactive coding, multi-agent orchestration, and automated manuscript auditing.</b>
ClaudeR is an R package that forges a direct link between RStudio and MCP configured LLM agents like Claude Code or Codex. This allows interactive coding sessions where the agent can execute code in your active RStudio environment so it can see the executed code and any generated plots in real-time. If you need help editing a script, a quick analysis done, or an LLM to audit your statistical claims against any manuscript before submission: ClaudeR has got your back.
This package, additionally, allows multiple agents to work on one script, or it can make multiple RStudio windows siloed so multiple agents can operate independently on different datasets. It's also compatible with Cursor and any service that supports MCP servers.
Quick Start
# Install
if (!require("devtools")) install.packages("devtools")
devtools::install_github("IMNMV/ClaudeR")
# Set up your AI tool
library(ClaudeR)
install_clauder() # For Claude Desktop / Cursor
install_cli(tools = "claude") # For Claude Code CLI
# Start the server in RStudio
claudeAddin()
AI agents: See llms-install.md for automated setup instructions.
Recent Updates (click to expand)
verify_referencestool. Extracts DOIs from a manuscript's bibliography, queries the CrossRef API for each, and returns metadata (title, authors, year, journal) for comparison against manuscript claims. Non-resolving DOIs, metadata mismatches, and references without DOIs are flagged. Works standalone ("check my references") or as Pass 4 of Reviewer Zero.- R Best Practices Protocol. Built-in statistical analysis protocol covering EDA, assumption checking, model building, diagnostics, multiple-corrections, and reporting. Load it with
r_best_practices_prompt()or tell the agent to read it. - Reviewer Zero: Automated Academic Audits. Now a 4-pass protocol for AI-driven manuscript verification. The agent extracts every statistical and methodological claim, verifies its extraction, recomputes values against the author's R code, and checks references via CrossRef. Methodological claims (e.g., "zero variance made testing impossible") are tested directly rather than accepted at face value. Run
reviewer_zero_prompt()to get the full protocol. clean_error_logtool. Point the agent at a session log and it will parse every code block, find errors, check whether a fix follows each one, then strip the error blocks and any duplicate code that preceded them. The result is a clean log with only the working code. Accepts an optionaloutput_pathto write to a separate file instead of overwriting the original.- Persistent server across UI restarts. Closing the Shiny addin (console stop or Done button) no longer kills the MCP server. Re-running
claudeAddin()reconnects to the still-running server with the correct port, session name, and execution count. Only clicking "Stop Server" in the UI actually stops the server. - Descriptive log filenames. Log files now include the session name, port, and timestamp:
clauder_default_8787_20260301_143022.R. A new log file is created each time you click Start Server. All subsequent code execution appends to that file. - Viewer content capture &
insert_texttool. Two new tools:get_viewer_contentreads HTML from interactive widgets (plotly, DT, leaflet) with pagination so agents can inspect htmlwidget output without blowing up context.insert_textinserts text at the cursor position or a specific line/column in the active document. During agent execution, htmlwidgets open in the browser instead of stealing the Shiny addin's viewer pane. - Multi-session routing fix. Agents now prefer the session named "default" when multiple sessions are active, preventing misrouting caused b
Tools (4)
verify_referencesExtracts DOIs from a manuscript and queries CrossRef API to verify metadata and resolve references.clean_error_logParses session logs to remove error blocks and duplicate code, leaving only working code.get_viewer_contentReads HTML from interactive widgets like plotly or leaflet for agent inspection.insert_textInserts text at the cursor position or a specific line/column in the active RStudio document.Configuration
{ "mcpServers": { "clauder": { "command": "Rscript", "args": ["-e", "ClaudeR::run_mcp()"] } } }