Lass AI-Clients R-Code in aktiven Sessions ausführen und registriere Drittanbieter-MCP-Server als Tools in R-Chats.
Auch bekannt als posit-dev/mcptools
- Stars
- 206
- Tools
- —
- Downloads, 30 Tage
- —
- Neueste Version
- —
- Letzter Commit
- 20. Okt. 2026
- Lizenz
- —
Was ist mcptools MCP?
mcptools ist ein MCP server. Lass AI-Clients R-Code in aktiven Sessions ausführen und registriere Drittanbieter-MCP-Server als Tools in R-Chats.
Zusammenfassung generiert aus dem README des Projekts
Über mcptools MCP server
mcptools ermöglicht es Data Scientists und Entwicklern, R-Code direkt in ihren aktiven AI-Coding-Sessions auszuführen. Durch die Implementierung des Model Context Protocol in R erlaubt dieses Package AI-Assistenten wie Claude Desktop, Claude Code und VS Code GitHub Copilot, mit deiner Live-R-Umgebung zu interagieren. Du kannst die mcp_server Funktion nutzen, um R-Funktionen als Tools bereitzustellen, oder die mcp_session Funktion verwenden, um Modellen Zugriff auf spezifische Variablen und Objekte in deinen laufenden Sessions zu gewähren.
Über die Rolle als Server hinaus fungiert das Package auch als MCP Client. Dies erlaubt es dir, Drittanbieter-MCP-Server, wie zum Beispiel für GitHub, Confluence oder Google Drive, in deine R-basierten Chat-Anwendungen zu registrieren. Durch die Nutzung der mcp_tools Funktion zusammen mit der ellmer Library kannst du diese externen Tools in Apps wie shinychat oder querychat integrieren und so verschiedene Datenquellen in deine R-gesteuerten Conversational Interfaces einbinden.
Was du damit machen kannst
- 1Abfragen von Live-Daten aus der R-SessionBitte einen AI-Assistenten, spezifische Werte oder Summary Statistics aus einem Data Frame zu finden, der gerade in deiner interaktiven R-Session geladen ist.
Geschrieben aus dem README des Projekts. Jeder Use Case wurde gegen ein Zitat daraus geprüft.
Konfiguration
GITHUB_PERSONAL_ACCESS_TOKEN
| Name | Beschreibung | Typ |
|---|---|---|
| GITHUB_PERSONAL_ACCESS_TOKEN | — |
Automatisierte Checks
Geluften am 13. Nov. 2026Vollständiger Bericht →Noch nicht verifiziert. Ein Server benötigt einen Score von 80, keine kritischen Befunde und genug Daten für unsere Prüfung. Wie die Checks funktionieren · Was du für mehr Punkte verbessern kannst
- Source Repository verknüpft und erreichbarposit-dev/mcptools is public and reachablegithub.com/posit-dev/mcptools ↗Bestanden
- Paket nennt dieses Repository als QuelleNicht geprüft
- Build-Provenienz (Sigstore-Attestierung)Nicht geprüft
- Open Source Lizenz (OSI)No licenseBefund
- Commit oder Release im letzten JahrLast commit or release 2026-10-20github.com/posit-dev/mcptools ↗Bestanden
- OpenSSF ScorecardNicht geprüft
- Package-Name ähnelt keinem populären PackageNicht geprüft
- Keine kritischen Advisories im Paket oder seinen AbhängigkeitenNicht geprüft
- Keine versteckten Anweisungen an das Modell0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersBestanden
- Destruktive Tools sind markiertNicht geprüft
- Remote-Endpoint beantwortet den MCP-HandshakeNicht geprüft
README
Auf GitHub ansehenmcptools
mcptools implements the Model Context Protocol in R. There are two sides to mcptools:
R as an MCP server:
When configured with mcptools, MCP-enabled tools like Claude Desktop, Claude Code, and VS Code GitHub Copilot can run R code in the sessions you have running to answer your questions. While the package supports configuring arbitrary R functions, you may be interested in the btw package’s integrated support for mcptools, which provides a default set of tools to to peruse the documentation of packages you have installed, check out the objects in your global environment, and retrieve metadata about your session and platform.
R as an MCP client:
Register third-party MCP servers with ellmer chats to integrate additional context into e.g. shinychat and querychat apps.
Installation
Install mcptools from CRAN with:
install.packages("mcptools")
You can install the development version of mcptools like so:
pak::pak("posit-dev/mcptools")
R as an MCP server
mcptools 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):
{
"mcpServers": {
"r-mcptools": {
"command": "Rscript",
"args": ["-e", "mcptools::mcp_server()"]
}
}
}
Or, to use with Claude Code, you might type in a terminal:
claude mcp add -s "user" r-mcptools -- Rscript -e "mcptools::mcp_server()"
Then, 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.)
To deploy an HTTP MCP server to Posit Connect, add a _server.yml file
with engine: mcptools and a tools file:
engine: mcptools
tools: tools.R
Deploy the directory as an R API and mark it as MCP content:
rsconnect::deployAPI(".", contentCategory = "mcp")
If the content URL is https://connect.example.com/content/abc123/, use
https://connect.example.com/content/abc123/mcp as the MCP endpoint.
If you cannot set contentCategory = "mcp" during deployment, set the
MCP category in Connect after deploying and set minimum processes to at
least 1.
R as an MCP client
mcptools 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 configuration would look like:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
Once 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:
ch <- ellmer::chat_anthropic()
ch$set_tools(mcp_tools())
ch$chat("What issues are open on posit-dev/mcptools?")
Example
In Claude Desktop, I’ll write the following:
“From what year is the earliest recorded sample in the
foresteddata in my Positron session?”
Without 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.
Using 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.
mcptools MCP Fragen
Kann Claude Desktop R-Code aus meiner Session ausführen?
Ja. Wenn mcptools als MCP server konfiguriert ist, können Tools wie Claude Desktop, Claude Code und VS Code Copilot R-Code in deinen laufenden Sessions ausführen.
Wie installiere ich mcptools in R?
Installiere die veröffentlichte Version von CRAN mit install.packages("mcptools") oder die Entwicklerversion von GitHub mit pak::pak("posit-dev/mcptools").
Wie verbinde ich mcptools mit Claude Desktop?
Füge deinem Claude Desktop Konfigurationsfile einen Eintrag hinzu, der Rscript -e "mcptools::mcp_server()" als Server-Command ausführt.
Kann R Drittanbieter-MCP-Server als Tools nutzen?
Ja. mcptools registriert Drittanbieter-MCP-Server unter Verwendung des Claude Desktop Config-Formats, und mcp_tools() gibt ellmer Tools zurück, die du der $set_tools() Methode eines Chats übergeben kannst.
Kann ich einen mcptools MCP server auf Posit Connect deployen?
Ja. Füge eine _server.yml mit engine: mcptools und einer Tools-Datei hinzu, deploye das Verzeichnis als R API und markiere es als MCP-Content.