betterhyq/mermaid-grammer-inspector-mcp
The Mermaid Grammar Inspector MCP is a Model Context Protocol (MCP) server that provides comprehensive syntax validation and grammar checking for Mermaid diagrams. It allows MCP-compatible clients, such as Claude Desktop or code editors, to submit Mermaid code snippets and receive detailed feedback on any syntax errors or structural issues. The server leverages the Mermaid library's parsing capabilities to ensure diagrams conform to the expected grammar, supporting a wide range of diagram types including flowcharts, sequence diagrams, Gantt charts, and more. Designed as a lightweight and easy-to-deploy tool, the inspector can be run locally or integrated into development workflows. It exposes MCP tools that accept raw Mermaid syntax and return validation results, enabling real-time feedback during diagram creation. The project is implemented in TypeScript and relies on Puppeteer and the Mermaid CLI for accurate rendering and validation, ensuring consistent results with the official Mermaid interpreter. The server is particularly useful for AI-assisted documentation and development environments where Mermaid diagrams are generated programmatically. By providing immediate grammar checks, it helps prevent common mistakes such as incorrect node definitions, missing arrows, or invalid styling attributes. The tool is open source and was actively developed up until June 2026, after which it was archived by its maintainer. Key features include support for all major Mermaid diagram types, detailed error messages with line and column numbers, and seamless integration with the MCP ecosystem. It can be installed via npm and run as a standalone process, accepting connections from any MCP client. Despite being archived, the server remains functional and useful for projects needing reliable Mermaid validation.
- Category
- Developer Tools
- Pricing
- Open Source
Problem solved
Developers, technical writers, and AI agents frequently create Mermaid diagrams to visualize processes, architectures, and timelines. However, manually ensuring correct syntax is error-prone and time-consuming, leading to broken diagrams in documentation or presentations. This MCP server solves the problem by providing an automated, accurate validation layer that can be invoked programmatically or through assistive tools, ensuring that Mermaid code is syntactically correct before rendering.
Use cases
- Validating Mermaid diagrams generated by AI coding assistants to prevent syntax errors in rendered output.
- Integrating into CI/CD pipelines to automatically check diagram syntax in markdown documentation files.
- Providing live feedback inside IDEs or editors that support MCP to help developers write correct Mermaid code.
- Enabling technical writers to verify diagrams in knowledge bases or wikis before publishing.
- Assisting data scientists in Jupyter notebooks to ensure Mermaid cells render without errors.
Audience
- Developers
- ML Engineers
- Data Scientists
- Content Creators
Pros
- Easy integration with any MCP-compatible client or tool.
- Accurate validation using the official Mermaid parser and CLI.
- Lightweight and fast, suitable for real-time feedback.
- Supports a wide variety of Mermaid diagram types.
- Open source with permissive usage even after archival.
Cons
- Limited to Mermaid syntax; does not validate other diagram languages.
- Archived project with no future updates or maintenance.
- Dependency on Puppeteer increases installation size and complexity.
Official website: https://github.com/betterhyq/mermaid_grammer_inspector_mcp
Canonical LambdaBase page: https://www.lambdabase.com/tools/betterhyq-mermaid-grammer-inspector-mcp