r-packagedev-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@r-packagedev-mcp create an R package called mypkg with a hello() function"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
r-packagedev-mcp
A standalone Model Context Protocol (MCP) server that exposes advanced R package development capabilities to AI assistants through natural language.
Overview
r-packagedev-mcp wraps the four most important R package development packages into a unified MCP tool surface:
Package | Purpose | Tools provided |
Automate package setup and configuration |
| |
Full package development cycle |
| |
Reproducible environments |
| |
Unit testing |
|
Why a standalone server instead of an add-on?
Existing R MCP servers (e.g. rmcp) focus on statistical analysis – running arbitrary R code, fitting models, generating plots. They are not designed for the package development workflow.
Building a standalone server allows:
Purpose-built tool interfaces with clear parameter names and defaults that match package development conventions.
No dependency on a third-party R MCP server that may have a different architecture, authentication model, or update cadence.
Portability – the server is a single Node.js binary that proxies calls to
Rscript; it works anywhere R is installed.Safety – tools are scoped to specific, well-defined package development operations rather than unrestricted R code execution.
Related MCP server: RStudio MCP Server
Requirements
Node.js ≥ 18
R ≥ 4.1 with the following packages installed:
install.packages(c("usethis", "devtools", "renv", "testthat"))
Installation
From source
git clone https://github.com/B0ydT/r-packagedev-mcp.git
cd r-packagedev-mcp
npm install
npm run buildRunning the server
node dist/index.jsThe server communicates over stdio (standard input/output), which is the default transport used by Claude Desktop, VS Code Copilot, Cursor, and most MCP clients.
Configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"r-packagedev": {
"command": "node",
"args": ["/path/to/r-packagedev-mcp/dist/index.js"]
}
}
}VS Code / Cursor (.mcp.json or settings)
{
"servers": {
"r-packagedev": {
"type": "stdio",
"command": "node",
"args": ["/path/to/r-packagedev-mcp/dist/index.js"]
}
}
}Tool reference
usethis
Tool | Description |
| Scaffold a new R package at a given path |
| Create |
| Create a matching test file under |
| Add |
| Create a vignette stub under |
| Add MIT |
| Add GPL-3 |
| Add a dependency to |
| Configure testthat testing infrastructure |
| Initialise a Git repo and make an initial commit |
| Create a GitHub remote and push |
| Export R objects as package data under |
| Add the |
devtools
Tool | Description |
| Simulate |
| Run roxygen2 and update |
| Run the test suite (optionally filtered) |
| Run |
| Install the package into the local library |
| Build a source tarball |
| Render |
| Spell-check documentation and vignettes |
renv
Tool | Description |
| Initialise an renv project library |
| Record current dependencies to |
| Restore packages from |
| Check library vs lockfile sync status |
| Install packages into the renv library |
| Update packages in the renv library |
| Remove unused packages / temp files |
testthat
Tool | Description |
| Run a single test file |
| Run all tests in a directory |
Development
# Type-check without emitting
npm run lint
# Build
npm run build
# Run in dev mode (ts-node, no build step)
npm run devArchitecture
src/
├── index.ts # Entry point – starts stdio MCP server
├── server.ts # Registers all tools with the MCP SDK
├── r-executor.ts # Spawns Rscript subprocesses & formats results
└── tools/
├── usethis.ts # usethis tool schemas + handlers
├── devtools.ts # devtools tool schemas + handlers
├── renv.ts # renv tool schemas + handlers
└── testthat.ts # testthat tool schemas + handlersEach tool module exports:
A schema map (
z.ZodObjectper tool) that defines input validation.A handler map that translates validated inputs into an
Rscript -ecall and returns the formatted output as MCP text content.
License
CC BY 4.0
Available Tools
30 toolsbuildB
Build a source (or binary) package tarball using devtools::build().
Inputs: project_path (required), path, binary, vignettes.
build_readmeA
Render README.Rmd to README.md and update GitHub preview using devtools::build_readme().
Inputs: project_path (required).
checkB
Run R CMD check on the package using devtools::check(). Identifies errors, warnings, and notes that would prevent CRAN submission.
Inputs: project_path (required), cran, document, error_on.
create_packageA
Create a new R package skeleton at the specified path using usethis::create_package(). Sets up DESCRIPTION, NAMESPACE, and the R/ directory.
Inputs: path (required), open, fields.
documentA
Generate roxygen2 documentation and update NAMESPACE using devtools::document(). Reads @-tags from R source and creates man/*.Rd files.
Inputs: project_path (required), roclets.
installB
Install the package into the local R library using devtools::install().
Inputs: project_path (required), upgrade, dependencies.
load_allA
Simulate installing and attaching the package using devtools::load_all(). Makes all functions available in the current R session for interactive testing.
Inputs: project_path (required), reset, recompile.
renv_cleanC
Remove unused packages or temporary files from the renv library using renv::clean().
Inputs: project_path (required), actions.
renv_initB
Initialise an renv project-local library for the project using renv::init(). Creates renv/ and renv.lock, and updates .Rprofile.
Inputs: project_path (required), bare, restart.
renv_installB
Install packages into the renv project library using renv::install(). Supports CRAN packages, GitHub (user/repo), or version-pinned installs.
Inputs: packages (required), project_path (required), rebuild.
renv_restoreB
Restore packages from renv.lock to recreate the recorded environment using renv::restore().
Inputs: project_path (required), rebuild.
renv_snapshotB
Record the current package dependencies into renv.lock using renv::snapshot().
Inputs: project_path (required), type.
renv_statusB
Report whether the project library is synchronised with renv.lock using renv::status().
Inputs: project_path (required).
renv_updateA
Update packages in the renv project library using renv::update(). If no package names are given, all outdated packages are updated.
Inputs: project_path (required), packages.
spell_checkA
Spell-check the package documentation and vignettes using devtools::spell_check().
Inputs: project_path (required), vignettes.
testA
Run the package's test suite (or a filtered subset) using devtools::test(). Reports test results in the chosen format.
Inputs: project_path (required), filter, reporter.
test_dirA
Run all test files in a directory (optionally filtered) using testthat::test_dir(). Returns a summary of pass/fail/skip counts.
Inputs: path (required), filter, reporter, stop_on_failure.
test_fileB
Run a single testthat test file using testthat::test_file(). Useful for rapid iteration on a specific file.
Inputs: file (required), reporter, project_path, stop_on_failure.
use_dataA
Export one or more R objects as package data files under data/ using usethis::use_data(). The objects must already be loaded in the R environment.
Inputs: object_names (required), project_path (required), overwrite.
use_gitC
Initialise a Git repository in the package and make an initial commit using usethis::use_git().
Inputs: project_path (required), message.
use_githubA
Create a GitHub remote for the package and push using usethis::use_github(). Requires a GitHub PAT configured via GITHUB_PAT or gh_token().
Inputs: project_path (required), private, organisation.
use_gpl3_licenseA
Add a GPL-3 LICENSE file and update DESCRIPTION License field using usethis::use_gpl3_license().
Inputs: project_path (required).
use_mit_licenseA
Add an MIT LICENSE file and update DESCRIPTION License field using usethis::use_mit_license().
Inputs: project_path (required), copyright_holder.
use_packageB
Add a package dependency to DESCRIPTION using usethis::use_package(). Supports Imports, Suggests, Depends, LinkingTo, and Enhances.
Inputs: package (required), project_path (required), type.
use_pipeA
Add the magrittr pipe (%>%) to the package via usethis::use_pipe(). Creates utils-pipe.R and updates NAMESPACE.
Inputs: project_path (required), export.
use_rA
Add a new R source file under R/ in an existing package using usethis::use_r(). Creates 'R/.R' with minimal boilerplate.
Inputs: name (required), project_path (required).
use_readme_mdC
Add a README.md to the package root using usethis::use_readme_md().
Inputs: project_path (required).
use_testA
Create a matching test file under tests/testthat/ for a given function or module using usethis::use_test(). Automatically sets up testthat if not already configured.
Inputs: name (required), project_path (required).
use_testthatB
Configure the testthat testing infrastructure for a package using usethis::use_testthat(). Creates tests/testthat/ and adds testthat to Suggests.
Inputs: project_path (required), edition.
use_vignetteA
Create a new vignette stub (Rmd file) under vignettes/ using usethis::use_vignette().
Inputs: name (required), project_path (required), title.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Each tool maps to a distinct usethis, devtools, renv, or testthat operation. Apparent overlaps like test/test_file/test_dir and install/renv_install are clearly separated by scope (suite vs file vs directory; package install vs renv library install).
Names are consistently snake_case and organized by recognizable prefixes such as use_, renv_, and test_. The bare devtools-style verbs document, test, check, install, and build break a single verb_noun convention, but they remain readable and domain-appropriate.
At 30 tools, the server is on the heavy side for an MCP surface, though most tools correspond to real R package lifecycle operations rather than filler. Some consolidation is possible (license variants, test variants, renv helper set), but the size is defensible for the broad domain.
The set covers package creation, scaffolding, dependencies, documentation, testing, checking, installation, building, Git/GitHub setup, and renv environment management. Minor gaps remain around release/version bumping, NEWS files, pkgdown, or coverage workflows, but core package development is well covered.
Maintenance
Related MCP Connectors
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.
Build and update complete applications in Apper through AI assistants using MCP.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceConnect RStudio directly to Claude Desktop, Claude Code, Codex, Gemini CLI, or any other MCP based AI assistant for interactive coding and data analysis.372-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to deeply integrate with RStudio for environment management, code execution, project management, and package management.12MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to research, plan, generate requirements, create starter projects, analyze codebases, and execute multi-step software development workflows through MCP tools.30 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to research, plan, generate requirements, user stories, task lists, and full-stack starter projects, analyze codebases, curate context, and run multi-step software development workflows through MCP tools.30 npmMIT