Skip to main content
Glama
Cloudflare Workers Table-to-Image MCP Connector

Cloudflare Workers Table-to-Image MCP Connector

by clem109

Cloudflare Workers Table-to-Image MCP Connector

Deploy to Cloudflare Workers

Convert table data to beautiful images using QuickChart.io API, deployed on Cloudflare Workers. This project serves as an MCP (Model Context Protocol) connector for Poke and other AI assistants.

✨ TRUE Zero-Configuration Deployment

Click the deploy button above for instant deployment - NO environment variables required!

The worker uses QuickChart.io's free tier by default (no API key needed). All configuration variables have sensible defaults built-in. You can optionally add a QuickChart API key later to increase rate limits.

Related MCP server: Chart-Output MCP Server

πŸš€ Features

  • Table to Image Conversion: Convert JSON table data to PNG/JPG images

  • QuickChart.io Integration: Leverage QuickChart's powerful charting engine

  • Multiple Table Formats: Support for various table data structures

  • Fast Edge Deployment: Runs on Cloudflare's global edge network

  • MCP Connector: Ready-to-use MCP server implementation

  • TypeScript Support: Fully typed for better DX

  • Zero Cold Starts: Instant responses worldwide

  • Zero Configuration: Works out-of-the-box with no setup required

🎯 Quick Start

  1. Click the "Deploy to Cloudflare Workers" button above

  2. Authenticate with your Cloudflare account

  3. Click "Deploy" - that's it!

No environment variables, no secrets, no configuration needed. The worker will be live immediately using QuickChart's free tier.

Option 2: CLI Deploy

# Clone the repository
git clone https://github.com/clem109/cloudflare-workers-table-to-image-mcp.git
cd cloudflare-workers-table-to-image-mcp

# Install dependencies
npm install

# Authenticate with Cloudflare
npx wrangler login

# Deploy (no configuration needed)
npm run deploy

Option 3: Development Mode

npm install
npm run dev

πŸ“‘ API Endpoints

POST /convert

Convert table data to image.

Request:

{
  "table": {
    "headers": ["Name", "Value", "Status"],
    "rows": [
      ["Item 1", "100", "Active"],
      ["Item 2", "200", "Pending"],
      ["Item 3", "150", "Active"]
    ]
  },
  "format": "png",
  "width": 800,
  "height": 600
}

Response:

{
  "success": true,
  "imageUrl": "https://quickchart.io/chart?...",
  "format": "png",
  "timestamp": "2026-02-17T20:44:00Z"
}

GET /health

Health check endpoint.

Response:

{
  "status": "healthy",
  "version": "1.0.0",
  "timestamp": "2026-02-17T20:44:00Z"
}

POST /mcp/convert

MCP-compatible endpoint for AI assistants.

Request:

{
  "method": "convert_table",
  "params": {
    "data": [["Header1", "Header2"], ["Value1", "Value2"]],
    "options": {
      "format": "png",
      "theme": "light"
    }
  }
}

🎨 Supported Table Formats

Format 1: Headers + Rows

{
  "headers": ["Column 1", "Column 2"],
  "rows": [
    ["Data 1", "Data 2"],
    ["Data 3", "Data 4"]
  ]
}

Format 2: Array of Objects

[
  {"name": "John", "age": 30, "city": "NYC"},
  {"name": "Jane", "age": 25, "city": "LA"}
]

Format 3: 2D Array

[
  ["Name", "Age", "City"],
  ["John", "30", "NYC"],
  ["Jane", "25", "LA"]
]

πŸ”§ Configuration (Optional)

Zero-Config Defaults

The worker comes with sensible defaults - no configuration needed:

Variable

Default

Description

MAX_TABLE_SIZE

10000

Max cells in table

DEFAULT_IMAGE_FORMAT

png

Default output format

DEFAULT_IMAGE_WIDTH

800

Default image width

DEFAULT_IMAGE_HEIGHT

600

Default image height

RATE_LIMIT

60

Requests per minute

ENABLE_CORS

true

Enable CORS

Optional Enhancements

To increase QuickChart rate limits (optional):

  1. Get a free API key from QuickChart.io

  2. Set it as a secret:

    echo "your-api-key" | npx wrangler secret put QUICKCHART_API_KEY

To add MCP authentication (optional):

echo "your-mcp-key" | npx wrangler secret put MCP_API_KEY

Custom Configuration

To customize defaults, edit wrangler.toml:

[vars]
MAX_TABLE_SIZE = "20000"
DEFAULT_IMAGE_FORMAT = "jpg"

πŸ”Œ MCP Integration

This project implements the Model Context Protocol for seamless AI assistant integration.

Configure with Poke

  1. Deploy your worker using the one-click button

  2. Copy your worker URL (e.g., https://table-to-image-mcp.your-subdomain.workers.dev)

  3. Add to your MCP config:

{
  "mcpServers": {
    "table-to-image": {
      "url": "https://your-worker-url.workers.dev/mcp"
    }
  }
}
  1. Use in conversations:

Convert this table to an image: [table data]

πŸ“š Usage Examples

cURL

curl -X POST https://your-worker.workers.dev/convert \
  -H "Content-Type: application/json" \
  -d '{
    "table": {
      "headers": ["Product", "Sales", "Growth"],
      "rows": [
        ["Widget A", "1000", "+15%"],
        ["Widget B", "2000", "+25%"]
      ]
    }
  }'

JavaScript/Node.js

const response = await fetch('https://your-worker.workers.dev/convert', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    table: {
      headers: ['Name', 'Score'],
      rows: [['Alice', '95'], ['Bob', '87']]
    },
    format: 'png'
  })
});

const result = await response.json();
console.log('Image URL:', result.imageUrl);

Python

import requests

response = requests.post(
    'https://your-worker.workers.dev/convert',
    json={
        'table': {
            'headers': ['Name', 'Score'],
            'rows': [['Alice', '95'], ['Bob', '87']]
        },
        'format': 'png'
    }
)

result = response.json()
print(f"Image URL: {result['imageUrl']}")

πŸ—οΈ Project Structure

cloudflare-workers-table-to-image-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.js           # Main Worker entry point
β”‚   └── mcp-server.js      # MCP connector implementation
β”œβ”€β”€ .cloudflare/
β”‚   └── deploy.json        # Zero-config deploy settings
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ table-formats.json # Example table formats
β”‚   └── usage.md          # Usage examples
β”œβ”€β”€ wrangler.toml         # Main Cloudflare config
β”œβ”€β”€ wrangler.json         # Deploy button config
β”œβ”€β”€ package.json          # Dependencies
β”œβ”€β”€ deploy.sh             # Deployment script
└── README.md             # This file

πŸ§ͺ Development

Local Testing

npm run dev

Visit http://localhost:8787 to test locally.

Run Tests

npm test

Linting

npm run lint

πŸš€ Deployment Options

1. One-Click (Zero Config)

Click the deploy button at the top - done!

2. CLI Deploy

npm run deploy

3. Environment-specific Deploy

npm run deploy:production
npm run deploy:staging

4. Custom Script

chmod +x deploy.sh
./deploy.sh

πŸ›‘οΈ Security

  • No sensitive data required for deployment

  • API keys are optional and stored as encrypted secrets

  • Rate limiting enabled by default

  • Input validation and sanitization

  • CORS configured for secure access

πŸ“ˆ Performance

  • Latency: <50ms globally (Cloudflare edge)

  • Throughput: 1000+ requests/second

  • Uptime: 99.99% SLA

  • Cold Start: 0ms (no cold starts)

  • Free Tier: QuickChart free tier included

❓ FAQ

Do I need a QuickChart API key?

No! The worker uses QuickChart's free tier by default. An API key is optional and only needed if you exceed free tier limits.

Do I need to set environment variables?

No! Everything has sensible defaults. The one-click deploy requires zero configuration.

Why is the deploy button asking for variables?

If this happens, it's likely a caching issue. The latest version requires no variables. Try:

  1. Clear browser cache

  2. Use the direct link: https://deploy.workers.cloudflare.com/?url=https://github.com/clem109/cloudflare-workers-table-to-image-mcp

  3. Deploy via CLI: npm run deploy

Can I customize the configuration?

Yes! After deployment, you can modify wrangler.toml and redeploy, or set optional secrets for enhanced features.

How do I get my worker URL?

After deployment:

  • Check your Cloudflare dashboard

  • Or look at the deployment output

  • Format: https://table-to-image-mcp.your-subdomain.workers.dev

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit changes (git commit -m 'Add amazing feature')

  4. Push to branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

πŸ“ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

πŸ—ΊοΈ Roadmap

  • Add more chart types (bar, pie, line)

  • Support custom styling/themes

  • Implement caching layer

  • Add batch conversion endpoint

  • Create CLI tool

  • Add TypeScript version

  • Support more output formats (SVG, PDF)

  • Add webhook notifications


Built with ❀️ by Clement Venard

⭐ Star this repo if you find it useful!

Made possible by Cloudflare Workers and QuickChart.io

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      TableCharts MCP Server gives any LLM assistant the ability to instantly convert tabular data into beautiful, hosted, interactive dashboards. Simply provide JSON rows, raw CSV text, or a public URL (Notion page, Google Sheet, or Salesforce report), and get back a shareable dashboard URL plus an embeddable iframe code β€” all in one tool call. Supports 6 chart types: bar, line, area, pie, scatter, a
      2
      15 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to render branded charts as inline images and persistent hosted URLs, supporting explicit chart types and automatic chart suggestion from data.
      2
      68 npm
      MIT