Mermaid Lint MCP
Validates and lints Mermaid diagram syntax across multiple types, including flowcharts, sequence diagrams, class diagrams, and state diagrams, to ensure they render correctly.
Enables automated Mermaid diagram validation within pre-commit hooks to maintain documentation quality and prevent syntax errors from being committed to a codebase.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mermaid Lint MCPvalidate this mermaid flowchart: graph TD; A-->B"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mermaid Lint MCP
δΈζηζ¬ | English
A powerful tool for validating Mermaid diagrams with both CLI and MCP server capabilities. Perfect for developers, technical writers, and AI assistants who work with Mermaid diagrams.
π Quick Start
Install and Use Immediately
# Validate a Mermaid file
npx mermaid-lint-mcp lint diagram.mmd
# Validate Mermaid code directly
npx mermaid-lint-mcp lint --code "graph TD; A-->B"
# Start MCP server for AI assistants
npx mermaid-lint-mcp server
# Get help
npx mermaid-lint-mcp --helpNo installation required! The tool will be downloaded automatically on first use.
Related MCP server: Mermaid-Grammer-Inspector
π― Use Cases
For Developers
Pre-commit validation: Ensure all Mermaid diagrams in your codebase are valid
CI/CD integration: Add diagram validation to your build pipeline
Documentation quality: Catch syntax errors before publishing docs
For Technical Writers
Content validation: Verify diagrams render correctly before publication
Error debugging: Get clear error messages for syntax issues
For AI Assistants
Real-time validation: Validate generated diagrams instantly
MCP integration: Seamless integration with Claude Code, Cursor, Trae, and other AI tools
Automated workflows: Enable AI to self-validate diagram outputs
π Features
β Fast Validation: Optimized for speed with browser reuse and local libraries
β Multiple Formats: Support for all Mermaid diagram types
β Dual Interface: Both CLI tool and MCP server in one package
β Error Details: Clear error messages with line numbers and suggestions
β Timeout Control: Configurable validation timeouts
β Zero Config: Works out of the box
π οΈ Installation Options
Option 1: Use with npx (Recommended)
No installation needed - just use npx mermaid-lint-mcp directly.
Option 2: Global Installation
npm install -g mermaid-lint-mcp
# Then use: mermaid-lint-mcpOption 3: Local Project Installation
npm install mermaid-lint-mcp
# Then use: npx mermaid-lint-mcpπ Usage Guide
CLI Commands
Validate Diagrams
# Validate a file
npx mermaid-lint-mcp lint diagram.mmd
npx mermaid-lint-mcp diagram.mmd # 'lint' is default
# Validate code string
npx mermaid-lint-mcp lint --code "graph TD; A-->B"
# With custom timeout (5 seconds)
npx mermaid-lint-mcp lint --timeout 5000 diagram.mmd
# Validate with file option
npx mermaid-lint-mcp lint --file diagram.mmdStart MCP Server
# Start server for AI assistant integration
npx mermaid-lint-mcp serverGet Help
npx mermaid-lint-mcp --help # Show all commands
npx mermaid-lint-mcp --version # Show versionMCP Server Integration
For Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mermaid-lint": {
"command": "npx",
"args": ["mermaid-lint-mcp", "server"]
}
}
}For Other MCP Clients, the setup is similar to above, please refer to the official documentation
π Supported Diagram Types
Type | Syntax | Example |
Flowchart |
| Decision trees, processes |
Sequence |
| API interactions, workflows |
Class |
| Object relationships |
State |
| State machines |
ER |
| Database schemas |
Gantt |
| Project timelines |
Pie |
| Data visualization |
Journey |
| User experiences |
Git Graph |
| Version control flows |
... |
| ... |
π§ Configuration
Validation Options
interface ValidationOptions {
timeout?: number; // Timeout in milliseconds (default: 5000)
}Environment Variables
# Set default timeout
export MERMAID_TIMEOUT=10000
# Enable debug logging
export DEBUG=mermaid-lint-mcpπ Example Outputs
Valid Diagram
{
"isValid": true,
"error": null,
"diagramType": "flowchart"
}Invalid Diagram
{
"isValid": false,
"error": "Parse error on line 8: ...> C E --> F[End ---------------------^ Expecting 'SQE', 'DOUBLECIRCLEEND', 'PE', '-)', 'STADIUMEND', 'SUBROUTINEEND', 'PIPE', 'CYLINDEREND', 'DIAMOND_STOP', 'TAGEND', 'TRAPEND', 'INVTRAPEND', 'UNICODE_TEXT', 'TEXT', 'TAGSTART', got '1'",
"diagramType": "flowchart"
}CLI Output
$ npx mermaid-lint-mcp lint --code "graph TD; A-->B"
π Validating Mermaid diagram...
β
Diagram is valid!
π Diagram type: flowchartπ¨ Common Issues & Solutions
Issue: "Command not found"
Solution: Use npx mermaid-lint-mcp instead of mermaid-lint-mcp
Issue: Validation timeout
Solution: Increase timeout with --timeout 10000
Issue: Permission denied
Solution: Run with appropriate permissions or use npx
π License
MIT License - see LICENSE file for details.
πββοΈ Support
π Documentation
π Report Issues
π¬ Discussions
π Related Tools
Mermaid - Create diagrams with text
Mermaid Live Editor - Online diagram editor
Model Context Protocol - AI integration standard
Available Tools
1 toolvalidate_mermaid_diagramB
Validate if a Mermaid diagram can be rendered successfully
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Mermaid diagram code to validate | |
| options | No | Validation options |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided. The description does not disclose whether the tool actually renders the diagram, checks syntax only, or has any side effects. Ambiguous about what 'validate' entails.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no redundancy. Perfectly concise for a simple validation tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema; description omits return values (e.g., boolean, errors). For a validation tool, the output is crucial and missing from description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline 3. The description adds no additional meaning beyond the schema fields; the timeout parameter is described in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool validates if a Mermaid diagram can be rendered successfully, which is a specific verb-resource combination. With no sibling tools, differentiation is not needed.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. Absence of siblings does not excuse lack of context like typical use cases or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
With only one tool, there is no ambiguity; the tool's purpose is clear and distinct by default.
The single tool name follows a clear verb_noun pattern (validate_mermaid_diagram), which is consistent and readable.
A single tool for a server named 'Mermaid Lint' feels insufficient; typical linting servers include multiple tools for validation, formatting, and configuration.
The surface is severely incomplete; only validation is provided, omitting common linting operations like reporting, fixing, or configuring rules.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagrβ¦
Create and manage Mermaid.js flowcharts and diagrams with AI agents via MCP.
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceValidates Mermaid diagrams with comprehensive grammar parsing supporting 28+ diagram types. Processes markdown files, ZIP archives, and direct input with detailed error reporting and enterprise-grade performance capabilities.1442Apache 2.0
- AlicenseAqualityFmaintenanceA Model Context Protocol (MCP) server for validating Mermaid diagram syntax and providing comprehensive grammar checking capabilities1135MIT
- AlicenseNot gradedqualityDmaintenanceEnables agents to search official Mermaid diagram syntax documentation and validate Mermaid diagram code before presenting it to users, ensuring syntactically correct flowcharts, sequence diagrams, class diagrams, and other Mermaid visualizations.4,357MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that validates Mermaid diagram syntax and identifies diagram types across all major formats. It provides detailed parse-error messages for invalid diagrams without requiring external rendering processes.133MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yaodebian/mermaid-lint-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server