loading…
Search for a command to run...
loading…
Enables AI agents to create, manipulate, and manage BPMN 2.0 diagrams programmatically, with support for Mermaid conversion, auto-layout, and file persistence.
Enables AI agents to create, manipulate, and manage BPMN 2.0 diagrams programmatically, with support for Mermaid conversion, auto-layout, and file persistence.
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.
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.).
# 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
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"]
}
}
}
Use the compiled CommonJS bundle:
node dist/server/bundle.cjs
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.
new_bpmnCreate 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_mermaidCreate 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]"
}
open_bpmnOpen an existing BPMN file and set it as the current context.
{
filename: "my-process.bpmn"
}
open_mermaid_fileOpen and convert a Mermaid file to BPMN, setting it as the current context.
{
filename: "my-flowchart.mmd"
}
saveSave the current diagram to its file (requires filename to be set).
{}
save_asSave the current diagram with a new filename.
{
filename: "my-process.bpmn"
}
closeClose the current diagram and clear the context.
{}
currentGet information about the current diagram.
{}
add_eventAdd 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_activityAdd 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_gatewayAdd gateways for branching logic to the current diagram.
{
gatewayType: "exclusive", // exclusive, parallel, inclusive, eventBased
name: "Payment Check",
position: { x: 400, y: 200 } // optional
}
connectConnect 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_poolAdd a pool (participant) to a collaboration diagram.
{
name: "Customer",
position: { x: 100, y: 100 }, // optional
size: { width: 600, height: 250 } // optional
}
add_laneAdd a lane to a pool (not yet fully implemented).
{
poolId: "Participant_1",
name: "Sales Department",
position: "bottom" // optional
}
list_elementsList all elements in the current diagram.
{
elementType: "bpmn:Task" // optional filter
}
get_elementGet details of a specific element.
{
elementId: "UserTask_1"
}
update_elementUpdate element properties.
{
elementId: "UserTask_1",
name: "Updated Task Name",
properties: { assignee: "john.doe" }
}
delete_elementDelete an element and its connections.
{
elementId: "Task_1"
}
exportExport the current diagram as BPMN 2.0 XML.
{
format: "xml", // only xml is currently supported
formatted: true // optional, defaults to true
}
validateValidate the current diagram structure.
{}
auto_layoutApply automatic layout to position elements in the current diagram.
{
algorithm: "horizontal" // currently only horizontal is supported
}
list_diagramsList all saved BPMN diagrams.
{}
delete_diagram_fileDelete a saved diagram file.
{
filename: "old-process.bpmn"
}
get_diagrams_pathGet the storage path for diagrams.
{}
The MCP-BPMN server uses a stateful design where you work with one diagram at a time:
new_bpmn, new_from_mermaid) or opening an existing one (open_bpmn, open_mermaid_file)add_event, connect, etc.) apply to the current diagramsave or save_ascloseIf 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
// 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();
// 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", ... }
BPMN diagrams are automatically saved to your local filesystem:
~/mcp-bpmn/%USERPROFILE%\mcp-bpmn\Custom path via environment variable:
export MCP_BPMN_DIAGRAMS_PATH=/custom/path
Files are named: {ProcessId}_{ProcessName}.bpmn
SimpleBpmnEngine - Core BPMN XML generation without browser dependenciesDiagramContext - Stateful context management for current diagramAutoLayout - Smart positioning algorithm with branch handlingBpmnRequestHandler - MCP request processingMermaidConverter - Mermaid to BPMN conversionTypeMappings - BPMN element type conversionsIdGenerator - Consistent ID generationmcp-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
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
The project includes comprehensive test coverage:
Run tests with:
npm test # All tests
npm run test:coverage # With coverage report
npm run test:watch # Watch mode
Contributions are welcome! Please:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)MIT License - see LICENSE file for details.
/docs folder for detailed guidesВыполни в терминале:
claude mcp add mcp-bpmn-server -- npx Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolProvides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzНе уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai