npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@achmadya-dev/mcp-drawio

v0.2.4

Published

Model Context Protocol (MCP) server for draw.io — render diagrams inline in chat

Downloads

1,257

Readme

@achmadya-dev/mcp-drawio

MCP server for draw.io. Create diagrams via LLM — rendered inline in chat using MCP Apps.

Built on @achmadya-dev/mcp-core and @modelcontextprotocol/ext-apps.

Requirements

  • Node.js ≥ 20
  • MCP host with MCP Apps support (e.g. Cursor)

Install via npx

{
  "mcpServers": {
    "drawio": {
      "command": "npx",
      "args": ["-y", "@achmadya-dev/mcp-drawio"]
    }
  }
}

Tools

| Tool | Description | | ---- | ----------- | | show_inline_drawio | Render a diagram inline in chat from Mermaid or draw.io XML | | search_shapes | Search 10k+ industry icon shapes (AWS, Cisco, P&ID, …) for XML diagrams |

search_shapes is registered when the bundled shape index is present (included in the npm package after build).

show_inline_drawio

Provide exactly one of mermaid or xml:

| Input | Use for | | ----- | ------- | | mermaid | Flowchart, sequence, ER, class, state, gantt, mindmap, C4, and 25+ other types | | xml | Hand-placed layouts, swimlanes, cloud/network/P&ID stencils, UI mockups |

Optional layout passes (XML only):

| Option | Effect | | ------ | ------ | | postLayout: "elk" | Re-layout vertices with ELK (flowcharts, pipelines, hierarchical diagrams) | | direction: "vertical" \| "horizontal" | ELK flow direction (XML only; defaults to vertical) | | routing: "libavoid" | Obstacle-avoiding edge routing without moving vertices |

For industry icons in XML diagrams, call search_shapes first and use the returned style strings in mxCell attributes. References: xml-reference.md, mermaid-reference.md.

Inline viewer

The create_diagram tool renders an interactive iframe in chat:

  • Zoom, pan, and fit-to-view
  • Fullscreen mode
  • Open in draw.io — opens the diagram in app.diagrams.net for editing and export (PNG, SVG, PDF)

To save a diagram as an image, use Open in draw.io → File → Export as.

Develop from source

git clone https://github.com/achmadya-dev/mcp-drawio.git
cd drawio-mcp
pnpm install
pnpm run build
pnpm start

Local Cursor config (.cursor/mcp.json):

{
  "mcpServers": {
    "drawio": {
      "command": "node",
      "args": ["${workspaceFolder}/dist/index.js"],
      "cwd": "${workspaceFolder}"
    }
  }
}

After changing viewer or server code, rebuild and restart the MCP server in Cursor.

Scripts

| Command | Description | | ------- | ----------- | | pnpm run build | Compile TypeScript and copy src/assets/dist/assets/ | | pnpm start | Run MCP server (stdio) | | pnpm test | Run tests | | pnpm run generate:shapes | Regenerate shape search index (requires network) | | pnpm run format | Format with Prettier |

Environment

| Variable | Description | | -------- | ----------- | | DOMAIN | MCP Apps iframe domain (passed in resource _meta.ui) | | VIEWER_PATH | Optional path to a local viewer-static.min.js override | | ELK_PATH | Optional path to a local drawio-elk.min.js override | | MERMAID_PATH | Optional path to a local drawio-mermaid.min.js override |

The draw.io viewer loads from https://viewer.diagrams.net by default (CDN). Optional bundle overrides are useful for offline development or pinning a specific draw.io release.

Project layout

src/
  index.ts              MCP server entry (stdio, MCP Apps)
  drawio/
    drawio.ts           Bundle loader (HTML, shape index, references)
    utils.ts            createDiagram, searchShapes, validation
    viewer/html.ts      Inline MCP App viewer (draw.io + MCP SDK)
  tools/
    search_shapes.ts    Shape search tool (defineTool)
  assets/
    shared/             Tool description references (XML, Mermaid)
    shape-search/       Pre-built shape index (~10k shapes)
    vendor/app/         libavoid WASM (edge routing in viewer)
  scripts/
    copy-assets.ts      Build-time asset copy
    generate-shape-index.ts
dist/                   Published to npm

Diagram formats (quick guide)

| Need | Approach | | ---- | -------- | | Flowchart, sequence, ER, class, … | Mermaid via show_inline_drawio | | AWS / Azure / Cisco / P&ID icons | XML + search_shapes | | Edit or export PNG/SVG | Open in draw.io in the inline viewer |

libavoid vendor refresh

Browser WASM lives in src/assets/vendor/app/libavoid/. To refresh:

cd src/assets/vendor/app/libavoid
npm pack libavoid-js && tar -xzf libavoid-js-*.tgz
cp package/dist/index.js libavoid.min.js
cp package/dist/libavoid.wasm libavoid.wasm

Regenerate shape index (optional, when draw.io releases new shapes):

pnpm run generate:shapes
pnpm run build

Release

Uses Changesets:

pnpm changeset
pnpm run version-packages

Push to main → GitHub opens a Version packages PR → merge → npm publish via CI.

Requires NPM_TOKEN secret on the repository.

License

Apache-2.0