How to Use and Privately Deploy MCP Server for Chart Visualization
This article walks through the MCP Server‑based chart generation service, covering its 25+ chart types, integration via AntV, configuration for Stdio and SSE modes, source code structure, and step‑by‑step private deployment using Docker and environment variables.
Overview
The mcp-server-chart project ( https://github.com/antvis/mcp-server-chart ) implements a Model Context Protocol (MCP) server that generates visual charts using the AntV ecosystem. It supports more than 25 chart types, ranging from basic line, bar, and pie charts to advanced visualizations such as Sankey, violin, and word‑cloud charts. The server can be integrated with any MCP‑compatible client (e.g., Claude, VSCode, Cursor).
Quick Start – Stdio Mode
Configure a local Stdio‑mode MCP server by adding the following JSON to the client configuration (use an absolute path for npx if necessary):
{
"mcpServers": {
"mcp-server-chart": {
"command": "npx",
"args": ["-y", "@antv/mcp-server-chart"]
}
}
}For Windows, replace the command with cmd.exe and adjust the arguments:
{
"mcpServers": {
"mcp-server-chart": {
"command": "cmd.exe",
"args": ["/c", "npx", "-y", "@antv/mcp-server-chart"]
}
}
}After configuring the server address in a client (e.g., Cherry Stdio) and issuing a query, the server returns a chart image URL such as
https://mdn.alipayobjects.com/one_clip/afts/img/qvkKTooCA1wAAAAASTAAAAgAoEACAQFr/original. This URL is publicly accessible, which may be unsuitable for enterprise data.
SSE Transport Mode
Install the server globally: npm install -g @antv/mcp-server-chart Start the server with the desired transport:
# SSE transport (default endpoint: /sse)
mcp-server-chart --transport sse
# Streamable transport with custom endpoint
mcp-server-chart --transport streamableAccess the server at http://localhost:1122/sse or http://localhost:1122/mcp. The environment variable VIS_REQUEST_SERVER can be set to point to a private chart‑rendering service, enabling private chart generation.
Source Code Structure
Chart definitions : one file per chart type declares input parameters and tool descriptions.
Service folder : creates and starts server objects for each MCP service; serves as reusable templates for custom MCP servers.
Utils/generate.ts : calls remote rendering APIs and provides getVisRequestServer to retrieve the rendering endpoint dynamically.
Entry point : parses command‑line arguments and launches the appropriate MCP server based on the selected mode.
Private Deployment with Docker
Two Docker‑Compose files are used.
Chart rendering service (image ghcr.io/luler/gpt_vis_ssr:latest) exposing port 13100 and storing generated images in /app/public/images.
version: '3.8'
services:
gpt-vis-ssr:
image: ghcr.io/luler/gpt_vis_ssr:latest
ports:
- "13100:3000"
volumes:
- ./images:/app/public/images
environment:
- NODE_ENV=production
- TZ=Asia/Shanghai
restart: unless-stoppedMCP server – after cloning the repository, replace its docker-compose.yml with the following content (replace <YOUR_DOMAIN_OR_IP> with the actual host):
name: mcp-server-chart
services:
sse:
restart: unless-stopped
build:
context: ./sse
dockerfile: Dockerfile
ports:
- "1123:1123"
environment:
- VIS_REQUEST_SERVER=http://<YOUR_DOMAIN_OR_IP>:13100/render
volumes:
- ./sse:/mcp-server-chart/sseStart both containers. The private MCP server becomes reachable at http://<YOUR_DOMAIN_OR_IP>:1123/sse. Configure this address in an MCP client to use the privately hosted chart service.
Relevant discussion on private deployment can be found in the project issue tracker: https://github.com/antvis/mcp-server-chart/issues/140. Prompt templates for chart generation are available at https://github.com/antvis/GPT-Vis/blob/main/prompts/chart-type.md.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubiquitous Tech
A ubiquitous public account for pirate enthusiasts, regularly sharing curated experiences, tech learning, and growth insights. Currently publishing articles on AI RAG customer service, AI MCP technology, and open-source design. Personal free Knowledge Planet: Awakening New World Programmer.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
