Skip to main content

Charts MCP

The Charts model context protocol (MCP) server lets AI assistants create and render Avalonia Charts from natural language requests. Your assistant can choose a chart type, provide JSON data, customize common options such as size, theme, labels, and palette, then receive a rendered PNG preview with C# and XAML snippets.

Charts MCP runs as a local stdio MCP server. It creates controls from Avalonia.Controls.Charts and renders them through Avalonia Headless and Skia. Use it for chart generation, chart exploration, and code scaffolding.

note

Charts MCP does not attach to a running Avalonia application or inspect the visual tree. For live application inspection, use the DevTools MCP.

For a general introduction to MCP, see AI Tools.

Prerequisites

Before setting up the MCP server, ensure you have:

  • .NET SDK installed. The server is distributed as a .NET tool.
  • Valid Avalonia Pro license with Charts. Charts are included with Avalonia Pro. Not included with Community, Plus, and legacy Accelerate subscriptions.
  • A NuGet source that contains the Charts MCP packages. The dotnet tool install command only works if Avalonia.Controls.Charts.Mcp and its matching runtime packages, such as Avalonia.Controls.Charts.Mcp.osx-arm64, are available from one of your configured NuGet sources.
  • An MCP-capable editor or assistant. VS Code, Visual Studio, Rider, Cursor, Windsurf, Claude Code, Claude Desktop, and Gemini CLI can be configured with MCP servers.

Install the server

  1. Configure a NuGet package source that contains Avalonia.Controls.Charts.Mcp and its matching runtime packages.
  2. Install the Charts MCP server as a global .NET tool by running dotnet tool install.
dotnet tool install --global Avalonia.Controls.Charts.Mcp
  1. If dotnet reports that the package cannot be found, confirm that the required package source is configured and enabled. Check your NuGet sources by running this command.
dotnet nuget list source
  1. The Charts MCP server is accessed by running the following command. Most editors do this automatically once configured.
mcp-server-charts
tip

If the command line cannot find mcp-server-charts after installation, check that the .NET global tools directory is on your PATH. On macOS and Linux, it is usually ~/.dotnet/tools. On Windows, it is usually %USERPROFILE%\.dotnet\tools.

Chart rendering requires a valid Avalonia Pro license with Charts in the MCP server process. Set AVALONIA_LICENSE_KEY in your environment, or add "env": { "AVALONIA_LICENSE_KEY": "your-license-key" } to your MCP client configuration if the editor does not inherit shell variables. Do not commit the key.

Run from source

If you are working from a source checkout instead of an installed tool:

  1. Build the MCP project.
dotnet build /absolute/path/to/Avalonia.Controls.Charts/src/Avalonia.Controls.Charts.Mcp/Avalonia.Controls.Charts.Mcp.csproj
  1. Configure your MCP client to run:
dotnet run --project /absolute/path/to/Avalonia.Controls.Charts/src/Avalonia.Controls.Charts.Mcp/Avalonia.Controls.Charts.Mcp.csproj
note

Running from source is intended for contributors and local validation. Chart generation requires a valid Avalonia Pro (or higher) license. If chart rendering fails with a chart initialization or licensing error, verify the Charts license setup for your build or package.

Set up the MCP server in your editor

The examples below use the global .NET tool command. If you are running from source, replace "command": "mcp-server-charts" with:

"command": "dotnet",
"args": [
"run",
"--project",
"/absolute/path/to/Avalonia.Controls.Charts/src/Avalonia.Controls.Charts.Mcp/Avalonia.Controls.Charts.Mcp.csproj"
]

Option A: Command palette

  1. Open the command palette (Ctrl+Shift+P / Cmd+Shift+P).
  2. Run MCP: Add Server.
  3. Select stdio as the server type.
  4. Enter mcp-server-charts as the command.
  5. Set the server name to avalonia_charts.
  6. Choose whether to install the server for this workspace or globally.

Option B: Manual configuration

Add the following to .vscode/mcp.json in your workspace root:

.vscode/mcp.json
{
"servers": {
"avalonia_charts": {
"type": "stdio",
"command": "mcp-server-charts"
}
}
}

Verify the connection

After configuring the MCP server, verify it is working:

  1. Check the server is running. Open your editor's MCP panel or status indicator. (In VS Code, this is MCP: List Servers from the command palette.) Confirm avalonia_charts appears as a connected server.
  2. Test with a prompt. Ask your AI assistant:
List the available Avalonia chart tools and show me the data format for a bar chart.

You can also test chart rendering with:

Create a dark themed Avalonia bar chart titled Quarterly Revenue with Q1=125, Q2=148, Q3=171, and Q4=193. Use a blue and green palette.

Usage examples

Describe the chart you want in natural language. The AI assistant calls the MCP tools automatically.

Generating a chart preview

Create a line chart comparing monthly signups from January through June. Use the default light theme and include the generated Avalonia code.

Choosing a chart type

Read the Avalonia Charts catalog resource and recommend a chart for showing stage-by-stage sales conversions.

Using a specific tool

Use avalonia_sankey_chart to show product flow from Acquisition to Activation to Retention. Render it at 900x520.

Creating app code

Create an Avalonia combo chart with a bar series for revenue and a line series for margin. Return the generated C# and XAML so I can adapt it to MVVM.

Debugging data formats

Show me the required data format for avalonia_calendar_heatmap, then render a small example.

Available tools

The Charts MCP server exposes 86 chart generation tools and one catalog tool.

Catalog

ToolDescription
avalonia_list_chartsLists all available charts with descriptions and example data formats.

Cartesian

ToolDescription
avalonia_line_chartTrends and time-series data.
avalonia_area_chartQuantitative data with filled areas.
avalonia_bar_chartComparing values across categories.
avalonia_scatter_chartRelationships between two variables.
avalonia_combo_chartCombined series, such as bar and line together.

Circular

ToolDescription
avalonia_pie_chartProportions of a whole.
avalonia_donut_chartProportions with a center hole.
avalonia_progress_donutSingle-value circular progress.
avalonia_semi_donutSemi-circle proportions.
avalonia_nightingale_rosePolar area chart, also known as a Coxcomb chart.
avalonia_radial_bar_chartBars arranged in a circle.
avalonia_sunburst_chartHierarchical proportions.

Gauge

ToolDescription
avalonia_gauge_chartStandard dial gauge.
avalonia_bullet_chartPerformance compared with target and ranges.
avalonia_circular_gaugeCircular needle indicator.
avalonia_linear_gaugeHorizontal or vertical scale indicator.
avalonia_gradient_ring_chartProgress or value as a colored ring.
avalonia_liquid_fill_gaugeValue as a fluid level.

Polar

ToolDescription
avalonia_radar_chartMultivariate comparisons.
avalonia_polar_chartAngular and radial line data.
avalonia_wind_rose_chartDirectional frequency distributions.
avalonia_smith_chartComplex impedance and engineering data.
avalonia_polar_area_chartEqual-angle sectors with variable radii.

Statistical

ToolDescription
avalonia_violin_plotDistribution density and range.
avalonia_boxplot_chartQuartiles, median, and outliers.
avalonia_ridgeline_chartMultiple distribution comparisons.
avalonia_beeswarm_plotIndividual point distribution.
avalonia_contour_plotTwo-dimensional density contours.
avalonia_density_plotKernel density estimation.
avalonia_strip_plotPoints along a single categorical axis.

Comparison and ranking

ToolDescription
avalonia_tornado_chartPaired comparison by category.
avalonia_bump_chartChanges in rank over time.
avalonia_slope_chartBefore and after state changes.
avalonia_dumbbell_chartRange or gap comparisons.
avalonia_pareto_chartFrequency with cumulative percentage.
avalonia_mirror_bar_chartBack-to-back horizontal bars.
avalonia_diverging_bar_chartOpposing positive and negative values.
avalonia_pyramid_chartHierarchical breakdown.
avalonia_population_pyramidAge and demographic structure.
avalonia_funnel_chartSequential process stages.

Flow and network

ToolDescription
avalonia_sankey_chartFlow between multiple categories.
avalonia_arc_diagramLinks between ordered nodes.
avalonia_chord_diagramInter-relationships in a circle.
avalonia_alluvial_chartStructural changes over steps or time.
avalonia_flow_chartGeneral process flow diagrams.
avalonia_network_chartNode-link relationships.
avalonia_force_directed_graphPhysics-based node graph layout.
avalonia_organization_chartTraditional hierarchy tree.

Proportional and hierarchical

ToolDescription
avalonia_treemap_chartNested rectangles for hierarchies.
avalonia_icicle_chartAdjacency diagram hierarchy.
avalonia_circle_packing_chartHierarchy packed into nested circles.
avalonia_dendrogram_chartHierarchical clustering tree.
avalonia_flame_graphStack or profile hierarchy visualization.
avalonia_indented_tree_chartIndented hierarchy tree.
avalonia_radial_tree_chartHierarchy arranged radially.
avalonia_waffle_chartGrid for percentages.
avalonia_mekko_chartVariable-width stacked bars.
avalonia_parliament_chartSeat distribution hemicycle.
avalonia_venn_chartSet relationships and intersections.

Grid and matrix

ToolDescription
avalonia_heatmap_chartValue intensity by color grid.
avalonia_matrix_chartCorrelation or relationship matrix.
avalonia_carpet_plotTwo independent variables against a dependent variable.
avalonia_hexbin_chartHexagonal bin density for X/Y points.
avalonia_mosaic_chartProportional groups and subgroups.
avalonia_parallel_coordinates_chartMultidimensional records across parallel axes.
avalonia_ternary_chartThree-part composition plot.
avalonia_calendar_heatmapActivity distribution by date.

Time and scheduling

ToolDescription
avalonia_gantt_chartProject management and task schedules.
avalonia_swimlane_chartWorkflow tasks grouped by lane.
avalonia_event_timelineChronological time events.
avalonia_spiral_timelineTime represented as a spiral.

Financial

ToolDescription
avalonia_candlestick_chartFinancial price movement.
avalonia_ohlc_chartOpen-high-low-close (OHLC) bars.
avalonia_heikin_ashi_chartSmoothed OHLC trend candles.
avalonia_kagi_chartPrice reversal movement chart.
avalonia_renko_chartFixed-size price movement bricks.
avalonia_point_and_figure_chartX/O price movement columns.

Map

ToolDescription
avalonia_choropleth_mapGeographic regions colored by values.
avalonia_shape_mapCustom multilayer geometric shapes.

Dashboard, data, text, and bubble

ToolDescription
avalonia_sparkline_chartCompact trend lines.
avalonia_kpi_cardMetric display with status or change.
avalonia_table_chartTabular data with conditional styling.
avalonia_word_cloudWord frequency cloud.
avalonia_bubble_chartBubble chart using X, Y, and size values.
avalonia_packed_bubble_chartNon-hierarchical bubble packing.
avalonia_bubble_cloudForce-directed bubble cloud layout.

Available resources

The server also exposes MCP resources that your assistant can read before calling chart tools. They can help the assistant choose a chart type, check an input shape, or pick a color palette.

Resource URIDescription
charts://catalogComplete chart catalog grouped by category.
charts://palettesDefault and suggested palette values.
charts://data-formatsData format references, derived from catalog examples.

Inputs and outputs

Most chart tools accept a title, a JSON data string, optional width and height values, and an optional theme. Some tools expose chart-specific arguments, such as geoJson, nodes or innerRadius.

JSON property names are case-insensitive. For example, Label, label, and LABEL map to the same property.

[
{ "Label": "Q1", "Value": 125 },
{ "Label": "Q2", "Value": 148 },
{ "Label": "Q3", "Value": 171 },
{ "Label": "Q4", "Value": 193 }
]

Color palettes are passed as comma-separated color codes:

#2196F3, #4CAF50, #FF9800

theme accepts Light or Dark. A successful chart generation response contains a rendered image/png preview, generated C# code, and generated XAML if supported.

Privacy and security

Charts MCP runs locally. Chart data is parsed and rendered in the MCP server process, and the server does not call external LLM providers or read provider API keys.

The MCP client receives the rendered chart image and generated code. Generated snippets can contain labels, values, colors, and other fields from the chart request.

Do not include secrets, credentials, or sensitive personal data in JSON, titles, labels, or descriptions, unless the connected MCP client is approved to receive that data.

Troubleshooting

mcp-server-charts command not found

The mcp-server-charts command must be on your system's PATH. If you installed it as a global .NET tool, check that PATH is available to your editor. This is usually ~/.dotnet/tools on macOS and Linux, or %USERPROFILE%\.dotnet\tools on Windows.

You can verify the tool is installed by running:

dotnet tool list -g

MCP server does not appear in the editor

  • Restart your editor. Most editors require a restart to detect new MCP servers, after the MCP configuration file is added or modified.
  • Check the config file location. Each editor expects configuration in a specific path. See the setup instructions for your editor.
  • Validate your JSON. A syntax error in the configuration file can prevent the server from loading.
  • Use an absolute command path. This may help the editor resolve mcp-server-charts.

Server starts but chart rendering fails

  • Confirm the Avalonia Pro Charts license. Chart rendering requires a valid license key where the server runs. You can check your subscription and license key at the Avalonia portal.
  • Check the server logs. Logs are written under logs/AvaloniaChartsMcpServer_*.log in the MCP server output directory. These may indicate startup or rendering failures.
  • Try a smaller chart first. A simple avalonia_bar_chart call can separate setup issues from data format issues.
  • Increase log detail temporarily. Try setting AVALONIA_CHARTS_MCP_LOG_LEVEL to a higher level, then lower or remove it after troubleshooting.

Format error

  • Check palette and color values. Hex colors such as #2196F3 are safest.
  • Avoid empty palette entries in comma-separated palette strings.

See also