Using DHTMLX MCP server with AI coding assistants
Building diagram applications requires precise control over shapes, connections, layout, and editor configuration. When an AI tool generates DHTMLX Diagram code from outdated training data, the result is mismatched APIs, missing properties, and configuration options that no longer exist.
The DHTMLX Model Context Protocol (MCP) server solves this by giving AI tools direct access to the live Diagram documentation. Whether you are working with swimlanes, custom shapes, the Diagram Editor, or any other part of the library, the assistant retrieves the current reference material before generating a response.
MCP endpoint
https://docs.dhtmlx.com/mcp
The DHTMLX MCP server covers all major DHTMLX products, not only DHTMLX Diagram. The same endpoint and configuration steps apply regardless of which component you are working with.
Where MCP server helps with Diagram
The MCP server indexes the full DHTMLX Diagram documentation. Common scenarios where the MCP server is useful:
- Looking up the current API for shapes, lines, groups, or swimlanes.
- Generating ready-to-run Diagram code based on a description.
- Exploring Editor configuration options, toolbar controls, and event handling.
- Checking export options and understanding how to produce PDF or PNG output.
- Configuring auto-layout options for default-mode diagrams using the diagram configuration.
- Loading diagram data and serializing it back with the available data methods.
- Handling Diagram and Editor events to respond to user interactions.
- Exploring TypeScript support and framework integration for React, Vue, Angular and Svelte.
How DHTMLX MCP server works
The server combines a Retrieval-Augmented Generation (RAG) pipeline with MCP so that AI assistants can query documentation on demand rather than relying solely on training data.
For example, when you ask "How do I configure a swimlane diagram with custom cell headers?", the assistant sends the prompt via the MCP endpoint. The server matches it against the swimlanes documentation, retrieves the relevant reference pages, and returns them as context. The assistant then generates code based on the current API rather than a training snapshot.
Connecting AI tools to Diagram
AI development tools typically support MCP through a CLI command or a JSON configuration file. In both cases the core step is registering the server URL:
https://docs.dhtmlx.com/mcp
Setup instructions for the most commonly used tools are listed below.
Claude Code setup
Full details on connecting MCP servers to Claude Code are available in the official documentation.
The fastest way to add the DHTMLX MCP server to Claude Code is through the CLI:
claude mcp add --transport http dhtmlx-mcp https://docs.dhtmlx.com/mcp
To configure it manually, add the following entry to your .mcp.json:
{
"mcpServers": {
"dhtmlx-mcp": {
"type": "http",
"url": "https://docs.dhtmlx.com/mcp"
}
}
}
Cursor setup
You can find step-by-step MCP setup instructions for Cursor in the official documentation.
Follow the steps below to connect the DHTMLX MCP server to Cursor:
- Open Settings (
Cmd+Shift+Jon Mac,Ctrl+Shift+Jon Windows/Linux) - Go to Tools & MCP
- Click Add Custom MCP
- Paste this config:
{
"mcpServers": {
"dhtmlx-mcp": {
"url": "https://docs.dhtmlx.com/mcp"
}
}
}
Google Antigravity
Antigravity 2.0
Refer to the official documentation for full details on MCP server integration in Antigravity.
These are the steps to complete for connecting DHTMLX MCP server with Google Antigravity:
- Open the command palette
- Type "mcp add"
- Select "HTTP"
- Provide the following values:
- Name:
dhtmlx-mcp
- URL:
https://docs.dhtmlx.com/mcp
Antigravity CLI
Check the related guide to learn about migration from Gemini CLI to Antigravity CLI.
To connect the DHTMLX MCP server to Antigravity CLI, create mcp_config.json in one of these locations:
- Global:
~/.gemini/config/mcp_config.json - Workspace:
.agents/mcp_config.json
Add the following configuration:
{
"mcpServers": {
"dhtmlx-mcp": {
"serverUrl": "https://docs.dhtmlx.com/mcp"
}
}
}
Then run agy in the terminal.
ChatGPT setup
See the official documentation for the complete guide on connecting MCP servers to ChatGPT.
Follow these steps to connect DHTMLX MCP server to ChatGPT:
- Go to Settings → Apps & Connectors
- Click Advanced settings
- Enable Developer mode
- Return to the Apps & Connectors screen and click "Create"
- Configure the connector:
- Name:
dhtmlx-mcp
- URL:
https://docs.dhtmlx.com/mcp
- Authentication:
No authentication
- Click Create
Once connected, ChatGPT will retrieve Diagram documentation when answering questions during your conversations.
Note that MCP integration with ChatGPT may result in slower response times. For a faster experience, consider one of the other tools listed on this page.
Other tools
Most modern AI coding tools (including Windsurf, Cline, Continue.dev, etc.) surface MCP under names such as "Model Context Protocol", "Context Sources", or "Custom integrations" in their settings. Add https://docs.dhtmlx.com/mcp as the source URL.
Privacy and data handling
The DHTMLX MCP server is a cloud-only service that runs remotely, leaves your local environment untouched, and stores no personal user data. Queries may be logged for debugging and service improvement purposes.
Teams that require stricter privacy guarantees can request a commercial deployment with query logging disabled. Contact us at info@dhtmlx.com for details.
Example prompts for Diagram with AI
Once the MCP server is connected, phrase your prompts around a concrete goal so the assistant knows which part of the Diagram API to look up. The prompts below are organized by the task type. You can copy and adapt them as needed.
Creating diagrams
How do I create a swimlane diagram with custom sections in DHTMLX Diagram? Use the docs.
I want to build an org chart from a JSON data set in DHTMLX Diagram. How do I configure the auto-layout?
How do I create a flowchart with decision nodes and multiple links in DHTMLX Diagram?
How do I use autoPlace() to automatically arrange shapes in DHTMLX Diagram?
Working with shapes
I want to add custom shapes with icons to DHTMLX Diagram. How do I define a shape template?
How do I restrict which shapes a user can place in the DHTMLX Diagram Editor?
How do I change the default text style and background color for all shapes in DHTMLX Diagram?
Configuring the editor
I want to enable inline editing for shape text in DHTMLX Diagram.
How do I add a custom toolbar button to the DHTMLX Diagram Editor?
Data and export
How do I export a DHTMLX Diagram to a PNG file?
What format does DHTMLX Diagram use for serialized data, and how do I reload it?
Tips for effective Diagram prompts
- Name the API surface. Distinguish between the diagram instance and the editor, for example: "in the DHTMLX Diagram Editor" vs. "on the diagram object". The server retrieves more relevant docs when the target is clear.
- Include the shape type. Prompts like "a swimlane shape" or "a custom shape with HTML content" retrieve the correct reference pages faster than generic "a shape".
- Add "Use the docs" to your prompt. This phrasing signals to the assistant that it should trigger an MCP lookup rather than answering from training data.
- Be specific about the version behavior you expect. If the generated code doesn't match what you see in the docs, add "based on the current DHTMLX Diagram documentation" to force a fresh retrieval.