A Model Context Protocol (MCP) server that provides tools for generating and saving various types of charts and graphs.
- 📊 Bar Graphs: Generate customizable bar graphs with titles, labels, and colors
- 📈 Line Graphs: Create line graphs with markers and customizable styling
- 🥧 Pie Charts: Visualize proportional data with pie charts
All charts are automatically saved to the /images directory with timestamped filenames and can be directly used in your applications.
This MCP requires Python 3.10+ and uses uv for dependency management.
# Clone the repository
git clone <your-repository-url>
cd new-mcp
# Install dependencies
uv install -e .
uv install mcp[cli] matplotlibAdd this to your settings.json in VS Code:
"mcp": {
"servers": {
"Chart-Plotting": {
"command": "/path/to/your/python/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/path/to/your/new-mcp/main.py"
]
}
}
}Add this to your Claude configuration:
{
"mcpServers": {
"Chart-Plotting": {
"command": "/path/to/your/python/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"matplotlib",
"mcp",
"run",
"/path/to/your/new-mcp/main.py"
]
}
}
}Replace /path/to/your/python/uv and /path/to/your/new-mcp/main.py with your actual paths.
Once configured, you can use the MCP tools in your AI assistant:
plot_bar_graph_and_save_image(
categories=["Category A", "Category B", "Category C"],
values=[42, 55, 30],
title="Sales Report",
xlabel="Product Categories",
ylabel="Units Sold",
color="skyblue"
)For bar graphs with image path return:
plot_bar_graph_and_save_image_return_imagepath(
categories=["Category A", "Category B", "Category C"],
values=[42, 55, 30],
title="Sales Report",
xlabel="Product Categories",
ylabel="Units Sold",
color="skyblue"
)plot_line_graph_and_save_image(
x_values=[1, 2, 3, 4, 5],
y_values=[12, 18, 11, 23, 19],
title="Temperature Trend",
xlabel="Days",
ylabel="Temperature (°C)",
color="red"
)plot_pie_chart_and_save_image(
values=[35, 25, 20, 20],
labels=["Product A", "Product B", "Product C", "Product D"],
title="Market Share",
colors=["#ff9999", "#66b3ff", "#99ff99", "#ffcc99"]
)- Generate sales and revenue visualizations
- Create data comparison charts for reports
- Visualize survey results with pie charts
- Plot time-series data with line graphs
- Create performance benchmarks with bar charts
When interacting with an AI assistant that has this MCP configured, you can use normal language to request charts. For example:
This is my data, plot a bar graph for me:
- Products: Laptops, Phones, Tablets, Accessories
- Sales: 45000, 62000, 28000, 15000
I'll create a bar graph with your sales data:
plot_bar_graph_and_save_image_return_imagepath(
categories=["Laptops", "Phones", "Tablets", "Accessories"],
values=[45000, 62000, 28000, 15000],
title="Product Sales Comparison",
xlabel="Products",
ylabel="Sales ($)",
color="skyblue"
)Here's your sales data visualization showing that phones have the highest sales at $62,000, followed by laptops at $45,000, tablets at $28,000, and accessories at $15,000.
Below is an example of Claude Desktop using the Chart Plotting MCP to generate all three types of charts based on user data:
The user provided data for BMW and Audi and requested all three types of charts:
"categories": [
"BMW",
"Audi"
],
"values": [
20,
30
],
plot all 3 types of graph bar, pie and lineClaude automatically recognized the data format and used all three Chart Plotting MCP tools:
Shows the comparison between BMW (20) and Audi (30):
Displays the proportion between BMW and Audi:
Represents the brands as sequential points to show the increasing trend:
The MCP automatically saved all three charts to the /images directory with unique timestamps.
- All images are saved with timestamps to prevent overwriting
- Images are saved in the
/imagesdirectory - You can customize colors, labels, titles, and other options
- Bar graph function with
_return_imagepathsuffix returns the path to the saved image
- Python 3.10+
- matplotlib
- mcp[cli]
MIT License




