MCP FastAPI Chart Server
Allows generating matplotlib charts through a FastAPI service by sending chart parameters and receiving PNG images.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP FastAPI Chart ServerGenerate a line chart of monthly sales for 2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP FastAPI Chart Server
An MCP (Model Context Protocol) server that interacts with a FastAPI service to generate matplotlib charts.
Overview
This MCP server provides tools to:
Generate charts using your FastAPI chart generation service
Check the status of your FastAPI server
Return chart images directly to the client
Related MCP server: QuickChart MCP Server
Prerequisites
Python 3.8+
Your FastAPI server running on
localhost:8000with the/plotendpoint
Installation
Install the package:
pip install -e .Configuration
For Claude Desktop
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fastapi-chart": {
"command": "python",
"args": ["-m", "mcp_fastapi_chart.server"]
}
}
}For Other MCP Clients
Configure your MCP client to run:
python -m mcp_fastapi_chart.serverAvailable Tools
1. generate_chart
Generate a chart using the FastAPI chart generation service.
Parameters:
chart_type(string): Type of chart to generate - "line", "bar", "scatter", or "pie"title(string): Main title of the chartsubtitle(string): Subtitle of the chartx_label(string): Label for the X-axisy_label(string): Label for the Y-axisdata(object): Chart data with labels and valueslabels(array of strings): Labels for data pointsvalues(array of numbers): Values for data points
Example Usage:
{
"chart_type": "line",
"title": "Asylum Applications Trend",
"subtitle": "Monthly applications received (2023-2024)",
"x_label": "Month",
"y_label": "Applications Received",
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
"values": [15400, 16800, 14200, 18900, 17600, 19500, 20300, 18700, 17400, 16200, 15800, 14900]
}
}2. check_fastapi_status
Check if the FastAPI server is running and accessible.
Parameters: None
FastAPI Server Requirements
Your FastAPI server should have an endpoint at /plot that accepts POST requests with the following JSON structure:
{
"chart_type": "string",
"title": "string",
"subtitle": "string",
"data": {
"labels": ["string"],
"values": [number]
},
"x_label": "string",
"y_label": "string"
}And should return a PNG image as the response.
Development
To run the server directly for testing:
python -m mcp_fastapi_chart.serverCloud Deployment
When you move your FastAPI server to the cloud, update the fastapi_base_url in mcp_fastapi_chart/server.py:
self.fastapi_base_url = "https://your-cloud-domain.com"Troubleshooting
Connection Errors: Make sure your FastAPI server is running on
localhost:8000Chart Generation Errors: Verify your FastAPI
/plotendpoint is working correctlyMCP Connection Issues: Check your Claude Desktop configuration file syntax
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Renders interactive Chart.js charts and dashboards inline in AI conversations. Supports bar, line, area, pie, doughnut, scatter, and radar charts with multi-chart dashboard grids.
Renders interactive Chart.js charts and dashboards inline in AI conversations.
Create, inspect, manage, and render charts and data visualizations as SVG/PNG or interactive embeds.
Generate production-ready chart code (Recharts, Chart.js, ECharts, Plotly) from a prompt.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables generation and visualization of bar and pie charts from structured data using FastAPI and Altair. Charts are saved as PNG images and served via REST API endpoints with unique URLs.-
- -licenseBqualityNot gradedmaintenanceEnables generation of various chart types (bar, line, pie, radar, etc.) using QuickChart.io service. Supports creating chart URLs and downloading chart images locally with customizable Chart.js configurations.2207 npm-
- AlicenseBqualityDmaintenanceEnables generation of various chart types (bar, line, pie, radar, etc.) using QuickChart.io and Chart.js configurations, with options to generate chart URLs or download images locally.2207 npm1MIT
- FlicenseAqualityDmaintenanceAn 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.9-