Get the FREE Ultimate OpenClaw Setup Guide →

rlang

MCP server from gdbelvin/rlang-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gdbelvin-rlang-mcp-server docker run -i rlang-mcp-server:latest \
  --env USE_DOCKER="true - Ensure stdin/stdout are properly connected for MCP communication"

How to use

This MCP server provides two main tools for working with R code: render_ggplot and execute_r_script. render_ggplot accepts R code that contains ggplot2 commands and returns a rendered visualization in a specified format (PNG, JPEG, PDF, or SVG). execute_r_script runs arbitrary R scripts and returns the textual output produced by the script. The server is designed to operate in an isolated container (via Docker) to securely execute R code and manage dependencies like ggplot2. To use it, connect an MCP client over the standard IO transport; the client will issue requests to render plots or run scripts and receive the results or error messages in response. You can specify output formats and control image dimensions and resolution to tailor the visuals to your needs.

When configuring your MCP client, you can choose either a local execution path or a Docker-based path. For local execution, the MCP config may point to your local R-enabled server binary. For Docker-based execution, the client will start the container and communicate via stdio, enabling isolation and dependency management. The available formats for render_ggplot are PNG, JPEG, PDF, and SVG, and you can adjust size (width x height) and resolution to suit publication or dashboard needs.

How to install

Prerequisites

  • Docker: Install Docker Desktop or Docker Engine on your host.
  • Optional: If you prefer local non-Docker execution, ensure R 4.0+ with ggplot2 is installed on your system.
  • Access to the repository for this MCP server (rlang).

Installation steps (Docker-based)

  1. Install Docker on your machine.
  2. Build the Docker image for the MCP server:
    • Using the provided tasks in the repo (if available): task docker:build
    • Or manually build with Dockerfile (example): docker build -t rlang-mcp-server:latest .
  3. Run the server container:
    • Using the provided tasks: task docker:run
    • Or with Docker directly: docker run -i --rm --name rlang-mcp -p 0.0.0.0:8080:8080 rlang-mcp-server:latest
  4. Verify connectivity: connect your MCP client to the container’s stdio stream as described by the MCP protocol for stdio-based communication.

Optional local (non-Docker) alternative

  1. Install Go 1.22+ and build the server binary if the project provides a Go-based binary.
  2. Run the server locally according to the project’s instructions (likely via a binary path or go run command).
  3. Ensure R 4.0+ with ggplot2 is installed and accessible to the server process.

Additional notes

Notes and best practices:

  • Docker-based execution isolates R code, reducing risk from untrusted inputs. Ensure the container has appropriate resource limits to prevent abuse.
  • Output formats: PNG, JPEG, PDF, SVG. Specify format in the render_ggplot request to control the returned file type.
  • Image sizing: You can adjust width, height, and resolution to balance quality and data transfer size.
  • Error handling: If R code contains syntax errors or ggplot2 commands fail, the server will return descriptive error messages to help diagnose issues.
  • Environment variables: USE_DOCKER controls docker-based execution in some setups; adjust according to your orchestration workflow.
  • If using docker-compose, ensure the MCP client communicates via the designated stdio transport for MCP stability.

Related MCP Servers

Sponsor this space

Reach thousands of developers