Skip to content
Limited Time 40% off for early adopters — Get discount →

MCP Tools

Last updated:

Mermaid Studio provides MCP (Model Context Protocol) tools that allow coding agents to generate, validate, and work with Mermaid diagrams directly in your IDE.

MCP is an open standard for connecting AI applications to external data sources and tools. When you use an MCP-compatible agent (like Claude Code, JetBrains AI Assistant, or GitHub Copilot), it can discover and invoke Mermaid Studio’s diagram capabilities through this protocol.

Validates diagram syntax and checks for errors using both the Mermaid.js parser and Mermaid Studio’s static analysis. Problem reports include suggested quick fixes derived from the same inspections shown in the IDE, giving agents actionable steps to resolve issues.

Renders a Mermaid diagram as SVG, either returning the content or saving to a file. Agents can use this for lightweight previews or to produce vector graphics suitable for embedding in documentation and web pages, just like the IDE’s export feature.

Exports a Mermaid diagram as a PNG image with support for custom dimensions and background color. PNGs work reliably in slide decks, documents, and other contexts where SVG support is inconsistent. Agents can also use the rendered output to catch layout and readability issues that syntax validation alone would miss.

Searches the icon index to find icons for use in diagrams, with fuzzy matching and filtering by icon set. The search covers whichever icon sets you’ve loaded into Mermaid Studio, including vendor-specific sets like AWS, Azure, and GCP that aren’t bundled with Mermaid.js. Supports batching multiple searches in a single call, reducing round-trips when an agent needs to find several icons at once.

Retrieves the JSON schema for a diagram type’s frontmatter, covering layout and theme options such as padding, fonts, and diagram-specific visual settings. Agents can use this to fine-tune diagram appearance without guessing at available options or valid values.

Provides syntax reference documentation for any Mermaid diagram type, available in condensed or comprehensive formats. This gives agents accurate, up-to-date syntax information without searching external documentation, reducing errors from outdated or hallucinated syntax.

You can enable, disable, or selectively configure which MCP tools are exposed to coding agents.

MCP Tools settings panel

  1. Open the IDE settings/preferences ( Command + Comma Control + Alt + S ).

  2. Navigate to Tools > Mermaid Studio > MCP Tools.

  3. Use the Enable MCP tools checkbox to turn the entire feature on or off.

  4. Under Available Tools, toggle individual tools based on your needs.

  5. Click Apply or OK to save your changes.

Changes take effect immediately. Active agent sessions may need to be restarted to see the updated tools list.

The MCP tools can be combined in an iterative generate-validate-render loop. To enable this behavior, add instructions to your agent’s configuration file (e.g., CLAUDE.md, AGENTS.md, or similar).

Example instructions to include:

When creating or editing Mermaid diagrams:
1. Call `getMermaidSyntaxGuide` to learn the syntax for the diagram type
2. Write the diagram code
3. Call `analyzeMermaidDiagram` to check for errors
4. Fix any issues and re-analyze until valid
5. Use `searchMermaidIcons` to find appropriate icons when needed
6. Call `generateMermaidPng` to render the diagram
7. Visually review the PNG for layout and readability issues
8. Refine and re-render until the diagram looks correct

With these instructions, the AI can catch visual issues that syntax validation alone would miss—like overlapping labels or confusing layouts—because it actually sees the rendered output.

Good tool-calling models will often use a variation of this workflow automatically when prompted to create or edit diagrams even without explicit instructions.

When working with a coding agent, you can ask it to:

  • “Create a flowchart showing the user registration process”
  • “Check this Mermaid diagram for errors”
  • “Export this sequence diagram as a PNG at 2x scale”
  • “Find AWS icons for an architecture diagram”
  • “Search for database icons I can use in a flowchart”
  • “Create a state diagram for an order workflow”

The agent can render diagrams directly and show you the results, or save them to files in your project.

The MCP tools aren’t limited to agents running inside a JetBrains IDE. External agents can access Mermaid Studio’s capabilities as long as your JetBrains IDE is running in the background.

This means you can work in VS Code, Cursor, or another editor with a coding agent and still use the Mermaid diagram tools—the JetBrains IDE handles rendering and validation behind the scenes.

For setup instructions, see External client setup in the JetBrains documentation.

Using Mermaid Studio through coding agents, AI assistants, and other AI-powered tools is permitted under the terms of Mermaid Studio’s End User License Agreement (EULA), section “AI Services Integration” (5.k).