SR

saidsurucu/rlang-mcp-python

部署与 DevOps

本页由 AI 翻译,技术细节请以原文为准。 查看原文

21 stars 3 forks 质量 64 趋势 10NOASSERTION

用于运行R语言的MCP服务器

概览

一个安全的基于 Docker 的模型上下文协议(MCP)服务器,用于 R 数据可视化和分析,使用 Python 和 FastMCP 构建。 该工具允许您通过自然语言对话与 Claude 等大型语言模型进行统计分析。所有 R 代码均在安全的 Docker 容器中执行,确保完全隔离和安全。 - 🗣️ : 与 AI 聊天进行复杂统计分析 - 🐳 : 所有 R 代码运行在隔离容器中,网络被禁用 - 📊 : AI 运行 R 代码并返回结果,无需你编写代码 - 📁 : 挂载多个本地目录供 R 访问 - 📈 : 自动返回为 base64 PNG 图像的图 - 🔒 : 可选自动编辑个人数据,避免进入 LLM - 💾 : R 变量在调用间持续存在 - ⚡ : 可配置结果缓存以实现即时重复操作 - 📦 : 自动安装缺少的 R 包 该项目灵感来自gdbelvin的rlang-mcp-server,但实际上是基于......

概述(AI 翻译)

一个安全的基于 Docker 的模型上下文协议(MCP)服务器,用于 R 数据可视化和分析,使用 Python 和 FastMCP 构建。

这是什么? 该工具允许您通过自然语言对话(如 Claude)进行 R 语言分析,如 LLM 模型。所有 R 代码均在安全的 Docker 容器中执行,确保完全隔离和安全。

主要优势:

  • 🗣️ 自然语言界面:与AI聊天进行复杂统计分析
  • 🐳 安全Docker执行:所有R代码运行在隔离容器中,网络被禁用
  • 📊 自动R执行:AI运行R代码并返回结果,无需你编写代码
  • 📁 多目录挂载:挂载多个本地目录供R访问
  • 📈 内联绘图捕捉:图表自动返回为base64 PNG图像
  • 🔒 个人信息保护:个人数据在到达LLM前的可选自动编辑
  • 💾 会话持久性:R个变量在调用之间保持
  • ⚡ 智能缓存:可配置的结果缓存,支持即时重复操作
  • 📦 自动库检测:自动安装缺失的R包
  • 🌐 土耳其语 |英语*

概述

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Python R-Server MCP

A secure, Docker-based Model Context Protocol (MCP) server for R data visualization and analysis, built with Python and FastMCP.

What is this? This tool allows you to perform statistical analysis in R through natural language conversations with LLM models like Claude. All R code is executed in secure Docker containers, ensuring complete isolation and security.

Key Benefits:

  • 🗣️ Natural Language Interface: Chat with AI to perform complex statistical analyses
  • 🐳 Secure Docker Execution: All R code runs in isolated containers with network disabled
  • 📊 Automatic R Execution: AI runs R code and returns results without you writing code
  • 📁 Multiple Directory Mounting: Mount multiple local directories for R to access
  • 📈 Inline Plot Capture: Plots automatically returned as base64 PNG images
  • 🔒 PII Protection: Optional auto-redaction of personal data before it reaches the LLM
  • 💾 Session Persistence: R variables persist between calls
  • ⚡ Smart Caching: Configurable result caching for instant repeated operations
  • 📦 Auto Library Detection: Missing R packages automatically installed

🌐 Türkçe | English

Overview

This project is inspired by gdbelvin’s rlang-mcp-server but is a complete Python reimplementation using the FastMCP framework. While the original Go version provided basic R visualization tools, this Python version extends the functionality with comprehensive security, file management, and data privacy features.

Features

🎨 Visualization & Analysis

  • ggplot2 Rendering: Execute R code with ggplot2 commands and return publication-ready visualizations
  • Inline Plot Capture: Plots automatically detected and returned as base64 PNG
  • R Script Execution: Run any R script with smart file handling and return formatted output
  • Session Persistence: R variables and workspace persist between calls via .RData

📁 File Management

  • Multiple Directory Mounting: Mount multiple local directories with custom mount points
  • Smart File Discovery: Use R scripts to explore and analyze files in mounted directories
  • Unmount Support: Cleanly unmount directories when done

📦 Package Management

  • Auto Library Detection: library() and require() calls parsed, missing packages auto-installed
  • Package Installation: Install R packages on-demand with version control
  • Automatic Dependencies: Smart package dependency resolution
  • Temporary Network: Network temporarily enabled only during package installation

🛡️ Security & Isolation

  • Mandatory Docker: All R code execution in isolated containers
  • Network Disabled by Default: Container cannot access internet during R execution
  • Resource Limits: Configurable memory (default 2GB) and CPU limits
在 GitHub 查看完整 README

安装

uvx --from git+https://github.com/saidsurucu/rlang-mcp-python rlang-mcp-python
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "r-server-python": { "command": "uvx", "args": [ "--from", "git+https://github.com/saidsurucu/rlang-mcp-python", "rlang-mcp-python" ] } } }