@eventcatalog/core 4.12.3 → 5.0.0-beta.1
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 +226 -95
- package/NOTICE +30 -0
- package/README.md +3 -2
- package/dist/analytics/analytics.cjs +2 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +44 -16
- package/dist/analytics/log-build.d.cts +6 -5
- package/dist/analytics/log-build.d.ts +6 -5
- package/dist/analytics/log-build.js +4 -3
- package/dist/{chunk-U4YJSTGV.js → chunk-AYNZXUB5.js} +2 -10
- package/dist/{chunk-5BPN6QEC.js → chunk-K2ACDO7Y.js} +1 -1
- package/dist/{chunk-ZYTCBNB3.js → chunk-KYJZJLBD.js} +2 -1
- package/dist/{chunk-TV3YAWKQ.js → chunk-Q6SD5SNQ.js} +1 -1
- package/dist/{chunk-HPC6KUDQ.js → chunk-S2QGT7ZF.js} +1 -1
- package/dist/chunk-TQLRG35T.js +203 -0
- package/dist/{chunk-M577VUOX.js → chunk-UDS3SYLZ.js} +13 -16
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +408 -291
- package/dist/eventcatalog.config.d.cts +2 -3
- package/dist/eventcatalog.config.d.ts +2 -3
- package/dist/eventcatalog.js +35 -98
- package/dist/federation/content-cache.d.cts +0 -5
- package/dist/federation/content-cache.d.ts +0 -5
- package/dist/federation/diagnostics.d.cts +0 -5
- package/dist/federation/diagnostics.d.ts +0 -5
- package/dist/federation/federate.cjs +0 -9
- package/dist/federation/federate.d.cts +0 -5
- package/dist/federation/federate.d.ts +0 -5
- package/dist/federation/federate.js +4 -5
- package/dist/federation/filesystem-source-provider.d.cts +0 -5
- package/dist/federation/filesystem-source-provider.d.ts +0 -5
- package/dist/federation/github-source-provider.d.cts +0 -5
- package/dist/federation/github-source-provider.d.ts +0 -5
- package/dist/federation/output-transaction.d.cts +0 -4
- package/dist/federation/output-transaction.d.ts +0 -4
- package/dist/federation/public-assets.d.cts +0 -5
- package/dist/federation/public-assets.d.ts +0 -5
- package/dist/federation/source-provider.d.cts +0 -5
- package/dist/federation/source-provider.d.ts +0 -5
- package/dist/federation/types.d.cts +0 -5
- package/dist/federation/types.d.ts +0 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/license-C1y-56bb.d.cts +23 -0
- package/dist/license-C1y-56bb.d.ts +23 -0
- package/dist/runtime-dependencies/@eventcatalog__visualiser__layout.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__react.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__server.mjs +3 -0
- package/dist/runtime-dependencies/@modelcontextprotocol__sdk__types.js.mjs +3 -0
- package/dist/runtime-dependencies/manifest.json +12 -1
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__graphql.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__json.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__markup.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__protobuf.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__yaml.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-dark.mjs +3 -0
- package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-light.mjs +3 -0
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/utils/license-status.cjs +240 -0
- package/dist/utils/license-status.d.cts +28 -0
- package/dist/utils/license-status.d.ts +28 -0
- package/dist/utils/license-status.js +12 -0
- package/eventcatalog/astro.config.mjs +1 -1
- package/eventcatalog/integrations/eventcatalog-runtime.mjs +1 -1
- package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +29 -19
- package/eventcatalog/src/components/ChatPanel/OfflineReply.tsx +74 -0
- package/eventcatalog/src/components/FieldsExplorer/FieldFilters.tsx +24 -28
- package/eventcatalog/src/components/FieldsExplorer/FieldNodeGraph.tsx +16 -11
- package/eventcatalog/src/components/FieldsExplorer/FieldsExplorer.tsx +4 -218
- package/eventcatalog/src/components/FieldsExplorer/FieldsTable.tsx +27 -36
- package/eventcatalog/src/components/Header.astro +43 -58
- package/eventcatalog/src/components/Lists/PillListFlat.styles.css +17 -17
- package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +1 -1
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +4 -0
- package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +14 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +49 -18
- package/eventcatalog/src/components/MDX/RemoteFile.astro +2 -24
- package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +59 -93
- package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +1 -32
- package/eventcatalog/src/components/SchemaExplorer/DiffViewer.tsx +20 -67
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -11
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +11 -60
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +1 -3
- package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +0 -3
- package/eventcatalog/src/components/SchemaExplorer/VersionHistoryModal.tsx +2 -9
- package/eventcatalog/src/components/SchemaExplorer/parse-schema.ts +46 -0
- package/eventcatalog/src/components/SchemaExplorer/utils.ts +11 -0
- package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +2 -9
- package/eventcatalog/src/components/Settings/LicenseSettings.tsx +288 -0
- package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +3 -19
- package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +85 -30
- package/eventcatalog/src/components/Settings/SettingsShared.tsx +7 -75
- package/eventcatalog/src/components/SideNav/CustomDocsNav.astro +2 -2
- package/eventcatalog/src/components/TrialBadge.astro +82 -0
- package/eventcatalog/src/content.config.ts +9 -96
- package/eventcatalog/src/{enterprise → features}/ai/chat-api.ts +22 -34
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/ga4.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/gtm.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/adapters/posthog.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsHead.astro +2 -4
- package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsTracker.astro +2 -4
- package/eventcatalog/src/{enterprise → features}/analytics/tracker.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/api/catalog.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/[...auth].ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware-auth.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/custom-pages.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/index.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/collections/resource-docs.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/collection.ts +0 -5
- package/eventcatalog/src/features/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +9 -0
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/CustomDocsNavWrapper.tsx +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NestedItem.tsx +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NoResultsFound.tsx +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/index.tsx +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/types.ts +0 -5
- package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/index.astro → features/custom-documentation/components/CustomDocumentationPage.astro} +5 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/badge-styles.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/custom-docs.ts +1 -6
- package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/docs-search.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/custom-pages/routes.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/directory/user-team-directory.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/field-extractor.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/field-indexer.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/fields-db.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/fields/pages/api/fields.ts +1 -6
- package/eventcatalog/src/{enterprise → features}/fields/pages/fields.astro +1 -2
- package/eventcatalog/src/{enterprise → features}/integrations/eventcatalog-features.ts +17 -75
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/links.ts +59 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/node-chat.tsx +299 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/shared.ts +14 -0
- package/eventcatalog/src/features/mcp/apps/architecture-diagram/view.tsx +454 -0
- package/eventcatalog/src/features/mcp/apps/generated/viewer.html +432 -0
- package/eventcatalog/src/features/mcp/apps/mermaid-stub.ts +10 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/schema-code.tsx +65 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/shared.ts +23 -0
- package/eventcatalog/src/features/mcp/apps/schema-viewer/view.tsx +170 -0
- package/eventcatalog/src/features/mcp/apps/shared/app-view.tsx +98 -0
- package/eventcatalog/src/features/mcp/apps/shared/resource-types.ts +15 -0
- package/eventcatalog/src/features/mcp/apps/viewer/shared.ts +24 -0
- package/eventcatalog/src/features/mcp/apps/viewer/styles.css +25 -0
- package/eventcatalog/src/features/mcp/apps/viewer/view.tsx +59 -0
- package/eventcatalog/src/features/mcp/mcp-app-icons.ts +63 -0
- package/eventcatalog/src/features/mcp/mcp-apps.ts +160 -0
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-auth.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-scope.ts +7 -7
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-scoped-tools.ts +47 -40
- package/eventcatalog/src/{enterprise → features}/mcp/mcp-server.ts +347 -34
- package/eventcatalog/src/{enterprise → features}/mcp/oauth-protected-resource.ts +0 -5
- package/eventcatalog/src/features/mcp/schema-viewer.ts +24 -0
- package/eventcatalog/src/{enterprise → features}/tools/catalog-tools.ts +133 -102
- package/eventcatalog/src/features/tools/index.ts +5 -0
- package/eventcatalog/src/{enterprise → features}/visualizer-layout/reset.ts +0 -5
- package/eventcatalog/src/{enterprise → features}/visualizer-layout/save.ts +0 -5
- package/eventcatalog/src/layouts/BaseLayout.astro +2 -2
- package/eventcatalog/src/layouts/Footer.astro +31 -39
- package/eventcatalog/src/layouts/SettingsLayout.astro +6 -6
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +7 -37
- package/eventcatalog/src/{enterprise → pages}/api/schemas/[collection]/[id]/[version]/index.ts +0 -22
- package/eventcatalog/src/{enterprise → pages}/api/schemas/services/[id]/[version]/[specification]/index.ts +0 -19
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].md.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].mdx.ts +2 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +9 -5
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +12 -0
- package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/root-index.astro → pages/docs/custom/index.astro} +1 -23
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +4 -9
- package/eventcatalog/src/pages/docs/llm/llms.txt.ts +4 -4
- package/eventcatalog/src/pages/docs/llm/schemas.txt.ts +0 -11
- package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +2 -2
- package/eventcatalog/src/pages/index.astro +2 -2
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +0 -3
- package/eventcatalog/src/pages/schemas/explorer/index.astro +1 -4
- package/eventcatalog/src/pages/settings/assistant.astro +2 -4
- package/eventcatalog/src/pages/settings/license.astro +18 -0
- package/eventcatalog/src/pages/settings/llm-access.astro +1 -4
- package/eventcatalog/src/pages/settings/mcp.astro +33 -4
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +1 -2
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +2 -45
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -1
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version].mermaid.ts +7 -109
- package/eventcatalog/src/pages/visualiser/_mermaid-route.ts +78 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/_index.data.ts +44 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -1
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +56 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +3 -40
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version].mermaid.ts +20 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/_index.data.ts +29 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +3 -38
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +56 -0
- package/eventcatalog/src/pages/visualiser/systems/[id]/[version].mermaid.ts +20 -0
- package/eventcatalog/src/stores/sidebar-store/builders/agent.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/container.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +7 -32
- package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/message.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/service.ts +2 -8
- package/eventcatalog/src/stores/sidebar-store/builders/system.ts +2 -12
- package/eventcatalog/src/stores/sidebar-store/custom-sidebar.ts +0 -10
- package/eventcatalog/src/stores/sidebar-store/state.ts +4 -6
- package/eventcatalog/src/styles/theme.css +22 -18
- package/eventcatalog/src/styles/themes/forest.css +8 -8
- package/eventcatalog/src/styles/themes/ocean.css +8 -8
- package/eventcatalog/src/styles/themes/sapphire.css +8 -8
- package/eventcatalog/src/styles/themes/sunset.css +8 -8
- package/eventcatalog/src/utils/clipboard.ts +4 -4
- package/eventcatalog/src/utils/collections/flow-step-schema.ts +117 -0
- package/eventcatalog/src/utils/collections/pointer-schema.ts +7 -0
- package/eventcatalog/src/utils/collections/resource-docs.ts +677 -14
- package/eventcatalog/src/utils/collections/schema-loader.ts +0 -5
- package/eventcatalog/src/utils/feature.ts +14 -23
- package/eventcatalog/src/utils/license.ts +114 -0
- package/eventcatalog/src/utils/node-graphs/architecture-diagram-types.ts +32 -0
- package/eventcatalog/src/utils/node-graphs/architecture-diagram.ts +84 -0
- package/eventcatalog/src/utils/node-graphs/channel-node-graph.ts +4 -25
- package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +12 -39
- package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +11 -27
- package/eventcatalog/src/utils/node-graphs/domain-levels-node-graph.ts +679 -0
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +3 -20
- package/eventcatalog/src/utils/node-graphs/export-mermaid.ts +51 -4
- package/eventcatalog/src/utils/node-graphs/field-node-graph.ts +8 -23
- package/eventcatalog/src/utils/node-graphs/flow-lanes.ts +119 -0
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +133 -47
- package/eventcatalog/src/utils/node-graphs/layout-node-graph.ts +28 -0
- package/eventcatalog/src/utils/node-graphs/layout-persistence.ts +3 -3
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +16 -34
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +11 -25
- package/eventcatalog/src/utils/node-graphs/system-context-node-graph.ts +18 -54
- package/eventcatalog/src/utils/node-graphs/system-levels-node-graph.ts +59 -0
- package/eventcatalog/src/utils/node-graphs/systems-node-graph.ts +20 -80
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -78
- package/eventcatalog/src/utils/trial.ts +36 -0
- package/eventcatalog/tsconfig.json +1 -1
- package/package.json +11 -11
- package/dist/chunk-FV56YFM4.js +0 -7
- package/dist/federation/entitlement.cjs +0 -31
- package/dist/federation/entitlement.d.cts +0 -12
- package/dist/federation/entitlement.d.ts +0 -12
- package/dist/federation/entitlement.js +0 -6
- package/dist/runtime-dependencies/dagre.mjs +0 -3
- package/eventcatalog/src/components/Settings/BillingSettingsForm.tsx +0 -265
- package/eventcatalog/src/enterprise/LICENSE +0 -57
- package/eventcatalog/src/enterprise/README.md +0 -5
- package/eventcatalog/src/enterprise/collections/resource-docs-utils.ts +0 -691
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +0 -9
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/[...path]/index.astro +0 -18
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/feature.astro +0 -171
- package/eventcatalog/src/enterprise/feature.ts +0 -75
- package/eventcatalog/src/enterprise/tools/index.ts +0 -10
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +0 -126
- package/eventcatalog/src/pages/settings/billing.astro +0 -17
- package/eventcatalog/src/pages/visualiser/domain-integrations/index.astro +0 -26
- package/eventcatalog/src/types/mcp-modules.d.ts +0 -67
- package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +0 -261
- package/eventcatalog/src/utils/node-graphs/export-node-graph.ts +0 -91
- /package/eventcatalog/src/{enterprise → features}/auth/error.astro +0 -0
- /package/eventcatalog/src/{enterprise → features}/auth/login.astro +0 -0
- /package/eventcatalog/src/{enterprise → features}/auth/unauthorized.astro +0 -0
- /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path]/_index.data.ts +0 -0
- /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path].mdx.ts +0 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import type { McpUiDisplayMode } from '@modelcontextprotocol/ext-apps';
|
|
4
|
+
import { registerAppResource, RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY } from '@modelcontextprotocol/ext-apps/server';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
// MCP App views (built by scripts/build-mcp-apps.mjs). Without a build, tools return text only.
|
|
8
|
+
// Loaded when a host reads the view, not up front: each view's HTML is up to a few MB
|
|
9
|
+
const mcpAppViews = import.meta.glob<string>('./apps/generated/*.html', { query: '?raw', import: 'default' });
|
|
10
|
+
|
|
11
|
+
/** Loads a built MCP App view's HTML, or undefined when the views weren't built */
|
|
12
|
+
export const getMcpAppViewLoader = (name: string) => mcpAppViews[`./apps/generated/${name}.html`];
|
|
13
|
+
|
|
14
|
+
/** Tool `_meta` telling MCP hosts that support MCP Apps to show the tool's result in a view */
|
|
15
|
+
const appViewMeta = (resourceUri: string, visibility?: Array<'model' | 'app'>) => ({
|
|
16
|
+
ui: { resourceUri, ...(visibility && { visibility }) },
|
|
17
|
+
[RESOURCE_URI_META_KEY]: resourceUri,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/** Told to the model with every result shown in a view, so it doesn't repeat what the user can already see */
|
|
21
|
+
export const mcpAppNote = (subject: string, avoid: string, otherwise: string) =>
|
|
22
|
+
`Clients that support MCP Apps are showing the user this ${subject} interactively. If so, do not ${avoid}: explain it instead. Otherwise, ${otherwise}.`;
|
|
23
|
+
|
|
24
|
+
/** What a tool shows: text for the model, and the payload for the view (built only when there is a view to show it) */
|
|
25
|
+
export type McpAppResult<Payload> =
|
|
26
|
+
| { error: string }
|
|
27
|
+
| {
|
|
28
|
+
/** What the model reads, including a note (see mcpAppNote) on what the view already shows the user */
|
|
29
|
+
forModel: Record<string, unknown>;
|
|
30
|
+
/** What was loaded, e.g. "the schema for events/OrderCreated", for the app-only tool's text */
|
|
31
|
+
label: string;
|
|
32
|
+
getPayload: () => Promise<Payload>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type ToolDefinition<Shape extends z.ZodRawShape> = {
|
|
36
|
+
name: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string;
|
|
39
|
+
/** The tool's arguments, as a Zod shape */
|
|
40
|
+
input: Shape;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type McpAppDefinition<Shape extends z.ZodRawShape, ViewShape extends z.ZodRawShape, Payload> = {
|
|
44
|
+
/** Loads the view's HTML; undefined when the views weren't built, so only the text result is returned */
|
|
45
|
+
loadView?: () => Promise<string>;
|
|
46
|
+
resource: {
|
|
47
|
+
name: string;
|
|
48
|
+
uri: string;
|
|
49
|
+
description: string;
|
|
50
|
+
csp?: { resourceDomains: string[] };
|
|
51
|
+
/** How hosts open the view: ChatGPT reads these before loading it, so it can open straight in that mode */
|
|
52
|
+
displayModes?: { preferred: McpUiDisplayMode; available: McpUiDisplayMode[] };
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Ties every result to one view (ChatGPT's `openai/widgetSessionId`): the host updates the view it already
|
|
56
|
+
* shows with each new result, instead of showing another one
|
|
57
|
+
*/
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
/** Key of the payload in the model-facing tool result's `_meta` */
|
|
60
|
+
metaKey: string;
|
|
61
|
+
/** The tool the model calls to show the user something */
|
|
62
|
+
tool: ToolDefinition<Shape>;
|
|
63
|
+
/** App-only tool the view calls to load its payload when the host doesn't pass the result's `_meta` */
|
|
64
|
+
viewTool: ToolDefinition<ViewShape>;
|
|
65
|
+
annotations: ToolAnnotations;
|
|
66
|
+
load: (params: z.output<z.ZodObject<Shape>> | z.output<z.ZodObject<ViewShape>>) => Promise<McpAppResult<Payload>>;
|
|
67
|
+
/** Prefix of the error returned when loading fails */
|
|
68
|
+
errorMessage: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const errorResult = (error: { error: string }) => ({
|
|
72
|
+
content: [{ type: 'text' as const, text: JSON.stringify(error) }],
|
|
73
|
+
isError: true,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Registers a tool whose result MCP hosts that support MCP Apps show in a view (e.g. an interactive diagram),
|
|
78
|
+
* with the app-only tool the view loads from and the view itself. Other hosts get the tool's text.
|
|
79
|
+
*/
|
|
80
|
+
export function registerMcpApp<Shape extends z.ZodRawShape, ViewShape extends z.ZodRawShape, Payload>(
|
|
81
|
+
server: McpServer,
|
|
82
|
+
app: McpAppDefinition<Shape, ViewShape, Payload>
|
|
83
|
+
) {
|
|
84
|
+
const { loadView } = app;
|
|
85
|
+
|
|
86
|
+
const showInView = async (params: z.output<z.ZodObject<Shape>>) => {
|
|
87
|
+
try {
|
|
88
|
+
const result = await app.load(params);
|
|
89
|
+
if ('error' in result) return errorResult(result);
|
|
90
|
+
return {
|
|
91
|
+
// The model reads the text; hosts that support MCP Apps show the view from `_meta`
|
|
92
|
+
content: [{ type: 'text' as const, text: JSON.stringify(result.forModel, null, 2) }],
|
|
93
|
+
...(loadView && {
|
|
94
|
+
_meta: {
|
|
95
|
+
[app.metaKey]: await result.getPayload(),
|
|
96
|
+
...(app.sessionId && { 'openai/widgetSessionId': app.sessionId }),
|
|
97
|
+
},
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
} catch (error) {
|
|
101
|
+
return errorResult({ error: `${app.errorMessage}: ${error}` });
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const toolInput = z.object(app.tool.input);
|
|
106
|
+
server.registerTool<z.ZodRawShape, typeof toolInput>(
|
|
107
|
+
app.tool.name,
|
|
108
|
+
{
|
|
109
|
+
title: app.tool.title,
|
|
110
|
+
description: app.tool.description,
|
|
111
|
+
inputSchema: toolInput,
|
|
112
|
+
annotations: app.annotations,
|
|
113
|
+
_meta: loadView ? appViewMeta(app.resource.uri) : undefined,
|
|
114
|
+
},
|
|
115
|
+
showInView
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
if (!loadView) return;
|
|
119
|
+
|
|
120
|
+
const loadForView = async (params: z.output<z.ZodObject<ViewShape>>) => {
|
|
121
|
+
const result = await app.load(params);
|
|
122
|
+
if ('error' in result) return errorResult(result);
|
|
123
|
+
return {
|
|
124
|
+
content: [{ type: 'text' as const, text: `Loaded ${result.label}` }],
|
|
125
|
+
structuredContent: (await result.getPayload()) as Record<string, unknown>,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const viewToolInput = z.object(app.viewTool.input);
|
|
130
|
+
server.registerTool<z.ZodRawShape, typeof viewToolInput>(
|
|
131
|
+
app.viewTool.name,
|
|
132
|
+
{
|
|
133
|
+
title: app.viewTool.title,
|
|
134
|
+
description: app.viewTool.description,
|
|
135
|
+
inputSchema: viewToolInput,
|
|
136
|
+
annotations: app.annotations,
|
|
137
|
+
_meta: appViewMeta(app.resource.uri, ['app']),
|
|
138
|
+
},
|
|
139
|
+
loadForView
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
registerAppResource(server, app.resource.name, app.resource.uri, { description: app.resource.description }, async () => ({
|
|
143
|
+
contents: [
|
|
144
|
+
{
|
|
145
|
+
uri: app.resource.uri,
|
|
146
|
+
mimeType: RESOURCE_MIME_TYPE,
|
|
147
|
+
text: await loadView(),
|
|
148
|
+
_meta: {
|
|
149
|
+
...(app.resource.csp && { ui: { csp: app.resource.csp } }),
|
|
150
|
+
...(app.resource.displayModes && {
|
|
151
|
+
'openai/ui': {
|
|
152
|
+
preferredDisplayMode: app.resource.displayModes.preferred,
|
|
153
|
+
availableDisplayModes: app.resource.displayModes.available,
|
|
154
|
+
},
|
|
155
|
+
}),
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Licensed under the EventCatalog Commercial License.
|
|
3
|
-
* See /packages/core/eventcatalog/src/enterprise/LICENSE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import jwt, { type Algorithm, type JwtPayload } from 'jsonwebtoken';
|
|
7
2
|
import { createPublicKey, type JsonWebKey, type KeyObject } from 'node:crypto';
|
|
8
3
|
import config from '@config';
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Licensed under the EventCatalog Commercial License.
|
|
3
|
-
* See /packages/core/eventcatalog/src/enterprise/LICENSE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import utils, { type CatalogGraphResourceType, type CatalogGraphRoot, type FlatCatalogGraph } from '@eventcatalog/sdk';
|
|
7
2
|
import { getCollection } from 'astro:content';
|
|
8
3
|
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
@@ -94,9 +89,14 @@ export class McpScope {
|
|
|
94
89
|
return true;
|
|
95
90
|
}
|
|
96
91
|
|
|
97
|
-
|
|
92
|
+
/** Find an entry in the scope. When no version (or 'latest') is given, the latest version in the scope is returned. */
|
|
93
|
+
find(collection: string, id: string, version?: string): CatalogEntry | undefined {
|
|
98
94
|
const entries = Array.from(this.entries.get(collection)?.values() ?? []);
|
|
99
|
-
return getItemsFromCollectionByIdAndSemverOrLatest(entries, id, version)
|
|
95
|
+
return getItemsFromCollectionByIdAndSemverOrLatest(entries, id, version)[0];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
has(collection: string, id: string, version?: string) {
|
|
99
|
+
return this.find(collection, id, version) !== undefined;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
list(collection: string) {
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Licensed under the EventCatalog Commercial License.
|
|
3
|
-
* See /packages/core/eventcatalog/src/enterprise/LICENSE
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import {
|
|
7
2
|
analyzeChangeImpact,
|
|
8
3
|
explainBusinessFlow,
|
|
9
4
|
explainUbiquitousLanguageTerms,
|
|
10
5
|
findMessageBySchemaId,
|
|
6
|
+
getArchitectureDiagramAsMermaid,
|
|
11
7
|
getConsumersOfMessage,
|
|
12
8
|
getMessagesProducedOrConsumedByResource,
|
|
13
9
|
getProducersOfMessage,
|
|
14
10
|
getResource,
|
|
15
11
|
getSchemaForResource,
|
|
16
12
|
paginate,
|
|
17
|
-
} from '@
|
|
13
|
+
} from '@features/tools/catalog-tools';
|
|
18
14
|
import type { McpScope } from './mcp-scope';
|
|
19
15
|
|
|
20
16
|
const notFound = (collection: string, id: string, version?: string) => ({
|
|
@@ -60,27 +56,26 @@ export function createScopedCatalogTools(scope: McpScope) {
|
|
|
60
56
|
};
|
|
61
57
|
},
|
|
62
58
|
|
|
63
|
-
async getResource(params: { collection: string; id: string; version
|
|
64
|
-
|
|
65
|
-
return
|
|
59
|
+
async getResource(params: { collection: string; id: string; version?: string }) {
|
|
60
|
+
const entry = scope.find(params.collection, params.id, params.version);
|
|
61
|
+
if (!entry) return notFound(params.collection, params.id, params.version);
|
|
62
|
+
return getResource({ ...params, version: entry.data.version });
|
|
66
63
|
},
|
|
67
64
|
|
|
68
65
|
async getMessagesProducedOrConsumedByResource(params: {
|
|
69
66
|
resourceId: string;
|
|
70
|
-
resourceVersion
|
|
67
|
+
resourceVersion?: string;
|
|
71
68
|
resourceCollection: string;
|
|
72
69
|
}) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return getMessagesProducedOrConsumedByResource(params);
|
|
70
|
+
const entry = scope.find(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
71
|
+
if (!entry) return notFound(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
72
|
+
return getMessagesProducedOrConsumedByResource({ ...params, resourceVersion: entry.data.version });
|
|
77
73
|
},
|
|
78
74
|
|
|
79
|
-
async getSchemaForResource(params: { resourceId: string; resourceVersion
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
return getSchemaForResource(params);
|
|
75
|
+
async getSchemaForResource(params: { resourceId: string; resourceVersion?: string; resourceCollection: string }) {
|
|
76
|
+
const entry = scope.find(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
77
|
+
if (!entry) return notFound(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
78
|
+
return getSchemaForResource({ ...params, resourceVersion: entry.data.version });
|
|
84
79
|
},
|
|
85
80
|
|
|
86
81
|
async findResourcesByOwner(params: { ownerId: string }) {
|
|
@@ -101,31 +96,28 @@ export function createScopedCatalogTools(scope: McpScope) {
|
|
|
101
96
|
return { ownerId: params.ownerId, totalCount: resources.length, resources, scope: scope.ref };
|
|
102
97
|
},
|
|
103
98
|
|
|
104
|
-
async getProducersOfMessage(params: { messageId: string; messageVersion
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
const result = await getProducersOfMessage(params);
|
|
99
|
+
async getProducersOfMessage(params: { messageId: string; messageVersion?: string; messageCollection: string }) {
|
|
100
|
+
const entry = scope.find(params.messageCollection, params.messageId, params.messageVersion);
|
|
101
|
+
if (!entry) return notFound(params.messageCollection, params.messageId, params.messageVersion);
|
|
102
|
+
const result = await getProducersOfMessage({ ...params, messageVersion: entry.data.version });
|
|
109
103
|
if ('error' in result) return result;
|
|
110
104
|
const producers = filterScopedReferences(scope, result.producers);
|
|
111
105
|
return { ...result, producers, count: producers.length, scope: scope.ref };
|
|
112
106
|
},
|
|
113
107
|
|
|
114
|
-
async getConsumersOfMessage(params: { messageId: string; messageVersion
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
const result = await getConsumersOfMessage(params);
|
|
108
|
+
async getConsumersOfMessage(params: { messageId: string; messageVersion?: string; messageCollection: string }) {
|
|
109
|
+
const entry = scope.find(params.messageCollection, params.messageId, params.messageVersion);
|
|
110
|
+
if (!entry) return notFound(params.messageCollection, params.messageId, params.messageVersion);
|
|
111
|
+
const result = await getConsumersOfMessage({ ...params, messageVersion: entry.data.version });
|
|
119
112
|
if ('error' in result) return result;
|
|
120
113
|
const consumers = filterScopedReferences(scope, result.consumers);
|
|
121
114
|
return { ...result, consumers, count: consumers.length, scope: scope.ref };
|
|
122
115
|
},
|
|
123
116
|
|
|
124
|
-
async analyzeChangeImpact(params: { messageId: string; messageVersion
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
const result = await analyzeChangeImpact(params);
|
|
117
|
+
async analyzeChangeImpact(params: { messageId: string; messageVersion?: string; messageCollection: string }) {
|
|
118
|
+
const entry = scope.find(params.messageCollection, params.messageId, params.messageVersion);
|
|
119
|
+
if (!entry) return notFound(params.messageCollection, params.messageId, params.messageVersion);
|
|
120
|
+
const result = await analyzeChangeImpact({ ...params, messageVersion: entry.data.version });
|
|
129
121
|
if ('error' in result) return result;
|
|
130
122
|
|
|
131
123
|
const producers = filterScopedReferences(scope, result.producers);
|
|
@@ -158,9 +150,10 @@ export function createScopedCatalogTools(scope: McpScope) {
|
|
|
158
150
|
};
|
|
159
151
|
},
|
|
160
152
|
|
|
161
|
-
async explainBusinessFlow(params: { flowId: string; flowVersion
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
async explainBusinessFlow(params: { flowId: string; flowVersion?: string }) {
|
|
154
|
+
const entry = scope.find('flows', params.flowId, params.flowVersion);
|
|
155
|
+
if (!entry) return notFound('flows', params.flowId, params.flowVersion);
|
|
156
|
+
const result = await explainBusinessFlow({ ...params, flowVersion: entry.data.version });
|
|
164
157
|
if ('error' in result) return result;
|
|
165
158
|
return {
|
|
166
159
|
...result,
|
|
@@ -188,10 +181,24 @@ export function createScopedCatalogTools(scope: McpScope) {
|
|
|
188
181
|
};
|
|
189
182
|
},
|
|
190
183
|
|
|
184
|
+
// The diagram shows the resource with what it connects to, as on its Diagram page, which can include resources outside the scope
|
|
185
|
+
async getArchitectureDiagramAsMermaid(params: {
|
|
186
|
+
resourceId: string;
|
|
187
|
+
resourceVersion?: string;
|
|
188
|
+
resourceCollection: string;
|
|
189
|
+
detail?: 'overview' | 'full';
|
|
190
|
+
}) {
|
|
191
|
+
const entry = scope.find(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
192
|
+
if (!entry) return notFound(params.resourceCollection, params.resourceId, params.resourceVersion);
|
|
193
|
+
const result = await getArchitectureDiagramAsMermaid({ ...params, resourceVersion: entry.data.version });
|
|
194
|
+
if ('error' in result) return result;
|
|
195
|
+
return { ...result, scope: scope.ref };
|
|
196
|
+
},
|
|
197
|
+
|
|
191
198
|
async explainUbiquitousLanguageTerms(params: { domainId: string; domainVersion?: string }) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return explainUbiquitousLanguageTerms(params);
|
|
199
|
+
const entry = scope.find('domains', params.domainId, params.domainVersion);
|
|
200
|
+
if (!entry) return notFound('domains', params.domainId, params.domainVersion);
|
|
201
|
+
return explainUbiquitousLanguageTerms({ ...params, domainVersion: entry.data.version });
|
|
195
202
|
},
|
|
196
203
|
};
|
|
197
204
|
}
|