A powerful Model Context Protocol (MCP) server for creating interactive data visualizations using matplotlib
Project description
Visualization MCP Server
A powerful Model Context Protocol (MCP) server for creating interactive data visualizations using matplotlib. This server provides comprehensive visualization tools including relationship graphs, scatter plots, 3D visualizations, and more.
Features
- 🔗 Relationship Graphs: Create network diagrams to visualize connections between entities
- 📊 Scatter Plots: Basic and classification scatter plots with customizable styling
- 🌐 3D Visualizations: Support for 3D scatter plots, surface plots, and wireframes
- 📈 Statistical Charts: Histograms, line plots, and heatmaps
- 💾 Auto-save: Automatically saves high-resolution images to temporary directory
- 🖼️ Live Display: Shows plots in interactive matplotlib windows
- 🎨 Customizable: Extensive styling options for colors, labels, and layouts
Installation
Prerequisites
$ python3 -m venv .venv --upgrade-deps
$ source .venv/bin/activate
$ pip install "mcp[cli]" httpx
$ pip install matplotlib numpy pandas networkx
Clone and Run
git clone https://github.com/xlisp/visualization-mcp-server.git
cd visualization-mcp-server
python visualization_server.py
Usage
1. Cladue Desktop Client Config
"visualization": {
"command": "/Users/clojure/Desktop/visualization-mcp-server/.venv/bin/python",
"args": [
"/Users/clojure/Desktop/visualization-mcp-server/visualization_server.py"
]
}
The server provides several visualization tools that can be called via MCP protocol:
1. Relationship Graph
Create network diagrams to show relationships between entities:
# Example: Show relationships between A, B, C, D
nodes = ["Alice", "Bob", "Charlie", "Diana"]
edges = [["Alice", "Bob"], ["Bob", "Charlie"], ["Alice", "Charlie"], ["Charlie", "Diana"]]
# Call: create_relationship_graph(nodes, edges, "Social Network")
Parameters:
nodes: List of node namesedges: List of connections (pairs of node names)title: Graph title (optional)node_size: Size of nodes (default: 1000)font_size: Label font size (default: 12)
2. Scatter Plot
Create basic scatter plots with optional labels and colors:
# Example: Basic scatter plot
x_data = [1, 2, 3, 4, 5]
y_data = [2, 5, 3, 8, 7]
labels = ["Point A", "Point B", "Point C", "Point D", "Point E"]
# Call: create_scatter_plot(x_data, y_data, labels, title="My Scatter Plot")
Parameters:
x_data: X-axis valuesy_data: Y-axis valueslabels: Point labels (optional)colors: Point colors (optional)title,x_label,y_label: Chart labelssize: Point size (default: 50)
3. Classification Scatter Plot
Visualize data points grouped by categories:
# Example: Classification visualization
x_data = [1, 2, 3, 4, 5, 6]
y_data = [2, 3, 1, 5, 4, 6]
categories = ["Type A", "Type A", "Type B", "Type B", "Type C", "Type C"]
# Call: create_classification_plot(x_data, y_data, categories)
Parameters:
x_data: X-axis valuesy_data: Y-axis valuescategories: Category labels for each pointtitle,x_label,y_label: Chart labels
4. 3D Visualization
Create 3D plots with multiple visualization types:
# Example: 3D scatter plot
x_data = [1, 2, 3, 4, 5]
y_data = [2, 4, 1, 5, 3]
z_data = [3, 1, 4, 2, 5]
# Call: create_3d_plot(x_data, y_data, z_data, plot_type="scatter")
Parameters:
x_data,y_data,z_data: 3D coordinatesplot_type: "scatter", "surface", or "wireframe"title,x_label,y_label,z_label: Chart labels
5. Additional Charts
Histogram
# create_histogram(data, bins=30, title="Distribution")
Line Plot
# create_line_plot(x_data, y_data, line_style="-", color="blue")
Heatmap
# create_heatmap(data_matrix, x_labels, y_labels, colormap="viridis")
Output
Each visualization function:
- Displays the plot in an interactive matplotlib window
- Saves a high-resolution PNG file to the system temporary directory
- Returns the file path where the image was saved
Example output:
"Graph saved to: /tmp/relationship_graph_20250802_143022.png and displayed"
File Management
- Images are saved with timestamps to avoid conflicts
- Files are stored in the system temporary directory:
- Windows:
C:\Users\username\AppData\Local\Temp\ - macOS/Linux:
/tmp/
- Windows:
- High resolution (300 DPI) PNG format
MCP Integration
This server follows the Model Context Protocol standard and can be integrated with MCP-compatible clients. The server runs on stdio transport by default.
Server Configuration
if __name__ == "__main__":
mcp.run(transport='stdio')
Examples
Social Network Analysis
# Visualize social connections
nodes = ["Alice", "Bob", "Charlie", "Diana", "Eve"]
relationships = [
["Alice", "Bob"],
["Bob", "Charlie"],
["Charlie", "Diana"],
["Alice", "Eve"],
["Eve", "Diana"]
]
# Creates a network graph showing social connections
Data Classification
# Visualize machine learning results
features_x = [1.2, 2.3, 1.8, 3.1, 2.9, 1.5]
features_y = [2.1, 3.2, 1.9, 4.1, 3.8, 2.2]
predictions = ["Class A", "Class B", "Class A", "Class B", "Class B", "Class A"]
# Creates a classification scatter plot
Scientific Data
# 3D scientific visualization
x_coords = [0, 1, 2, 3, 4]
y_coords = [0, 1, 4, 9, 16]
z_coords = [0, 1, 8, 27, 64]
# Creates a 3D surface or scatter plot
Error Handling
The server includes comprehensive error handling:
- Invalid data format detection
- Missing parameter validation
- Matplotlib rendering error recovery
- File system permission checks
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
matplotlib: Core plotting librarynetworkx: Graph/network visualizationnumpy: Numerical computationspandas: Data manipulationmcp: MCP server framework
Roadmap
- Interactive plot widgets
- Animation support
- Export to multiple formats (SVG, PDF)
- Custom color schemes
- Statistical analysis integration
- Real-time data streaming plots
Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed description
- Include sample data and error messages
Made with ❤️ for the MCP ecosystem
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iflow_mcp_xlisp_visualization_mcp_server-0.1.0.tar.gz.
File metadata
- Download URL: iflow_mcp_xlisp_visualization_mcp_server-0.1.0.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74de3ece5d7e2489bac5cc24038c504ef46a7f25245b5b455a516d35dc74b844
|
|
| MD5 |
992cbcbafeedfcb14493f82f110076ba
|
|
| BLAKE2b-256 |
a9baa7d7fbc57bbf91a66f44a1d89a9ee5a867ddeaf55f54070fc98d7840c779
|
File details
Details for the file iflow_mcp_xlisp_visualization_mcp_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_xlisp_visualization_mcp_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adffce40025a4bc2d79402f6493827e7e6804f0ce7cdf66385203235af922895
|
|
| MD5 |
2fdfb30d7694b6733f3a2514a062818a
|
|
| BLAKE2b-256 |
123e09b3f46205b50a05c6cca123e0204c076c38e7d0068a353b8d253b91456b
|