mcp-server-echart

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

GitHub Stars

55

User Rating

Not Rated

Favorites

0

Views

33

Forks

2

Issues

0

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Go: バージョン 1.24 以上
Docker: (オプション、コンテナ化デプロイ用)

Installation

Installation

Prerequisites

Go: Version 1.24 or higher
Docker: (optional, for containerized deployment)

Installation Steps

1. Clone Repository

bash
git clone https://github.com/cnkanwei/mcp-server-echart.git
cd mcp-server-echart

2. Install Dependencies

bash
go mod tidy

3. Copy Configuration File

bash
cp .env.example .env

4. Start the Server

bash
go run main.go

Troubleshooting

Common Issues

Issue: Server won't start Solution: Check your Go version and reinstall dependencies.

Configuration

Configuration

Basic Configuration

The .env file contains the following configuration items:
PORT: The port the service listens on (default: 8989)
PUBLIC_URL: The root path of the publicly exposed URL (e.g., http://localhost:8989)
LOG_LEVEL: The logging level (e.g., info, debug)
STATIC_DIR: The directory where generated static HTML files are stored (default: static)

Example Configuration

env
PORT=8989
PUBLIC_URL=http://localhost:8989
LOG_LEVEL=info
STATIC_DIR=static

Examples

Examples

Basic Usage

Generating an ECharts Page

json
{
  "title": "Sample Chart",
  "inputSchema": {
    "xAxis": {
      "type": "category",
      "data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
    },
    "series": [{
      "name": "Sales",
      "type": "bar",
      "data": [120, 200, 150, 80, 70, 110, 130]
    }]
  },
  "width": 800,
  "height": 600
}

Using with Docker

bash
docker run -p 8989:8989 -d --name my-echart-server mcp-server-echart

Use Cases

Building dashboards for data visualization by dynamically generating charts using ECharts.
Developing a web application that generates charts in real-time based on user-inputted data.
Easily deploying the ECharts chart generation service in different environments using Docker.
Creating interactive web pages that generate charts with multiple different configurations for user selection.

Additional Resources