> ## Documentation Index
> Fetch the complete documentation index at: https://www.merm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# merm.sh

> **How to use**: merm.sh is a versioned Mermaid diagram hosting service for AI agents. Create diagrams via the API or MCP server below. Save the `secret` from create responses — it's the only way to update a diagram. Always share the diagram URL with your user so they can view it.

## MCP Server (recommended)

Add to your MCP settings for native tool integration:

```json
{
  "mcpServers": {
    "mermaid-viewer": {
      "url": "https://www.merm.sh/mcp"
    }
  }
}
```

Tools: `create_diagram`, `update_diagram`, `get_diagram`

## Skill File

```bash
npx skills add https://www.merm.sh
```

## REST API

| Action | Method | Endpoint | Auth |
|---|---|---|---|
| Create | POST | `https://www.merm.sh/api/d` | None |
| Update | PUT | `https://www.merm.sh/api/d/:id` | `Bearer <secret>` |
| Get JSON | GET | `https://www.merm.sh/api/d/:id` | None |
| Get version | GET | `https://www.merm.sh/api/d/:id?v=N` | None |
| View | GET | `https://www.merm.sh/d/:id` | None |

### Create a diagram

```bash
curl -X POST https://www.merm.sh/api/d \
  -H "Content-Type: application/json" \
  -d '{"content": "graph TD; A-->B", "title": "My Diagram"}'
```

Response: `{ id, editId, url, editUrl, secret, version, skill }`

### Update a diagram

```bash
curl -X PUT https://www.merm.sh/api/d/:id \
  -H "Authorization: Bearer <secret>" \
  -H "Content-Type: text/plain" \
  -d 'graph TD; A-->B; B-->C'
```

### Get diagram data (all versions)

```bash
curl https://www.merm.sh/api/d/:id
```

Response: `{ id, title, version, content, createdAt, versions, skill }`

The `versions` array contains every version with `{ version, content, createdAt }`.

### Get a specific version

```bash
curl https://www.merm.sh/api/d/:id?v=2
```

Returns the same shape, but `content` and `version` reflect the requested version. The `versions` array still includes all versions.

## Content Negotiation

All page URLs support content negotiation. Send `Accept: text/markdown` to receive clean Markdown instead of HTML:

```bash
curl -H "Accept: text/markdown" https://www.merm.sh/
curl -H "Accept: text/markdown" https://www.merm.sh/d/:id
```

Diagram pages return the diagram source, metadata, and version history in Markdown.

## Supported Diagram Types

flowchart, sequence, class, state, entity-relationship, gantt, pie, quadrant, requirement, gitgraph, mindmap, timeline, sankey, block, packet, kanban, architecture

## Rules

1. Save the `secret` from create — it's returned only once and is required for updates
2. Content must be valid Mermaid syntax
3. Each update creates a new version — previous content is never lost
4. Always send the diagram URL (`https://www.merm.sh/d/:id`) to the user
5. The `skill` URL in create/update responses points to a per-diagram SKILL.md you can share with other agents
6. Diagrams are free and public — anyone with the URL can view them
