IM

iamfiscus/mcp-d3-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

18 stars 8 forks 质量 38 趋势 22

一个基于TypeScript Express的模型上下文协议(MCP)服务器,用于D3.js信息. 这个服务器通过MCP提供D3可视化文档,图表建议和代码生成. .

概览

一个基于TypeScript Express的模型上下文协议(MCP)服务器,用于D3.js信息. 这个服务器通过MCP协议提供D3可视化文档,图表建议和代码生成. - 2. 服务器将在 [[T0] (或您.env文件中指定的 PORT) 运行 3. 使用 MCP 客户端连接到 [[T1] 的 MCP 端点 - 获取关于特定主题的D3文档 - 获取关于特定D3图表类型的信息 - :生成不同图表类型的D3代码 - 参数:图表类型,数据格式,特征(可选) - :根据您的数据获取对D3图表类型的建议 - 参数:数据描述,目的 欢迎捐款!

概述(AI 翻译)

一个基于TypeScript Express的模型上下文协议(MCP)服务器,用于D3.js信息. 这个服务器通过MCP协议提供D3可视化文档,图表建议和代码生成.

□ 特性

  • D3资源:从D3来源获取文件和实例
  • ** 图表建议**:根据您的数据和目标,为正确的图表类型提出建议
  • ** 代码生成**:生成各种图表类型的 D3 代码示例
    • ** MCP 集成**:将AI工具直接连接到D3知识

□ 先决条件

  • 节点.js 16.x或以上
  • Npm或纱线

□ 安装

  1. 清除储存库

  2. 安装依赖关系

  3. 建设项目

□ 使用量

  1. 启动服务器

  2. 服务器将在 [[T0] (或您.env文件中指定的 PORT) 运行

  3. 使用 MCP 客户端连接到 [[T1] 的 MCP 端点

□ 发展

对于带有热重载的开发:

□ 可用的 MCP 资源和工具

资源

  • d3-docs://{topic}: 获取关于特定专题的D3文件
  • d3-charts://{chartType}:获取特定D3图表类型的信息

QQ 工具

本页由 AI 翻译,技术细节请以原文为准。

README

D3 MCP Server

A TypeScript Express-based Model Context Protocol (MCP) server for D3.js information. This server provides D3 visualization documentation, chart recommendations, and code generation through the MCP protocol.

Features

  • 📊 D3 Resources: Access documentation and examples from D3 sources
  • 🔍 Chart Recommendation: Get recommendations for the right chart type based on your data and goals
  • 💻 Code Generation: Generate D3 code examples for various chart types
  • 🔌 MCP Integration: Connect AI tools directly to D3 knowledge

Prerequisites

  • Node.js 16.x or higher
  • npm or yarn

Installation

  1. Clone the repository
git clone https://github.com/iamfiscus/mcp-d3-server.git
cd mcp-d3-server
  1. Install dependencies
npm install
  1. Build the project
npm run build

Usage

  1. Start the server
npm start
  1. The server will be running at http://localhost:3000 (or the PORT specified in your .env file)

  2. Connect to the MCP endpoint at http://localhost:3000/mcp-sse using an MCP client

Development

For development with hot reloading:

npm run dev

Available MCP Resources and Tools

Resources

  • d3-docs://{topic}: Access D3 documentation on specific topics
  • d3-charts://{chartType}: Get information about specific D3 chart types

Tools

  • generate-d3-chart: Generate D3 code for different chart types

    • Parameters: chartType, dataFormat, features (optional)
  • recommend-chart: Get recommendations for D3 chart types based on your data

    • Parameters: dataDescription, purpose

Examples

MCP Client Connection Example

import { McpClient } from "@modelcontextprotocol/sdk/client/mcp.js";
import { SseClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";

// Create an MCP client
const client = new McpClient();

// Connect to the D3 MCP server
const transport = new SseClientTransport("http://localhost:3000/sse");
await client.connect(transport);

// Get chart recommendations
const result = await client.invokeTool("recommend-chart", {
  dataDescription: "Monthly sales data for 5 product categories over 2 years",
  purpose: "Show trends and compare performance across categories"
});

console.log(result.content[0].text);

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →