C4 Diagram MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@C4 Diagram MCP Server Create a C4 context diagram for our online banking system"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
C4 Diagram MCP Server
This project delivers an MCP server that enables creating architectural diagrams using PlantUML. The server helps you build your diagrams through natural conversation while ensuring adherence to C4 abstractions and diagram types.
The server uses C4-PlantUML by referencing their raw .puml files in the generated PUML syntax for your diagram(s).
Here is an example of a context diagram generated exclusively by Claude for this code base:

Supported Diagram Types
Context diagrams
Container diagrams
Component diagrams
Custom C4-styled type/interface/enum relationship diagrams, focused on their relationships with Containers and NOT including specific implementation details or properties (see example below)
C4-styled sequence diagrams (no boundaries or indexing)
Related MCP server: PlantUML MCP Server
Prerequisites
Node.js 18 or higher
npm 9 or higher
Internet connection (for PlantUML server access)
The official Filesystem MCP server installed and configured
This C4 diagram MCP server will use the Filesystem MCP server to store the generated PUML source code and PNG images for your diagrams
The Filesystem MCP server should be configured to allow the root directory where you would like any C4 diagram projects to be stored
This dependency exists because the official Filesystem MCP server has an established security model for properly accessing your filesystem which we will leverage to ensure that the generated PUML source code and PNG images are stored in a secure manner
Installation
Clone this repository
Install dependencies:
cd c4-plantuml-mcp-server
npm installBuild the project:
npm run buildExample Integration with Claude Desktop
Open Claude Desktop and access the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add the following configuration (adjust paths according to your environment):
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/desired/root/directory" ] }, "c4-plantuml": { "command": "node", "args": [ "path/to/c4-plantuml-mcp-server/build/index.js" ] }, } }As a tip, on Windows machines the path for the Filesystem MCP server configuration should be specified like
"C:\\my\\desired\\directory".Restart Claude Desktop using
CTRL+QorCMD+Q
Usage Examples
In the examples below, a single Markdown document containing some high-level design infomation for this example application was included in Claude's Project Knowledge. You can include more detailed information, code files, or use the Filesystem MCP server to point Claude to a directory containing the files you would like it to use as context for your project.
Basic usage
The video below shows a user prompting Claude with a simple concept statement for an app they'd like to design. While an optional step, the user also feeds some documentation into the prompt to increase the accuracy of the generated design. The AI then generates a C4 Context diagram, as requested, by thinking through the design and then generating each of the elements and their relationships. The PUML syntax to support the diagram is constantly being updated on disk. When the AI determines it has finished, it generates a png image of the completed PUML source code and saves it to disk.

Creating additional diagrams
The video below shows a user asking Claude to create the next-detailed C4 diagram, a Container diagram, to zoom in on the system that was defined in the Context diagram. The AI follows a similar thinking step as seen before, then creates a new Container diagram in the same project, adds the elements and relationships that it determines to be necessary, and then generates a png image of the completed diagram when it's finished. This additional diagram is created in the same chat session, but you can split this up over multiple sessions as well. Check out the Tips section below for more details.

Updating diagrams
The tool descriptions push the AI toward updating existing diagrams rather than creating new ones. You can make changes simply by prompting with something like "Let's simplify this diagram by representing all of the disparate user personas as a single "HOA member" user". If you would prefer to create a new version of your diagram instead, simply include that instruction in your prompt.
Tips
Having the official Sequential Thinking MCP server installed will greatly enhance your experience if you have a complex project by enabling the AI to think critically about your project to design the elements for your diagrams and their relationships.
This tool will generate PUML source code and png images for your diagrams using a pre-configured directory structure. You can include the path where you would like that directory to be created in your initial prompt with something like "I'd like all generated files to be created in
/tmp".If you generate different diagram levels across multiple chats, it is recommended that you upload the generated PUML source code from each completed diagram to the project knowledge (or utilize the
filesystemMCP server and point Claude to the directory) so that it has access to all of the IDs to fetch in the database.The ID of each diagram and the project that it belongs to are written to notes in the PUML source code, so you (or the AI) can easily find them.
If the call to the
generate-diagram-imagetool to create the png version of your diagram fails, as it sometimes does because we are using the public PlantUML server for this beta version of the code base, you can ask it to try again with a prompt like "Can you try again to generate the diagram image?".
Available Tools
12 toolsadd-elementA
Add an element to a C4 diagram.
This tool allows you to add any type of element (person, system, container, component, boundary)
to your C4 diagrams. The required parameters vary based on the element type and variant.
Required Input Fields:
- projectId: String (UUID of the project)
- diagramId: String (UUID of the diagram)
- elementType: String (Type of element: "note", "person", "system", "container", "component", "boundary", "interface", "type", "enum", "divider", "group")
- variant: String (Variant of the element: "standard", "external", "db", "queue", "system", "container")
- name: String (Name of the element)
- description: String (Description of the element)
Conditional Input Fields:
- technology: String (Required for container and component entities)
- boundaryId: String (Optional UUID of the boundary element this element belongs to)
- sprite: String (Optional icon for the element)
- tags: String (Optional styling tags)
- link: String (Optional URL link)
- type: String (Optional type specifier, for boundaries can be "system" or "container")
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs)
You can continue to use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: name (required), variant (required), diagramId (required), projectId (required), +8 more.
add-relationshipA
Add a relationship between elements in the C4 diagram.
Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram)
- sourceId: String (UUID of the source element)
- targetId: String (UUID of the target element)
- description: String (Description of the relationship)
Optional Input Fields:
- technology: String (Technology used in the relationship)
- direction: String (Relationship direction: standard, bidirectional, up, down, left, right, back, neighbor)
- sprite: String (Icon/sprite for the relationship)
- tags: String (Styling tags for the relationship)
- link: String (URL link for the relationship)
- rel: String (for sequence diagrams)
For sequence diagrams, you can specify custom arrow styles using the rel parameter:
- Common examples: "->", "-->", "<-", "o->", "->o", "->"
- The rel parameter accepts any valid PlantUML arrow syntax
- For example, "o->" represents an asynchronous message, "->o" represents a message to a participant's lifeline
- For the complete reference of arrow types, refer to PlantUML's sequence diagram documentation
Examples:
- A standard synchronous call: $rel="->" (solid arrow)
- An asynchronous message: $rel="o->" (starting with a circle)
- A return message: $rel="<-" (arrow pointing backward)
The response will include unique IDs that you'll need for all subsequent operations,
as well as a state object that will direct you to the appropriate next step to take.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element UUIDs to their names)
You can continue to use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: sourceId (required), targetId (required), diagramId (required), projectId (required), +7 more.
create-component-diagramA
Create a new C4 Component diagram within an existing architecture project.
If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead.
A Component diagram (C4 Level 3) zooms into a specific container to show the components that make up that container. Use this to show how container responsibilities are distributed across components and how these components interact.
IMPORTANT: Before using this tool, you will need either:
- the project ID returned from the create-c4-project tool
- to locate the project ID of an existing project; In this case, the projectId can be found in a note within the PUML source code for each diagram in the existing project
DO NOT create a new project if you have access to an existing project ID. Reusing the same project ID ensures proper relationships between different diagram levels.
Benefits:
- Shows the internal architecture of a specific container
- Clarifies how responsibilities are distributed across components
- Helps identify key classes, data structures, and libraries needed
Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your container/diagram)
Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)
The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's component/ directory.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs by diagram)
You can use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: title (required), projectId (required), description.
create-container-diagramA
Create a new C4 Container diagram within an existing architecture project.
If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead.
A Container diagram (C4 Level 2) zooms into a software system to show the containers (applications, data stores, microservices, etc.) that make up that system. Use this to show how system responsibilities are distributed across containers and how these containers communicate.
IMPORTANT: Before using this tool, you will need either:
- the project ID returned from the create-c4-project tool
- to locate the project ID of an existing project; In this case, the projectId can be found in a note within the PUML source code for each diagram in the existing project
DO NOT create a new project if you have access to an existing project ID. Reusing the same project ID ensures proper relationships between different diagram levels.
Benefits:
- Shows the high-level technical building blocks and their interactions
- Clarifies the architecture without going into implementation details
- Helps identify major technology decisions required
Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your system/diagram)
Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)
The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's container/ directory.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs by diagram)
You can use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: title (required), projectId (required), description.
create-context-diagramA
Create a new C4 Context diagram within an existing architecture project.
If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead.
A Context diagram (C4 Level 1) shows your system in its environment, focusing on people and systems rather than technologies or implementation details. Use this when you need a high-level overview that stakeholders can easily understand.
IMPORTANT: Before using this tool, you will need either:
- the project ID returned from the create-c4-project tool
- to locate the project ID of an existing project; In this case, the projectId can be found in a note within the PUML source code for each diagram in the existing project
DO NOT create a new project if you have access to an existing project ID. Reusing the same project ID ensures proper relationships between different diagram levels.
Benefits:
- Automatic PlantUML code generation without needing to write syntax
- Shows your system, its users, and external system dependencies
- Perfect for explaining the big picture to executives and stakeholders
Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your system/diagram)
Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)
The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's context/ directory.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs by diagram)
You can use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: title (required), projectId (required), description.
create-interfaces-visualizationA
Create a new C4-styled interfaces visualization diagram within an existing architecture project.
If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead.
An interfaces diagram is a specialized C4-styled visualization that shows your type system in a
comprehensible format, with clear styling for interfaces, types, enums, and the relationships
between them. It's ideal for documenting complex type systems and API contracts.
IMPORTANT: Before using this tool, you will need either:
- the project ID returned from the create-c4-project tool
- to locate the project ID of an existing project; In this case, the projectId can be found in a note
within the PUML source code for each diagram in the existing project
Benefits:
- Automatic PlantUML code generation with consistent C4 styling
- Clear visualization of interfaces, types, and their relationships
- Customized styling to distinguish between different element types
Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your interfaces diagram)
Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)
The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's interfaces/ directory.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs by diagram)
You can use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.Inputs: title (required), projectId (required), description.
create-sequence-diagramA
Create a new C4-styled Sequence diagram within an existing architecture project.
C4-PlantUML offers limited sequence diagram support that allows reusing existing elements
and relationships as participants and calls in a time-sequenced interaction flow.
Note: For simplicity, this implementation does not support boundaries in sequence diagrams.
Benefits:
- Automatic PlantUML code generation
- Shows interactions between components over time
- Perfect for explaining complex flows to stakeholders
Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your sequence diagram)
Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)
- showElementDescriptions: Boolean (Whether to show element descriptions in the diagram)
- showFootBoxes: Boolean (Whether to show foot boxes in the diagram)
- showIndex: Boolean (Whether to show message indices in the diagram)
The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's sequence/ directory.Inputs: title (required), projectId (required), showIndex, description, +2 more.
delete-entityA
Delete an existing element or relationship from the C4 diagram.
Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram)
Conditional Input Fields (ONE of the following is required):
- elementId: String (UUID of the element to delete)
- relationshipId: String (UUID of the relationship to delete)
You must provide either elementId OR relationshipId, but not both.
The response will include unique IDs that you'll need for all subsequent operations,
as well as a state object that will direct you to the appropriate next step to take.Inputs: diagramId (required), projectId (required), elementId, relationshipId.
generate-diagram-imageA
Generate a PNG image from the current state of the diagram.
This tool generates a visual representation (PNG) of your C4 diagram by sending the PlantUML
code to the PlantUML server. It should be used ONLY when you've finished designing your
diagram to avoid rate limiting issues with the PlantUML server.
All other diagram modification tools (add-element, add-relationship, etc.) only update
the PlantUML source file but do not generate the image. You must explicitly call this
tool when you have finished designing your diagram to create its visual representation
for the user.
Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram or create-container-diagram)
Response Fields:
- message: String (User-friendly message about the operation)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element UUIDs to their names)Inputs: diagramId (required), projectId (required).
locate-or-create-c4-projectA
A C4 project is a collection of related architecture diagrams that describe a system at different levels of detail. This tool sets up the foundation for creating a cohesive set of diagrams including Context (L1), Container (L2), Component (L3), and Code (L4) diagrams.
IMPORTANT: If your intent is to create a container, component, or code diagram, then it is likely that a project
already exists and you SHOULD NOT create a new project. Instead:
1. Check for existing project IDs in any PUML code shared in the conversation
2. Look for notes like: "This diagram is part of the X project with ID Y"
3. If you find a project ID, DO NOT use this tool and skip directly to calling the appropriate diagram creation tool
Creating multiple disconnected projects for the same system will break diagram relationships and navigation.
Conditional Input Fields:
To locate an existing project:
- id: String (UUID of an existing project - use this if you already know the project ID)
To search for or create a project:
- name: String (Name of the architecture project to search for or create)
- rootPath: String (Filesystem path where project directories will be created if needed)
- description: String (A brief explanation of what the project represents)
Response Fields:
- message: String (User-friendly message about the operation)
- projectId: String (UUID of the existing or newly created project)
- diagrams: Object (Information about existing diagrams if a project was found)Inputs: id, name, rootPath, description.
update-elementA
Update an existing element in an existing C4 diagram. This tool should be used WHENEVER a user requests changes to existing elements rather than creating new diagrams.
Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram)
- elementId: String (UUID of the element to update)
Optional Input Fields:
- name: String (New name for the element)
- description: String (New description for the element)
- type: String (New type for the element, e.g., 'system', 'person', 'external-system')
The response will include unique IDs that you'll need for all subsequent operations,
as well as a state object that will direct you to the appropriate next step to take.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element UUIDs to their names)Inputs: diagramId (required), elementId (required), projectId (required), name, +2 more.
update-relationshipA
Update an existing relationship in an existing C4 diagram. This tool should be used WHENEVER a user requests changes to existing relationships rather than creating new diagrams.
Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram)
- relationshipId: String (UUID of the relationship to update)
Optional Input Fields:
- sourceId: String (UUID of the new source element)
- targetId: String (UUID of the new target element)
- description: String (New description for the relationship)
- technology: String (New technology used in the relationship)
The response will include unique IDs that you'll need for all subsequent operations,
as well as a state object that will direct you to the appropriate next step to take.
Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element UUIDs to their names)Inputs: diagramId (required), projectId (required), relationshipId (required), sourceId, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool maps to a distinct C4 operation: project setup, diagram creation by type, element/relationship add/update/delete, and image generation. The only mild overlap is delete-entity handling both elements and relationships and create-* vs add-* verbs, but the descriptions make the boundaries clear.
All names use kebab-case and mostly follow a verb_noun pattern. The mix of create- for diagrams and add- for elements/relationships is semantically justified, though locate-or-create-c4-project and delete-entity are slightly less parallel.
12 tools is well within the expected range for a C4 diagram authoring server. Each tool covers a distinct lifecycle step, and no tool appears redundant.
Core lifecycle is covered: locate/create project, create five diagram types, add/update/delete elements and relationships, and generate PNG. Gaps include no delete-diagram/delete-project operation and no create-code-diagram despite L4 being mentioned, but most workflows can proceed.
Maintenance
Related MCP Connectors
Generate cloud architecture diagrams, flowcharts, and sequence diagrams.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Draw architecture diagrams, UML, planning boards and clickable wireframes from your AI assistant.
Software diagrams for developers, teams and agents — give your AI agents diagramming superpowers.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables generation of PlantUML diagrams (sequence, class, C4, architecture) with embeddable SVG/PNG URLs, encoding/decoding capabilities, and automatic syntax error detection and fixing.31,041 npm55MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to generate UML diagrams from text descriptions using PlantUML, supporting multiple output formats (PNG, SVG, PDF), syntax validation, and diagram source extraction.MIT
- AlicenseNot gradedqualityDmaintenanceEnables creation of Azure architecture diagrams from natural language descriptions, generating PNG images automatically.MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to list, read, create, update, delete, and render PlantUML and Mermaid diagrams, and check them against the actual codebase to detect architecture drift.15100 npm1MIT