bpmn-generator-mcp
This MCP server generates, validates, and reconstructs BPMN 2.0 diagrams from multiple sources, with a rich BPMN knowledge base, templates, OCR/vision capabilities, and file management tools.
Generate BPMN processes from simple linear flows, decisions, parallel branches, YAML/JSON specs, natural language text, and images via OCR.
Reconstruct BPMN from images using a Python vision pipeline (PaddleOCR, YOLO, OpenCV) and preview/validate the intermediate representation.
Access BPMN 2.0 knowledge: element lists, cheat sheets, activity/marker/attribute/flow/artifact/swimlane catalogs, best practices, validation rules, and Bizagi-specific details.
Use predefined templates to quickly create processes for common scenarios like approvals, orders, and onboarding.
Create advanced subprocess constructs: embedded subprocesses, call activities, boundary events, error handling, transactions, loops, and multi-instance activities.
Create event-driven processes with timer events, message/signal/error triggers, and event definitions.
Validate BPMN files or XML strings against BPMN 2.0 rules.
Manage generated files: get the output directory, list generated BPMN files, and read them with sandboxed path protection.
Check OCR availability and extract text from images as an OCR utility.
Get guided prompts for designing, reviewing, converting descriptions to BPMN, and applying best practices.
Generates BPMN 2.0 process files that can be imported directly into Camunda Modeler for process modeling and automation.
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., "@bpmn-generator-mcp Create a BPMN 2.0 model for a loan approval process"
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.
BPMN Generator MCP
MCP (Model Context Protocol) server que genera y reconstruye diagramas BPMN 2.0 desde múltiples fuentes: texto, templates, YAML/JSON, imágenes (OCR) y diagramas escaneados (visión por computadora). El output se importa directamente en Bizagi Modeler, Camunda Modeler, bpmn.io y cualquier herramienta compatible con el estándar OMG BPMN 2.0.
Stack dual: TypeScript (capa MCP) + Python (visión por computadora). Dockerizado en una sola imagen.
✨ Características
🎨 44 herramientas MCP registradas
6 de generación:
create_simple_linear_process,create_process_with_decision,create_process_with_parallel,create_from_yaml_spec,create_process_from_text_description,create_process_from_image(OCR)3 de visión (NUEVO):
reconstruct_bpmn_from_image(PaddleOCR + YOLO + OpenCV),preview_bpmn_ir,validate_bpmn_ir8 de conocimiento BPMN:
list_bpmn_elements,get_bpmn_cheatsheet,get_event_matrix,explain_bpmn_concept, etc.6 de plantillas: 9 plantillas predefinidas (aprobación, pedidos, onboarding, etc.)
6 de subprocesos avanzados: subproceso, call activity, boundary events, error handling, transactions, loops/multi-instance
2 de eventos: timer, message, signal, error, escalation, etc.
2 de validación:
validate_bpmn_file,validate_bpmn_xml2 de OCR:
is_ocr_available,extract_text_from_image3 de files:
get_output_directory,list_generated_files,read_bpmn_file2 de subprocess:
add_event_with_trigger,create_process_with_timer4 prompts predefinidos:
design_bpmn_process,review_bpmn_process,convert_description_to_bpmn,bpmn_best_practices
🧠 Knowledge Base BPMN 2.0 exhaustivo
41 tipos de eventos (start/intermediate/end/boundary × todos los triggers)
13 actividades (tasks + subprocesos: embedded, call, ad-hoc, event, transaction)
5 gateways (exclusive, parallel, inclusive, event-based, complex)
30+ atributos del estándar
5 marcadores (loops, multi-instance, compensation)
30+ reglas de validación
9 plantillas de procesos comunes
4 categorías de paleta Bizagi
Especificidades de Bizagi Modeler
🛡️ Seguridad Hardened
Path traversal sandbox (path.resolve + relative_to)
XXE prevention (
fast-xml-parserconprocessEntities: false)Resource limits anti-DoS (MAX_TASKS, MAX_XML_SIZE, MAX_IMAGE_SIZE_BYTES)
Unicode normalization NFC + filtrado zero-width/bidi
Exception sanitization (no exponer paths internos)
Race condition locks (Mutex en BPMNGenerator)
Non-root Docker user (uid 1001)
Pinned dependency versions (
package.jsoncon==exactos)
🏗️ Calidad de código
TypeScript strict mode +
noUncheckedIndexedAccessPython con type hints en todas las funciones
< 700 LOC por archivo (regla dura)
Tests reproducibles: 8/8 archivos BPMN válidos en suite completa
Pydantic + Zod schemas sincronizados (23 tipos BPMN) entre Python y TS
Related MCP server: MCP-GLSP
📦 Stack Técnico
Capa | Tecnología |
MCP Server | TypeScript + |
Validación |
|
XML BPMN |
|
Logging |
|
OCR TS |
|
OCR Py |
|
Detección símbolos |
|
Geometría |
|
Grafo |
|
Imagen Docker |
|
🏗️ Arquitectura
bpmn-generator-mcp/
├── src/ # TypeScript MCP server (4978 LOC, 47 archivos)
│ ├── server.ts # Entry point (stdio MCP)
│ ├── constants.ts # BPMN namespaces, security limits
│ ├── schemas/ # Zod schemas para MCP inputs
│ ├── utils/ # logger, errors, sandbox
│ ├── bpmn/ # Generador BPMN (core, builders, elements, DI)
│ ├── knowledge/ # Catálogo BPMN 2.0
│ ├── mcp-tools/ # 44 tools + 4 prompts
│ └── vision/ # Cliente HTTP al vision pipeline Python
├── vision-pipeline/ # Python vision (2245 LOC, 17 archivos)
│ ├── src/vision_pipeline/
│ │ ├── ocr/ # PaddleOCR wrapper
│ │ ├── detection/ # YOLO 17 clases BPMN
│ │ ├── geometry/ # OpenCV preprocessing + arrows
│ │ ├── graph/ # NetworkX + KDTree mapping
│ │ ├── ir/ # Pydantic BPMNIR (23 tipos)
│ │ └── bridge/ # CLI subprocess + FastAPI server
│ ├── tools/ # ⭐ scrape, generate, train
│ ├── requirements.txt # Deps pinned
│ ├── data/ # scraped + yolo_dataset (gitignored)
│ └── PLAN.md # Plan completo
├── migration/ # Trazabilidad Python→TS (47 microtareas)
├── .agents/ # ⭐ Reglas persistentes (claude.md, rules.md, agents.md)
├── tests/ # test-all.ts + test-final.ts
├── examples/ # ejemplo-basico.ts
├── Dockerfile # ⭐ UN SOLO multi-stage (Node + Python)
├── docker-compose.yml
├── package.json # ESM, deps pinned
├── tsconfig.json # strict + noUncheckedIndexedAccess
├── tsconfig.build.json # Solo src/ para producción
├── .dockerignore
└── .gitignore🚀 Instalación y Uso
Opción 1: Docker (Recomendado para producción)
# Build de la imagen unificada (~5 min, descarga PaddleOCR + YOLO)
docker build -t bpmn-generator-mcp:latest .
# Ejecutar el servidor MCP via stdio
docker run -i --rm \
-v "C:\Users\LENOVO\.agents\mcps\bpmn-generator-mcp\output:/app/output" \
-v "C:\Users\LENOVO\.Pictures:/mnt/pictures:ro" \
bpmn-generator-mcp:latest
# O usar docker-compose
docker compose up -dLa imagen Docker incluye:
✅ Node.js 22 + TypeScript compilado (4978 LOC)
✅ Python 3.11 + venv con PaddleOCR + YOLO + OpenCV
✅ Tesseract OCR (spa + eng)
✅ Usuario no-root
bpmn(uid 1001, SEC-011)✅ Comunicación Node ↔ Python vía subprocess CLI
Opción 2: Desarrollo TS local (sin Docker)
# Solo para editar/compilar el TypeScript MCP server
npm install
npm run build # tsc -> dist/
npm test # tsx tests/test-all.ts && tsx tests/test-final.ts
# Ejecutar el MCP server
npm start # node dist/server.jsOpción 3: Desarrollo Python del vision pipeline (en venv)
# ⚠️ NUNCA uses `pip install -e .` global
# Usa siempre un entorno virtual LOCAL
cd vision-pipeline
python -m venv .venv # Crea .venv/ (gitignored)
.venv\Scripts\activate.bat # Windows
# source .venv/bin/activate # Linux/Mac
pip install -r requirements.txt🔧 Configuración MCP en opencode
El archivo ~/.config/opencode/opencode.jsonc debe apuntar al container Docker:
"bpmn-generator": {
"type": "local",
"enabled": true,
"timeout": 60000,
"command": [
"docker", "run", "-i", "--rm",
"-v", "C:\\Users\\LENOVO\\.agents\\mcps\\bpmn-generator-mcp\\output:/app/output",
"-v", "C:\\Users\\LENOVO\\Pictures:/mnt/pictures:ro",
"bpmn-generator-mcp:latest"
],
"environment": {
"BPMN_OUTPUT_DIR": "/app/output",
"LOG_LEVEL": "info"
}
}Hay una entrada legacy bpmn-generator-python (deshabilitada) por si se necesita rollback.
🤖 Entrenamiento del modelo YOLO (visión)
Pipeline completo (3 pasos)
cd vision-pipeline
.venv\Scripts\activate.bat
# Paso 1: Scraping de imágenes reales (Wikimedia + DuckDuckGo + GitHub)
python tools/scrape_bpmn_images.py \
--query "bpmn diagram example" \
--output data/scraped \
--max 200
# Paso 2: Generación de imágenes sintéticas (Graphviz + PIL fallback)
python tools/generate_synthetic_dataset.py \
--output data/yolo_dataset \
--num 1000
# Paso 3: Anotar las imágenes scrapeadas con LabelImg o Roboflow
# (manual, formato YOLO: class_id x_center y_center width height)
# Paso 4: Entrenar YOLO con transfer learning desde COCO
python tools/train_yolo.py \
--data data/yolo_dataset \
--model yolo11n.pt \
--epochs 100Salida del training: weights/bpmn_best.pt (modelo entrenado con tus datos).
17 Clases BPMN soportadas (sincronizadas entre Python y TS):
ID | Clase | Tipo |
0 | startEvent | Evento |
1 | endEvent | Evento |
2 | intermediateEvent | Evento |
3 | task | Tarea |
4 | userTask | Tarea |
5 | serviceTask | Tarea |
6 | manualTask | Tarea |
7 | scriptTask | Tarea |
8 | exclusiveGateway | Gateway |
9 | parallelGateway | Gateway |
10 | inclusiveGateway | Gateway |
11 | subProcess | Sub-proceso |
12 | callActivity | Sub-proceso |
13 | pool | Swimlane |
14 | lane | Swimlane |
15 | sequenceFlow | Conector |
16 | messageFlow | Conector |
Limitación: solo 13/17 clases son sintetizables con bbox rectangular. pool, lane, sequence_flow, message_flow requieren datos scrapeados anotados manualmente.
Tiempos estimados
CPU (i7-12700): 5-15 min/epoch × 100 = ~8-25 horas total
GPU (RTX 3060+): 1-2 min/epoch × 100 = ~2-4 horas total
🧪 Testing
# TypeScript build (producción)
npx tsc -p tsconfig.build.json --noEmit # exit 0
# Suite completa TS (8 tests, genera 8 archivos BPMN válidos)
npx tsx tests/test-all.ts
# Verificar tools MCP registradas
npx tsx tests/test-final.ts
# Python parse check (sin instalar deps)
python -c "import ast; ast.parse(open('vision-pipeline/tools/scrape_bpmn_images.py').read())"Resultados esperados:
tsc -p tsconfig.build.json: exit 0test-all.ts: 8 archivos.bpmngenerados, 8/8 válidostest-final.ts: 44 tools + 4 prompts listadas
🐛 Debug
Ver logs del MCP server
docker logs bpmn-generator-mcpLogs estructurados (niveles)
LOG_LEVEL=debug→ máxima verbosidadLOG_LEVEL=info(default)LOG_LEVEL=warn→ solo warnings
Vision pipeline debug
# Probar CLI directamente
echo '{"image_path": "test.jpg"}' | docker exec -i bpmn-generator-mcp \
python -m vision_pipeline.bridge.cli📜 Reglas de Contribución
Ver .agents/claude.md (reglas de memoria), .agents/rules.md (reglas duras) y .agents/agents.md (configuración de subagentes).
Reglas Hard (NO ROMPER)
NO archivos >700 LOC
NO commitear
node_modules/,dist/,*.traineddata,.venv/Trazabilidad en microtareas para features >500 LOC
Backup antes de cambios grandes →
~/.config/opencode/backups/TS strict mode obligatorio
NO
pip install -e .global — usar venv localTODOS los
add_*métodos del BPMNGenerator DEBEN registrar enelementsLayoutPost-processing en
toXmlString— fast-xml-parser bug con booleanDockerfile multi-stage con non-root
YOLO_CLASSES sincronizado Python ↔ TypeScript
Bugs Históricos (NO reintroducir)
createProcessretornaba→ usarundefinedthis._definitions['bpmn:definitions']['bpmn:process']XML<bpmn:process>duplicado→ no mirror top-levelCircular import rompía registro→ usarregister.tsseparadofast-xml-parser serializa'true'como self-closing→ post-processing regexisExecutableboolean inválido en BPMN 2.0 strict→ eliminado
📊 Estadísticas del Proyecto
Métrica | Valor |
Total LOC TS | 4,978 (47 archivos en |
Total LOC Python | 2,245 (17 archivos en |
MCP Tools | 44 |
MCP Prompts | 4 |
BPMN Templates | 9 |
Knowledge entries | 100+ |
Microtareas migración | 47 (completadas) |
Microtareas vision pipeline | 18/35 (Fases 1-7 completas) |
Tests | 8/8 BPMN válidos + 63/63 Python checks |
🤝 Licencia y Créditos
Proyecto educativo de TECSUP - Integración de Sistemas Empresariales (Week 2).
Tecnologías usadas:
@modelcontextprotocol/sdk (Apache 2.0)
PaddleOCR (Apache 2.0)
Ultralytics YOLO (AGPL-3.0)
OpenCV (Apache 2.0)
NetworkX (BSD-3-Clause)
fast-xml-parser (MIT)
🔗 Links
Repositorio: https://github.com/johnleyva28/bpmn-generator-mcp
Bizagi Modeler: https://www.bizagi.com/es/platform/modeler
BPMN 2.0 Spec: https://www.omg.org/spec/BPMN/2.0/
MCP Protocol: https://modelcontextprotocol.io/
🎯 Próximos Pasos
Entrenar YOLO cuando tengas GPU + dataset (100 scraped + 1000 sintético)
Anotar imágenes scrapeadas con LabelImg/Roboflow (manual, ~30-60 min para 100 imágenes)
Re-entrenar con dataset completo
Build & deploy:
docker build -t bpmn-generator-mcp:vision . docker push your-registry/bpmn-generator-mcp:visionMonitorear el uso de las tools MCP en producción
Available Tools
41 toolsadd_event_with_triggerC
Agrega un evento (start/intermediate/end/boundary) a un proceso nuevo.
Inputs: attached_to_ref, timer_definition, condition_expression.
create_call_activity_processC
Crea un proceso que invoca otro proceso (call activity).
Inputs: description.
create_from_templateC
Crea un proceso BPMN desde una plantilla predefinida.
Inputs: process_name.
create_from_yaml_specB
Crea un proceso BPMN desde especificación YAML/JSON estructurada.
Inputs: description.
create_process_from_imageB
Crea un proceso BPMN extrayendo pasos de una imagen usando OCR.
Inputs: process_name.
create_process_from_text_descriptionB
Crea un proceso BPMN interpretando una descripción textual en lenguaje natural.
Inputs: no named parameters.
create_process_with_boundary_eventsC
Crea un proceso con boundary events (interrupting/non-interrupting).
Inputs: description.
create_process_with_decisionC
Crea un proceso BPMN con gateway exclusivo (decisión binaria).
Inputs: description, merge_tasks.
create_process_with_error_handlingC
Proceso con boundary error event y manejador dedicado.
Inputs: description.
create_process_with_loops_and_multiinstanceC
Proceso con loops (standard) y multi-instance (sequential/parallel).
Inputs: description.
create_process_with_parallelC
Crea un proceso BPMN con ramas paralelas (parallel gateway).
Inputs: description, merge_tasks.
create_process_with_timerA
Crea un proceso con timer event intermedio (wait/schedule).
Inputs: no named parameters.
create_process_with_transactionC
Proceso con transaction sub-process (todo o nada).
Inputs: description.
create_simple_linear_processB
Crea un proceso BPMN 2.0 lineal simple con tareas secuenciales.
Inputs: description.
create_subprocessC
Crea un subproceso embebido con actividades internas.
Inputs: description.
explain_bpmn_conceptC
Explica un concepto BPMN (busca en best practices por título o id).
Inputs: no named parameters.
extract_text_from_imageB
Extrae texto de una imagen usando OCR.
Inputs: no named parameters.
get_activities_catalogA
Catálogo de activities (tareas y subprocesos).
Inputs: no named parameters.
get_artifacts_catalogA
Catálogo de artefactos (data objects, annotations).
Inputs: no named parameters.
get_attributes_catalogC
Catálogo de atributos BPMN 2.0.
Inputs: no named parameters.
get_best_practicesC
Best practices BPMN 2.0.
Inputs: no named parameters.
get_bizagi_extended_infoC
Información extendida de Bizagi Modeler.
Inputs: no named parameters.
get_bizagi_specificsB
Especificidades del formato Bizagi (.bpm vs .bpmn).
Inputs: no named parameters.
get_bpmn_cheatsheetB
Cheat sheet completo de BPMN 2.0.
Inputs: no named parameters.
get_event_definitions_infoB
Definiciones de eventos (message, timer, signal, error, etc.).
Inputs: no named parameters.
get_event_matrixA
Matriz completa de eventos BPMN 2.0 (start/intermediate/end x todos los triggers).
Inputs: no named parameters.
get_flow_elements_catalogB
Catálogo de elementos de flujo (flows, gateways).
Inputs: no named parameters.
get_gateway_types_infoB
Tipos de gateway (exclusive, parallel, inclusive, event-based, complex).
Inputs: no named parameters.
get_markers_catalogB
Catálogo de markers (loops, multi-instance, compensation).
Inputs: no named parameters.
get_output_directoryB
Obtiene el directorio de salida con archivos BPMN generados.
Inputs: no named parameters.
get_swimlanes_catalogC
Catálogo de swimlanes (pools, lanes).
Inputs: no named parameters.
get_task_types_infoB
Tipos de task (userTask, serviceTask, scriptTask, etc.).
Inputs: no named parameters.
get_template_detailsC
Obtiene detalles de una plantilla BPMN por id.
Inputs: no named parameters.
get_validation_rulesC
Reglas de validación BPMN 2.0.
Inputs: no named parameters.
is_ocr_availableB
Verifica si OCR (Tesseract.js) está disponible.
Inputs: no named parameters.
list_bpmn_elementsA
Lista todos los elementos BPMN 2.0 soportados.
Inputs: no named parameters.
list_generated_filesA
Lista todos los archivos BPMN generados en el directorio de salida.
Inputs: no named parameters.
list_templatesA
Lista todas las plantillas BPMN predefinidas.
Inputs: no named parameters.
read_bpmn_fileB
Lee un archivo BPMN/XML (sandbox al directorio de salida).
Inputs: no named parameters.
validate_bpmn_fileB
Valida un archivo BPMN 2.0.
Inputs: no named parameters.
validate_bpmn_xmlB
Valida un string XML BPMN 2.0.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 41 tools
Many tools are clearly distinct, but the set includes several overlapping reference/catalog tools (e.g., get_flow_elements_catalog vs list_bpmn_elements, get_activities_catalog vs get_task_types_info) and closely related creation variants (e.g., create_process_with_boundary_events vs create_process_with_error_handling). Descriptions help, but an agent could easily select the wrong lookup or generator in a 41-tool surface.
Tool names consistently use snake_case and mostly follow a verb_noun pattern, which is predictable. Minor deviations exist, such as create_from_yaml_spec vs create_process_from_text_description vs create_simple_linear_process, but the overall style remains coherent.
With 41 tools, the server is over-scoped for most agent workflows. The many catalog/reference/lookup tools could be consolidated into a smaller set, and the proliferation of create_process_with_* variants adds unnecessary bulk.
The server covers BPMN generation well: multiple construction patterns, validation, templates, catalogs, OCR input, and output file access. Minor gaps exist around updating/deleting generated files or directly editing existing BPMN models, but these are not core to a generator's main workflow.
Related MCP Connectors
Turn calls and notes into process flow diagrams in Claude, ChatGPT, VS Code, Cursor, and Teams.
Make editable flowcharts, process charts, funnels, timelines and data models from plain language.
Create workflow, sequence, architecture, and mind map diagrams via AI assistants.
Turn conversations about work processes into process maps: read, draw, correct and export.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI agents to create, manipulate, and manage BPMN 2.0 diagrams programmatically, with support for Mermaid conversion, auto-layout, and file persistence.2418MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI-driven graphical diagram creation and manipulation using natural language, with support for BPMN workflows, analysis, and manual editing via the Model Context Protocol.1MIT
- AlicenseBqualityBmaintenanceEnables AI assistants to create and manage one BPMN 2.0 diagram at a time, including Mermaid conversion, validation, layout, persistence, and XML or SVG export.27MIT
- AlicenseAqualityCmaintenanceEnables generating, reading, auditing, and previewing BPMN 2.0 diagrams for Bizagi Modeler, with an automatic layout engine that produces files Bizagi can open, plus optional control of the Bizagi Modeler desktop app on Windows.12MIT