Skip to content

Commit 26704f9

Browse files
committed
refractor(mcp-echarts):rename
1 parent 1f551e8 commit 26704f9

123 files changed

Lines changed: 7626 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

0 Bytes
Binary file not shown.

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js environment
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
22+
- name: Run Continuous Integration
23+
run: |
24+
npm install
25+
npm run build
26+
npx vitest --watch=false

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
yarn.lock
9+
10+
# Sys
11+
.DS_Store
12+
.idea
13+
14+
# Node
15+
node_modules/
16+
17+
# Build
18+
dist
19+
lib
20+
esm
21+
build
22+
23+
# Test
24+
coverage
25+
26+
# Editor
27+
.vscode
28+
.histor
29+
30+
# Package
31+
package-lock.json
32+
pnpm-lock.yaml
33+
bun.lock
34+
35+
# Environment variables
36+
.env
37+
.env.*
38+
!.env.example
39+
40+
# Test files
41+
test-*.js

echarts/.env.example

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# MinIO Configuration
2+
# Copy this file to .env and update with your MinIO settings
3+
4+
# MinIO server endpoint (without protocol)
5+
MINIO_ENDPOINT=localhost
6+
7+
# MinIO server port
8+
MINIO_PORT=9000
9+
10+
# Use SSL/HTTPS connection (true/false)
11+
MINIO_USE_SSL=false
12+
13+
# MinIO access credentials
14+
MINIO_ACCESS_KEY=minioadmin
15+
MINIO_SECRET_KEY=minioadmin
16+
17+
# Bucket name for storing charts
18+
MINIO_BUCKET_NAME=mcp-echarts

echarts/.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
echo "Running lint-staged"
3+
npx lint-staged

echarts/.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"singleQuote": false,
4+
"trailingComma": "all",
5+
"bracketSpacing": true
6+
}

echarts/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:lts-alpine
2+
3+
WORKDIR /app
4+
5+
# Copy package files
6+
COPY package*.json ./
7+
8+
# Install dependencies
9+
RUN npm install --ignore-scripts
10+
11+
# Copy application code
12+
COPY . .
13+
14+
# Build the application
15+
RUN npm run build
16+
17+
# Command will be provided by smithery.yaml
18+
CMD ["node", "build/index.js"]

echarts/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 hustcc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

echarts/README.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# <img src="https://echarts.apache.org/zh/images/favicon.png" height="24"/> MCP ECharts ![](https://badge.mcpx.dev?type=server 'MCP Server') [![build](https://github.com/hustcc/mcp-echarts/actions/workflows/build.yml/badge.svg)](https://github.com/hustcc/mcp-echarts/actions/workflows/build.yml) [![npm Version](https://img.shields.io/npm/v/mcp-echarts.svg)](https://www.npmjs.com/package/mcp-echarts) [![smithery badge](https://smithery.ai/badge/@hustcc/mcp-echarts)](https://smithery.ai/server/@hustcc/mcp-echarts) [![npm License](https://img.shields.io/npm/l/mcp-echarts.svg)](https://www.npmjs.com/package/mcp-echarts) [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/hustcc/mcp-echarts)](https://archestra.ai/mcp-catalog/hustcc__mcp-echarts)
2+
3+
Generate <img src="https://echarts.apache.org/zh/images/favicon.png" height="14"/> [Apache ECharts](https://echarts.apache.org/) with AI MCP dynamically for chart generation and data analysis. _Also you can use <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ZFK8SrovcqgAAAAAAAAAAAAAemJ7AQ/original" height="14"/> [mcp-server-chart](https://github.com/antvis/mcp-server-chart) to generate chart, graph, map._
4+
5+
<a href="https://glama.ai/mcp/servers/@hustcc/mcp-echarts">
6+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@hustcc/mcp-echarts/badge" alt="ECharts MCP server" />
7+
</a>
8+
9+
<div align="center">
10+
<img width="648" alt="mcp-echarts" src="https://mdn.alipayobjects.com/huamei_1gdzij/afts/img/A*s3w3SpMMPDQAAAAARzAAAAgAemB7AQ/original" />
11+
</div>
12+
13+
## ✨ Features
14+
15+
- Fully support all features and syntax of `ECharts`, include data, style, theme and so on.
16+
- Support exporting to `png`, `svg`, and `option` formats, with validation for `ECharts` to facilitate the model's multi-round output of correct syntax and graphics.
17+
- MinIO Integration, store charts in `MinIO` object storage and return URLs instead of Base64 data for better performance and sharing capabilities.
18+
- Lightweight, we can install it easily with `zero dependence`.
19+
- Extremely `secure`, fully generated locally, without relying on any remote services.
20+
21+
22+
## 🤖 Usage
23+
24+
### Desktop Applications (stdio transport)
25+
26+
To use with `Desktop APP`, such as Claude, VSCode, Cline, Cherry Studio, and so on, add the MCP server config below. On Mac system:
27+
28+
```json
29+
{
30+
"mcpServers": {
31+
"mcp-echarts": {
32+
"command": "npx",
33+
"args": [
34+
"-y",
35+
"mcp-echarts"
36+
]
37+
}
38+
}
39+
}
40+
```
41+
42+
On Window system:
43+
44+
```json
45+
{
46+
"mcpServers": {
47+
"mcp-echarts": {
48+
"command": "cmd",
49+
"args": [
50+
"/c",
51+
"npx",
52+
"-y",
53+
"mcp-echarts"
54+
]
55+
}
56+
}
57+
}
58+
```
59+
60+
Also, you can use it on [modelscope](https://www.modelscope.cn/mcp/servers/hustcc/MCP-ECharts), [glama.ai](https://glama.ai/mcp/servers/@hustcc/mcp-echarts), [smithery.ai](https://smithery.ai/server/@hustcc/mcp-echarts) or others with HTTP, SSE Protocol.
61+
62+
63+
## 🚰 Run with SSE or Streamable transport
64+
65+
Install the package globally.
66+
67+
```bash
68+
npm install -g mcp-echarts
69+
```
70+
71+
Run the server with your preferred transport option:
72+
73+
```bash
74+
# For SSE transport (default endpoint: /sse)
75+
mcp-echarts -t sse
76+
77+
# For Streamable transport with custom endpoint
78+
mcp-echarts -t streamable
79+
```
80+
81+
Then you can access the server at:
82+
- SSE transport: `http://localhost:3033/sse`
83+
- Streamable transport: `http://localhost:3033/mcp`
84+
85+
86+
## 🎮 CLI Options
87+
88+
You can also use the following CLI options when running the MCP server. Command options by run cli with `-h`.
89+
90+
```plain
91+
MCP ECharts CLI
92+
93+
Options:
94+
--transport, -t Specify the transport protocol: "stdio", "sse", or "streamable" (default: "stdio")
95+
--port, -p Specify the port for SSE or streamable transport (default: 3033)
96+
--endpoint, -e Specify the endpoint for the transport:
97+
- For SSE: default is "/sse"
98+
- For streamable: default is "/mcp"
99+
--help, -h Show this help message
100+
```
101+
102+
103+
## 🗂️ MinIO Configuration (Optional)
104+
105+
For better performance and sharing capabilities, you can configure MinIO object storage to store chart images as URLs instead of Base64 data.
106+
107+
> [!NOTE]
108+
> If MinIO is not configured or unavailable, the system automatically falls back to `Base64` data output, ensuring compatibility.
109+
110+
We can Integrate with `MinIO` object storage providers below.
111+
112+
- [MinIO](https://min.io/): High-performance, S3-compatible object storage. Use [MinIO JavaScript Client](https://min.io/docs/minio/linux/developers/javascript/minio-javascript.html) for direct integration.
113+
- [Amazon S3](https://aws.amazon.com/s3/): Use [AWS SDK](https://aws.amazon.com/sdk-for-javascript/) with compatible API endpoint.
114+
- [Alibaba Cloud OSS](https://www.alibabacloud.com/product/object-storage-service): Use the [Alibaba Cloud SDK](https://www.alibabacloud.com/help/en/sdk) for OSS services.
115+
- [Google Cloud Storage](https://cloud.google.com/storage): Integrate using [Google Cloud SDK](https://cloud.google.com/sdk) or compatible API.
116+
- [Microsoft Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs): Use [Azure SDK](https://azure.microsoft.com/en-us/downloads/) for Blob storage access.
117+
- [Tencent Cloud COS](https://intl.cloud.tencent.com/product/cos): Use the [Tencent Cloud SDK](https://intl.cloud.tencent.com/document/product/436/6474) for COS integration.
118+
119+
Also, we can setup MinIO locally for free.
120+
121+
1. **Install and start MinIO locally:**
122+
123+
```bash
124+
# Download MinIO (macOS example)
125+
brew install minio/stable/minio
126+
127+
# Start MinIO server
128+
minio server ~/minio-data --console-address :9001
129+
```
130+
131+
3. **Configure environment variables:**
132+
133+
```bash
134+
# Copy the example environment file
135+
cp .env.example .env
136+
137+
# Edit .env with your MinIO settings
138+
MINIO_ENDPOINT=localhost
139+
MINIO_PORT=9000
140+
MINIO_USE_SSL=false
141+
MINIO_ACCESS_KEY=minioadmin
142+
MINIO_SECRET_KEY=minioadmin
143+
MINIO_BUCKET_NAME=mcp-echarts
144+
```
145+
146+
147+
## 🔨 Development
148+
149+
Install dependencies:
150+
151+
```bash
152+
npm install
153+
```
154+
155+
Build the server:
156+
157+
```bash
158+
npm run build
159+
```
160+
161+
Start the MCP server:
162+
163+
```bash
164+
npm run start
165+
```
166+
167+
168+
## 🧑🏻‍💻 Contributors
169+
170+
- [lyw405](https://github.com/lyw405): Supports `15+` charting MCP tool. [#2](https://github.com/hustcc/mcp-echarts/issues/2)
171+
- [2niuhe](https://github.com/2niuhe): Support MCP with SSE and Streaming HTTP. [#17](https://github.com/hustcc/mcp-echarts/issues/17)
172+
- [susuperli](https://github.com/susuperli): Use `MinIO` to save the chart image base64 and return the url. [#10](https://github.com/hustcc/mcp-echarts/issues/10)
173+
- [BQXBQX](https://github.com/BQXBQX): Use `@napi-rs/canvas` instead node-canvas. [#3](https://github.com/hustcc/mcp-echarts/issues/3)
174+
- [Meet-student](https://github.com/Meet-student): Add `outputType` schema for all chart tools. [#24](https://github.com/hustcc/mcp-echarts/issues/24)
175+
- [hustcc](https://github.com/hustcc): Initial the repo.
176+
177+
178+
## 📄 License
179+
180+
MIT@[hustcc](https://github.com/hustcc).

0 commit comments

Comments
 (0)