Get the FREE Ultimate OpenClaw Setup Guide →

mcp -echart

基于 mcp-go 框架构建的 mcp 服务,它提供了一个能动态生成 ECharts 图表页面的工具。

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cnkanwei-mcp-server-echart docker run -i -p 8989:8989 -e PORT=8989 -e PUBLIC_URL=http://localhost:8989 -e LOG_LEVEL=info -e STATIC_DIR=static cnkanwei/mcp-server-echart:latest

How to use

This MCP server dynamically generates standalone HTML pages that render ECharts visualizations. You provide an ECharts configuration object (inputSchema) and a title, along with optional width and height, and the server returns a URL to the generated chart page. The core tool exposed by this service is generate_echarts_page, which takes the chart JSON and produces a self-contained HTML page that can be served from the static directory or shared publicly via the configured PUBLIC_URL. The server is designed to be configurable via environment variables and can be run locally with Docker or directly as a binary when built from source. To use, connect an MCP client (supporting Server-Sent Events) to the server’s /sse endpoint and invoke the generate_echarts_page tool with the desired parameters. The client will receive a URL pointing to the new chart page once generation succeeds.

How to install

Prerequisites:

  • Docker (recommended for quick start) or Go toolchain if building from source
  • Git (to clone the repository)

Option A: Use Docker (recommended)

  1. Build the image (if you have a Dockerfile and want to build locally): docker build -t mcp-server-echart .
  2. Run the container (exposes port 8989): docker run -p 8989:8989 -e PORT=8989 -e PUBLIC_URL=http://localhost:8989 -e LOG_LEVEL=info -e STATIC_DIR=static mcp-server-echart

Option B: Build from source (Go)

  1. Ensure Go 1.20+ is installed
  2. Clone the repository: git clone https://github.com/cnkanwei/mcp-server-echart.git cd mcp-server-echart
  3. Install dependencies and build: go mod tidy go build -o mcp-server-echart
  4. Run the server: ./mcp-server-echart

Note: If you run locally without Docker, ensure the environment variables PORT, PUBLIC_URL, LOG_LEVEL, and STATIC_DIR are set as needed.

Additional notes

Environment variables:

  • PORT: Port to listen on (default 8989)
  • PUBLIC_URL: Public URL base (e.g., http://localhost:8989 or https://example.com)
  • LOG_LEVEL: Logging level (e.g., info, debug)
  • STATIC_DIR: Directory to store generated HTML files (default: static)

Tips:

  • When using Docker, map the container port to a desired host port with -p, and pass PORT and PUBLIC_URL through -e flags.
  • The tool generate_echarts_page expects: title (string, required), inputSchema (object, required), width (number, optional, default 800), height (number, optional, default 600).
  • If you use a custom domain via PUBLIC_URL, ensure DNS and TLS certificates are properly configured for a production setup.
  • The Docker image cnkanwei/mcp-server-echart:latest publishes the /sse endpoint for MCP clients supporting SSE.

Related MCP Servers

Sponsor this space

Reach thousands of developers