原始内容
MCP Server for Generating Chart Image (FastMCP + FastAPI)
This is a MCP Server for generating chart images from Python code
Requirements
- Python 3.11+
- FastMCP
- FastAPI
- uvicorn
- python-dotenv
- requests
- matplotlib
Usage
$ git clone https://github.com/qnnpnet/chart-mcp-server.git
$ cd chart-mcp-server
$ uv sync
$ uv run main.py
Generate Chart Image
$ curl -X POST http://localhost:8107/generate_chart \
-H "Content-Type: application/json" \
-d '{"code": "import matplotlib.pyplot as plt\nplt.plot([1,2,3],[4,5,6])\nplt.title(\"My Chart\")"}'
Response
{ "image_url": "http://localhost:8107/static/images/20250419160332_d8b758e9.png" }
Result
