PlotMCP Server

PlotMCP Server

An MCP server that enables LLMs to generate high-quality SVG charts using matplotlib, supporting various plot types like line, bar, and heatmaps. It provides flexible configuration for dimensions and axis scales, returning either raw SVG content or paths to saved image files.

Category
Visit Server

README

PlotMCP Server

PlotMCP is a powerful Model Context Protocol (MCP) server designed to enable LLMs to generate high-quality SVG charts from structured data. It leverages fastmcp for the server infrastructure and matplotlib for consistent, precise chart rendering.

Key Features

  • Pure SVG Rendering: Generates static SVG format with no external JavaScript dependencies. Safe, portable, and easy to embed.
  • Multiple Plot Types: Supports Line, Scatter, Bar, Area, Histogram, Box, Heatmap, Contour, and Pie charts.
  • Flexible Configuration: Full control over titles, dimensions, margins, and axis properties (linear, log, and symlog scales).
  • Output Management: When --output-dir is configured, automatically saves generated charts and returns a specially formatted response that clients can parse to display the image:
    ```local_image
    /path/to/chart.svg
    ```
    
    This format allows clients to easily detect and render the generated images.
  • Deterministic Output: Ensures identical inputs produce bit-identical SVG outputs.

Installation

Requires Python >= 3.11 and uv installed.

Local Installation (Development)

git clone <repository-url>
cd plot-mcp
uv sync

Install as a Global Tool

uv tool install .

Running the Server

Running from Source

uv run plot-mcp --output-dir ./plots

Running Remotely via GitHub (using uvx)

You can run the server directly from the GitHub repository without manual cloning:

uvx --from git+https://github.com/Nexo-Agent/plot-mcp plot-mcp --output-dir ./plots

Note: Replace the URL with the actual repository location.

CLI Configuration

The server supports the following command-line options:

  • --output-dir PATH: Directory where generated SVG files will be saved. When set, tools return the file path instead of the raw SVG content.
  • --transport [stdio|sse|streamable-http]: The communication protocol (default: stdio).
  • --port INTEGER: The port for SSE or HTTP transport (default: 8000).

Output Format

The server supports two output modes depending on whether --output-dir is configured:

Without --output-dir (Default)

Tools return a PlotOutput object containing the raw SVG content:

{
  "svg": "<svg>...</svg>",
  "width": 800,
  "height": 400,
  "viewBox": "0 0 800 400"
}

With --output-dir (Recommended)

Tools save the SVG to a file and return a specially formatted string:

```local_image
/absolute/path/to/chart.svg
```

This format is designed to be easily parsed by clients. When your client receives a response containing this pattern, it should:

  1. Detect the ```local_image marker
  2. Extract the file path
  3. Load and display the image from that path

This approach keeps the response lightweight and allows clients to handle image rendering efficiently.

See examples/local_image_format.py for a complete demonstration of how this format works.

Available Tools

The LLM can invoke the following tools:

  1. plot_line: Render continuous 2D lines.
  2. plot_scatter: Render discrete 2D points.
  3. plot_bar: Render categorical bar charts.
  4. plot_area: Render filled area under a curve.
  5. plot_histogram: Render 1D histograms.
  6. plot_box: Render box plots from raw values.
  7. plot_heatmap: Render 2D matrix as a color grid.
  8. plot_contour: Render 2D contour lines.
  9. plot_pie: Render circular pie and donut charts.

Chart Configuration

All tools accept a shared config object to customize the visual output:

{
  "title": "My Chart",
  "width": 800,
  "height": 400,
  "margin": { "top": 40, "right": 20, "bottom": 40, "left": 50 },
  "x_axis": { "label": "X Axis", "scale": "linear" },
  "y_axis": { "label": "Y Axis", "scale": "log" }
}

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured