{"id":29941753,"url":"https://github.com/posit-dev/mcptools","last_synced_at":"2026-04-07T19:31:56.327Z","repository":{"id":284632885,"uuid":"955571244","full_name":"posit-dev/mcptools","owner":"posit-dev","description":"Model Context Protocol For R","archived":false,"fork":false,"pushed_at":"2026-03-10T14:40:32.000Z","size":166796,"stargazers_count":160,"open_issues_count":7,"forks_count":14,"subscribers_count":8,"default_branch":"main","last_synced_at":"2026-03-10T20:49:05.628Z","etag":null,"topics":["mcp-server","r"],"latest_commit_sha":null,"homepage":"https://posit-dev.github.io/mcptools/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/posit-dev.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-26T21:10:12.000Z","updated_at":"2026-03-10T14:39:05.000Z","dependencies_parsed_at":"2025-10-19T19:07:57.844Z","dependency_job_id":"9b18ffb0-e089-444e-a758-5dbe9b8062c4","html_url":"https://github.com/posit-dev/mcptools","commit_stats":null,"previous_names":["simonpcouch/rmcp","posit-dev/acquaint","simonpcouch/acquaint","posit-dev/mcptools"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/posit-dev/mcptools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fmcptools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fmcptools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fmcptools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fmcptools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posit-dev","download_url":"https://codeload.github.com/posit-dev/mcptools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fmcptools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31526666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mcp-server","r"],"created_at":"2025-08-03T01:27:50.707Z","updated_at":"2026-04-07T19:31:56.322Z","avatar_url":"https://github.com/posit-dev.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# mcptools \u003ca href=\"https://posit-dev.github.io/mcptools/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"240\" alt=\"A hexagonal logo showing a bridge connecting two portions of a forested meadow.\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![CRAN status](https://www.r-pkg.org/badges/version/mcptools)](https://CRAN.R-project.org/package=mcptools)\n[![R-CMD-check](https://github.com/posit-dev/mcptools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/posit-dev/mcptools/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nmcptools implements the [Model Context\nProtocol](https://modelcontextprotocol.io/) in R. There are two sides to\nmcptools:\n\n**R as an MCP server**: \n\n```{r}\n#| label: r-as-a-server\n#| echo: false\n#| fig-alt: \"A system architecture diagram showing three main components: Client (left), Server (center), and Session (right). The Client box lists AI coding assistants including Claude Desktop, Claude Code, Copilot Chat in VS Code, and Positron Assistant. The Server is initiated with `mcp_server()` and contains tools for R functions like reading package documentation, running R code, and inspecting global environment objects. Sessions can be configured with `mcp_session()` and can optionally connect to interactive R sessions, with two example projects shown: 'Some R Project' and 'Other R Project'.\"\nknitr::include_graphics(\"man/figures/r_as_a_server.png\")\n```\n\nWhen configured with mcptools, MCP-enabled\ntools like Claude Desktop, Claude Code, and VS Code GitHub Copilot can\nrun R code *in the sessions you have running* to answer your\nquestions. While the package supports configuring arbitrary R\nfunctions, you may be interested in the\n[btw](https://posit-dev.github.io/btw/) package’s integrated support for\nmcptools, which provides a default set of tools to to peruse the \ndocumentation of packages you have installed, check out the objects in your \nglobal environment, and retrieve metadata about your session and platform.\n\n**R as an MCP client**: \n\n```{r}\n#| label: r-as-a-client\n#| echo: false\n#| fig-alt: \"An architecture diagram showing the Client (left) with R code using the ellmer library to create a chat object and then setting tools from mcp with `mcp_tools()`, and the Server (right) containing third-party tools including GitHub (for reading PRs/Issues), Confluence (for searching), and Google Drive (for searching). Bidirectional arrows indicate communication between the client and server components.\"\nknitr::include_graphics(\"man/figures/r_as_a_client.png\")\n```\n\nRegister third-party MCP servers with [ellmer](https://ellmer.tidyverse.org/)\nchats to integrate additional context into\ne.g. [shinychat](https://github.com/posit-dev/shinychat) and\n[querychat](https://posit-dev.github.io/querychat/) apps.\n\n\u003e NOTE:\n\u003e \n\u003e This package used to be called acquaint and supplied a default set of tools from [btw](https://github.com/posit-dev/btw) when R was used as an MCP server. The direction of the dependency has been reversed; to use the same functionality from before, transition `acquaint::mcp_server()` to `btw::btw_mcp_server()` and `acquaint::mcp_session()` to `btw::btw_mcp_session()`.\n\n## Installation\n\nInstall mcptools from CRAN with:\n\n```r\ninstall.packages(\"mcptools\")\n```\n\nYou can install the development version of mcptools like so:\n\n```r\npak::pak(\"posit-dev/mcptools\")\n```\n\n### R as an MCP server\n\nmcptools can be hooked up to any application that supports MCP. For example, to use with Claude Desktop, you might paste the following in your Claude Desktop configuration (on macOS, at  `~/Library/Application Support/Claude/claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"r-mcptools\": {\n      \"command\": \"Rscript\",\n      \"args\": [\"-e\", \"mcptools::mcp_server()\"]\n    }\n  }\n}\n```\n\nOr, to use with Claude Code, you might type in a terminal:\n\n```bash\nclaude mcp add -s \"user\" r-mcptools -- Rscript -e \"mcptools::mcp_server()\"\n```\n\nThen, if you'd like models to access variables in specific R sessions, call `mcptools::mcp_session()` in those sessions. (You might include a call to this function in your .Rprofile, perhaps using `usethis::edit_r_profile()`, to automatically register every session you start up.)\n\n### R as an MCP client\n\nmcptools uses the Claude Desktop configuration file format to register third-party MCP servers, as most MCP servers provide setup instructions for Claude Desktop in their documentation. For example, here's what the [official GitHub MCP server](https://github.com/github/github-mcp-server) configuration would look like:\n\n```json\n{\n  \"mcpServers\": {\n    \"github\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"-i\",\n        \"--rm\",\n        \"-e\",\n        \"GITHUB_PERSONAL_ACCESS_TOKEN\",\n        \"ghcr.io/github/github-mcp-server\"\n      ],\n      \"env\": {\n        \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"\u003cYOUR_TOKEN\u003e\"\n      }\n    }\n  }\n}\n```\n\nOnce the configuration file has been created (by default, mcptools will look to `file.path(\"~\", \".config\", \"mcptools\", \"config.json\")`), `mcp_tools()` will return a list of ellmer tools which you can pass directly to the `$set_tools()` method from ellmer:\n\n```\nch \u003c- ellmer::chat_anthropic()\nch$set_tools(mcp_tools())\n\nch$chat(\"What issues are open on posit-dev/mcptools?\")\n```\n\n## Example\n\nIn Claude Desktop, I'll write the following:\n\n\u003e \"From what year is the earliest recorded sample in the `forested` data in my Positron session?\"\n\nWithout mcptools, Claude couldn't get far here; by default, it can't run R code and doesn't have any way to \"speak to\" my interactive R sessions. \n\n```{r}\n#| echo: false\n#| fig-alt: \"A screencast of a chat with Claude. After the question is asked, a tool called 'describe data frame' is called with the `data_frame` argument set to `forested`. The results are returned from mcptools as json, which the model then integrates into its response: 'Based on the data structure, I can see there's a `year` column with values ranfing from 1995 to 2024. The earliest recorded sample in the `forested` data is from 1995.'\"\nknitr::include_graphics(\"https://github.com/user-attachments/assets/064df664-2669-498e-a644-fb191a30235f\")\n```\n\nUsing the package, the model asks to describe the data frame using a structure that will show summary statistics from the data. mcptools will appropriately route the request to the open Positron session, forwarding the results back to the model for it to situate in a response.\n","funding_links":[],"categories":["Frameworks \u0026 SDKs","📚 Projects (1974 total)","📦 Other"],"sub_categories":["Trading \u0026 Exchanges","MCP Servers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fmcptools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposit-dev%2Fmcptools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fmcptools/lists"}