enterprise-architect-mcp 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +226 -0
- package/dist/database.d.ts +3 -0
- package/dist/database.js +25 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +68 -0
- package/dist/model-session.d.ts +29 -0
- package/dist/model-session.js +172 -0
- package/dist/package-path.d.ts +2 -0
- package/dist/package-path.js +36 -0
- package/dist/remembered-path.d.ts +5 -0
- package/dist/remembered-path.js +43 -0
- package/dist/resolve-qea-path.d.ts +26 -0
- package/dist/resolve-qea-path.js +58 -0
- package/dist/text.d.ts +37 -0
- package/dist/text.js +152 -0
- package/dist/tools/annotations.d.ts +3 -0
- package/dist/tools/annotations.js +5 -0
- package/dist/tools/connectors.d.ts +3 -0
- package/dist/tools/connectors.js +152 -0
- package/dist/tools/diagrams.d.ts +3 -0
- package/dist/tools/diagrams.js +225 -0
- package/dist/tools/elements.d.ts +3 -0
- package/dist/tools/elements.js +210 -0
- package/dist/tools/packages.d.ts +3 -0
- package/dist/tools/packages.js +80 -0
- package/dist/tools/resolve.d.ts +3 -0
- package/dist/tools/resolve.js +135 -0
- package/dist/tools/scenarios.d.ts +3 -0
- package/dist/tools/scenarios.js +106 -0
- package/dist/tools/schema.d.ts +3 -0
- package/dist/tools/schema.js +164 -0
- package/dist/tools/search.d.ts +3 -0
- package/dist/tools/search.js +217 -0
- package/dist/tools/windowing.d.ts +37 -0
- package/dist/tools/windowing.js +92 -0
- package/dist/tools.d.ts +3 -0
- package/dist/tools.js +18 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
|
2
|
+
EUPL © the European Union 2007, 2016
|
|
3
|
+
|
|
4
|
+
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined below) which is provided under the
|
|
5
|
+
terms of this Licence. Any use of the Work, other than as authorised under this Licence is prohibited (to the extent such
|
|
6
|
+
use is covered by a right of the copyright holder of the Work).
|
|
7
|
+
The Work is provided under the terms of this Licence when the Licensor (as defined below) has placed the following
|
|
8
|
+
notice immediately following the copyright notice for the Work:
|
|
9
|
+
Licensed under the EUPL
|
|
10
|
+
or has expressed by any other means his willingness to license under the EUPL.
|
|
11
|
+
|
|
12
|
+
1.Definitions
|
|
13
|
+
In this Licence, the following terms have the following meaning:
|
|
14
|
+
— ‘The Licence’:this Licence.
|
|
15
|
+
— ‘The Original Work’:the work or software distributed or communicated by the Licensor under this Licence, available
|
|
16
|
+
as Source Code and also as Executable Code as the case may be.
|
|
17
|
+
— ‘Derivative Works’:the works or software that could be created by the Licensee, based upon the Original Work or
|
|
18
|
+
modifications thereof. This Licence does not define the extent of modification or dependence on the Original Work
|
|
19
|
+
required in order to classify a work as a Derivative Work; this extent is determined by copyright law applicable in
|
|
20
|
+
the country mentioned in Article 15.
|
|
21
|
+
— ‘The Work’:the Original Work or its Derivative Works.
|
|
22
|
+
— ‘The Source Code’:the human-readable form of the Work which is the most convenient for people to study and
|
|
23
|
+
modify.
|
|
24
|
+
— ‘The Executable Code’:any code which has generally been compiled and which is meant to be interpreted by
|
|
25
|
+
a computer as a program.
|
|
26
|
+
— ‘The Licensor’:the natural or legal person that distributes or communicates the Work under the Licence.
|
|
27
|
+
— ‘Contributor(s)’:any natural or legal person who modifies the Work under the Licence, or otherwise contributes to
|
|
28
|
+
the creation of a Derivative Work.
|
|
29
|
+
— ‘The Licensee’ or ‘You’:any natural or legal person who makes any usage of the Work under the terms of the
|
|
30
|
+
Licence.
|
|
31
|
+
— ‘Distribution’ or ‘Communication’:any act of selling, giving, lending, renting, distributing, communicating,
|
|
32
|
+
transmitting, or otherwise making available, online or offline, copies of the Work or providing access to its essential
|
|
33
|
+
functionalities at the disposal of any other natural or legal person.
|
|
34
|
+
|
|
35
|
+
2.Scope of the rights granted by the Licence
|
|
36
|
+
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, sublicensable licence to do the following, for
|
|
37
|
+
the duration of copyright vested in the Original Work:
|
|
38
|
+
— use the Work in any circumstance and for all usage,
|
|
39
|
+
— reproduce the Work,
|
|
40
|
+
— modify the Work, and make Derivative Works based upon the Work,
|
|
41
|
+
— communicate to the public, including the right to make available or display the Work or copies thereof to the public
|
|
42
|
+
and perform publicly, as the case may be, the Work,
|
|
43
|
+
— distribute the Work or copies thereof,
|
|
44
|
+
— lend and rent the Work or copies thereof,
|
|
45
|
+
— sublicense rights in the Work or copies thereof.
|
|
46
|
+
Those rights can be exercised on any media, supports and formats, whether now known or later invented, as far as the
|
|
47
|
+
applicable law permits so.
|
|
48
|
+
In the countries where moral rights apply, the Licensor waives his right to exercise his moral right to the extent allowed
|
|
49
|
+
by law in order to make effective the licence of the economic rights here above listed.
|
|
50
|
+
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to any patents held by the Licensor, to the
|
|
51
|
+
extent necessary to make use of the rights granted on the Work under this Licence.
|
|
52
|
+
|
|
53
|
+
3.Communication of the Source Code
|
|
54
|
+
The Licensor may provide the Work either in its Source Code form, or as Executable Code. If the Work is provided as
|
|
55
|
+
Executable Code, the Licensor provides in addition a machine-readable copy of the Source Code of the Work along with
|
|
56
|
+
each copy of the Work that the Licensor distributes or indicates, in a notice following the copyright notice attached to
|
|
57
|
+
the Work, a repository where the Source Code is easily and freely accessible for as long as the Licensor continues to
|
|
58
|
+
distribute or communicate the Work.
|
|
59
|
+
|
|
60
|
+
4.Limitations on copyright
|
|
61
|
+
Nothing in this Licence is intended to deprive the Licensee of the benefits from any exception or limitation to the
|
|
62
|
+
exclusive rights of the rights owners in the Work, of the exhaustion of those rights or of other applicable limitations
|
|
63
|
+
thereto.
|
|
64
|
+
|
|
65
|
+
5.Obligations of the Licensee
|
|
66
|
+
The grant of the rights mentioned above is subject to some restrictions and obligations imposed on the Licensee. Those
|
|
67
|
+
obligations are the following:
|
|
68
|
+
|
|
69
|
+
Attribution right: The Licensee shall keep intact all copyright, patent or trademarks notices and all notices that refer to
|
|
70
|
+
the Licence and to the disclaimer of warranties. The Licensee must include a copy of such notices and a copy of the
|
|
71
|
+
Licence with every copy of the Work he/she distributes or communicates. The Licensee must cause any Derivative Work
|
|
72
|
+
to carry prominent notices stating that the Work has been modified and the date of modification.
|
|
73
|
+
|
|
74
|
+
Copyleft clause: If the Licensee distributes or communicates copies of the Original Works or Derivative Works, this
|
|
75
|
+
Distribution or Communication will be done under the terms of this Licence or of a later version of this Licence unless
|
|
76
|
+
the Original Work is expressly distributed only under this version of the Licence — for example by communicating
|
|
77
|
+
‘EUPL v. 1.2 only’. The Licensee (becoming Licensor) cannot offer or impose any additional terms or conditions on the
|
|
78
|
+
Work or Derivative Work that alter or restrict the terms of the Licence.
|
|
79
|
+
|
|
80
|
+
Compatibility clause: If the Licensee Distributes or Communicates Derivative Works or copies thereof based upon both
|
|
81
|
+
the Work and another work licensed under a Compatible Licence, this Distribution or Communication can be done
|
|
82
|
+
under the terms of this Compatible Licence. For the sake of this clause, ‘Compatible Licence’ refers to the licences listed
|
|
83
|
+
in the appendix attached to this Licence. Should the Licensee's obligations under the Compatible Licence conflict with
|
|
84
|
+
his/her obligations under this Licence, the obligations of the Compatible Licence shall prevail.
|
|
85
|
+
|
|
86
|
+
Provision of Source Code: When distributing or communicating copies of the Work, the Licensee will provide
|
|
87
|
+
a machine-readable copy of the Source Code or indicate a repository where this Source will be easily and freely available
|
|
88
|
+
for as long as the Licensee continues to distribute or communicate the Work.
|
|
89
|
+
Legal Protection: This Licence does not grant permission to use the trade names, trademarks, service marks, or names
|
|
90
|
+
of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
|
|
91
|
+
reproducing the content of the copyright notice.
|
|
92
|
+
|
|
93
|
+
6.Chain of Authorship
|
|
94
|
+
The original Licensor warrants that the copyright in the Original Work granted hereunder is owned by him/her or
|
|
95
|
+
licensed to him/her and that he/she has the power and authority to grant the Licence.
|
|
96
|
+
Each Contributor warrants that the copyright in the modifications he/she brings to the Work are owned by him/her or
|
|
97
|
+
licensed to him/her and that he/she has the power and authority to grant the Licence.
|
|
98
|
+
Each time You accept the Licence, the original Licensor and subsequent Contributors grant You a licence to their contributions
|
|
99
|
+
to the Work, under the terms of this Licence.
|
|
100
|
+
|
|
101
|
+
7.Disclaimer of Warranty
|
|
102
|
+
The Work is a work in progress, which is continuously improved by numerous Contributors. It is not a finished work
|
|
103
|
+
and may therefore contain defects or ‘bugs’ inherent to this type of development.
|
|
104
|
+
For the above reason, the Work is provided under the Licence on an ‘as is’ basis and without warranties of any kind
|
|
105
|
+
concerning the Work, including without limitation merchantability, fitness for a particular purpose, absence of defects or
|
|
106
|
+
errors, accuracy, non-infringement of intellectual property rights other than copyright as stated in Article 6 of this
|
|
107
|
+
Licence.
|
|
108
|
+
This disclaimer of warranty is an essential part of the Licence and a condition for the grant of any rights to the Work.
|
|
109
|
+
|
|
110
|
+
8.Disclaimer of Liability
|
|
111
|
+
Except in the cases of wilful misconduct or damages directly caused to natural persons, the Licensor will in no event be
|
|
112
|
+
liable for any direct or indirect, material or moral, damages of any kind, arising out of the Licence or of the use of the
|
|
113
|
+
Work, including without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, loss
|
|
114
|
+
of data or any commercial damage, even if the Licensor has been advised of the possibility of such damage. However,
|
|
115
|
+
the Licensor will be liable under statutory product liability laws as far such laws apply to the Work.
|
|
116
|
+
|
|
117
|
+
9.Additional agreements
|
|
118
|
+
While distributing the Work, You may choose to conclude an additional agreement, defining obligations or services
|
|
119
|
+
consistent with this Licence. However, if accepting obligations, You may act only on your own behalf and on your sole
|
|
120
|
+
responsibility, not on behalf of the original Licensor or any other Contributor, and only if You agree to indemnify,
|
|
121
|
+
defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against such Contributor by
|
|
122
|
+
the fact You have accepted any warranty or additional liability.
|
|
123
|
+
|
|
124
|
+
10.Acceptance of the Licence
|
|
125
|
+
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’ placed under the bottom of a window
|
|
126
|
+
displaying the text of this Licence or by affirming consent in any other similar way, in accordance with the rules of
|
|
127
|
+
applicable law. Clicking on that icon indicates your clear and irrevocable acceptance of this Licence and all of its terms
|
|
128
|
+
and conditions.
|
|
129
|
+
Similarly, you irrevocably accept this Licence and all of its terms and conditions by exercising any rights granted to You
|
|
130
|
+
by Article 2 of this Licence, such as the use of the Work, the creation by You of a Derivative Work or the Distribution
|
|
131
|
+
or Communication by You of the Work or copies thereof.
|
|
132
|
+
|
|
133
|
+
11.Information to the public
|
|
134
|
+
In case of any Distribution or Communication of the Work by means of electronic communication by You (for example,
|
|
135
|
+
by offering to download the Work from a remote location) the distribution channel or media (for example, a website)
|
|
136
|
+
must at least provide to the public the information requested by the applicable law regarding the Licensor, the Licence
|
|
137
|
+
and the way it may be accessible, concluded, stored and reproduced by the Licensee.
|
|
138
|
+
|
|
139
|
+
12.Termination of the Licence
|
|
140
|
+
The Licence and the rights granted hereunder will terminate automatically upon any breach by the Licensee of the terms
|
|
141
|
+
of the Licence.
|
|
142
|
+
Such a termination will not terminate the licences of any person who has received the Work from the Licensee under
|
|
143
|
+
the Licence, provided such persons remain in full compliance with the Licence.
|
|
144
|
+
|
|
145
|
+
13.Miscellaneous
|
|
146
|
+
Without prejudice of Article 9 above, the Licence represents the complete agreement between the Parties as to the
|
|
147
|
+
Work.
|
|
148
|
+
If any provision of the Licence is invalid or unenforceable under applicable law, this will not affect the validity or
|
|
149
|
+
enforceability of the Licence as a whole. Such provision will be construed or reformed so as necessary to make it valid
|
|
150
|
+
and enforceable.
|
|
151
|
+
The European Commission may publish other linguistic versions or new versions of this Licence or updated versions of
|
|
152
|
+
the Appendix, so far this is required and reasonable, without reducing the scope of the rights granted by the Licence.
|
|
153
|
+
New versions of the Licence will be published with a unique version number.
|
|
154
|
+
All linguistic versions of this Licence, approved by the European Commission, have identical value. Parties can take
|
|
155
|
+
advantage of the linguistic version of their choice.
|
|
156
|
+
|
|
157
|
+
14.Jurisdiction
|
|
158
|
+
Without prejudice to specific agreement between parties,
|
|
159
|
+
— any litigation resulting from the interpretation of this License, arising between the European Union institutions,
|
|
160
|
+
bodies, offices or agencies, as a Licensor, and any Licensee, will be subject to the jurisdiction of the Court of Justice
|
|
161
|
+
of the European Union, as laid down in article 272 of the Treaty on the Functioning of the European Union,
|
|
162
|
+
— any litigation arising between other parties and resulting from the interpretation of this License, will be subject to
|
|
163
|
+
the exclusive jurisdiction of the competent court where the Licensor resides or conducts its primary business.
|
|
164
|
+
|
|
165
|
+
15.Applicable Law
|
|
166
|
+
Without prejudice to specific agreement between parties,
|
|
167
|
+
— this Licence shall be governed by the law of the European Union Member State where the Licensor has his seat,
|
|
168
|
+
resides or has his registered office,
|
|
169
|
+
— this licence shall be governed by Belgian law if the Licensor has no seat, residence or registered office inside
|
|
170
|
+
a European Union Member State.
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
Appendix
|
|
174
|
+
|
|
175
|
+
‘Compatible Licences’ according to Article 5 EUPL are:
|
|
176
|
+
— GNU General Public License (GPL) v. 2, v. 3
|
|
177
|
+
— GNU Affero General Public License (AGPL) v. 3
|
|
178
|
+
— Open Software License (OSL) v. 2.1, v. 3.0
|
|
179
|
+
— Eclipse Public License (EPL) v. 1.0
|
|
180
|
+
— CeCILL v. 2.0, v. 2.1
|
|
181
|
+
— Mozilla Public Licence (MPL) v. 2
|
|
182
|
+
— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
|
183
|
+
— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for works other than software
|
|
184
|
+
— European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
|
185
|
+
— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong Reciprocity (LiLiQ-R+).
|
|
186
|
+
|
|
187
|
+
The European Commission may update this Appendix to later versions of the above licences without producing
|
|
188
|
+
a new version of the EUPL, as long as they provide the rights granted in Article 2 of this Licence and protect the
|
|
189
|
+
covered Source Code from exclusive appropriation.
|
|
190
|
+
All other changes or additions to this Appendix require the production of a new EUPL version.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Enterprise Architect MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/enterprise-architect-mcp)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522enterprise-architect%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522enterprise-architect-mcp%2522%255D%257D)
|
|
7
|
+
[](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522enterprise-architect%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522enterprise-architect-mcp%2522%255D%257D)
|
|
8
|
+
|
|
9
|
+
A read-only [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server for Sparx Enterprise Architect `.qea` exports. Gives AI agents access to EA analysis models — search elements, navigate packages, read use case scenarios, and traverse connectors — without a running EA instance.
|
|
10
|
+
|
|
11
|
+
Works with any MCP client (VS Code / GitHub Copilot, Claude Desktop, Cursor, Windsurf). Reads the `.qea` SQLite export directly, never writes to it, and every response carries completeness metadata so an agent can tell a truncated answer from a complete one.
|
|
12
|
+
|
|
13
|
+
**Keywords:** MCP server · Sparx Enterprise Architect · `.qea` · UML · use case scenarios · package tree · connectors · diagrams · model search · AI agent tooling
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js 22+** (uses the built-in `node:sqlite` module)
|
|
18
|
+
- A `.qea` file exported from Sparx Enterprise Architect
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### VS Code / GitHub Copilot
|
|
23
|
+
|
|
24
|
+
The quickest route is the **Install in VS Code** badge at the top of this page. There is nothing to
|
|
25
|
+
fill in: the server asks for your `.qea` path the first time an agent queries the model, and
|
|
26
|
+
remembers the answer for next time.
|
|
27
|
+
|
|
28
|
+
To register it from a terminal instead, which is handier for scripting or a shared setup, use one
|
|
29
|
+
CLI call:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
code --add-mcp '{\"name\":\"enterprise-architect\",\"command\":\"npx\",\"args\":[\"-y\",\"enterprise-architect-mcp\"]}'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The `\"` sequences are for the `code` shim, which re-parses the argument after PowerShell has
|
|
36
|
+
already handed it over — escaping with PowerShell's own backtick, or using `--%`, still arrives with
|
|
37
|
+
the quotes stripped. The single quotes stop PowerShell from touching the string. On bash or zsh the
|
|
38
|
+
plain form works instead:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
code --add-mcp '{"name":"enterprise-architect","command":"npx","args":["-y","enterprise-architect-mcp"]}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
To configure it by hand instead, add to your project's `.vscode/mcp.json`:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"servers": {
|
|
49
|
+
"enterprise-architect": {
|
|
50
|
+
"type": "stdio",
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "enterprise-architect-mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Nothing personal is in that file, so it can be committed as-is and each developer answers the prompt
|
|
59
|
+
once on their own machine. If you would rather not be asked at all, name the path up front — as a
|
|
60
|
+
trailing argument, in an `env` block, or in a gitignored `.env` in your workspace root:
|
|
61
|
+
|
|
62
|
+
```ini
|
|
63
|
+
EA_QEA_PATH=C:\EA\exports\model.qea
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Claude Desktop
|
|
67
|
+
|
|
68
|
+
The same path-less configuration goes in `claude_desktop_config.json` (`%APPDATA%\Claude\` on
|
|
69
|
+
Windows, `~/Library/Application Support/Claude/` on macOS):
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"enterprise-architect": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": ["-y", "enterprise-architect-mcp"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Claude Desktop does not run the server from a workspace folder, so a `.env` there is not reliable.
|
|
83
|
+
If the client cannot show the path prompt at all, the server says so instead of failing silently, and
|
|
84
|
+
you can name the path in an `env` block:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
"env": { "EA_QEA_PATH": "C:\\EA\\exports\\model.qea" }
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
To run straight from source instead of npm, use `"args": ["-y", "github:mm6502/enterprise-architect-mcp"]`.
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
The server does not need a path to start. It looks for one when an agent first queries the model, and
|
|
95
|
+
takes the first source that actually opens:
|
|
96
|
+
|
|
97
|
+
1. **CLI argument** — `mcp-server-ea C:\path\to\model.qea`
|
|
98
|
+
2. **Environment variable** — `EA_QEA_PATH` (set in an `env` block or system env)
|
|
99
|
+
3. **`.env` file** — `EA_QEA_PATH=...` in a `.env` file in the working directory
|
|
100
|
+
4. **A remembered answer** — whatever you last told the prompt
|
|
101
|
+
5. **The prompt** — the client asks, and a working answer is remembered for next time
|
|
102
|
+
|
|
103
|
+
A source naming a path that cannot be opened is **skipped** rather than fatal, so the next source gets
|
|
104
|
+
its turn. The reason goes to the server log, and once some later source opens, `ea_get_model_info`
|
|
105
|
+
lists it under `ignored`. That is deliberate — a sample value left in an `env` block would otherwise
|
|
106
|
+
outrank every answer you could give, and answering the prompt would never help. The cost is that a
|
|
107
|
+
genuine typo is demoted quietly, so check `ea_get_model_info` if the server opens a different model
|
|
108
|
+
than you expected.
|
|
109
|
+
|
|
110
|
+
Skipping is only worth it when an answer can take the skipped source's place, so two cases stay
|
|
111
|
+
fatal: a path you passed **on the command line** (that is this run's explicit instruction, not a
|
|
112
|
+
stale default), and any broken source in a client that **cannot show a prompt** — falling through
|
|
113
|
+
there would quietly open some other model instead of telling you.
|
|
114
|
+
|
|
115
|
+
Answers are remembered per machine, in `%APPDATA%\enterprise-architect-mcp\` on Windows,
|
|
116
|
+
`~/Library/Application Support/enterprise-architect-mcp/` on macOS, and `$XDG_CONFIG_HOME` (or
|
|
117
|
+
`~/.config`) elsewhere; set `EA_MCP_CONFIG_DIR` to keep that file somewhere else. A path that does
|
|
118
|
+
not open is never remembered, so asking again is enough to correct a mistyped answer.
|
|
119
|
+
|
|
120
|
+
If the path points to a **directory**, the server automatically picks the newest `.qea` file by
|
|
121
|
+
modification time. Pointing at your export folder means new exports are picked up without
|
|
122
|
+
reconfiguring anything.
|
|
123
|
+
|
|
124
|
+
### Name ordering
|
|
125
|
+
|
|
126
|
+
Matching is locale-independent — search folds case and diacritics across European Latin alphabets,
|
|
127
|
+
so `Straße`, `Łódź` and `Győr` are found however they are typed or entity-encoded.
|
|
128
|
+
|
|
129
|
+
The enumeration tools — `ea_search`, `ea_list_elements`, `ea_list_diagrams` — do not order by name
|
|
130
|
+
at all. They order by the model's internal identity: stable and repeatable, but artificial, so
|
|
131
|
+
nothing should be read into which row follows which. That is a deliberate trade. Alphabetical
|
|
132
|
+
ordering under SQLite's binary collation sorts every accented initial after `Z`, and since these
|
|
133
|
+
tools return a window rather than the whole set, it does not merely reorder the list — it pushes
|
|
134
|
+
accented names out of the window entirely. Measured on a real export, names with an accented
|
|
135
|
+
initial filled 1.3% of visible slots under binary ordering against 3.0% under identity order, in a
|
|
136
|
+
model where they make up 3.9% of all names.
|
|
137
|
+
|
|
138
|
+
Only `ea_get_scenarios` still orders names by locale, where the whole set is always returned and no
|
|
139
|
+
name can be cut off. `EA_LOCALE` pins that ordering to a BCP 47 tag (`sk`, `pl`, `hu`, `de`, …) in
|
|
140
|
+
an `env` block or system env; unset, the host default applies. It does not affect matching.
|
|
141
|
+
|
|
142
|
+
### Paging and narrowing
|
|
143
|
+
|
|
144
|
+
The enumeration tools return a window, not a sample. Each response carries `totalMatched`,
|
|
145
|
+
`returned`, `offset` and `truncated`, and when rows remain, a `continuation` naming the next call —
|
|
146
|
+
following it repeatedly visits every match once and terminates. Raising `limit` is not the way to
|
|
147
|
+
read a large set; advancing `offset` is.
|
|
148
|
+
|
|
149
|
+
When far more rows match than one window could hold, the response also carries a `breakdown` of how
|
|
150
|
+
they distribute. Its keys are parameter names and its values are argument values, so a breakdown is
|
|
151
|
+
a prompt to narrow — by `objectType`, `stereotype`, or `diagramType` — rather than to page through
|
|
152
|
+
thousands of rows.
|
|
153
|
+
|
|
154
|
+
### Naming the path up front
|
|
155
|
+
|
|
156
|
+
If you would rather never see the prompt — a CI job, a shared image, or simply a preference — put
|
|
157
|
+
the path in a gitignored `.env` in the working directory. Copy the template:
|
|
158
|
+
|
|
159
|
+
```powershell
|
|
160
|
+
Copy-Item .env.example .env
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Then set your local path in `.env`:
|
|
164
|
+
|
|
165
|
+
```ini
|
|
166
|
+
EA_QEA_PATH=C:\EA\exports\model.qea
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
A directory works too — the newest `.qea` file in it is used:
|
|
170
|
+
|
|
171
|
+
```ini
|
|
172
|
+
EA_QEA_PATH=C:\EA\exports\
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The `.env` file is gitignored — each developer sets their own path without affecting the shared
|
|
176
|
+
config. It is also never committed, which is why it is the one route every new user has to set up by
|
|
177
|
+
hand; answering the prompt once is what makes that unnecessary.
|
|
178
|
+
|
|
179
|
+
## Available Tools
|
|
180
|
+
|
|
181
|
+
| Tool | Description |
|
|
182
|
+
|------|-------------|
|
|
183
|
+
| `ea_search` | Full-text search across elements, attributes, operations, and constraints. Case- and diacritic-insensitive across European Latin alphabets, decodes entity-encoded text. |
|
|
184
|
+
| `ea_get_element` | Full element detail — attributes, operations, diagrams it appears on, constraints (pre/post/invariant/process). Flags whether attribute multiplicity is contrastive. |
|
|
185
|
+
| `ea_list_elements` | List elements in a package, optionally filtered by type. Windowed: reports the total and pages with `offset`. |
|
|
186
|
+
| `ea_get_connectors` | Relationships for an element — includes feature-link resolution (which attribute/operation each end attaches to). |
|
|
187
|
+
| `ea_get_diagram_elements` | Elements and connectors on a diagram, including implied connectors and feature links. |
|
|
188
|
+
| `ea_get_scenarios` | Use case scenario steps with all attributes (trigger, uses, result, link, state) and scenario notes. |
|
|
189
|
+
| `ea_get_package_tree` | Navigate the package hierarchy with recursive depth. |
|
|
190
|
+
| `ea_list_diagrams` | Search diagrams by name, type and package. Windowed like the tools above. |
|
|
191
|
+
| `ea_resolve` | Resolve analyst references (braced GUID or plain name) to model candidates with full package path. Falls back to name-prefix matching for analyst codes; every candidate carries a `match` of `guid`, `exact`, or `prefix`. |
|
|
192
|
+
| `ea_get_schema` | Introspect the model's database schema — tables, columns, indexes, rowid alias. |
|
|
193
|
+
| `ea_get_model_info` | Identity of the open export — file name, size, modification date, server version, and which configuration source the path came from. |
|
|
194
|
+
|
|
195
|
+
### Response contract
|
|
196
|
+
|
|
197
|
+
Every tool returns structured JSON with:
|
|
198
|
+
|
|
199
|
+
- `_meta.sourceTables` — which database tables were consulted
|
|
200
|
+
- `totalMatched` / `returned` / `truncated` — completeness metadata on every collection
|
|
201
|
+
- `continuation` — exact call to retrieve the full set when truncated
|
|
202
|
+
- `isError: true` + `{ error: "not_found" }` for non-existent subjects (distinct from empty results)
|
|
203
|
+
|
|
204
|
+
Two fields exist to stop an inexact answer from being read as a confirmed one:
|
|
205
|
+
|
|
206
|
+
- `ea_resolve` — `match` is always present; only `prefix` is an inexact match
|
|
207
|
+
- `ea_get_element` — `_meta.attributes.multiplicityIsUniform: true` means the element's attributes show no multiplicity contrast, so `1..1` is not evidence of requiredness
|
|
208
|
+
|
|
209
|
+
## Example Prompts
|
|
210
|
+
|
|
211
|
+
Once connected, try prompts like:
|
|
212
|
+
|
|
213
|
+
- "Search for elements related to 'legal entity'"
|
|
214
|
+
- "Show me the package structure under the root"
|
|
215
|
+
- "What are the use case scenarios for UC_SUBMIT_APPLICATION?"
|
|
216
|
+
- "What elements and connectors are on diagram 0103 Application Processing?"
|
|
217
|
+
- "Resolve the reference {3F2A7C10-5B4D-4e8a-9C1F-27D6E8B0A4F3}"
|
|
218
|
+
- "What columns does t_connector have?"
|
|
219
|
+
- "Which diagrams does element a7680 appear on?"
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
Copyright (c) 2026 Michal Mracka
|
|
224
|
+
|
|
225
|
+
Licensed under the EUPL — see [LICENSE](LICENSE) for the full text.
|
|
226
|
+
|
package/dist/database.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DatabaseSync } from "node:sqlite";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
export function openDatabase(path) {
|
|
4
|
+
if (!existsSync(path)) {
|
|
5
|
+
throw new Error(`QEA file not found: "${path}"`);
|
|
6
|
+
}
|
|
7
|
+
let db;
|
|
8
|
+
try {
|
|
9
|
+
db = new DatabaseSync(path, { readOnly: true });
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
throw new Error(`Failed to open database: ${err instanceof Error ? err.message : String(err)}`);
|
|
13
|
+
}
|
|
14
|
+
// Sanity check: verify it's an EA export
|
|
15
|
+
try {
|
|
16
|
+
db.prepare("SELECT COUNT(*) FROM t_object").get();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
db.close();
|
|
20
|
+
throw new Error(`File is not a valid Enterprise Architect export (missing t_object table): "${path}"`);
|
|
21
|
+
}
|
|
22
|
+
// Performance: increase cache
|
|
23
|
+
db.exec("PRAGMA cache_size = -64000"); // 64MB cache
|
|
24
|
+
return db;
|
|
25
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import yargs from "yargs";
|
|
5
|
+
import { hideBin } from "yargs/helpers";
|
|
6
|
+
import { ModelSession } from "./model-session.js";
|
|
7
|
+
import { configureAllTools } from "./tools.js";
|
|
8
|
+
import { packageVersion } from "./version.js";
|
|
9
|
+
const argv = yargs(hideBin(process.argv))
|
|
10
|
+
.scriptName("mcp-server-ea")
|
|
11
|
+
.usage("Usage: $0 [qea-path]")
|
|
12
|
+
.version(packageVersion)
|
|
13
|
+
.command("$0 [qea-path]", "Enterprise Architect MCP Server", (yargs) => {
|
|
14
|
+
yargs.positional("qea-path", {
|
|
15
|
+
describe: "Path to .qea file or directory containing .qea files. " +
|
|
16
|
+
"Falls back to EA_QEA_PATH env var, .env in CWD, a remembered answer, " +
|
|
17
|
+
"then asking the client. If a directory is given, the newest .qea file is used.",
|
|
18
|
+
type: "string",
|
|
19
|
+
});
|
|
20
|
+
})
|
|
21
|
+
.help()
|
|
22
|
+
.parseSync();
|
|
23
|
+
const server = new McpServer({
|
|
24
|
+
name: "Enterprise Architect MCP Server",
|
|
25
|
+
version: packageVersion,
|
|
26
|
+
}, {
|
|
27
|
+
instructions: `This server provides read-only access to a Sparx Enterprise Architect analysis model (.qea export).
|
|
28
|
+
|
|
29
|
+
Response shape contract:
|
|
30
|
+
- Every response is structured JSON — no tool returns unstructured text, even for empty results.
|
|
31
|
+
- Every collection carries totalMatched, returned, truncated (always present, even when truncated: false).
|
|
32
|
+
- _meta.sourceTables lists which database tables the response draws from.
|
|
33
|
+
- ea_get_diagram_elements returns per-collection metadata in _meta.elements and _meta.connectors (not top-level) because it returns two independent collections.
|
|
34
|
+
- The enumeration tools (ea_search, ea_list_elements, ea_list_diagrams) return a window: they accept offset, echo it back, and order results deterministically. That order is stable but artificial — not alphabetical and not the analyst's tree order — so never infer meaning from adjacency.
|
|
35
|
+
- When truncated: true, a continuation object provides the exact call that returns the next window. Following it repeatedly visits every matching row once and terminates; do not raise limit to fetch a large set in one call.
|
|
36
|
+
- When far more rows match than one window holds, a breakdown object reports how they distribute. Every key in it is a parameter name and every value is an argument value, so a breakdown is an invitation to narrow the next call rather than page through the set. Each axis reports totalMatched/returned/truncated for its own list of distinct values, not for rows, and rows carrying no value on that axis are not counted — so the counts need not sum to the response's totalMatched.
|
|
37
|
+
- Not-found errors (non-existent element/package/diagram ID) return isError: true with structured JSON — distinct from a valid empty result.
|
|
38
|
+
- When reporting that something is absent from the model, cite totalMatched, truncated and _meta.sourceTables from the response that supports the claim. An empty result is not evidence of absence unless the subject is confirmed to exist.
|
|
39
|
+
|
|
40
|
+
Text fields (Note, Notes, notes) use EA's HTML dialect: lists (<ol>, <ul>, <li>), bold (<b>), anchors (<a href>). No div/span/script. Structural escapes (< > &) are preserved. Embedded model links ($element://, $diagram://) appear as <a href> targets. Character entities (á etc.) are decoded to characters.
|
|
41
|
+
|
|
42
|
+
Use ea_* tools when the user asks about:
|
|
43
|
+
- Business analysis, use cases, requirements, screens, classes, or domain model elements
|
|
44
|
+
- Application architecture, components, interfaces, or their relationships
|
|
45
|
+
- Use case scenarios / flows — all step attributes (trigger, uses, result, link) and scenario notes are returned
|
|
46
|
+
- How elements relate to each other — connectors include feature-link resolution showing which attribute or operation each end attaches to
|
|
47
|
+
- Package/module structure of the analysis model
|
|
48
|
+
- Diagram contents — elements AND connectors (including implied connectors with both ends on the diagram)
|
|
49
|
+
- Which diagrams an element appears on (returned by ea_get_element)
|
|
50
|
+
- Constraints and business rules on elements (pre-conditions, post-conditions, invariants, process rules)
|
|
51
|
+
- Resolving analyst references (GUIDs, names) to model nodes
|
|
52
|
+
- What database tables and columns the model export contains
|
|
53
|
+
- Which export file the server has open
|
|
54
|
+
|
|
55
|
+
Do NOT use ea_* tools for:
|
|
56
|
+
- Azure DevOps work items, bugs, tasks, PRs, or repositories (use ado server instead)
|
|
57
|
+
- Source code, builds, or deployments
|
|
58
|
+
|
|
59
|
+
Typical workflow: ea_search → ea_get_element → ea_get_connectors / ea_get_scenarios
|
|
60
|
+
Reference resolution: ea_resolve (GUID or name) → ea_get_element or ea_get_diagram_elements
|
|
61
|
+
Discovery: ea_list_diagrams to find diagrams, ea_get_schema to explore the model's tables
|
|
62
|
+
Provenance: ea_get_model_info to identify the export file`,
|
|
63
|
+
});
|
|
64
|
+
const session = new ModelSession(server, argv["qea-path"]);
|
|
65
|
+
configureAllTools(server, session);
|
|
66
|
+
const transport = new StdioServerTransport();
|
|
67
|
+
await server.connect(transport);
|
|
68
|
+
session.reportConfiguration();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { type Database } from "./database.js";
|
|
3
|
+
import { type QeaPathOrigin, type QeaPathSource } from "./resolve-qea-path.js";
|
|
4
|
+
/** What the tools need from the session: a database, and where it came from. */
|
|
5
|
+
export interface ModelAccess {
|
|
6
|
+
database(): Promise<Database>;
|
|
7
|
+
origin(): QeaPathOrigin | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function describeSource(source: QeaPathSource): string;
|
|
10
|
+
export declare class ModelSession implements ModelAccess {
|
|
11
|
+
private readonly server;
|
|
12
|
+
private readonly cliArg?;
|
|
13
|
+
private db?;
|
|
14
|
+
private opened?;
|
|
15
|
+
private opening?;
|
|
16
|
+
/** A rejected answer is not remembered, so the next prompt has to carry the reason itself. */
|
|
17
|
+
private lastPromptFailure?;
|
|
18
|
+
constructor(server: McpServer, cliArg?: string | undefined);
|
|
19
|
+
origin(): QeaPathOrigin | undefined;
|
|
20
|
+
/** Startup diagnostics only: reports what is configured without opening anything. */
|
|
21
|
+
reportConfiguration(): void;
|
|
22
|
+
database(): Promise<Database>;
|
|
23
|
+
private candidates;
|
|
24
|
+
private open;
|
|
25
|
+
/** Opens a candidate and, on success, makes it this session's model. */
|
|
26
|
+
private adopt;
|
|
27
|
+
private promptReason;
|
|
28
|
+
private ask;
|
|
29
|
+
}
|