Chhart-MCP

Chhart-MCP

MCP for https://chhart.app to easily create flowcharts or sankey diagram

Category
访问服务器

README

Chhart MCP Server

npm version License: MIT Node.js Version

An MCP (Model Context Protocol) server that enables AI assistants like ChatGPT, Claude, and others to programmatically create flowcharts and Sankey diagrams on chhart.app.

Table of Contents

Features

  • 🎨 Create Flowcharts - Generate flowcharts using Chhart's intuitive text-based DSL
  • 📊 Create Sankey Diagrams - Build Sankey diagrams from flow data
  • 📚 Syntax Help - Get comprehensive documentation and examples
  • 🔗 Shareable URLs - All diagrams come with shareable chhart.app links
  • 🚀 Easy Integration - Works with any MCP-compatible AI assistant
  • 🌐 Dual Mode - Run locally (stdio) or remotely (StreamableHTTP)
  • ☁️ Cloud Ready - Deploy to Railway, Vercel, or any Node.js hosting
  • 🔒 Reliable - Modern StreamableHTTP transport for stable connections

Prerequisites

  • Node.js 20 or higher
  • npm or yarn
  • An MCP-compatible client (Claude Desktop, Cursor, etc.)

Installation

From npm

npm install -g chhart-mcp

Or run directly without installing:

npx chhart-mcp

From Source

# Clone the repository
git clone https://github.com/alwank/chhart_MCP.git
cd chhart_MCP

# Install dependencies
npm install

# Build the project
npm run build

Usage

Quick Start (Public Server)

You can use our managed MCP server without installing anything locally.

Configure your MCP client to connect to the public endpoint:

{
  "mcpServers": {
    "chhart": {
      "url": "https://mcp.chhart.app/mcp"
    }
  }
}

Local Mode (stdio)

For use with Claude Desktop, Cursor, or other local MCP clients:

  1. Build the project:

    npm run build
    
  2. Add to your MCP client configuration:

    For Claude Desktop, edit claude_desktop_config.json:

    {
      "mcpServers": {
        "chhart": {
          "command": "npx",
          "args": ["-y", "chhart-mcp"]
        }
      }
    }
    

    For Cursor or other clients, see CONFIG_EXAMPLES.md for more examples.

  3. Restart your MCP client

Remote Mode (StreamableHTTP)

For deployment to Railway, Vercel, or other cloud platforms, we use the modern StreamableHTTP transport for reliable, stateless communication.

  1. Build and start the StreamableHTTP server:

    npm run build
    npm run start:streamable
    

    The server will start on port 3000 (or the port specified in PORT environment variable).

  2. Configure your MCP client to connect to the remote endpoint:

    {
      "mcpServers": {
        "chhart": {
          "url": "https://your-deployment-url.com/mcp"
        }
      }
    }
    
  3. Deploy to Railway:

    See the Railway Deployment Guide for detailed instructions.

Why StreamableHTTP?

We migrated from SSE to StreamableHTTP transport for better reliability:

Feature SSE Transport StreamableHTTP Transport
Connection Type Long-lived SSE stream Stateless HTTP requests
Stability Prone to timeouts ✅ Robust and reliable
Cloud Compatibility Limited ✅ Excellent
Session Management Required Optional (stateless)

Legacy SSE Mode

The SSE transport is still available but deprecated:

npm run start:sse  # Not recommended for production

Available Tools

create_flowchart

Creates a flowchart using Chhart's text-based DSL.

Parameters:

  • content (string, required) - Flowchart content in Chhart DSL format
  • title (string, optional) - Title for the flowchart

Example:

{
  "content": "Start\n  Process Step\n    Decision? [shape=diamond]\n      Yes\n        Action\n        End\n      No\n        Skip\n        End",
  "title": "Simple Workflow"
}

create_sankey

Creates a Sankey diagram showing flows between nodes.

Parameters:

  • content (string, required) - Sankey diagram content in Chhart DSL format
  • title (string, optional) - Title for the diagram

Example:

{
  "content": "Revenue [value=100]\n  Costs [value=40]\n    Salaries [value=25]\n    Operations [value=15]\n  Profit [value=60]",
  "title": "Budget Flow"
}

get_syntax_help

Returns documentation and examples for Chhart syntax.

Parameters:

  • type (enum, optional) - 'flowchart', 'sankey', or 'all' (default: 'all')

Example Conversations

Once configured, you can ask your AI assistant:

"Create a flowchart showing a user login process with email verification"

"Create a Sankey diagram showing how $100 of revenue splits into costs, taxes, and profit"

"Show me the syntax for creating flowcharts in Chhart"

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode (auto-rebuild on changes)
npm run watch

# Run locally (stdio mode)
npm start

# Run StreamableHTTP server (recommended for remote access)
npm run start:streamable

# Run SSE server (legacy, deprecated)
npm run start:sse

Project Structure

chhart_MCP/
├── src/
│   ├── index.ts              # Main entry point (stdio mode)
│   ├── server-streamable.ts  # StreamableHTTP server (recommended)
│   ├── server-sse.ts         # SSE server (legacy)
│   ├── tools/                # MCP tool implementations
│   ├── utils/                # Utility functions
│   └── transports/           # Transport implementations
│       ├── streamable.ts     # StreamableHTTP transport
│       └── sse.ts            # SSE transport (legacy)
├── dist/                     # Compiled JavaScript (generated)
└── docs/                     # Documentation files

How It Works

The MCP server generates shareable URLs by encoding chart data into the URL hash, leveraging chhart.app's existing URL-based sharing feature. This means:

  • ✅ No backend API required
  • ✅ Charts are fully client-side
  • ✅ URLs work immediately without storage
  • ✅ Charts can be edited on chhart.app
  • ✅ Privacy-friendly (data stays in the URL)

Troubleshooting

"Command not found" or "Module not found"

  • Ensure you've run npm install and npm run build
  • Verify the path in your MCP client configuration is absolute
  • Check that Node.js 20+ is installed: node --version

Connection Issues

"connection closed: EOF" or similar errors:

  • If using remote mode, ensure you're using StreamableHTTP transport (npm run start:streamable)
  • The legacy SSE transport is deprecated and may have stability issues
  • Verify the server is running: check the health endpoint at http://localhost:3000/health
  • Check firewall settings if deploying remotely
  • Ensure CORS is properly configured for your domain

Client configuration:

  • StreamableHTTP clients use application/json requests to /mcp
  • Legacy SSE clients require text/event-stream for the /mcp stream and JSON for /messages
  • Ensure the URL points to the /mcp endpoint

Charts Not Loading

  • Verify the generated URL is complete and not truncated
  • Check browser console for errors
  • Try opening the URL directly in a browser
  • Very large diagrams may exceed URL length limits (typically 2000 characters)

TypeScript Build Errors

  • Ensure you're using Node.js 20+
  • Delete node_modules and dist, then run npm install and npm run build
  • Check for TypeScript version compatibility

For more help, see CONTRIBUTING.md or open an issue.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on:

  • Reporting bugs
  • Suggesting features
  • Submitting pull requests
  • Development setup
  • Coding standards

Security

For security concerns, please see our Security Policy. Do not open public issues for security vulnerabilities.

License

MIT License - see LICENSE for details.

Copyright (c) 2026 Chhart.app

Links

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选