plotly-mcp-cursor

plotly-mcp-cursor

Enables creating Plotly charts from natural language in Cursor, supporting a wide variety of trace types with full customization.

Category
访问服务器

README

Plotly MCP Server - Implementation Plan

Project Overview

Goal: Graph Objects-only Plotly MCP server for Cursor
Output: HTML visualizations from natural language
Control: Minute-level customization of all chart elements
Scope: Complete coverage of 50+ Plotly trace types

Phase 1 Status ✅

Foundation Complete:

  • ✅ MCP server with FastMCP framework (SDK 1.2.0+)
  • ✅ Project structure for 49 trace types
  • ✅ 5 basic trace builders (scatter, bar, line, pie, histogram)
  • ✅ Figure assembly system
  • ✅ Layout controllers (axes, styling)
  • ✅ Sample data generation for testing
  • ✅ Cursor integration ready

Quick Start

1. Install Dependencies

With UV (recommended):

# Install UV if you havent already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Setup project
cd /Users/arshad/Desktop/personal/code/plotly-mcp-claude
uv sync

With pip:

pip install -r requirements.txt

2. Run the MCP Server

cd src
python server.py

3. Add to Cursor MCP Settings

Add this to your Cursor MCP configuration:

{
  "mcpServers": {
    "plotly-mcp": {
      "command": "python",
      "args": ["/Users/arshad/Desktop/personal/code/plotly-mcp-claude/src/server.py"]
    }
  }
}

Available Tools (Phase 1)

Basic Trace Builders

  1. create_scatter_plot - Scatter plots with markers, lines, or both
  2. create_bar_chart - Vertical/horizontal bar charts with text labels
  3. create_line_chart - Line charts with styling and fill options
  4. create_pie_chart - Pie/donut charts with custom colors
  5. create_histogram - Histograms with binning and normalization

Utility Tools

  1. create_multi_trace_figure - Initialize figures for multiple traces
  2. generate_sample_data - Create test data (linear, sine, random, categories)

Usage Examples

Scatter Plot

create_scatter_plot(
    x_data=[1, 2, 3, 4, 5],
    y_data=[2, 4, 1, 5, 3],
    colors="red",
    sizes=15,
    mode="markers+lines",
    name="My Data"
)

Bar Chart

create_bar_chart(
    x_data=["A", "B", "C", "D"],
    y_data=[20, 14, 23, 25],
    colors="blue",
    orientation="v",
    text=["20", "14", "23", "25"],
    name="Sales Data"
)

Pie Chart

create_pie_chart(
    labels=["Apple", "Orange", "Banana"],
    values=[30, 25, 45],
    hole=0.3,  # Donut chart
    textinfo="label+percent"
)

Generate Test Data

generate_sample_data(
    data_type="sine",
    size=100,
    noise=0.1
)

Architecture

plotly-mcp-claude/
├── src/
│   ├── server.py              # Main MCP server (FastMCP)
│   ├── traces/                # All trace builders (5/49 complete)
│   │   └── basic/            # Phase 1: scatter, bar, line, pie, histogram
│   ├── layouts/              # Layout controllers
│   │   ├── axes.py           # X/Y/Z axis configuration
│   │   └── styling.py        # Colors, fonts, margins, legends
│   ├── assembly/             # Figure building
│   │   └── builder.py        # Combine traces + layout
│   └── [themes/, nlp/]       # Future phases
├── data/                     # Sample datasets (future)
├── examples/                 # Usage examples (future)
├── tests/                    # Unit tests (future)
├── requirements.txt          # Python dependencies
├── pyproject.toml           # Project configuration
└── README.md                # This file

Complete Plotly Trace Types (Planned)

Phase 1 ✅ (5/49)

  • Basic Charts: scatter ✅, bar ✅, line ✅, pie ✅, histogram ✅

Phase 2 📋 (15 more types)

  • Statistical Charts: box, violin, heatmap, contour, splom, parcoords, parcats, histogram2d
  • 3D Charts: scatter3d, surface, mesh3d, volume, isosurface, cone, streamtube

Phase 3 📋 (15 more types)

  • Geographic Charts: choropleth, choroplethmap, choroplethmapbox, scattergeo, scattermap, scattermapbox, densitymap, densitymapbox
  • Financial Charts: candlestick, ohlc, waterfall
  • Hierarchical Charts: treemap, sunburst, icicle, sankey

Phase 4 📋 (14 more types)

  • Polar & Coordinates: scatterpolar, scatterpolargl, scattersmith, scatterternary, carpet, scattercarpet
  • Specialized Charts: funnel, funnelarea, indicator, image, table
  • Additional: barpolar, histogram2dcontour, contourcarpet

Total: 49 trace builders planned

Implementation Timeline

  • Phase 1 ✅ Foundation (5 basic traces) - COMPLETE
  • Phase 2 🚧 Statistical & 3D traces (15 more types)
  • Phase 3 📋 Geographic & Financial traces (15 more types)
  • Phase 4 📋 Remaining traces & complete layout (14 more types)
  • Phase 5 📋 Theming system (sci-fi, corporate, dark themes)
  • Phase 6 📋 Natural language interface

Technical Details

MCP Server Features

  • Built with MCP Python SDK 1.2.0+
  • FastMCP framework for easy tool definition
  • Async/await pattern throughout
  • Type hints for all parameters
  • Error handling with detailed messages
  • Logging for debugging

Chart Features

  • HTML output with embedded Plotly.js
  • Interactive charts (zoom, pan, hover)
  • Responsive design (800x600 default)
  • Professional styling (plotly_white theme)
  • Full customization of all visual elements

Testing

Each trace type returns complete HTML that can be:

  • Viewed directly in browser
  • Embedded in applications
  • Displayed in Cursor/Claude interface

Next Steps for Phase 2

Ready to add Statistical & 3D traces:

  • Box plots - quartile visualization
  • Violin plots - distribution shape
  • Heatmaps - 2D data correlation
  • 3D scatter - three-dimensional points
  • Surface plots - 3D mathematical functions

Contributing

The modular architecture makes it easy to add new trace types:

  1. Create trace builder in src/traces/{category}/
  2. Add tool decorator in src/server.py
  3. Test with sample data
  4. Update documentation

Requirements

  • Python 3.10+
  • MCP Python SDK 1.2.0+
  • Plotly 5.0+
  • Modern browser for viewing charts

Phase 1 Complete - 5/49 trace types implemented Ready for Phase 2: Statistical & 3D visualization

Built with ❤️ for the Claude ecosystem

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选