A professional Model Context Protocol (MCP) server for generating dynamic charts using Chart.js. Supports multiple chart types with flexible upload options and transport protocols.
- π Multiple Chart Types: Bar, Pie, and Line charts with full customization
- π¨ Advanced Styling: Colors, borders, fills, gradients, and animations
- π€ Flexible Upload Options: Local temp files, AWS S3, or custom HTTP endpoints
- π Multiple Transport Protocols: Stdio, SSE, and Streamable HTTP support
- π§ Full TypeScript Support: Complete type safety and IntelliSense integration
- β‘ High Performance: Optimized rendering with Chart.js 4.0+
- π Enterprise Ready: Secure upload methods and configurable environments
# Run with default stdio transport
npx -y @yshtools/mcp-chartkraft
# Run with SSE transport on port 3000
npx -y @yshtools/mcp-chartkraft sse
# Run with HTTP transport on port 8080
npx -y @yshtools/mcp-chartkraft http --port 8080npm install -g @yshtools/mcp-chartkraft
mcp-chartkraft --help
mcp-chartkraft http --port 8080Generate vertical bar charts perfect for categorical data comparisons.
{
"name": "create_bar_chart",
"arguments": {
"data": {
"labels": ["Q1", "Q2", "Q3", "Q4"],
"datasets": [{
"label": "Revenue",
"data": [120, 190, 300, 500],
"backgroundColor": "#3498db"
}]
}
}
}Create circular charts for showing proportions and percentages.
{
"name": "create_pie_chart",
"arguments": {
"data": {
"labels": ["Desktop", "Mobile", "Tablet"],
"datasets": [{
"label": "Traffic Sources",
"data": [60, 30, 10]
}]
}
}
}Generate line charts for time series and trend analysis.
{
"name": "create_line_chart",
"arguments": {
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
"datasets": [{
"label": "Sales",
"data": [120, 150, 180, 200, 240, 300],
"borderColor": "#3498db",
"tension": 0.4
}]
}
}
}Copy env.example to .env and configure as needed:
# Upload mode: temp, aws-s3, or http
UPLOAD_MODE=temp
# Temp directory (when using temp mode)
CHART_TEMP_DIR=/tmp/charts
# AWS S3 configuration (when using aws-s3 mode)
AWS_S3_BUCKET_NAME=my-chart-bucket
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
# HTTP upload configuration (when using http mode)
HTTP_UPLOAD_URL=https://your-server.com/upload
HTTP_UPLOAD_METHOD=POSTBest for direct MCP client integration:
npx -y @yshtools/mcp-chartkraftFor web-based clients:
npx -y @yshtools/mcp-chartkraft sse --port 3000For modern HTTP-based clients:
npx -y @yshtools/mcp-chartkraft http --port 3000All chart types support:
- Custom dimensions:
widthandheightin pixels - Styling options: Colors, borders, backgrounds
- Title and legend: Positioning and visibility
- Responsive design: Auto-scaling options
fill: Enable area fill under the linetension: Control curve smoothness (0-1)pointRadius: Size of data points- Point styling: Colors and borders for data points
{
"name": "create_line_chart",
"arguments": {
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr", "May"],
"datasets": [{
"label": "Revenue",
"data": [100, 150, 200, 180, 220],
"borderColor": "#e74c3c",
"backgroundColor": "rgba(231, 76, 60, 0.1)",
"fill": true,
"tension": 0.4,
"pointRadius": 5
}]
},
"options": {
"plugins": {
"title": {
"display": true,
"text": "Monthly Revenue"
},
"legend": {
"position": "top"
}
},
"scales": {
"y": {
"beginAtZero": true,
"title": {
"display": true,
"text": "Amount ($)"
}
}
}
},
"width": 1000,
"height": 600
}
}Charts are saved to system temp directory or custom path.
Upload charts directly to S3 bucket with public URLs.
Post charts to any HTTP endpoint that accepts file uploads.
git clone <repository>
cd mcp-chartkraft
npm install
npm run build
# Development mode
npm run dev
# Different transports
npm run dev:sse
npm run dev:http
# Test locally
npm run build
./dist/index.js --helpThis project is licensed under the ISC License - see the LICENSE file for details.
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- π§ Issues: GitHub Issues
- π Documentation: Full Documentation
- π¬ Discussions: GitHub Discussions