MCPR is an MCP server that exposes R functions and statistical scripts to AI assistants via the Model Context Protocol. Built as an R package, it connects local or containerized R runtime environments with clients such as Claude Desktop over HTTP transport. Data scientists, statisticians, and software developers use MCPR to enable language models to execute native R routines, run statistical tests, calculate descriptive metrics, and process data structures directly within analysis workflows. Users can register functions programmatically using server tool methods or automatically expose them via roxygen-style decorators in R script files. MCPR allows users to configure host interfaces, ports, and logging levels, making it suitable for both local development setups and production environments deployed via Docker containers. By bridging the gap between conversational AI interfaces and the R ecosystem, the server provides direct access to R packages, mathematical algorithms, and custom analytics pipelines.
Category: Data & Analytics
Tags: data-science, programming, r, statistics
r devtools::install_github("chi2labs/mcpr") 2. Create and run an R script defining your server and tools: r library(mcpr) server <- mcp_http("My R Analysis Server", "1.0.0", port = 8080) server$mcp_tool(name = "calculate_mean", fn = function(numbers) mean(numbers), description = "Calculate mean") server$mcp_run() 3. Add the server URL to your Claude Desktop configuration file: json { "mcpServers": { "r-analysis": { "url": "http://localhost:8080/mcp" } } } 4. Restart Claude Desktop to use the registered R tools.Part of MCP Servers
MCPR can be installed directly inside an R environment from GitHub using the devtools package with the command devtools::install_github("chi2labs/mcpr"). Once installed, you can load the library and initialize the HTTP server using R scripts.
MCPR allows AI assistants to invoke native R functions over HTTP using the Model Context Protocol. It supports registering custom functions, importing annotated R scripts with tool decorators, and executing statistical routines like t-tests, correlation analyses, and numerical aggregations.
MCPR works with any client supporting HTTP-based Model Context Protocol connections, including Claude Desktop configured with a remote server URL, as well as development tools and agent frameworks compatible with MCP specifications.
Yes, MCPR is an open source project distributed under the MIT license with an accompanying LICENSE file in its official GitHub repository.