MatPlotLibNet.Mcp
1.25.0
See the version list below for details.
{ "inputs": [ { "type": "promptString", "id": "MATPLOTLIBNET_MCP_OUTPUT_ROOT", "description": "The only directory save_chart may write under. Defaults to the system temp directory." }, { "type": "promptString", "id": "MATPLOTLIBNET_FONTS", "description": "Font files (.ttf, .otf) and directories of them, separated by ';', registered at startup so a chart can use a script the bundled font lacks (Devanagari, Thai, Chinese). Arabic and Hebrew work without it." } ], "servers": { "MatPlotLibNet.Mcp": { "type": "stdio", "command": "dnx", "args": ["MatPlotLibNet.Mcp@1.25.0", "--yes"], "env": { "MATPLOTLIBNET_MCP_OUTPUT_ROOT": "${input:MATPLOTLIBNET_MCP_OUTPUT_ROOT}", "MATPLOTLIBNET_FONTS": "${input:MATPLOTLIBNET_FONTS}" } } } }
.vscode/mcp.json settings file.
dotnet tool install --global MatPlotLibNet.Mcp --version 1.25.0
dotnet new tool-manifest
dotnet tool install --local MatPlotLibNet.Mcp --version 1.25.0
#tool dotnet:?package=MatPlotLibNet.Mcp&version=1.25.0
nuke :add-package MatPlotLibNet.Mcp --version 1.25.0
MatPlotLibNet.Mcp
mcp-name: io.github.xkqg/matplotlibnet
An MCP (Model Context Protocol) server for MatPlotLibNet. It gives an AI agent (Claude Code, VS Code, Claude Desktop, or any other MCP host) five tools:
| tool | what it does |
|---|---|
render_chart |
renders a chart spec to a PNG image the model can look at |
save_chart |
writes the chart as PNG, SVG or PDF to a file and returns the path it wrote |
chart_data_table |
returns the chart's data as markdown tables the model can read, and the same values as structured content it can compute with |
list_chart_types |
lists the chart types the spec accepts; the list is read from the library's own registry |
describe_chart_schema |
describes the fields of the spec and gives a worked example for a chart type |
The server communicates over stdio. It is a .NET tool: a host runs it with dnx MatPlotLibNet.Mcp (the .NET 10 SDK
resolves and starts it), or with dotnet tool exec MatPlotLibNet.Mcp.
{
"servers": {
"MatPlotLibNet.Mcp": {
"type": "stdio",
"command": "dnx",
"args": ["MatPlotLibNet.Mcp", "--yes"]
}
}
}
The spec
The spec is the library's own figure JSON: the same document that figure.ToJson() writes and
ChartSerializer.FromJson reads. The agent can therefore ask for any chart the library can draw:
{
"width": 800, "height": 600, "title": "Revenue",
"subPlots": [{
"series": [{ "type": "line", "xData": [1, 2, 3, 4, 5], "yData": [2, 4, 3, 5, 1], "label": "Q1" }]
}]
}
The server validates the spec before it renders. It rejects an unknown field, an unknown chart type, a misspelled
enum value, a colour the library does not know, or a missing size. The error message names the field that is
wrong, so the model can correct the spec instead of receiving a blank picture. It checks every axis and every series
of a subplot the same way, a left-hand Y axis or the fifth right-hand one included, and the message names the place
(for example $.subPlots[0].leftYAxes[1].series[0].type). A chart can have any number of Y axes on either side.
A spec's dpi sizes the PNG it renders, as WithDpi does in code: an 800 by 600 spec at 192 dpi is a 1600 by 1200
pixel picture with the same layout, drawn finer. SVG and PDF ignore it. The canvas ceiling (4,000 by 4,000 pixels)
holds for the picture the spec draws, so its width and height times dpi / 96 must stay inside it: 400 wide at 960 dpi
is exactly 4,000 pixels. A spec over the ceiling is refused with a message that names dpi, the size it would draw and
the ceiling.
What comes back
render_chart returns the PNG as an image block. Beside it, it returns a short text summary (chart types, series,
axis ranges), so a model that cannot see the image still knows what it made. SVG and PDF output is large, so it
goes to a file through save_chart and is never returned inline.
The SVG this server writes stores text as glyph outlines (<path>), not as <text> elements. This is because the
PNG backend is loaded in the same process, and the library then embeds its own font so that the drawing is
identical everywhere.
Limits
save_chartwrites only under one directory: the system temp directory, or the one named by theMATPLOTLIBNET_MCP_OUTPUT_ROOTenvironment variable. It never overwrites an existing file unless asked.- Arabic and Hebrew text work without setup. For Devanagari, Thai, Chinese, Japanese or Korean, name font files
or directories of font files in the
MATPLOTLIBNET_FONTSenvironment variable, separated by;; they are registered when the server starts. A bad entry is logged and skipped. - The server refuses a canvas larger than the documented ceiling, and the error message states the ceiling.
License
MIT — see the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.29.0 | 104 | 11/1/2026 |
| 1.28.0 | 104 | 10/31/2026 |
| 1.27.0 | 110 | 10/30/2026 |
| 1.26.0 | 105 | 10/30/2026 |
| 1.25.0 | 109 | 10/29/2026 |
| 1.24.0 | 101 | 10/29/2026 |
| 1.23.0 | 112 | 10/27/2026 |
| 1.22.0 | 102 | 10/24/2026 |
| 1.21.0 | 102 | 10/23/2026 |
| 1.20.0 | 100 | 10/22/2026 |
| 1.19.0 | 109 | 10/21/2026 |
| 1.18.2 | 108 | 10/18/2026 |
| 1.18.1 | 149 | 10/12/2026 |
| 1.18.0 | 164 | 9/23/2026 |
| 1.17.1 | 131 | 9/13/2026 |
| 1.17.0 | 168 | 9/12/2026 |
| 1.16.0 | 139 | 9/12/2026 |
| 1.15.1 | 136 | 9/12/2026 |
| 1.15.0 | 136 | 9/11/2026 |
MatPlotLibNet 1.25.0. What changed in this release, and in every release before it, is written out in the changelog: https://github.com/xkqg/MatPlotLibNet/blob/main/CHANGELOG.md#1250