MCP ExplorerExplorer

Chart Mcp

@pxnton 17 days ago
1 MIT
FreeCommunity
AI Systems
#mcp#mcp-server#react#recharts#typescript
MCP-Chart-Server is a powerful Node.js service that generates beautiful charts using React and Recharts, with server-side rendering and no browser required. Built on the Model Context Protocol (MCP), it offers seamless integration with AI assistants to create bar and line charts with extensive customization options.

Overview

What is Chart Mcp

chart-mcp is a powerful Node.js service that generates beautiful charts using React and Recharts, with server-side rendering capabilities and no browser required. It is built on the Model Context Protocol (MCP) and allows seamless integration with AI assistants for creating customizable bar and line charts.

Use cases

Use cases for chart-mcp include generating real-time data visualizations for dashboards, creating reports with interactive charts, integrating with AI tools for enhanced data representation, and developing educational tools that require graphical data display.

How to use

To use chart-mcp, ensure you have Node.js v20.19.2 installed. Install the package using ‘npm install’, build the project with ‘npm run build’, and start the server using ‘npm run start’. You can test the server with ‘npm run simple-server’ or an example with ‘npm run example’.

Key features

Key features of chart-mcp include server-side rendering, extensive customization options for charts, integration with AI assistants, and compatibility with Node.js v20.19.2. It also addresses ESM module loading issues with dynamic imports and proper module resolution.

Where to use

chart-mcp can be used in various fields such as data visualization, web applications, business intelligence, and anywhere that requires dynamic chart generation without a browser.

Content

MCP Chart Server v2 (Node v20.19.2 Fix)

This is a fixed version of the MCP Chart Server to work with Node.js v20.19.2. The original version had issues with ESM module loading in newer Node.js versions, causing an internal assertion error.

Fixed Issues

The following issues were fixed:

  1. Updated dynamic imports to use file:// URL protocol with absolute paths
  2. Added .js extensions to all imports for proper ESM resolution
  3. Added file path utilities (fileURLToPath, dirname, resolve) for proper module resolution
  4. Removed dynamic import in main index.ts file to avoid ESM loading issues

How to Use

Prerequisites

  • Node.js v20.19.2 (as specified in package.json)

Installation

npm install

Build

npm run build

Run

npm run start

Testing the Server

You can test the server using:

npm run simple-server

Or with the example:

npm run example

If You Still Encounter Issues

If you still encounter ESM module loading issues, you can run the fix script:

chmod +x fix-esm-imports.sh
./fix-esm-imports.sh
npm run build

Using with LibreChat

This fixed version should now work correctly when integrated with LibreChat using Node.js v20.19.2.

Tools

No tools

Comments