mermaid-validator-mcp 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.
Files changed (4) hide show
  1. package/README.md +88 -0
  2. package/dist/main.js +390876 -0
  3. package/index.ts +70 -0
  4. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # Mermaid Validator MCP
2
+
3
+ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server built with [Bun](https://bun.sh) and TypeScript that validates [Mermaid](https://mermaid.js.org) diagram syntax.
4
+
5
+ ## MCP Client Configuration
6
+
7
+ Add the server to your MCP client (e.g. Claude Desktop) configuration:
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "mermaid-validator": {
13
+ "command": "bun",
14
+ "args": [
15
+ "/path/to/mermaid-validator-mcp/index.ts"
16
+ ]
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ Or if you have it installed globally:
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "mermaid-validator": {
28
+ "command": "mermaid-validator-mcp"
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ## Features
35
+
36
+ - **Single tool – `validate_mermaid`**: Pass any Mermaid diagram text and receive either a success response with the detected diagram type, or a detailed parse-error message.
37
+ - Supports all major Mermaid diagram types: flowchart, sequence, class, pie, gantt, state, ER, gitGraph, mindmap, timeline, and more.
38
+ - No dependency on `mermaid-cli` or any external rendering process.
39
+ - Uses JSDOM to provide the minimal DOM environment required by Mermaid.
40
+
41
+ ## Requirements
42
+
43
+ - [Bun](https://bun.sh) ≥ 1.0
44
+
45
+ ## Getting Started
46
+
47
+ ```bash
48
+ # Install dependencies
49
+ bun install
50
+
51
+ # Start the MCP server (stdio mode)
52
+ bun start
53
+ ```
54
+
55
+ ## Tool: `validate_mermaid`
56
+
57
+ ### Input
58
+
59
+ | Field | Type | Description |
60
+ |-----------|--------|--------------------------------------|
61
+ | `diagram` | string | The Mermaid diagram text to validate |
62
+
63
+ ### Output (JSON text)
64
+
65
+ **Valid diagram**
66
+
67
+ ```json
68
+ { "valid": true, "diagramType": "flowchart-v2" }
69
+ ```
70
+
71
+ **Invalid diagram**
72
+
73
+ ```json
74
+ {
75
+ "valid": false,
76
+ "error": "Parse error on line 2:\n...TD\n --> B\n-------^\nExpecting 'SEMI', ..."
77
+ }
78
+ ```
79
+
80
+ ## Development
81
+
82
+ ```bash
83
+ # Run with auto-reload
84
+ bun dev
85
+
86
+ # Build
87
+ bun run build
88
+ ```