Skip to main content
Glama
powerdesigner-mcp-dfd
by 011011bjf
README.md
# powerdesigner-mcp-dfd

An [MCP](https://modelcontextprotocol.io) server that lets AI agents drive **SAP PowerDesigner** through its COM automation API. This is a fork of [`powerdesigner-mcp`](https://pypi.org/project/powerdesigner-mcp/) 0.1.2 (MIT, by TIQS) that adds **Data Flow Diagrams** and fixes several problems found on PowerDesigner 16.7.

> Tested on PowerDesigner **16.7.1.6488**, Windows 11, Python 3.13. Windows only (COM). Not affiliated with SAP or the original authors.

## What it adds

### Data Flow Diagrams (Yourdon / DeMarco)

PowerDesigner has no DFD model type: a DFD is a Business Process Model whose process language is "Data Flow Diagram". `CreateModel` ignores the language, so this fork creates DFDs by copying PowerDesigner's own `Examples\DFD sample.bpm` (read from your installation at run time, never redistributed) and clearing it.

| Tool | What it does |
|---|---|
| `create_dfd_model`, `open_dfd_model`, `list_dfd_models`, `save_dfd_model`, `close_dfd_model` | model lifecycle |
| `add_dfd_external_entity` (`temporal=true` for a clock), `add_dfd_process`, `add_dfd_data_store`, `add_dfd_flow` | build the diagram; flows to a store become read/create/update accesses |
| `decompose_dfd_process`, `add_dfd_process(parent=…)` | explode a process into a child diagram (level 1, 2, …) |
| `add_dfd_data_element`, `dfd_data_dictionary` | data dictionary with DeMarco definitions; export as Markdown |
| `check_dfd` | black holes / miracles, isolated nodes, write-only or read-only stores, flows missing from the dictionary, **parent/child balancing** |
| `layout_dfd` | one row per process, every flow on its own straight lane so labels never overlap |
| `name_dfd_diagram`, `get_dfd`, `export_dfd_images` | title diagrams, read the structure back, export PNGs |
| `dfd_from_spec` | build a whole leveled DFD from one JSON spec (`spec` or `spec_path`) |

A flow may connect a child process with a sibling of its parent (for example `4.3 → 7.0`); it is drawn on the child diagram, where PowerDesigner shows the sibling as a shortcut.

Minimal `dfd_from_spec` example:

```json
{
  "name": "Orders - DFD", "path": "C:/models/orders.bpm",
  "external_entities": [{"name": "Customer", "code": "E1"}],
  "processes": [{"name": "0 Order system", "code": "P0"}],
  "data": [{"name": "order", "definition": "order = customer + 1{item}n"}],
  "flows": [{"source": "E1", "destination": "P0", "data": ["order"]}]
}
```

### Fixes for the data-model tools

* A foreign key created with `create_reference` could be merged onto the child's own primary key when both tables name their key `id` (`cita(id) → paciente(id)`). It now creates a distinct FK column (`paciente_id`), and `validate_model` warns (`FK_ON_OWN_PK`) when a table's whole key is a foreign key.
* `create_model(dbms=…)` no longer silently falls back to the default DBMS (SAP SQL Anywhere): it fails and tells you to use the exact DBMS *Name* (`PostgreSQL 9.x`, `MySQL 5.0`, `ORACLE Version 19c`, `Microsoft SQL Server 2017`).
* `list_open_models` ignores process models, which have their own tools.

## Install

Requires Windows, a licensed PowerDesigner and [uv](https://docs.astral.sh/uv/).

```powershell
uv tool install git+https://github.com/011011bjf/powerdesigner-mcp-dfd --python 3.13
claude mcp add powerdesigner --scope user -- "$env:USERPROFILE\.local\bin\powerdesigner-mcp.exe" serve
```

Other clients: `powerdesigner-mcp install` writes the entry for Claude Desktop, Cursor and others. Without PowerDesigner installed the server falls back to an in-memory mock (data-model tools only; the DFD tools need the real application).

Configuration (`PDMCP_*` environment variables, e.g. `PDMCP_ATTACH_MODE`, `PDMCP_DEFAULT_DBMS`, `PDMCP_DFD_TEMPLATE` to point at another DFD `.bpm`) is documented in [`src/pd_mcp/config.py`](src/pd_mcp/config.py).

## PowerDesigner behaviour worth knowing

Found by experiment on 16.7; they explain several choices in the code.

* Process codes are rewritten: `1.1` is stored as `1_1`. The tools accept both forms.
* Flow labels are recomputed when a model is **loaded**: centred on the middle of the line, above it, plus the symbol's `CenterTextOffset`. Save and reopen before judging a layout or exporting images.
* Symbols with "auto adjust to text" shrink on load and drag their links; the layout switches it off.
* A child diagram starts with generic display preferences (no centre label on flows). The service copies the top diagram's preferences before drawing.
* When a flow crosses levels, PowerDesigner adds shortcut symbols of its own. **Do not delete them**: deletion cascades to the flows rewired through them.
* `Diagram.AttachObject` on an object already shown creates a graphical synonym; the layout uses this to draw a partner once per process row.

## Tests

The upstream offline suite is not included in this fork. Two live scripts need a running PowerDesigner:

```powershell
python tests/live_fk_check.py
python tests/live_dfd_check.py <existing output directory>
```

They create and close their own models; the DFD script writes `*_test.bpm` files into the directory you pass.

## License and credits

MIT, see [LICENSE](LICENSE). Original work © 2026 TIQS ([NovolineGast/powerdesigner-mcp](https://github.com/NovolineGast/powerdesigner-mcp)); the DFD service, layout, FK and DBMS fixes are additions on top of release 0.1.2.

TDQS

C2.9/5.0

Scored across 78 tools

Disambiguation3/5

Most tools target a distinct object type plus action, but several pairs overlap meaningfully: model_snapshot vs inspect_schema (both 'compact JSON of the schema to save context'), list_tables/search_tables and list_columns/search_columns (search is just a filtered list), and rename_table/rename_column vs update_table/update_column (rename is a subset of update). set_primary_key is an explicit alias of create_primary_key, and create_database_schema / design_from_spec / apply_schema_patch / dfd_from_spec are four bulk-construction tools with fuzzy boundaries, plus three separate validators (validate_model, check_database_design, check_dfd).

Naming Consistency4/5

The surface is overwhelmingly consistent snake_case with verb_noun ordering (create_table, list_columns, delete_index, update_reference). Minor deviations exist: noun-first names (model_snapshot, dfd_data_dictionary) and verb-last names (dfd_from_spec, design_from_spec, export_dfd_images), and the DFD prefix placement varies (create_dfd_model vs dfd_from_spec vs get_dfd).

Tool Count2/5

78 tools is far beyond a comfortable surface for an agent, even granting that the server spans two real domains (relational/CDM/LDM modeling plus DFD authoring). The count is inflated by redundancy: an explicit alias, three overlapping whole-schema build paths, three validators, and both search_* and list_* variants of the same queries.

Completeness3/5

Core relational lifecycle is well covered (models, tables, columns, keys, indexes, references, transactions, backups, DDL, conversions, validation). However there is no standalone create_domain/update_domain/delete_domain tool (create_domain only exists as a patch op), no delete_model, and the DFD side is add-only — no tools to rename, move, modify or delete DFD processes, stores, entities, flows, or data elements once created.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues