mcp-server-echart logo

mcp-server-echart

Community
cnkanwei

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

Publishercnkanwei
Repositorymcp-server-echart
LanguageHTML
Forks
4
Stars
60
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    mcp-server-echart exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    60 stars and 4 forks from the linked repository.

mcp-server-echart

License: MIT

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

✨ 功能特性

  • 动态图表生成:通过调用工具,传入 ECharts 的 JSON 配置,即可生成一个独立的 HTML 图表页面。
  • 高度可配置:支持自定义图表的标题、宽度和高度。
  • 现代化页面:生成的图表页面拥有一个干净、现代化的外观。
  • Docker 支持:提供 Dockerfile,可以轻松构建轻量、可移植的 Docker 镜像。
  • 配置灵活:通过环境变量或 .env 文件进行配置,轻松适配不同环境。

🚀 快速开始

1. 准备工作

  • Go (版本 1.24 或更高)
  • Docker (可选,用于容器化部署)

2. 克隆与配置

克隆本仓库到您的本地:

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

复制配置文件模板,并根据需要进行修改:

bash
cp .env.example .env

.env 文件包含以下配置项:

  • PORT: 服务监听的端口 (默认: 8989)
  • PUBLIC_URL: 对外暴露的 URL 根路径 (例如 http://localhost:8989 或 https://your.domain.com)
  • LOG_LEVEL: 日志级别 (例如 info, debug)
  • STATIC_DIR: 生成的静态 HTML 文件存放的目录 (默认: static)

3. 安装依赖

bash
go mod tidy

📦 如何运行

在本地运行

bash
go run main.go

服务启动后,会监听在 .env 文件中配置的 PORT 端口(默认为 8989)。

使用 Docker 运行

  1. 构建 Docker 镜像:

    bash
    docker build -t mcp-server-echart .
  2. 运行 Docker 容器:

    bash
    # 基础运行
    docker run -p 8989:8989 -d --name my-echart-server mcp-server-echart
    
    # 自定义端口和对外 URL
    docker run -p 9090:9090 \
      -e PORT=9090 \
      -e PUBLIC_URL="https://my.domain.com" \
      -d --name my-echart-server mcp-server-echart

🛠️ 工具 (Tool) API

本服务提供了一个名为 generate_echarts_page 的工具。

参数

  • title (string, 必需): 图表页面的标题。
  • inputSchema (object, 必需): ECharts 的 JSON 配置对象。
  • width (number, 可选): 图表的宽度(像素),默认 800。
  • height (number, 可选): 图表的高度(像素),默认 600。

返回值

成功调用后,工具会返回一个 URL,指向新生成的图表页面。


💻 如何使用

本服务可以通过任何支持 Server-Sent Events (SSE) 的 MCP 客户端进行调用。

客户端配置

如果您使用的 MCP 客户端支持通过配置文件连接到服务器,您可以添加如下配置来连接到本服务。

请将 mcp-server-echart 添加到您的客户端配置中,并将 URL 指向本服务的监听地址(默认为 http://localhost:8989/sse)。

示例配置 (client-config.json):

json
{
  "mcpServers": {
    "mcp-server-echart": {
      "url": "http://localhost:8989/sse"
    }
  }
}

另一个示例 (例如,用于浏览器环境):

json
{
  "mcpServers": {
    "browser-use-mcp-server": {
      "url": "http://localhost:8000/sse"
    }
  }
}

注意:

  • URL 应与您在 .env 文件中配置的 PORT 和 PUBLIC_URL 保持一致。
  • mcp-go 工具调用的默认端点是 /sse,而不是 /。

客户端配置 (通过 Docker 命令)

如果您的 MCP 客户端支持通过命令启动服务,您也可以配置它来直接运行 Docker Hub 上的镜像。这会将服务作为一个子进程来管理,客户端通过标准输入/输出 (stdin/stdout) 与其通信。

这对于本地开发或将服务分发给他人使用非常方便。

示例配置 (client-config.json):

json
{
  "mcpServers": {
    "mcp-server-echart-docker": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "8989:8989",
        "-e",
        "PORT=8989",
        "-e",
        "PUBLIC_URL=http://localhost:8989",
        "cnkanwei/mcp-server-echart:latest"
      ]
    }
  }
}

注意:

  • -p 8989:8989 将容器的 8989 端口映射到主机的 8989 端口,以便您可以从浏览器访问生成的图表。
  • cnkanwei/mcp-server-echart:latest 是发布在 Docker Hub 上的公共镜像。

📜 许可证

本项目基于 MIT License 开源。

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "cnkanwei-mcp-server-echart": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-echart"
      ]
    }
  }
}

Use mcp-server-echart MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-server-echart is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-server-echart as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-server-echart MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "cnkanwei-mcp-server-echart": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-echart"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-server-echart MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-server-echart MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-server-echart to help me with this task?
mcp-server-echart
Sure. I read it.
Here is what I found using mcp-server-echart.

Frequently asked questions

What is the mcp-server-echart MCP server used for?

mcp-server-echart is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-server-echart MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-server-echart with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-server-echart MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-server-echart connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-server-echart MCP to TypingMind?

mcp-server-echart runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-server-echart MCP provide in TypingMind?

mcp-server-echart exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-server-echart MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-server-echart requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇