Skip to main content
Glama
MCP-BPMN Server
by oisee

MCP-BPMN Server

A Model Context Protocol (MCP) server that enables AI agents to create, manipulate, and manage BPMN 2.0 (Business Process Model and Notation) diagrams programmatically.

🎯 Overview

MCP-BPMN provides a standardized interface for AI assistants to work with business process diagrams. It generates valid BPMN 2.0 XML files that can be viewed and edited in any BPMN-compliant tool (VS Code BPMN Editor, Camunda Modeler, etc.).

Key Features

  • βœ… Complete BPMN 2.0 Support: Events, activities, gateways, pools, and sequences

  • βœ… Mermaid to BPMN Conversion: Bootstrap BPMN diagrams from Mermaid flowcharts

  • βœ… Smart Auto-Layout: Automatic positioning with branch handling for gateways

  • βœ… File Persistence: Save diagrams locally for editing in visual tools

  • βœ… Proper Visual Rendering: Accurate waypoint calculation for connections

  • βœ… Enterprise-Ready: Clean API design following BPMN standards

  • βœ… No Browser Dependencies: Server-side XML generation

Related MCP server: bpmn-generator-mcp

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/your-org/mcp-bpmn.git
cd mcp-bpmn

# Install dependencies
npm install

# Build the project
npm run build

# Run tests (optional)
npm test

Configuration

For Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "mcp-bpmn": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-bpmn/dist/server/index.js"]
    }
  }
}

For Other MCP Clients

Use the compiled CommonJS bundle:

node dist/server/bundle.cjs

πŸ“š API Reference

Stateful Context Management

MCP-BPMN uses a stateful API design where you work with one diagram at a time. All operations apply to the current diagram context, eliminating the need for processId parameters.

Creation Tools

new_bpmn

Create a new BPMN process or collaboration diagram and set it as the current context.

{
  name: "Order Processing",
  type: "process" // or "collaboration" (optional, defaults to "process")
}

new_from_mermaid

Create a new BPMN diagram from Mermaid code and set it as the current context.

{
  name: "My Process",
  mermaidCode: "graph TD\n  A[Start] --> B[Task] --> C[End]"
}

File Operations

open_bpmn

Open an existing BPMN file and set it as the current context.

{
  filename: "my-process.bpmn"
}

open_mermaid_file

Open and convert a Mermaid file to BPMN, setting it as the current context.

{
  filename: "my-flowchart.mmd"
}

save

Save the current diagram to its file (requires filename to be set).

{}

save_as

Save the current diagram with a new filename.

{
  filename: "my-process.bpmn"
}

close

Close the current diagram and clear the context.

{}

current

Get information about the current diagram.

{}

Element Manipulation Tools

add_event

Add events (start, end, intermediate, boundary) to the current diagram.

{
  eventType: "start", // start, end, intermediate-throw, intermediate-catch, boundary
  name: "Order Received",
  eventDefinition: "message", // optional: message, timer, error, signal, etc.
  position: { x: 100, y: 200 } // optional
}

add_activity

Add activities (tasks, subprocesses) to the current diagram.

{
  activityType: "userTask", // task, userTask, serviceTask, scriptTask, etc.
  name: "Review Order",
  position: { x: 250, y: 200 }, // optional
  properties: { assignee: "reviewer" } // optional
}

add_gateway

Add gateways for branching logic to the current diagram.

{
  gatewayType: "exclusive", // exclusive, parallel, inclusive, eventBased
  name: "Payment Check",
  position: { x: 400, y: 200 } // optional
}

connect

Connect two elements with a sequence flow in the current diagram.

{
  sourceId: "StartEvent_1",
  targetId: "UserTask_1",
  label: "Start Flow", // optional
  condition: "amount > 1000" // optional, for conditional flows
}

add_pool

Add a pool (participant) to a collaboration diagram.

{
  name: "Customer",
  position: { x: 100, y: 100 }, // optional
  size: { width: 600, height: 250 } // optional
}

add_lane

Add a lane to a pool (not yet fully implemented).

{
  poolId: "Participant_1",
  name: "Sales Department",
  position: "bottom" // optional
}

Query and Manipulation Tools

list_elements

List all elements in the current diagram.

{
  elementType: "bpmn:Task" // optional filter
}

get_element

Get details of a specific element.

{
  elementId: "UserTask_1"
}

update_element

Update element properties.

{
  elementId: "UserTask_1",
  name: "Updated Task Name",
  properties: { assignee: "john.doe" }
}

delete_element

Delete an element and its connections.

{
  elementId: "Task_1"
}

Utility Tools

export

Export the current diagram as BPMN 2.0 XML.

{
  format: "xml", // only xml is currently supported
  formatted: true // optional, defaults to true
}

validate

Validate the current diagram structure.

{}

auto_layout

Apply automatic layout to position elements in the current diagram.

{
  algorithm: "horizontal" // currently only horizontal is supported
}

File Management Tools

list_diagrams

List all saved BPMN diagrams.

{}

delete_diagram_file

Delete a saved diagram file.

{
  filename: "old-process.bpmn"
}

get_diagrams_path

Get the storage path for diagrams.

{}

πŸ”„ Context Management

The MCP-BPMN server uses a stateful design where you work with one diagram at a time:

  1. Create or Open: Start by creating a new diagram (new_bpmn, new_from_mermaid) or opening an existing one (open_bpmn, open_mermaid_file)

  2. Manipulate: All operations (add_event, connect, etc.) apply to the current diagram

  3. Save: Save your work with save or save_as

  4. Close: Close the current diagram with close

If you try to perform operations without a current context, you'll get a helpful error message:

No current context. Please create a diagram first with:
  - new_bpmn(name) to create a new BPMN diagram
  - new_from_mermaid(name, mermaidCode) to convert from Mermaid
  - open_bpmn(filename) to open an existing BPMN file
  - open_mermaid_file(filename) to convert a Mermaid file

πŸ’‘ Examples

Example 1: Creating an Approval Process from Scratch

// Step 1: Create a new process (sets it as current context)
await new_bpmn({ name: "Approval Workflow" });

// Step 2: Add elements (all operations apply to current diagram)
await add_event({ eventType: "start", name: "Request Received" });
await add_activity({ activityType: "userTask", name: "Review Request" });
await add_gateway({ gatewayType: "exclusive", name: "Approved?" });
await add_activity({ activityType: "serviceTask", name: "Process Approval" });
await add_activity({ activityType: "userTask", name: "Handle Rejection" });
await add_event({ eventType: "end", name: "Complete" });

// Step 3: Connect elements
await connect({ sourceId: "StartEvent_1", targetId: "UserTask_1" });
await connect({ sourceId: "UserTask_1", targetId: "ExclusiveGateway_1" });
await connect({ sourceId: "ExclusiveGateway_1", targetId: "ServiceTask_1", label: "Yes" });
await connect({ sourceId: "ExclusiveGateway_1", targetId: "UserTask_2", label: "No" });
await connect({ sourceId: "ServiceTask_1", targetId: "EndEvent_1" });
await connect({ sourceId: "UserTask_2", targetId: "EndEvent_1" });

// Step 4: Apply auto-layout for proper positioning
await auto_layout();

// Step 5: Save and export the diagram
await save_as({ filename: "approval-workflow.bpmn" });
const xml = await export();
// Step 1: Create from Mermaid syntax (much more concise!)
await new_from_mermaid({ 
  name: "Approval Workflow",
  mermaidCode: `
    graph TD
      A((Request Received)) --> B[Review Request]
      B --> C{Approved?}
      C -->|Yes| D[Process Approval]
      C -->|No| E[Handle Rejection]
      D --> F((Complete))
      E --> F
  `
});

// Step 2: Apply auto-layout (Mermaid conversion includes basic layout)
await auto_layout();

// Step 3: Make additional edits if needed
await update_element({ 
  elementId: "UserTask_1", 
  properties: { assignee: "reviewer" }
});

// Step 4: Save and export
await save_as({ filename: "approval-workflow.bpmn" });
const xml = await export();

Example 3: Working with Multiple Diagrams

// Create first diagram
await new_bpmn({ name: "Process A" });
await add_event({ eventType: "start" });
await add_activity({ activityType: "task", name: "Task A" });
await save_as({ filename: "process-a.bpmn" });

// Create second diagram (automatically closes the first)
await new_bpmn({ name: "Process B" });
await add_event({ eventType: "start" });
await add_activity({ activityType: "task", name: "Task B" });
await save_as({ filename: "process-b.bpmn" });

// Go back to first diagram
await open_bpmn({ filename: "process-a.bpmn" });
await add_event({ eventType: "end" });
await save();

// Check current diagram info
const info = await current();
console.log(info); // Shows: { name: "Process A", filename: "process-a.bpmn", ... }

πŸ—‚οΈ File Storage

BPMN diagrams are automatically saved to your local filesystem:

  • Unix/Linux/Mac: ~/mcp-bpmn/

  • Windows: %USERPROFILE%\mcp-bpmn\

Custom path via environment variable:

export MCP_BPMN_DIAGRAMS_PATH=/custom/path

Files are named: {ProcessId}_{ProcessName}.bpmn

πŸ—οΈ Architecture

Technology Stack

  • TypeScript - Type-safe development

  • Node.js - Runtime environment

  • MCP SDK - Model Context Protocol implementation

  • Jest - Testing framework

Key Components

  • SimpleBpmnEngine - Core BPMN XML generation without browser dependencies

  • DiagramContext - Stateful context management for current diagram

  • AutoLayout - Smart positioning algorithm with branch handling

  • BpmnRequestHandler - MCP request processing

  • MermaidConverter - Mermaid to BPMN conversion

  • TypeMappings - BPMN element type conversions

  • IdGenerator - Consistent ID generation

Project Structure

mcp-bpmn/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ core/           # Core BPMN engine
β”‚   β”œβ”€β”€ server/         # MCP server implementation
β”‚   β”œβ”€β”€ utils/          # Utilities (layout, ID generation)
β”‚   β”œβ”€β”€ types/          # TypeScript type definitions
β”‚   └── config/         # Configuration
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/          # Unit tests
β”‚   β”œβ”€β”€ integration/   # Integration tests
β”‚   └── e2e/           # End-to-end tests
β”œβ”€β”€ dist/              # Compiled output
└── docs/              # Documentation

πŸ§ͺ Development

Available Scripts

npm run build        # Build TypeScript
npm run build:bundle # Build CommonJS bundle
npm run build:watch  # Build with watch mode
npm test            # Run all tests
npm run test:unit   # Run unit tests only
npm run test:e2e    # Run end-to-end tests
npm run lint        # Run ESLint
npm run dev         # Development mode with hot reload
npm start           # Start the MCP server

Testing

The project includes comprehensive test coverage:

  • Unit Tests: Core functionality testing

  • Integration Tests: Handler and tool testing

  • E2E Tests: Full MCP protocol testing

Run tests with:

npm test                    # All tests
npm run test:coverage       # With coverage report
npm run test:watch         # Watch mode

πŸ“ˆ Performance

  • Fast XML Generation: Direct XML string building

  • Efficient Layout: O(n) complexity for standard flows

  • Minimal Dependencies: No browser or heavy libraries

  • Bundled Size: ~48KB CommonJS bundle

πŸ› Known Limitations

  • SVG export not yet implemented (XML only)

  • Vertical layout algorithm pending

  • Lanes within pools not fully implemented

  • Complex gateway merging patterns need manual positioning

🚧 Roadmap

  • SVG export support

  • Vertical and radial layout algorithms

  • Enhanced BPMN validation framework

  • Mermaid diagram import/export (Completed!)

  • Natural language to BPMN conversion

  • Integration with Camunda/Activiti engines

  • Subprocess expansion support

  • Message flow between pools

  • BPMN execution simulation

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

Code Style

  • TypeScript with strict mode

  • ESLint configuration provided

  • Jest for testing

  • Conventional commits

πŸ“ License

MIT License - see LICENSE file for details.

πŸ“ž Support

πŸ™ Acknowledgments

Available Tools

24 tools
add_activityC

Add an activity to the current diagram

Inputs: name (required), activityType (required), position, properties.

add_eventC

Add an event to the current diagram

Inputs: eventType (required), name, attachTo, position, +1 more.

add_gatewayC

Add a gateway to the current diagram

Inputs: gatewayType (required), name, position.

add_laneA

Add a lane to an existing pool in the current diagram

Inputs: name (required), poolId (required), position.

add_poolC

Add a pool to the current collaboration diagram

Inputs: name (required), size, position.

auto_layoutB

Apply automatic layout to the current diagram

Inputs: algorithm.

closeB

Close the current diagram and clear the context

Inputs: no named parameters.

connectC

Connect two elements in the current diagram

Inputs: sourceId (required), targetId (required), label, condition.

currentB

Get information about the current diagram

Inputs: no named parameters.

delete_diagram_fileC

Delete a saved BPMN diagram file

Inputs: filename (required).

delete_elementA

Delete an element from the current diagram

Inputs: elementId (required).

exportC

Export the current diagram as BPMN XML

Inputs: format, formatted.

get_diagrams_pathA

Get the path where BPMN diagrams are saved

Inputs: no named parameters.

get_elementC

Get details of a specific element in the current diagram

Inputs: elementId (required).

list_diagramsA

List all saved BPMN diagrams

Inputs: no named parameters.

list_elementsB

List all elements in the current diagram

Inputs: elementType.

new_bpmnA

Create a new BPMN diagram and set it as current context

Inputs: name (required), type.

new_from_mermaidB

Create a new BPMN diagram from Mermaid code and set it as current context

Inputs: name (required), mermaidCode (required).

open_bpmnA

Open an existing BPMN file and set it as current context

Inputs: filename (required).

open_mermaid_fileA

Open a Mermaid file, convert it to BPMN, and set as current context

Inputs: filename (required).

saveA

Save the current diagram to its file (error if no filename set)

Inputs: no named parameters.

save_asB

Save the current diagram with a new filename

Inputs: filename (required).

update_elementB

Update properties of an element in the current diagram

Inputs: elementId (required), name, properties.

validateB

Validate the current diagram for BPMN correctness

Inputs: level.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 24 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, targeting specific operations like adding different BPMN elements, file management, or validation. Overlap is minimal and descriptions clearly differentiate similar tools like new_bpmn and new_from_mermaid.

    Naming Consistency4/5

    All tools use snake_case with a verb_noun pattern, which is consistent. The only minor deviation is 'current' as a noun instead of a verb (e.g., get_current), but overall the naming is predictable.

    Tool Count4/5

    With 24 tools, the count is on the higher side but still reasonable for a comprehensive BPMN editor. Each tool serves a specific function, and the set covers the full workflow without being overwhelming.

    Completeness4/5

    The tool set covers core CRUD operations for diagram elements, lifecycle management, validation, export, and layout. Missing features like text annotations or image export are minor gaps, but the overall coverage is solid.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      B
      maintenance
      Enables generating BPMN 2.0 process models from natural language descriptions, YAML, or images via OCR, with templates, validation, and compatibility with tools like Bizagi Modeler and Camunda Modeler.
      41
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to read, explain, lint, and edit existing BPMN 2.0 files in a repository while preserving diagram layout and structural integrity through parsed-document patch operations.
      Apache 2.0
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants and other tools to create, edit, import, and export BPMN 2.0 workflow diagrams, including through a local browser-based live modeler with explicit save back to the session.
      11
      MIT