MCPcopy Index your code
hub / github.com/TomWright/mermaid-server

github.com/TomWright/mermaid-server @v1.0.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.4 ↗ · + Follow
41 symbols 92 edges 6 files 35 documented · 85%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

mermaid-server

Use mermaid-js to generate diagrams in a HTTP endpoint.

While this currently serves the diagrams via HTTP, it could easily be manipulated to server diagrams via other means.

Basic usage

Docker

Run the container:

docker run -d --name mermaid-server -p 80:80 tomwright/mermaid-server:latest --allow-all-origins=true

Manually as a go command

Start the HTTP server:

go run cmd/app/main.go --mermaid=./mermaidcli/node_modules/.bin/mmdc --in=./in --out=./out

Diagram creation

Use the query param 'type' to change between 'png' and 'svg' defaults to 'svg'.

POST

Send a CURL request to generate a diagram via POST:

curl --location --request POST 'http://localhost:80/generate' \
--header 'Content-Type: text/plain' \
--data-raw 'graph LR

    A-->B
    B-->C
    C-->D
    C-->F
'

GET

Send a CURL request to generate a diagram via GET... send in url encoded data under the data query param:

curl --location --request GET 'http://localhost:80/generate?data=graph%20LR%0A%0A%20%20%20%20A--%3EB%0A%20%20%20%20B--%3EC%0A%20%20%20%20C--%3ED%0A%20%20%20%20C--%3EF%0A'

Example request in Postman

Caching

All generated diagram input and output will be cached for 1 hour. The cache time is reset whenever a cached diagram is accessed.

Extension points exported contracts — how you extend this code

Generator (Interface)
Generator provides the ability to generate a diagram. [1 implementers]
internal/generator.go
DiagramCache (Interface)
DiagramCache provides the ability to cache diagram results. [1 implementers]
internal/cache.go

Core symbols most depended-on inside this repo

writeErr
called by 7
internal/http.go
ID
called by 6
internal/diagram.go
Get
called by 4
internal/cache.go
Run
called by 3
internal/cleanup.go
Store
called by 2
internal/cache.go
NewDiagram
called by 2
internal/diagram.go
Touch
called by 2
internal/diagram.go
Generate
called by 1
internal/generator.go

Shape

Method 22
Function 13
Struct 4
Interface 2

Languages

Go100%

Modules by API surface

internal/cache.go13 symbols
internal/generator.go9 symbols
internal/http.go8 symbols
internal/diagram.go7 symbols
internal/cleanup.go3 symbols
cmd/app/main.go1 symbols

For agents

$ claude mcp add mermaid-server \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact