Skip to content

Commit fbf2d0c

Browse files
Update README and checked functioning with Claude Desktop (#2)
1 parent 0041bd7 commit fbf2d0c

File tree

4 files changed

+71
-35
lines changed

4 files changed

+71
-35
lines changed

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ COPY --from=builder --chown=app:app /home/app/.local/share/cartopy ${CARTOPY_DAT
6767
RUN mkdir -p /tmp/matplotlib && chown app:app /tmp/matplotlib
6868
ENV MPLCONFIGDIR=/tmp/matplotlib
6969

70-
# Set the host for the MCP server
71-
ENV MCP_HOST="0.0.0.0"
72-
7370
# Switch to non-root user
7471
USER app
7572

README.md

Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Plotting MCP Server
1+
# 📊 Plotting MCP Server
22

3-
An MCP (Model Context Protocol) server that generates plots from CSV data, optimized for LibreChat integration.
3+
A MCP (Model Context Protocol) server that transforms CSV data into beautiful visualizations. Built with Python and optimized for seamless integration with AI assistants and chat applications.
44

5-
## Features
5+
## Features
66

7-
- Generate plots from CSV data strings
8-
- Support for multiple plot types: line, bar, pie
9-
- Returns base64-encoded PNG images compatible with LibreChat
7+
- **📈 Multiple Plot Types**: Create line charts, bar graphs, pie charts, and world maps
8+
- **🌍 Geographic Visualization**: Built-in support for plotting coordinate data on world maps using Cartopy
9+
- **🔧 Flexible Parameters**: Fine-tune your plots with JSON-based configuration options
10+
- **📱 Chat-Ready Output**: Returns base64-encoded PNG images perfect for AI chat interfaces
11+
- **⚡ Fast Processing**: Efficient CSV parsing and plot generation with pandas and matplotlib
1012

1113
## Installation
1214

@@ -35,26 +37,57 @@ The server runs on port 9090 by default.
3537
### Tools
3638

3739
#### `generate_plot`
38-
Generate a plot from CSV data.
40+
Transform your CSV data into stunning visualizations.
3941

4042
**Parameters:**
4143
- `csv_data` (str): CSV data as a string
42-
- `plot_type` (str): Type of plot (line, bar, pie)
43-
- `**kwargs`: Additional plotting parameters.
44-
45-
**Returns:** Base64 PNG image with data URL prefix
46-
47-
## LibreChat Integration
44+
- `plot_type` (str): Plot type - `line`, `bar`, `pie`, or `worldmap`
45+
- `json_kwargs` (str): JSON string with plotting parameters for customization
46+
47+
**Plotting Options:**
48+
- **Line/Bar Charts**: Use Seaborn parameters (`x`, `y`, `hue` for data mapping)
49+
- **World Maps**: Automatic coordinate detection (`lat`/`latitude`/`y` and `lon`/`longitude`/`x`)
50+
- Customize with `s` (size), `c` (color), `alpha` (transparency), `marker` (style)
51+
- **Pie Charts**: Supports single column (value counts) or two columns (labels + values)
52+
53+
**Returns:** Base64-encoded PNG image ready for display
54+
55+
## 🤖 AI Assistant Integration
56+
57+
Perfect for enhancing AI conversations with data visualization capabilities. The server returns plots as base64-encoded PNG images that display seamlessly in:
58+
59+
- **LibreChat**: Direct integration for chat-based data analysis
60+
- **Claude Desktop**: Through `mcp-remote` command to transform from HTTP transport to stdio
61+
```json
62+
{
63+
"mcpServers": {
64+
"math": {
65+
"command": "npx",
66+
"args": [
67+
"mcp-remote",
68+
"http://localhost:9090/mcp"
69+
]
70+
}
71+
}
72+
}
73+
```
74+
- **Custom AI Applications**: Easy integration via MCP protocol
75+
- **Development Tools**: Compatible with any MCP-enabled environment
4876

49-
This MCP server is designed to work with LibreChat. The generated images are returned as base64 PNG data that LibreChat can display directly.
77+
**Image Format**: High-quality PNG with configurable DPI and sizing
5078

51-
Supported image format: PNG
79+
## 🚀 ToolHive Deployment
5280

53-
## ToolHive
81+
Deploy and manage your plotting server effortlessly with ToolHive - a platform that provides containerized, secure environments for MCP servers across UI, CLI, and Kubernetes modes.
5482

55-
ToolHive is a platform that simplifies the deployment and management of Model Context Protocol (MCP) servers by providing containerized, secure environments across UI, CLI, and Kubernetes modes. It offers streamlined deployment with comprehensive security controls and integration with popular development tools.
83+
**Benefits:**
84+
- 🔒 **Secure Containerization**: Isolated environments with comprehensive security controls
85+
- ⚙️ **Multiple Deployment Options**: UI, CLI, and Kubernetes support
86+
- 🔧 **Developer-Friendly**: Seamless integration with popular development tools
5687

57-
For more information, see the [ToolHive documentation](https://docs.stacklok.com/toolhive/). To get started with the CLI, check out the [ToolHive CLI Quickstart](https://docs.stacklok.com/toolhive/tutorials/quickstart-cli).
88+
📚 **Resources:**
89+
- [ToolHive Documentation](https://docs.stacklok.com/toolhive/)
90+
- [CLI Quickstart Guide](https://docs.stacklok.com/toolhive/tutorials/quickstart-cli)
5891

5992
### Build the Docker image
6093

@@ -77,7 +110,7 @@ thv run --name plotting-mcp --transport streamable-http plotting-mcp:latest
77110
kubectl apply -f toolhive-pvc.yaml
78111
```
79112

80-
2. Deploy the MCP server in K8s
113+
2. Deploy the MCP server in K8s. In the `toolhive-deployment.yaml`, you can customize the `image` field to point to your image registry.
81114
```bash
82115
kubectl apply -f toolhive-deployment.yaml
83116
```
@@ -87,21 +120,28 @@ kubectl apply -f toolhive-deployment.yaml
87120
kubectl port-forward svc/mcp-plotting-mcp-proxy 9090:9090
88121
```
89122

90-
## Development
123+
## 🛠️ Development
91124

92-
### Code Formatting
125+
Built with modern Python tooling for a great developer experience.
93126

94-
```bash
95-
make format
96-
# or
97-
uv run ruff format .
98-
uv run ruff check --fix .
99-
```
127+
**Tech Stack:**
128+
- 🐍 **Python 3.13+**: Latest Python features
129+
- 📊 **Seaborn & Matplotlib**: Professional-grade plotting
130+
- 🌍 **Cartopy**: Advanced geospatial visualization
131+
-**FastMCP**: High-performance MCP server framework
132+
- 🔧 **UV**: Fast Python package management
100133

101-
### Typechecking
134+
### Code Quality
102135

103136
```bash
137+
# Format code and fix linting issues
138+
make format
139+
140+
# Type checking
104141
make typecheck
105-
# or
142+
143+
# Or use uv directly
144+
uv run ruff format .
145+
uv run ruff check --fix .
106146
uv run ty check
107147
```

src/plotting_mcp/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010

1111
# Constants for server configuration
1212
MCP_PORT = os.getenv("MCP_PORT", 9090)
13-
MCP_HOST = os.getenv("MCP_HOST", "127.0.0.1")

src/plotting_mcp/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
from starlette.responses import JSONResponse, Response
1616

1717
from plotting_mcp.configure_logging import configure_logging
18-
from plotting_mcp.constants import MCP_HOST, MCP_PORT
18+
from plotting_mcp.constants import MCP_PORT
1919
from plotting_mcp.plot import plot_to_bytes
2020
from plotting_mcp.utils import sizeof_fmt
2121

2222
logger = structlog.get_logger(__name__)
2323

24-
mcp = FastMCP(name="plotting-mcp", host=MCP_HOST, port=MCP_PORT)
24+
mcp = FastMCP(name="plotting-mcp", host="0.0.0.0", port=MCP_PORT)
2525

2626

2727
@mcp.tool()

0 commit comments

Comments
 (0)