MCP FastAPI Chart Server

MCP FastAPI Chart Server

Generates matplotlib charts via a FastAPI service, supporting line, bar, scatter, and pie charts with customizable labels and data.

Category
Visit Server

README

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

Prerequisites

  • Python 3.8+
  • Your FastAPI server running on localhost:8000 with the /plot endpoint

Installation

  1. 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.server

Available 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 chart
  • subtitle (string): Subtitle of the chart
  • x_label (string): Label for the X-axis
  • y_label (string): Label for the Y-axis
  • data (object): Chart data with labels and values
    • labels (array of strings): Labels for data points
    • values (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.server

Cloud 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

  1. Connection Errors: Make sure your FastAPI server is running on localhost:8000
  2. Chart Generation Errors: Verify your FastAPI /plot endpoint is working correctly
  3. MCP Connection Issues: Check your Claude Desktop configuration file syntax

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured