npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

r-packagedev-mcp

v1.0.1

Published

MCP server for R package development using usethis, devtools, renv, and testthat

Downloads

51

Readme

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 | |---------|---------|----------------| | usethis | Automate package setup and configuration | create_package, use_r, use_test, use_readme_md, use_vignette, use_mit_license, use_gpl3_license, use_package, use_testthat, use_git, use_github, use_data, use_pipe | | devtools | Full package development cycle | load_all, document, test, check, install, build, build_readme, spell_check | | renv | Reproducible environments | renv_init, renv_snapshot, renv_restore, renv_status, renv_install, renv_update, renv_clean | | testthat | Unit testing | test_file, test_dir |

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.

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 build

Running the server

node dist/index.js

The 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 | |------|-------------| | create_package | Scaffold a new R package at a given path | | use_r | Create R/<name>.R in an existing package | | use_test | Create a matching test file under tests/testthat/ | | use_readme_md | Add README.md to the package root | | use_vignette | Create a vignette stub under vignettes/ | | use_mit_license | Add MIT LICENSE and update DESCRIPTION | | use_gpl3_license | Add GPL-3 LICENSE and update DESCRIPTION | | use_package | Add a dependency to DESCRIPTION | | use_testthat | Configure testthat testing infrastructure | | use_git | Initialise a Git repo and make an initial commit | | use_github | Create a GitHub remote and push | | use_data | Export R objects as package data under data/ | | use_pipe | Add the %>% pipe operator to the package |

devtools

| Tool | Description | |------|-------------| | load_all | Simulate library(pkg) for interactive testing | | document | Run roxygen2 and update NAMESPACE | | test | Run the test suite (optionally filtered) | | check | Run R CMD check | | install | Install the package into the local library | | build | Build a source tarball | | build_readme | Render README.RmdREADME.md | | spell_check | Spell-check documentation and vignettes |

renv

| Tool | Description | |------|-------------| | renv_init | Initialise an renv project library | | renv_snapshot | Record current dependencies to renv.lock | | renv_restore | Restore packages from renv.lock | | renv_status | Check library vs lockfile sync status | | renv_install | Install packages into the renv library | | renv_update | Update packages in the renv library | | renv_clean | Remove unused packages / temp files |

testthat

| Tool | Description | |------|-------------| | test_file | Run a single test file | | test_dir | 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 dev

Architecture

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 + handlers

Each tool module exports:

  • A schema map (z.ZodObject per tool) that defines input validation.
  • A handler map that translates validated inputs into an Rscript -e call and returns the formatted output as MCP text content.

License

CC BY 4.0