mcp-dashboards 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KyuRish
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.
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # MCP Dashboard
2
+
3
+ mcp-name: io.github.KyuRish/mcp-dashboard
4
+
5
+ **Turn your data into interactive dashboards inside any AI client.**
6
+
7
+ [![npm](https://img.shields.io/npm/v/mcp-dashboard)](https://www.npmjs.com/package/mcp-dashboard)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+
10
+ The first MCP server that renders live, interactive Chart.js visualizations directly inside Claude Desktop, VS Code, and other MCP Apps-compatible clients. No browser needed - your charts appear right in the conversation.
11
+
12
+ ## Features
13
+
14
+ - **Pie & Donut Charts** - key-value data with percentages, labels, hover tooltips
15
+ - **Bar Charts** - vertical/horizontal, stacked, multi-series support
16
+ - **Line & Area Charts** - smooth curves, gradient fills, time series
17
+ - **Sortable Data Tables** - click-to-sort columns, numeric alignment, striped rows
18
+ - **Full Dashboards** - KPI cards with trend indicators + multiple charts in a responsive grid
19
+ - **Auto-Detect from JSON** - pass any JSON and get the best visualization automatically
20
+ - **Auto Dark/Light Mode** - adapts to your system theme
21
+ - **Fully Self-Contained** - Chart.js bundled inline, zero external requests
22
+ - **Animated** - staggered card entrances, smooth hover effects, loading states
23
+
24
+ ## Installation
25
+
26
+ ### Claude Desktop
27
+
28
+ Add to your Claude Desktop config (`claude_desktop_config.json`):
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "dashboard": {
34
+ "command": "npx",
35
+ "args": ["-y", "mcp-dashboard", "--stdio"]
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ ### Claude Code (VS Code)
42
+
43
+ ```bash
44
+ claude mcp add dashboard -- npx -y mcp-dashboard --stdio
45
+ ```
46
+
47
+ ### Remote (Streamable HTTP)
48
+
49
+ ```bash
50
+ npx mcp-dashboard
51
+ # Server starts on http://localhost:3001/mcp
52
+ ```
53
+
54
+ ## Tools
55
+
56
+ ### `render_pie_chart`
57
+
58
+ Render a pie or donut chart from label-value pairs.
59
+
60
+ ```
61
+ "Show me a pie chart of browser market share:
62
+ Chrome 65%, Safari 18%, Firefox 8%, Edge 5%, Other 4%"
63
+ ```
64
+
65
+ **Parameters:**
66
+ | Name | Type | Required | Description |
67
+ |------|------|----------|-------------|
68
+ | title | string | Yes | Chart title |
69
+ | data | [{label, value}] | Yes | Array of segments |
70
+ | options.donut | boolean | No | Hollow center (default: false) |
71
+ | options.showLegend | boolean | No | Show legend (default: true) |
72
+
73
+ ### `render_bar_chart`
74
+
75
+ Render vertical or horizontal bar charts with multi-series support.
76
+
77
+ ```
78
+ "Create a bar chart comparing Q1-Q4 revenue for 2024 vs 2025"
79
+ ```
80
+
81
+ **Parameters:**
82
+ | Name | Type | Required | Description |
83
+ |------|------|----------|-------------|
84
+ | title | string | Yes | Chart title |
85
+ | labels | string[] | Yes | Category labels |
86
+ | datasets | [{label, data}] | Yes | Data series |
87
+ | options.horizontal | boolean | No | Horizontal bars (default: false) |
88
+ | options.stacked | boolean | No | Stack datasets (default: false) |
89
+
90
+ ### `render_line_chart`
91
+
92
+ Render line or area charts with smooth curves and gradient fills.
93
+
94
+ ```
95
+ "Plot my portfolio value over the last 12 months as a line chart"
96
+ ```
97
+
98
+ **Parameters:**
99
+ | Name | Type | Required | Description |
100
+ |------|------|----------|-------------|
101
+ | title | string | Yes | Chart title |
102
+ | labels | string[] | Yes | X-axis labels |
103
+ | datasets | [{label, data}] | Yes | Data series |
104
+ | options.fill | boolean | No | Area fill (default: true) |
105
+ | options.smooth | boolean | No | Smooth curves (default: true) |
106
+ | options.showPoints | boolean | No | Show data points (default: false) |
107
+
108
+ ### `render_dashboard`
109
+
110
+ Render a full dashboard with KPI cards and multiple charts.
111
+
112
+ ```
113
+ "Create a sales dashboard with total revenue, growth rate, and customer count as KPIs,
114
+ plus a line chart of monthly revenue and a pie chart of revenue by region"
115
+ ```
116
+
117
+ **Parameters:**
118
+ | Name | Type | Required | Description |
119
+ |------|------|----------|-------------|
120
+ | title | string | Yes | Dashboard title |
121
+ | kpis | [{label, value, change?, prefix?, suffix?}] | No | KPI metric cards |
122
+ | charts | [{type, title?, ...chartConfig}] | Yes | Charts to display |
123
+
124
+ **KPI fields:**
125
+ - `label` - metric name
126
+ - `value` - the number or text
127
+ - `change` - percentage change (positive = green arrow up, negative = red arrow down)
128
+ - `prefix` - e.g. "$", "Rs."
129
+ - `suffix` - e.g. "%", " users"
130
+
131
+ ### `render_table`
132
+
133
+ Render a sortable, interactive data table. Click column headers to sort.
134
+
135
+ ```
136
+ "Show me a table of the top 10 countries by GDP"
137
+ ```
138
+
139
+ **Parameters:**
140
+ | Name | Type | Required | Description |
141
+ |------|------|----------|-------------|
142
+ | title | string | Yes | Table title |
143
+ | columns | string[] | Yes | Column names in display order |
144
+ | rows | [{key: value}] | Yes | Array of row objects |
145
+ | options.sortable | boolean | No | Enable sorting (default: true) |
146
+ | options.striped | boolean | No | Alternating row colors (default: false) |
147
+
148
+ ### `render_from_json`
149
+
150
+ Pass any JSON data and get the best visualization automatically.
151
+
152
+ ```
153
+ "Visualize this JSON data: [{"month": "Jan", "sales": 1200}, ...]"
154
+ ```
155
+
156
+ **Auto-detection rules:**
157
+ - `[{name, value}]` (1 string + 1 number key) - Pie chart
158
+ - `[{category, sales, profit}]` (1 string + N number keys) - Grouped bar chart
159
+ - `[{date, price}]` (date-like key + number keys) - Line chart
160
+ - `{key: number}` (flat object with numeric values) - Pie chart
161
+ - `[1, 2, 3]` (array of numbers) - Bar chart
162
+ - Complex objects with 3+ keys - Sortable table
163
+ - Unrecognizable - Raw JSON display
164
+
165
+ **Parameters:**
166
+ | Name | Type | Required | Description |
167
+ |------|------|----------|-------------|
168
+ | title | string | Yes | Chart title |
169
+ | data | any | Yes | Any JSON data |
170
+ | options.preferredType | string | No | Force: "pie", "bar", "line", or "table" |
171
+
172
+ ## Development
173
+
174
+ ```bash
175
+ git clone https://github.com/KyuRish/mcp-dashboard.git
176
+ cd mcp-dashboard
177
+ npm install
178
+ npm run build
179
+ npm run serve
180
+ ```
181
+
182
+ ### Scripts
183
+
184
+ | Script | Description |
185
+ |--------|-------------|
186
+ | `npm run build` | Build UI + server |
187
+ | `npm run build:ui` | Bundle HTML with Vite |
188
+ | `npm run build:server` | Compile TypeScript server |
189
+ | `npm run serve` | Start HTTP server on port 3001 |
190
+ | `npm start` | Build + serve |
191
+
192
+ ## How It Works
193
+
194
+ This server uses [MCP Apps](https://modelcontextprotocol.io/docs/extensions/apps) (SEP-1865) to return interactive HTML that renders inside AI clients as sandboxed iframes.
195
+
196
+ 1. You ask the AI to visualize data
197
+ 2. AI calls the appropriate MCP tool with your data
198
+ 3. Server generates structured content + links to a bundled HTML resource
199
+ 4. Client renders the HTML as an interactive widget inline in the conversation
200
+ 5. Chart.js handles rendering, tooltips, hover effects - all inside the iframe
201
+
202
+ The entire UI (Chart.js + CSS + JS) is bundled into a single self-contained HTML file using Vite + vite-plugin-singlefile. No CDN, no external requests.
203
+
204
+ ## Requirements
205
+
206
+ - Node.js 18+
207
+ - An MCP Apps-compatible client (Claude Desktop, VS Code, Goose, etc.)
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Entry point for the MCP Dashboard server.
4
+ * Run with: npx mcp-dashboard
5
+ * Or: node dist/index.js [--stdio]
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Entry point for the MCP Dashboard server.
4
+ * Run with: npx mcp-dashboard
5
+ * Or: node dist/index.js [--stdio]
6
+ */
7
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
9
+ import { createServer } from "./server.js";
10
+ async function startStreamableHTTPServer(factory) {
11
+ const port = parseInt(process.env.PORT ?? "3001", 10);
12
+ const express = await import("express");
13
+ const cors = await import("cors");
14
+ const app = express.default();
15
+ app.use(cors.default());
16
+ app.use(express.default.json());
17
+ app.all("/mcp", async (req, res) => {
18
+ const server = factory();
19
+ const transport = new StreamableHTTPServerTransport({
20
+ sessionIdGenerator: undefined,
21
+ });
22
+ res.on("close", () => {
23
+ transport.close().catch(() => { });
24
+ server.close().catch(() => { });
25
+ });
26
+ try {
27
+ await server.connect(transport);
28
+ await transport.handleRequest(req, res, req.body);
29
+ }
30
+ catch (error) {
31
+ console.error("MCP error:", error);
32
+ if (!res.headersSent) {
33
+ res.status(500).json({
34
+ jsonrpc: "2.0",
35
+ error: { code: -32603, message: "Internal server error" },
36
+ id: null,
37
+ });
38
+ }
39
+ }
40
+ });
41
+ const httpServer = app.listen(port, () => {
42
+ console.log(`MCP Dashboard server listening on http://localhost:${port}/mcp`);
43
+ });
44
+ const shutdown = () => {
45
+ console.log("\nShutting down...");
46
+ httpServer.close(() => process.exit(0));
47
+ };
48
+ process.on("SIGINT", shutdown);
49
+ process.on("SIGTERM", shutdown);
50
+ }
51
+ async function startStdioServer(factory) {
52
+ await factory().connect(new StdioServerTransport());
53
+ }
54
+ async function main() {
55
+ if (process.argv.includes("--stdio")) {
56
+ await startStdioServer(createServer);
57
+ }
58
+ else {
59
+ await startStreamableHTTPServer(createServer);
60
+ }
61
+ }
62
+ main().catch((e) => {
63
+ console.error(e);
64
+ process.exit(1);
65
+ });
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAGnG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,yBAAyB,CACtC,OAAwB;IAExB,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IAEtD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9B,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,C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