Memungkinkan AI client menjalankan kode R dalam sesi aktif dan mendaftarkan MCP server pihak ketiga sebagai tool dalam chat R.
Juga dikenal sebagai posit-dev/mcptools
- Stars
- 206
- Tools
- —
- Unduhan, 30 hari
- —
- Versi terbaru
- —
- Commit terakhir
- 20 Okt 2026
- Lisensi
- —
Apa itu mcptools MCP?
mcptools adalah MCP server. Memungkinkan AI client menjalankan kode R dalam sesi aktif dan mendaftarkan MCP server pihak ketiga sebagai tool dalam chat R.
Ringkasan dibuat dari README proyek
Tentang mcptools MCP server
Menjalankan kode R secara langsung di dalam sesi coding AI aktif Anda adalah apa yang dimungkinkan oleh mcptools bagi para data scientist dan developer. Dengan mengimplementasikan Model Context Protocol di R, package ini memungkinkan AI assistant seperti Claude Desktop, Claude Code, dan VS Code GitHub Copilot untuk berinteraksi dengan lingkungan R Anda yang sedang berjalan. Anda dapat menggunakan fungsi mcp_server untuk mengekspos fungsi R sebagai tool, atau menggunakan fungsi mcp_session untuk memberikan akses kepada model ke variabel dan objek spesifik dalam sesi yang sedang berjalan.
Selain bertindak sebagai server, package ini juga berfungsi sebagai MCP client. Hal ini memungkinkan Anda untuk mendaftarkan MCP server pihak ketiga, seperti untuk GitHub, Confluence, atau Google Drive, ke dalam aplikasi chat berbasis R Anda. Dengan menggunakan fungsi mcp_tools bersama library ellmer, Anda dapat mengintegrasikan tool eksternal ini ke dalam aplikasi seperti shinychat atau querychat, sehingga membawa berbagai sumber data ke dalam antarmuka percakapan berbasis R Anda.
Apa yang bisa Anda lakukan dengannya
- 1Melakukan query data sesi R yang sedang berjalanMinta AI assistant untuk menemukan nilai spesifik atau statistik ringkasan dari sebuah data frame yang saat ini sedang dimuat dalam sesi interaktif R Anda.
Ditulis berdasarkan README proyek. Setiap use case diperiksa terhadap kutipan dari README tersebut.
Konfigurasi
GITHUB_PERSONAL_ACCESS_TOKEN
| Nama | Deskripsi | Tipe |
|---|---|---|
| GITHUB_PERSONAL_ACCESS_TOKEN | — |
Pengecekan otomatis
Berjalan 13 Nov 2026Laporan lengkap →Belum diverifikasi. Sebuah server memerlukan skor 80, tidak ada temuan serius, dan data yang cukup untuk kami periksa. Cara kerja checks · Yang perlu diperbaiki untuk menambah poin
- Source repository terhubung dan dapat dijangkauposit-dev/mcptools is public and reachablegithub.com/posit-dev/mcptools ↗Lolos
- Nama paket mencantumkan repositori ini sebagai sumbernyaTidak diperiksa
- Provenance build (atestasi Sigstore)Tidak diperiksa
- Lisensi open source (OSI)No licenseTemuan
- Ada commit atau release dalam satu tahun terakhirLast commit or release 2026-10-20github.com/posit-dev/mcptools ↗Lolos
- OpenSSF ScorecardTidak diperiksa
- Nama package tidak mirip dengan package populerTidak diperiksa
- Tidak ada advisory kritis pada paket atau dependensinyaTidak diperiksa
- Tidak ada instruksi tersembunyi untuk model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersLolos
- Tools yang bersifat destruktif telah diberi labelTidak diperiksa
- Endpoint remote merespons handshake MCPTidak diperiksa
README
Lihat di GitHubmcptools
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.
Pertanyaan tentang mcptools MCP
Apakah Claude Desktop bisa menjalankan kode R dari sesi saya?
Ya. Dengan mengonfigurasi mcptools sebagai MCP server, tool seperti Claude Desktop, Claude Code, dan VS Code Copilot dapat menjalankan kode R dalam sesi yang sedang Anda jalankan.
Bagaimana cara install mcptools di R?
Install versi rilis dari CRAN menggunakan install.packages("mcptools"), atau versi pengembangan dari GitHub menggunakan pak::pak("posit-dev/mcptools").
Bagaimana cara menghubungkan mcptools ke Claude Desktop?
Tambahkan entri ke file konfigurasi Claude Desktop Anda yang menjalankan Rscript -e "mcptools::mcp_server()" sebagai command server.
Apakah R bisa menggunakan MCP server pihak ketiga sebagai tool?
Ya. mcptools mendaftarkan MCP server pihak ketiga menggunakan format konfigurasi Claude Desktop, dan mcp_tools() mengembalikan ellmer tools yang dapat Anda masukkan ke dalam method $set_tools() pada sebuah chat.
Bisakah saya men-deploy mcptools MCP server ke Posit Connect?
Ya. Tambahkan _server.yml dengan engine: mcptools dan sebuah file tools, deploy direktori tersebut sebagai R API, lalu tandai sebagai konten MCP.