R mcptools
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 CodeFrom its SKILL.md
npx -y skills add arthurgailes/r-package-skills --skill r-mcptoolsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 23 stars23 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.2 KB, as published. Nobody here has run it
mcptools: R as Model Context Protocol Server
Overview
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")
References
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 configuration
When to Use
- Let Claude Code/VS Code run R code
- Give agents access to live R session
- Expose R functions as MCP tools
- Query R data stores from agents
When NOT to Use
- Want to call LLMs FROM R (use r-ellmer)
- Just need R object descriptions (use r-btw)
- Building chatbot in R (use r-ellmer + r-btw)
Quick Reference
library(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.
Common Mistakes
| 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 |
Core Functions
Session Management:
mcp_session(): Initialize MCP session (console only, per startup)mcp_mcp_server(): Launch MCP server
Advanced
See references/ for:
- API.md: Complete function reference
- server.md: R as MCP server details
- Package docs: Full package documentation
Integration
With Claude Code: Call mcp_session() in R console
With ragnar: Agents can query ragnar stores
Cross-package patterns: See r-ai meta-skill