About
The mcptools package implements the Model Context Protocol in R, enabling tools like Claude and GitHub Copilot to execute R code within active sessions. It provides built-in utilities for inspecting packages, globals, and session metadata, simplifying AI-driven R workflows.
Capabilities

The mcptools package brings the Model Context Protocol (MCP) to the R ecosystem, turning an R session into a fully‑featured MCP server or client. For developers who rely on AI assistants such as Claude Desktop, Claude Code, or GitHub Copilot, this means that the assistant can execute R code directly within a running R session and return results in real time. This eliminates the need for separate scripts or manual copy‑paste, enabling a seamless “code‑in‑context” workflow where the assistant can inspect objects, run diagnostics, or generate plots on the fly.
When configured as an MCP server, mcptools exposes a set of R‑centric tools that are immediately useful in data science workflows. These include functions for reading package documentation, querying the global environment, and retrieving session metadata such as platform details. The package integrates with btw, providing a ready‑made toolset that lets assistants browse installed packages, inspect objects, and fetch environment information without any custom code. This is especially valuable for exploratory data analysis or debugging, where the assistant can suggest relevant functions or highlight potential issues in the current session.
On the client side, mcptools allows R applications to consume MCP servers from other ecosystems. By registering third‑party servers with ellmer chats, developers can inject external context—such as GitHub pull requests, Confluence pages, or Google Drive documents—into R‑based conversational interfaces like shinychat or querychat. This bidirectional integration expands the assistant’s knowledge base beyond the local R environment, enabling richer, cross‑platform interactions.
Key features of mcptools include:
- Bidirectional communication between R and MCP‑enabled assistants, allowing code execution and result retrieval within the same session.
- Built‑in tool sets via integration with btw, providing immediate access to documentation and environment introspection.
- Flexible server registration for both local R sessions and external MCP services through ellmer.
- Extensibility: developers can define custom R functions as tools, tailoring the assistant’s capabilities to specific project needs.
Real‑world use cases span from interactive data exploration—where an assistant can run or plot a histogram on demand—to automated reporting, where the assistant pulls in live data from a database and generates visualizations directly in the session. In collaborative settings, developers can share an MCP server with teammates, letting everyone leverage the same assistant‑driven code execution environment.
In short, mcptools turns R into a powerful MCP hub that bridges AI assistants with live code execution and external knowledge sources, streamlining development workflows and unlocking new possibilities for AI‑assisted programming.
Related Servers
n8n
Self‑hosted, code‑first workflow automation platform
FastMCP
TypeScript framework for rapid MCP server development
Activepieces
Open-source AI automation platform for building and deploying extensible workflows
MaxKB
Enterprise‑grade AI agent platform with RAG and workflow orchestration.
Filestash
Web‑based file manager for any storage backend
MCP for Beginners
Learn Model Context Protocol with hands‑on examples
Weekly Views
Server Health
Information
Explore More Servers
Skip Tracing POC Server
Real‑time, AI‑powered skip tracing for enterprises
Crypto Exchange MCP Server
Real‑time crypto market data for Bybit, OKX, and Binance
MCP-OpenLLM
LangChain wrapper for seamless MCP and LLM integration
James Mcp Streamable
Remote MCP server for versatile testing scenarios
MSPaint MCP Server
AI‑driven automation of MSPaint via Model Context Protocol
Host Inspector
Inspect and analyze host health via MCP.