Skip to main content
Glama
Enterprise Architect MCP Server

Enterprise Architect MCP Server

by mm6502

Enterprise Architect MCP Server

npm version Node.js License: EUPL-1.2 Install in VS Code Install in VS Code Insiders

一个只读的 Model Context Protocol (MCP) 服务器,用于 Sparx Enterprise Architect 的 .qea 导出。让 AI 代理能够访问 EA 分析模型——搜索元素、导航包、读取用例场景、遍历连接器——而无需运行中的 EA 实例。

适用于任何 MCP 客户端(VS Code / GitHub Copilot、Claude Desktop、Cursor、Windsurf)。直接读取 .qea SQLite 导出,从不写入,并且每个响应都携带完整性元数据,使代理能够区分截断的答案和完整的答案。

关键词: MCP 服务器 · Sparx Enterprise Architect · .qea · UML · 用例场景 · 包树 · 连接器 · 图 · 模型搜索 · AI 代理工具

前提条件

  • Node.js 22+(使用内置的 node:sqlite 模块)

  • 从 Sparx Enterprise Architect 导出的 .qea 文件

Related MCP server: jgs-sysmlv2-api-mcp

安装

VS Code / GitHub Copilot

最快的途径是页面顶部的 Install in VS Code 徽章。无需填写任何内容:服务器会在代理首次查询模型时询问你的 .qea 路径,并记住答案以供下次使用。

如果想改为从终端注册(更适合脚本或共享设置),只需一次 CLI 调用:

code --add-mcp '{\"name\":\"enterprise-architect\",\"command\":\"npx\",\"args\":[\"-y\",\"enterprise-architect-mcp\"]}'

\" 序列是用于 code shim 的,它会在 PowerShell 已经传递参数后重新解析参数——使用 PowerShell 自己的反引号转义,或使用 --%,仍然会以引号被剥离的方式到达。单引号可阻止 PowerShell 触碰该字符串。在 bash 或 zsh 上,普通形式即可:

code --add-mcp '{"name":"enterprise-architect","command":"npx","args":["-y","enterprise-architect-mcp"]}'

如果想手动配置,请添加到项目的 .vscode/mcp.json 中:

{
  "servers": {
    "enterprise-architect": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "enterprise-architect-mcp"]
    }
  }
}

该文件中不包含任何个人信息,因此可以原样提交,每位开发者在自己的机器上只需回答一次提示。如果你完全不想被询问,可以预先指定路径——作为尾随参数、在 env 块中,或在工作区根目录的 gitignored .env 文件中:

EA_QEA_PATH=C:\EA\exports\model.qea

Claude Desktop

相同的无路径配置放在 claude_desktop_config.json 中(Windows 上为 %APPDATA%\Claude\,macOS 上为 ~/Library/Application Support/Claude/):

{
  "mcpServers": {
    "enterprise-architect": {
      "command": "npx",
      "args": ["-y", "enterprise-architect-mcp"]
    }
  }
}

Claude Desktop 不会从工作区文件夹运行服务器,因此那里的 .env 不可靠。如果客户端根本无法显示路径提示,服务器会明确说明而不是静默失败,你可以在 env 块中指定路径:

"env": { "EA_QEA_PATH": "C:\\EA\\exports\\model.qea" }

要从源代码而不是 npm 直接运行,请使用 "args": ["-y", "github:mm6502/enterprise-architect-mcp"]。

配置

服务器启动时不需要路径。当代理首次查询模型时,它会查找路径,并采用第一个实际能打开的来源:

  1. CLI 参数 — mcp-server-ea C:\path\to\model.qea

  2. 环境变量 — EA_QEA_PATH(在 env 块或系统环境中设置)

  3. .env 文件 — 工作目录中 .env 文件里的 EA_QEA_PATH=...

  4. 记住的答案 — 你上次告诉提示的内容

  5. 提示 — 客户端询问,有效的答案会被记住以供下次使用

指定了无法打开的路径的来源会被跳过而不是致命错误,因此下一个来源会获得机会。原因会记录到服务器日志中,一旦后续某个来源打开,ea_get_model_info 会将其列在 ignored 下。这是有意为之——否则 env 块中遗留的示例值会凌驾于你能给出的所有答案之上,回答提示也永远不会起作用。代价是真正的拼写错误会被静默降级,因此如果服务器打开的是与你预期不同的模型,请检查 ea_get_model_info。

只有当某个答案能够取代被跳过的来源时,跳过才有意义,因此有两种情况保持致命:你在命令行上传递的路径(这是本次运行的明确指令,不是过时的默认值),以及客户端无法显示提示时的任何损坏来源——在这种情况下继续下去会静默打开其他模型,而不是告诉你。

答案按机器记住,Windows 上位于 %APPDATA%\enterprise-architect-mcp\,macOS 上位于 ~/Library/Application Support/enterprise-architect-mcp/,其他系统位于 $XDG_CONFIG_HOME(或 ~/.config);设置 EA_MCP_CONFIG_DIR 可将该文件放在其他位置。无法打开的路径永远不会被记住,因此再次询问即可纠正输错的答案。

如果路径指向目录,服务器会自动按修改时间选择最新的 .qea 文件。指向你的导出文件夹意味着无需重新配置即可获取新的导出。

预先指定路径

如果你完全不想看到提示——CI 作业、共享镜像,或仅仅是个人偏好——请将路径放在工作目录中 gitignored 的 .env 文件中。复制模板:

Copy-Item .env.example .env

然后在 .env 中设置你的本地路径:

EA_QEA_PATH=C:\EA\exports\model.qea

目录也可以——将使用其中最新的 .qea 文件:

EA_QEA_PATH=C:\EA\exports\

.env 文件是 gitignored 的——每位开发者设置自己的路径,不影响共享配置。它也永远不会被提交,这就是为什么它是每个新用户都必须手动设置的一条途径;回答一次提示即可使其变得不必要。

可用工具

工具

描述

ea_search

跨元素、属性、操作和约束进行全文搜索。不区分大小写,覆盖斯洛伐克字母表,解码实体编码文本。

ea_get_element

完整的元素详情——属性、操作、出现的图、约束(前置/后置/不变量/过程)。标记属性多重性是否具有对比性。

ea_list_elements

列出包中的元素,可选按类型过滤。报告总数并支持分页。

ea_get_connectors

元素的关系——包括特性链接解析(每个端点连接到哪个属性/操作)。

ea_get_diagram_elements

图上的元素和连接器,包括隐含连接器和特性链接。

ea_get_scenarios

用例场景步骤,包含所有属性(触发器、使用、结果、链接、状态)和场景注释。

ea_get_package_tree

以递归深度导航包层次结构。

ea_list_diagrams

按名称和包搜索图。

ea_resolve

将分析师引用(花括号 GUID 或纯名称)解析为带有完整包路径的模型候选。对于分析师代码回退到名称前缀匹配;每个候选都带有 match,值为 guid、exact 或 prefix。

ea_get_schema

检查模型的数据库模式——表、列、索引、rowid 别名。

ea_get_model_info

打开的导出的身份信息——文件名、大小、修改日期、服务器版本,以及路径来自哪个配置来源。

响应约定

每个工具都返回结构化 JSON,包含:

  • _meta.sourceTables — 查询了哪些数据库表

  • totalMatched / returned / truncated — 每个集合的完整性元数据

  • continuation — 截断时用于检索完整集合的确切调用

  • isError: true + { error: "not_found" } 用于不存在的主题(与空结果不同)

存在两个字段以防止不精确的答案被误读为已确认的答案:

  • ea_resolve — match 始终存在;只有 prefix 是不精确匹配

  • ea_get_element — _meta.attributes.multiplicityIsUniform: true 表示元素的属性没有显示多重性对比,因此 1..1 不是必需性的证据

示例提示

连接后,可以尝试如下提示:

  • "搜索与 'legal entity' 相关的元素"

  • "显示根目录下的包结构"

  • "UC_SUBMIT_APPLICATION 的用例场景是什么?"

  • "图 0103 Application Processing 上有哪些元素和连接器?"

  • "解析引用 {3F2A7C10-5B4D-4e8a-9C1F-27D6E8B0A4F3}"

  • "t_connector 有哪些列?"

  • "元素 a7680 出现在哪些图上?"

许可证

版权所有 (c) 2026 Michal Mracka

根据 EUPL 许可——完整文本见 LICENSE。

Available Tools

12 tools
ea_get_connectorsA
Read-only

Get all relationships (connectors) for a given element. connectors lists what the element is connected to and how (Realisation, Dependency, Association, etc.), each entry naming its source and dest ends. For Generalization connectors, source is always the specific (child) type and dest the general (parent) type — each end also carries a role making this explicit without needing to reason about direction. Filter by connectorType and direction to list an element's direct children (incoming Generalization) or direct parent(s) (outgoing Generalization) without a diagram. Feature links show which specific attribute or operation each end attaches to.

Inputs: elementId (required), direction, connectorType.

ea_get_diagram_elementsA
Read-only

Get all elements and connectors placed on a specific diagram: the diagram itself, plus elements and connectors. elements already includes free-text Note diagram objects, which often carry a legend or abbreviation definitions an agent would otherwise miss. Connectors include feature-link resolution showing which attribute or operation each end attaches to. The connector list is the union of explicit t_diagramlinks rows and implied connectors (both ends on the diagram).

Inputs: diagramId (required).

ea_get_elementA
Read-only

Get full details of an Enterprise Architect element by its ID, including its Note, attributes, operations, the diagrams it appears on, and its constraints. Attribute multiplicity supports a requiredness inference only when the element uses multiplicities contrastively; read _meta.attributes.multiplicityIsUniform before making that inference — when it is true the element's attributes carry no multiplicity contrast, so a value like 1..1 is not evidence of requiredness. Attributes and operations are capped inline: attributesTruncated/operationsTruncated say whether the returned list is partial, and attributesTotal/operationsTotal give the full counts, so never infer a count from the inline list alone.

Inputs: elementId (required).

ea_get_model_infoA
Read-only

Report which .qea export file the server has open: fileName is the citable identity, alongside fileSizeBytes, lastModified, and the serverVersion that produced the answer. The full local path is also returned as resolvedPath, with resolvedPathNote explaining why it is environment detail rather than something to cite. configuration says where that path came from — source in words, sourceId as one of argument/environment/dotenv/remembered/prompt, and the configured value behind it — plus any skipped settings, each with the reason it could not be opened, and shadowed ones a higher-priority source outranked; configurationNote says how much of that is safe to repeat.

Inputs: no named parameters.

ea_get_package_treeA
Read-only

Navigate the package hierarchy. Without parameters, returns top-level packages. With a packageId, returns that package's children up to the specified depth. Each node carries id, name, parentId, and elementCount.

Inputs: depth, packageId.

ea_get_scenariosA
Read-only

Get use case scenario flows for an element. scenarios holds the parsed flows; each has name, type, notes, and steps, and each step carries stepNumber plus its attributes (trigger, uses, result, state, link). Steps are numbered within each scenario. Scenarios ordered by type: Basic Path first, then Alternate, then Exception. A step's uses may name a business rule or constraint by code; that code is not independently searchable or resolvable — look it up among this same elementId's own constraints via ea_get_element, not by a separate lookup.

Inputs: elementId (required).

ea_get_schemaA
Read-only

List the model's database tables in tables, or pass a tableName to get that table's columns and indexes instead. That form echoes the table name and adds rowidAlias — the INTEGER PRIMARY KEY aliasing SQLite's rowid, so the fastest lookup path, or null when the table has none — with rowidNote saying which case applies. Use this to discover what data the model holds beyond what the typed ea_* tools return. See ea_get_model_info for the export's identity.

Inputs: tableName.

ea_list_diagramsA
Read-only

List diagrams in the model, optionally filtered by package, diagram type, and/or name substring. Each entry in results carries diagramId, name, type, packagePath, and eaGuid. Diagrams are ordered by the model's internal identity — stable but artificial, neither alphabetical nor the analyst's tree order — so adjacency carries no meaning. Walk a large result set with offset rather than a larger limit; while rows remain, continuation names the next call. When far more diagrams match than one window can hold, breakdown reports how many each type holds, so the next call can narrow by diagramType instead of paging.

Inputs: limit, offset, packageId, diagramType, +1 more.

ea_list_elementsA
Read-only

List elements within a package, optionally filtered by object type. elements is a lightweight list (ID, type, name, alias, stereotype), grouped by element type and then ordered by the model's internal identity. That order is stable but artificial — neither alphabetical nor the analyst's tree order — so adjacency carries no meaning. Walk a large package with offset rather than a larger limit; while rows remain, continuation names the next call. When far more elements match than one window can hold, breakdown reports how many each type holds, so the next call can narrow by objectType instead of paging.

Inputs: packageId (required), limit, offset, objectType.

ea_resolveA
Read-only

Resolve an analyst reference (braced GUID or plain name) to model candidates: the input is echoed as reference and the hits are in candidates. A braced GUID is matched exactly. A plain name is matched against the full name first; only if nothing matches exactly is the reference retried as a name prefix, which resolves analyst codes like UC_ABC_2079 or OA_ABC_2280 to elements named 'CODE: description'. An exact hit is returned alone and is never diluted by prefix hits. Each candidate reports its type (element, diagram, package), id, name, fullPackagePath, eaGuid, and a match field that is always present with value "guid", "exact", or "prefix" — a "prefix" candidate is an inexact match and must not be treated as a confirmed identity. Use the optional kind filter to narrow results.

Inputs: reference (required), kind.

ea_search_and_any_ofA
Read-only

Search Enterprise Architect model elements the same way ea_search does, plus andAnyOf: a required-and-alternative filter. requiredTerms still works exactly as it does on ea_search (conjunction, contiguous substring, terms need not share a field). andAnyOf is an optional list of further terms; when supplied, a result must contain requiredTerms AND at least one andAnyOf term, so it can only ever narrow — it never returns a result requiredTerms alone would not. An empty andAnyOf array applies no filter. For promoting rather than narrowing, use ea_search instead, which offers the same alternatives idea as a rank boost. When no element matches the required terms at all, termMatches reports, per supplied term, whether it matched anywhere in the corpus. Matching elements are returned in results, strongest first, each with a decoded note preview, a truncation flag, and matches — the evidence for why it was returned, capped and strongest-first, with _meta.matches reporting how many were found and withheld. packageScope restricts results to a package and its descendants. Walk a large result set with offset; while rows remain, continuation names the next call. When far more elements match than one window can hold, breakdown reports how they distribute by objectType, stereotype, or packageScope.

Inputs: requiredTerms (required), limit, offset, andAnyOf, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 12 tools

    Disambiguation3/5

    Most tools target clearly distinct resources (packages, elements, connectors, diagrams, scenarios, schema), but `ea_search` and `ea_search_and_any_of` are effectively the same operation with one extra filter, and their descriptions spend most of their length explaining how they differ from each other. That is a parameter variation surfaced as a separate tool, which invites misselection. `ea_get_element` vs `ea_list_elements` is distinguishable, but the search pair drags the set down.

    Naming Consistency4/5

    All names share the `ea_` prefix and follow a verb_noun pattern (`ea_get_element`, `ea_list_diagrams`, `ea_get_connectors`), which is highly predictable. Minor deviations: `ea_resolve` has no object noun, and `ea_search_and_any_of` encodes a parameter in the tool name rather than following the resource+action convention.

    Tool Count4/5

    Twelve tools is a well-scoped surface for a read-only model browser, and each maps to a real artifact type in the .qea model. The count would be a clean 5 if the two near-duplicate search tools were merged into one with an optional filter.

    Completeness4/5

    The surface covers the main exploration paths: package hierarchy, element search and detail, element listing, connectors, diagram listing and contents, scenario flows, raw schema access, reference resolution, and export identity. Gaps remain around tagged values, standalone constraint/attribute/operation lookups, and any write capability, though a read-only inspector scope makes the latter a defensible design choice.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers