Skip to main content
Glama
JehadurRE

todiagram-mcp-windows-fix

by JehadurRE

todiagram-mcp-windows-fix

Windows-compatible fork of @todiagram/todiagram-mcp that fixes ERR_UNSUPPORTED_ESM_URL_SCHEME on Node.js v22+ and v25+ on Windows.

Connect ToDiagram to Cursor, Claude, Windsurf, and other AI assistants — now works on Windows!

⚠️ The Problem

The original @todiagram/todiagram-mcp crashes on Windows with:

Fatal error in main(): Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]:
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader.
On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Root cause: In dist/mcp-server.js, the lazyLoadUtil() function dynamically imports tool modules using path.join(), which on Windows produces paths like C:\Users\...\tools\file.js. The Node.js ESM loader requires file:// URLs, not bare Windows paths.

Related MCP server: fcp-drawio

✅ The Fix

A one-line change in dist/mcp-server.js:

- import { fileURLToPath } from "url";
+ import { fileURLToPath, pathToFileURL } from "url";

  // ... in lazyLoadUtil():
- await import(toolPath);
+ await import(pathToFileURL(toolPath).href);

pathToFileURL() converts C:\Users\...\file.jsfile:///C:/Users/.../file.js, which the ESM loader accepts on all platforms.

📦 Install

npm install -g todiagram-mcp-windows-fix

🔧 MCP Configuration

Claude Code (.mcp.json)

{
  "mcpServers": {
    "todiagram": {
      "type": "stdio",
      "command": "todiagram",
      "env": {
        "TODIAGRAM_API_KEY": "your-api-key-here"
      }
    }
  }
}

Or via npx

{
  "mcpServers": {
    "todiagram": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "todiagram-mcp-windows-fix"],
      "env": {
        "TODIAGRAM_API_KEY": "your-api-key-here"
      }
    }
  }
}

API Key Setup

  1. Go to ToDiagram Editor

  2. Click the account icon at top right

  3. Go to API Key section

  4. Create a key with a descriptive name and expiry time

🐛 Upstream Issue

This fix should be applied to the original @todiagram/todiagram-mcp package. The upstream issue is in src/mcp-server.ts:

// Current (broken on Windows):
for (const toolPath of toolsPaths) {
    await import(toolPath);
}

// Fix:
import { pathToFileURL } from "url";
for (const toolPath of toolsPaths) {
    await import(pathToFileURL(toolPath).href);
}

Affected platforms: Windows with Node.js v22+ (any version using ESM loader with strict URL scheme validation)

Affected versions: @todiagram/todiagram-mcp v1.1.0 and likely earlier versions

✅ Platform Compatibility

Platform

Node.js v20

Node.js v22

Node.js v25

Windows

macOS

Linux

📄 License

FSL-1.1-ALv2 (same as upstream)

Available Tools

5 tools
generateCodeDiagramGenerate Code DiagramA

Code-level or detailed component diagrams with key-value rows plus optional icons/images. Use for repositories, services, configs, or data-rich nodes. Note: setting imageUrl on a node hides all rows (label + image only); use iconUrl when you need both an icon and key-value fields. For high-level system visuals with mostly image nodes, use generateSystemDiagram.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional document name override. Defaults to the name inside the content payload.
contentYesJSON representation of the diagram, with nodes and edges defined as per the schema.

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses important behaviors: imageUrl hides rows, iconUrl preserves rows, parent nodes should omit imageUrl. This covers rendering trade-offs. However, it doesn't mention error handling or return structure, but for a diagram tool, these are secondary. The behavioral context added is valuable and not in schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each contributing unique information: purpose, usage distinction, and behavioral note. No filler. Front-loaded with main purpose, resulting in high information density.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has nested objects and 2 top-level parameters with 100% schema coverage. No output schema. Description covers key behavioral differentiators (image vs icon, parent nodes) and usage context. It doesn't explain return format, but that's acceptable given schema coverage. Overall, adequate for agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds beyond schema: explaining the distinction between imageUrl and iconUrl, guidance for parent nodes, and direction defaults. This enriches parameter understanding without repeating schema fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Code-level or detailed component diagrams with key-value rows plus optional icons/images', which specifies the verb (generate) and resource (code diagram) and distinguishes it from generateSystemDiagram. It explicitly says 'For high-level system visuals with mostly image nodes, use generateSystemDiagram', providing clear sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use guidance: 'Code-level or detailed component diagrams' and when-not: 'For high-level system visuals with mostly image nodes, use generateSystemDiagram'. It also gives a behavioral note about imageUrl vs iconUrl, which helps the agent decide based on needs.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generateDataDiagramGenerate data diagramA

Generate diagrams from structured data like JSON, YAML, CSV or XML. Use this tool specifically for visualizing raw data structures, configuration files, or API responses.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesName of the diagram
formatYesFormat of the input data
contentYesCould be any JSON, YAML, CSV or XML data. The tool will convert it into a diagram format.

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral transparency burden. It only states the tool converts data to a diagram format, without disclosing limitations, output details, or side effects. This is minimal disclosure for a file-processing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences deliver purpose and usage guidance efficiently, with no wasted words. Front-loaded with the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no output schema and three parameters, the description covers basic purpose and usage. However, it lacks details on diagram output type, error handling, or size constraints, which are relevant for raw data input.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all parameters. The description adds no parameter-level details, but the context (e.g., 'structured data') reinforces usage. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates diagrams from structured data (JSON, YAML, CSV, XML). However, it does not explicitly differentiate from sibling tools like generateCodeDiagram or generateSystemDiagram, missing a chance to achieve a top score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage context: 'visualizing raw data structures, configuration files, or API responses.' It does not mention when not to use or name alternative tools, but the context is sufficient for most scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generateImageDiagramGenerate Image to DiagramA

Convert an image (screenshot, diagram, whiteboard sketch, architecture drawing, etc.) into a ToDiagram custom format diagram. Analyzes the image to identify components, relationships, and hierarchical structure, then generates an equivalent diagram.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional name for the generated diagram
descriptionNoOptional description or context about the image
imageBase64YesBase64-encoded image data
imageMimeTypeYesMIME type of the image

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses analysis process (identify components, relationships, hierarchy) but no details on limitations, accuracy, or side effects. No annotations provided, so description carries moderate burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two well-structured sentences with no extraneous content. First sentence defines purpose and examples, second explains mechanism. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, so description should clarify output format. 'ToDiagram custom format' is vague. Missing constraints like file size or supported image complexity. Adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline of 3. Description adds minimal value beyond schema: it mentions analysis but doesn't elaborate on parameter roles beyond what's in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Convert an image into a ToDiagram custom format diagram' with examples of image types (screenshot, diagram, sketch, architecture). Distinguishes from sibling tools like generateCodeDiagram and generateMermaidDiagram by specifying the input source is an image.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies use when you have an image and want a diagram, but lacks explicit when-not-to-use or alternatives. Sibling tools are listed but not compared directly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generateMermaidDiagramGenerate Mermaid FlowchartA

Use only when a user explicitly requests raw Mermaid syntax. Great for quick text-only flowcharts or when they need to edit Mermaid directly. For architecture, repositories, and anything that benefits from images/groups, prefer generateSystemDiagram or generateCodeDiagram. Supports optional Iconify icons (e.g., Node["fa:database Database"]). Only flowcharts are supported.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesName of the diagram
contentYesMermaid definition for a flowchart (e.g., `flowchart LR` or `graph TD`). You can optionally add Iconify icons to nodes for better visual clarity using the syntax: `NodeID["<iconSet>:<iconName> Label"]` (e.g., `fa:user`). Icons are not required for every node, use them selectively to enhance important or distinct components.

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It mentions support for Iconify icons and flowchart-only constraint, but does not explicitly state the output format (raw Mermaid code). The title and description imply text-only output, but this is not confirmed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with three sentences, each serving a distinct purpose: usage condition, alternatives, and parameter details. Front-loads the key instruction, no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no output schema), the description covers purpose, usage, and parameter semantics adequately. However, it lacks explicit mention of the return data (raw Mermaid syntax), which would enhance completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by explaining the Iconify icon syntax and the flowchart-only constraint for the 'content' parameter, enhancing understanding beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the purpose: generating raw Mermaid syntax for flowcharts when explicitly requested. It distinguishes from sibling tools by specifying when to prefer alternatives, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Use only when a user explicitly requests raw Mermaid syntax' and provides clear alternatives for other cases (e.g., generateSystemDiagram for architecture). Also notes that only flowcharts are supported.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generateSystemDiagramGenerate System DiagramA

High-level system/architecture diagrams with grouped image/icon nodes (logos: or fa7-solid:). Keep fields minimal and favor visual nodes. Use nested parent/group nodes when it helps clarity—too many parents at root can get chaotic. Use this for repositories, platform overviews, services, and environment maps.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoOptional document name override. Defaults to the name inside the content payload.
contentYesJSON representation of the diagram, with nodes and edges defined as per the schema.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It describes the output style (icons, nesting) but does not disclose behavioral traits like read-only nature, performance, or error conditions. Adequate but not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, each valuable: purpose, style guidance, nesting advice, use cases. No redundant or unnecessary content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers the main aspects of diagram generation with nodes/edges, icons, and nesting. Could mention direction parameter impact, but schema covers it. Sufficient for the complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. Description adds context about icon format and nesting advice but does not significantly extend beyond the schema's property descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it generates 'High-level system/architecture diagrams with grouped image/icon nodes' and lists specific use cases (repositories, platform overviews, services, environment maps). This distinguishes it from siblings like generateCodeDiagram or generateMermaidDiagram.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides guidance on when to use (listed use cases) and how to structure (nested nodes, minimal fields). Lacks explicit when-not-to-use or comparison to alternatives, but context is clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.1.1
    • First observedgenerateCodeDiagram
    • First observedgenerateDataDiagram
    • First observedgenerateImageDiagram
    • First observedgenerateMermaidDiagram
    • First observedgenerateSystemDiagram

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct diagram type (code, data, system, image, Mermaid), with descriptions explicitly guiding when to use each and highlighting differences (e.g., generateCodeDiagram vs generateSystemDiagram).

Naming Consistency5/5

All tools follow a consistent 'generate + [DiagramType]' pattern using CamelCase, e.g., generateCodeDiagram, generateDataDiagram, etc.

Tool Count5/5

5 tools is a well-scoped set for a diagram generation server, covering the main diagram categories without unnecessary duplication or missing core functionality.

Completeness5/5

The tool set covers the major diagram needs: code-level, data, system architecture, image-to-diagram conversion, and Mermaid syntax, with no obvious gaps for the domain.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants to programmatically create and manage flowcharts, ERDs, and swimlane diagrams. It provides tools for manipulating diagram structures, performing auto-layouts, and exporting to Mermaid or Markdown formats.
    2
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    MCP server that enables LLMs to create and edit draw.io diagrams using high-level intent commands, with automatic layout and styling.
    4
    17
    4
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    MCP server for generating diagrams, charts, and visualizations using Gemini image generation on Vertex AI. Supports auto-detection of diagram types, multiple style modes, and iterative refinement.
    3
    14
    1
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    MCP server that converts Mermaid diagrams to styled Excalidraw files, saving them directly to disk without token overhead.
    2
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JehadurRE/todiagram-mcp-windows-fix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server