From r-package-skills
Use when code loads or uses mcptools (library(mcptools), mcptools::), connecting AI agents to R sessions via MCP, or exposing R as an MCP server for Claude Code or VS Code
How this skill is triggered — by the user, by Claude, or both
Slash command
/r-package-skills:r-mcptoolsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**mcptools lets AI agents INTO your R session.** Agents (Claude Code, VS Code, etc.) can run R code, query data, call functions in your live R environment.
mcptools lets AI agents INTO your R session. Agents (Claude Code, VS Code, etc.) can run R code, query data, call functions in your live R environment.
btw vs mcptools: btw gives tools TO ellmer (R → LLM). mcptools lets agents INTO R (LLM → R).
Install: install.packages("mcptools")
Read references/API.md before writing code.
references/API.md - Complete function referencereferences/package-docs.md - Setup and configurationreferences/server.md - MCP server setup and agent configurationlibrary(mcptools)
# In R console (each startup, NOT in scripts)
mcp_session()
# Now Claude Code can:
# - Run R code
# - Query data frames
# - Call your R functions
# - Access documentation
CRITICAL: Call mcp_session() in console at each R startup, NOT in scripts.
| Issue | Solution |
|---|---|
| btw vs mcptools confusion | btw = tools TO chat; mcptools = agent INTO R |
| mcp_session() in scripts | Call in console, each startup |
| Expecting clipboard copy | mcptools is for agent access, not clipboard |
| Session not detected | Restart R, call mcp_session() in console |
Session Management:
mcp_session(): Initialize MCP session (console only, per startup)mcp_mcp_server(): Launch MCP serverSee references/ for:
With Claude Code: Call mcp_session() in R console
With ragnar: Agents can query ragnar stores
Cross-package patterns: See r-ai meta-skill
npx claudepluginhub arthurgailes/r-package-skills --plugin r-package-skillsUse when code loads or uses btw (library(btw), btw::), providing R session context to LLMs, registering tools for ellmer chat, or copying R object descriptions to clipboard
Configures MCP servers for Claude Code and Claude Desktop, including mcptools (R), Hugging Face, and custom servers. Handles WSL path translation and multi-client setup.
Modern R operations for data analysis, statistics, and reproducible work. Use for: R, Rstats, tidyverse, dplyr, tidyr, ggplot2, the native pipe |>, tibbles, data wrangling (filter/mutate/summarise/group_by/across/joins/pivot), reading and writing data (readr, readxl, arrow/Parquet, DBI/dbplyr databases, data.table::fread, rvest scraping), strings (stringr) and regex, dates/times (lubridate), factors (forcats), iteration and functional programming (purrr map family, list-columns), statistics and modeling (t.test/lm/glm, formulas, broom, tidymodels), high-performance data.table, time series (tsibble/fable, zoo/xts), and project workflow (renv, Quarto, here, testthat, styler, RStudio/Posit Projects). Covers tidyverse-first idioms with base R and data.table as named alternatives.