A Model Context Protocol (MCP) server that generates beautiful charts using Chart.js v4. Perfect for data visualization in Claude Desktop, Cursor, and other MCP-compatible applications.
Just ask "Create a bubble chart showing company performance" and get professional results instantly!
Transform your data into beautiful, professional charts instantly! This MCP server connects to your favorite AI applications and generates:
- π Bar Charts - Perfect for comparing categories
- π Line Charts - Great for showing trends over time
- π₯§ Pie & Doughnut Charts - Ideal for showing proportions
- π― Scatter & Bubble Charts - Perfect for correlation analysis
- πΈοΈ Radar Charts - Great for multi-dimensional comparisons
- π Polar Area Charts - Beautiful radial visualizations
All charts can be generated as:
- πΈ PNG Images (800x600px) - Perfect for saving, sharing, or embedding
- π Interactive HTML - Self-contained divs with hover tooltips and animations
Interactive HTML charts with hover tooltips and animations - perfect for web applications!
Here's what you can create with just a simple request:
- Node.js 18+ - Required for running the MCP server
The simplest way to use this MCP server:
-
Configure Claude Desktop
Add this to your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%/Claude/claude_desktop_config.json{ "mcpServers": { "chartjs": { "command": "npx", "args": ["@ax-crew/chartjs-mcp-server"] } } } -
Restart Claude Desktop
-
Start Creating Charts!
Try asking Claude:
"Create a bar chart showing sales data: Q1: $50k, Q2: $75k, Q3: $60k, Q4: $90k"
Add to your Cursor settings or workspace configuration:
{
"mcpServers": {
"chartjs": {
"command": "npx",
"args": ["@ax-crew/chartjs-mcp-server"]
}
}
}If you prefer to install from source or want to contribute:
-
Clone and Build
git clone https://github.com/ax-crew/chartjs-mcp-server.git cd chartjs-mcp-server npm install && npm run build
-
Configure with Local Path
{ "mcpServers": { "chartjs": { "command": "node", "args": ["/full/path/to/chartjs-mcp-server/dist/index.js"] } } }
Once configured, you can ask your AI assistant to create charts using natural language:
- "Create a pie chart of my budget: Housing 40%, Food 25%, Transport 15%, Entertainment 20%"
- "Make a line chart showing website visitors over 6 months: Jan 1000, Feb 1200, Mar 1500, Apr 1300, May 1800, Jun 2100"
- "Generate a bar chart comparing programming languages: JavaScript 65%, Python 45%, Java 35%, Go 25%"
You can specify the output format when creating charts:
PNG Images (Default)
"Create a bar chart as a PNG image showing sales data..."
- High-quality static images (800x600px)
- Perfect for documents, presentations, and sharing
- Works everywhere
Interactive HTML
"Create an interactive HTML doughnut chart showing project status..."
- Self-contained HTML divs with embedded Chart.js
- Hover tooltips and animations
- Perfect for web applications and frontends
- Just inject the HTML into any webpage
Example Interactive HTML Usage:
// The AI returns HTML like this:
const chartHtml = `<div id="chart-container-123">...</div>`;
// You can inject it anywhere:
document.getElementById('dashboard').innerHTML = chartHtml;
// Works with any framework
// React: <div dangerouslySetInnerHTML={{ __html: chartHtml }} />
// Vue: <div v-html="chartHtml"></div>
// Angular: <div [innerHTML]="chartHtml"></div>| Chart Type | Best For | Example Use Case |
|---|---|---|
| Bar | Comparing categories | Sales by region, survey results |
| Line | Trends over time | Stock prices, website traffic |
| Pie | Parts of a whole | Budget breakdown, market share |
| Doughnut | Proportions with focus | Same as pie, but more modern look |
| Scatter | Correlation analysis | Height vs weight, sales vs advertising |
| Bubble | 3D relationships | Revenue vs profit vs company size |
| Radar | Multi-factor comparison | Skill assessments, product features |
| Polar Area | Radial data | Seasonal data, directional analysis |
- π¨ Custom Colors: Specify color schemes for your brand
- π Multiple Datasets: Compare multiple data series
- π·οΈ Labels & Titles: Add context with custom labels
- π± Responsive: Charts work great at any size
- ποΈ Chart.js Options: Full access to Chart.js v4 features
- π±οΈ Interactive Elements: Tooltips, hover effects, and animations (HTML format)
- π Framework Agnostic: HTML output works with React, Vue, Angular, and vanilla JS
Chart not generating?
- Check that the MCP server is properly configured in your client
- Verify the server is running:
ps aux | grep chartjs - Try restarting your MCP client (Claude Desktop, Cursor, etc.)
Configuration not working?
- Check JSON syntax in your config file
- Ensure file paths are correct
- Check file permissions
Charts look wrong?
- Verify your data format matches Chart.js requirements
- Check for missing required fields (labels, datasets, etc.)
- Try a simpler chart first to test the connection
- Check the examples - See working chart configurations
- Run tests -
npm testto verify everything works - Check logs - Look for error messages in your MCP client
- Open an issue - We're here to help!
Want to improve this MCP server? We welcome contributions!
# Clone and setup
git clone https://github.com/ax-crew/chartjs-mcp-server.git
cd chartjs-mcp-server
npm install
# Development workflow
npm run dev # Watch mode for development
npm test # Run tests
npm run build # Build for production
npm run test:watch # Test in watch modechartjs-mcp-server/
βββ src/
β βββ index.ts # Main MCP server implementation
β βββ chart-schema.json # Chart.js v4 validation schema
βββ examples/ # Example configurations & outputs
β βββ *.json # Chart configuration examples
β βββ *.png # Generated chart images
β βββ README.md # Developer examples guide
βββ test/
β βββ chart-server.test.js # Comprehensive test suite
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
- TypeScript - Type-safe development
- Chart.js v4 - Chart generation engine
- Node Canvas - Server-side rendering
- MCP Protocol - Model Context Protocol implementation
- Node.js Test Runner - Native testing (no external deps)
We have comprehensive testing to ensure reliability:
npm test # 24 tests across 9 suites
npm run test:integration # CLI-based integration tests
npm run test:watch # Development watch mode- Add chart type support in
src/index.ts - Create example configuration in
examples/ - Add tests in
test/chart-server.test.js - Update documentation in both READMEs
- Submit a pull request
- β TypeScript with strict mode
- β Comprehensive error handling
- β Test coverage for all features
- β Clear, documented code
- β MCP protocol compliance
The server exposes one primary tool for chart generation:
Parameters:
chartConfig(object) - Complete Chart.js v4 configurationoutputFormat(string, optional) - Output format:'png'(default) or'html'saveToFile(boolean, optional) - Save PNG to file (only applies to PNG format)
Returns:
- PNG Success:
{ success: true, buffer: Buffer, message: string }or{ success: true, pngFilePath: string, message: string } - HTML Success:
{ success: true, htmlSnippet: string, message: string } - Error:
{ success: false, error: string, message: string }
Example:
{
"type": "bar",
"data": {
"labels": ["Q1", "Q2", "Q3", "Q4"],
"datasets": [{
"label": "Sales",
"data": [50000, 75000, 60000, 90000],
"backgroundColor": "rgba(54, 162, 235, 0.8)"
}]
},
"options": {
"responsive": true,
"plugins": {
"title": {
"display": true,
"text": "Quarterly Sales"
}
}
}
}- β Complete MCP Server - Ready to use with any MCP client
- β 8 Chart Types - All major Chart.js chart types supported
- β Dual Output Formats - PNG images and interactive HTML divs
- β
Example Configurations - 8 working examples in
/examples - β Visual References - Generated PNG samples for each chart type
- β Comprehensive Tests - 24 tests ensuring reliability
- β TypeScript Support - Full type safety and IDE support
- β Error Handling - Graceful error handling and validation
- β Documentation - Complete setup and usage guides
- π Chart.js Documentation
- π Model Context Protocol
- π¨ Example Charts - See all supported chart types
- π Issue Tracker
- π¬ Discussions
MIT License - feel free to use this in your projects!
If this MCP server helps you create amazing charts, please give it a star β to help others discover it!
Made with β€οΈ for the MCP community






