Mermaid Claude MCP App
The Mermaid Claude MCP App enables Claude to create, render, and manage Mermaid diagrams directly within the conversation. When you ask Claude to create a flowchart, sequence diagram, or any other Mermaid diagram, this app handles the entire process automatically - rendering an interactive widget with the diagram, copy functionality, and repair options for invalid syntax. Authenticated users can save, update, and list their personal diagrams.
Server URL: https://chatgpt.mermaid.ai/anthropic/v2/mcp
Available Tools
display_mermaid
Displays a Mermaid diagram in an interactive UI widget. The diagram is rendered client-side in the widget using the Mermaid library.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
diagramCode | string | Yes | The Mermaid diagram code to display |
title | string | Yes | Title for the diagram |
documentID | string | No | Must be provided when updating an existing diagram that already has a documentID. Should be omitted when creating a new diagram from scratch. |
Output:
The tool returns structured content containing:
viewMode- Always"diagramView"title- The diagram titlediagramCode- The original Mermaid codedocumentID- The document ID (if provided)isAuthenticated- Whether the user is signed inremainingCredits- AI credits remaining (if authenticated)
Tool Annotations:
readOnlyHint: true- Does not modify any dataopenWorldHint: false- Does not interact with external domainsidempotentHint: true- Safe to call multiple timesdestructiveHint: false- No destructive side effects
list_personal_diagrams
Lists the user’s saved Mermaid diagrams from their Mermaid.ai account. Requires authentication.
Input Parameters: None
Output:
The tool returns structured content containing:
viewMode- Always"listView"diagrams- Array of{ documentID, title }objectstotalCount- Total number of diagramsisAuthenticated- Whether the user is signed in
Tool Annotations:
readOnlyHint: true- Does not modify any dataopenWorldHint: false- Does not interact with external domainsidempotentHint: true- Safe to call multiple timesdestructiveHint: false- No destructive side effects
save_diagram
Saves a new diagram to the user’s Mermaid.ai account. Requires authentication.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
diagramCode | string | Yes | The Mermaid diagram code to save |
title | string | No | Optional title for the diagram |
Output:
The tool returns structured content containing:
documentID- The new document IDprojectID- The project IDid- The document record IDcode- The saved diagram codetitle- The diagram title
Tool Annotations:
readOnlyHint: false- Creates a new documentopenWorldHint: false- Does not interact with external domainsidempotentHint: false- Each call creates a new documentdestructiveHint: false- Does not overwrite existing data
update_diagram
Updates an existing diagram in the user’s Mermaid.ai account. Requires authentication.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
documentID | string | Yes | The ID of the document to update |
diagramCode | string | Yes | The updated Mermaid diagram code |
title | string | No | Optional new title for the diagram |
Output:
The tool returns structured content containing:
documentID- The document IDprojectID- The project IDcode- The updated diagram codetitle- The diagram title
Tool Annotations:
readOnlyHint: false- Modifies an existing documentopenWorldHint: false- Does not interact with external domainsidempotentHint: true- Updating with the same data has no additional effectdestructiveHint: true- Overwrites existing diagram data
repair_diagram
Attempts to repair an invalid Mermaid diagram using AI. Requires authentication and consumes AI credits if the repair was successful.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | The invalid Mermaid diagram code to repair |
error | string | Yes | The error message from diagram validation |
Output:
The tool returns structured content containing:
diagramCode- The repaired Mermaid diagram code
Tool Annotations:
readOnlyHint: false- Consumes AI creditsopenWorldHint: false- Does not interact with external domainsidempotentHint: false- AI repair may produce different results and consumes credits each calldestructiveHint: false- Does not overwrite existing data
sign_in
Triggers the OAuth sign-in flow for the user’s Mermaid.ai account.
Input Parameters: None
Output:
Returns a text confirmation of successful sign-in.
Tool Annotations:
readOnlyHint: false- Establishes an auth sessionopenWorldHint: false- Does not interact with external domainsidempotentHint: true- Signing in multiple times has the same effectdestructiveHint: false- No destructive side effects
get_diagram_by_url
Returns diagram title and code from the user’s Mermaid account using a URL. Requires authentication.
Input Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | A MermaidChart diagram URL |
Output:
The tool returns structured content containing:
documentID- The document IDprojectID- The project IDcode- The diagram codetitle- The diagram title
Tool Annotations:
readOnlyHint: true- Does not modify any dataopenWorldHint: false- Does not interact with external domainsidempotentHint: true- Safe to call multiple timesdestructiveHint: false- No destructive side effects
UI Widget
The app includes an interactive UI widget that displays:
- Rendered Diagram - Visual representation of the Mermaid diagram, rendered client-side
- Copy Code Button - One-click copy of the diagram code
- Repair Option - If the diagram has a syntax error, offers a repair option
- Diagram List - Browse and select from saved personal diagrams
Widget Permissions:
clipboardWrite- Allows copying diagram code to clipboard
How It Works
When you ask Claude to create a Mermaid diagram:
- Claude generates the Mermaid syntax based on your request
- The
display_mermaidtool sends the code to the interactive widget - The widget renders the diagram client-side using the Mermaid library
- If the diagram has a syntax error, the widget offers a repair option
- Authenticated users can save diagrams to their Mermaid.ai account and manage them with
save_diagram,update_diagram, andlist_personal_diagrams
Example Usage
Ask Claude to create any type of Mermaid diagram:
- “Create a flowchart showing the user login process”
- “Make a sequence diagram for an API request flow”
- “Generate a class diagram for a User model”
- “Draw a state diagram for an order lifecycle”
- “Show me my saved diagrams”
- “Save this diagram to my account”
Claude will automatically use the appropriate tool to render, save, or manage your diagrams.
Troubleshooting
If you encounter any issues:
- Invalid Syntax - Use the repair option in the widget, or ask Claude to use the
repair_diagramtool - Rendering Issues - Ensure your diagram code follows Mermaid syntax guidelines
- Copy Not Working - Check that clipboard permissions are enabled for the app
- Authentication Issues - Use the
sign_intool to re-authenticate with your Mermaid.ai account
For additional help, report issues at Mermaid Chart Issue Tracker.
Ask Claude to create a Mermaid diagram and see it rendered instantly with the interactive widget!