@ffschrattenecker/tm1-mcp-server 6.0.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/CHANGELOG.md +1211 -0
- package/LICENSE +21 -0
- package/NOTICE +34 -0
- package/README.md +276 -0
- package/dist/config.d.ts +35 -0
- package/dist/config.js +238 -0
- package/dist/http-transport.d.ts +8 -0
- package/dist/http-transport.js +132 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +164 -0
- package/dist/lib/callgraph/callGraph.d.ts +124 -0
- package/dist/lib/callgraph/callGraph.js +334 -0
- package/dist/lib/callgraph/choreGraph.d.ts +23 -0
- package/dist/lib/callgraph/choreGraph.js +102 -0
- package/dist/lib/callgraph/dataFlow.d.ts +74 -0
- package/dist/lib/callgraph/dataFlow.js +271 -0
- package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
- package/dist/lib/callgraph/datasourceMembership.js +142 -0
- package/dist/lib/callgraph/lintTypes.d.ts +28 -0
- package/dist/lib/callgraph/lintTypes.js +2 -0
- package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
- package/dist/lib/callgraph/mdxMembers.js +97 -0
- package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
- package/dist/lib/callgraph/referenceIndex.js +584 -0
- package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
- package/dist/lib/callgraph/rulesLinter.js +776 -0
- package/dist/lib/callgraph/rulesParser.d.ts +26 -0
- package/dist/lib/callgraph/rulesParser.js +71 -0
- package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
- package/dist/lib/callgraph/subsetUsage.js +134 -0
- package/dist/lib/callgraph/tiParser.d.ts +21 -0
- package/dist/lib/callgraph/tiParser.js +672 -0
- package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
- package/dist/lib/callgraph/tiSignatures.js +6185 -0
- package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
- package/dist/lib/callgraph/tm1-adapter.js +159 -0
- package/dist/lib/callgraph/types.d.ts +53 -0
- package/dist/lib/callgraph/types.js +2 -0
- package/dist/lib/callgraph/variableEnv.d.ts +86 -0
- package/dist/lib/callgraph/variableEnv.js +214 -0
- package/dist/lib/cell-address.d.ts +12 -0
- package/dist/lib/cell-address.js +71 -0
- package/dist/lib/complexity/antipatterns.d.ts +22 -0
- package/dist/lib/complexity/antipatterns.js +302 -0
- package/dist/lib/complexity/comment-classifier.d.ts +24 -0
- package/dist/lib/complexity/comment-classifier.js +43 -0
- package/dist/lib/complexity/cross-process.d.ts +78 -0
- package/dist/lib/complexity/cross-process.js +114 -0
- package/dist/lib/complexity/process-metrics.d.ts +78 -0
- package/dist/lib/complexity/process-metrics.js +278 -0
- package/dist/lib/complexity/rules-metrics.d.ts +31 -0
- package/dist/lib/complexity/rules-metrics.js +99 -0
- package/dist/lib/concurrency.d.ts +11 -0
- package/dist/lib/concurrency.js +27 -0
- package/dist/lib/control-name.d.ts +10 -0
- package/dist/lib/control-name.js +10 -0
- package/dist/lib/coordinate-error.d.ts +3 -0
- package/dist/lib/coordinate-error.js +29 -0
- package/dist/lib/credential-format.d.ts +23 -0
- package/dist/lib/credential-format.js +25 -0
- package/dist/lib/cube-stats/fetcher.d.ts +106 -0
- package/dist/lib/cube-stats/fetcher.js +194 -0
- package/dist/lib/feeders/brackets.d.ts +47 -0
- package/dist/lib/feeders/brackets.js +195 -0
- package/dist/lib/feeders/element-type-cache.d.ts +42 -0
- package/dist/lib/feeders/element-type-cache.js +86 -0
- package/dist/lib/feeders/static-heuristics.d.ts +101 -0
- package/dist/lib/feeders/static-heuristics.js +202 -0
- package/dist/lib/git-process.d.ts +67 -0
- package/dist/lib/git-process.js +243 -0
- package/dist/lib/mask-secrets.d.ts +10 -0
- package/dist/lib/mask-secrets.js +99 -0
- package/dist/lib/mdx.d.ts +3 -0
- package/dist/lib/mdx.js +13 -0
- package/dist/lib/naming/odata-filter.d.ts +15 -0
- package/dist/lib/naming/odata-filter.js +81 -0
- package/dist/lib/naming/rules.d.ts +34 -0
- package/dist/lib/naming/rules.js +215 -0
- package/dist/lib/pro-parser.d.ts +19 -0
- package/dist/lib/pro-parser.js +260 -0
- package/dist/lib/pro-serializer.d.ts +19 -0
- package/dist/lib/pro-serializer.js +170 -0
- package/dist/lib/process-parts-schema.d.ts +45 -0
- package/dist/lib/process-parts-schema.js +46 -0
- package/dist/lib/process-refs.d.ts +88 -0
- package/dist/lib/process-refs.js +441 -0
- package/dist/lib/rules-outline.d.ts +29 -0
- package/dist/lib/rules-outline.js +68 -0
- package/dist/lib/rules-patch.d.ts +6 -0
- package/dist/lib/rules-patch.js +59 -0
- package/dist/lib/safe-regex.d.ts +15 -0
- package/dist/lib/safe-regex.js +37 -0
- package/dist/lib/sample-cells.d.ts +48 -0
- package/dist/lib/sample-cells.js +146 -0
- package/dist/lib/slim-json-schema.d.ts +20 -0
- package/dist/lib/slim-json-schema.js +68 -0
- package/dist/lib/strip-comments.d.ts +23 -0
- package/dist/lib/strip-comments.js +61 -0
- package/dist/lib/tm1-events.d.ts +16 -0
- package/dist/lib/tm1-events.js +29 -0
- package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
- package/dist/lib/v12-compat/deprecated-ti.js +257 -0
- package/dist/lib/v12-compat/scanner.d.ts +10 -0
- package/dist/lib/v12-compat/scanner.js +43 -0
- package/dist/lib/variables-ui-data.d.ts +26 -0
- package/dist/lib/variables-ui-data.js +77 -0
- package/dist/load-env.d.ts +2 -0
- package/dist/load-env.js +29 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +60 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.js +141 -0
- package/dist/resources/index.d.ts +5 -0
- package/dist/resources/index.js +237 -0
- package/dist/resources/list-handler.d.ts +40 -0
- package/dist/resources/list-handler.js +86 -0
- package/dist/resources/subscriptions.d.ts +19 -0
- package/dist/resources/subscriptions.js +80 -0
- package/dist/schemas/cells.d.ts +17 -0
- package/dist/schemas/cells.js +13 -0
- package/dist/schemas/common.d.ts +16 -0
- package/dist/schemas/common.js +14 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.js +23 -0
- package/dist/schemas/metadata.d.ts +70 -0
- package/dist/schemas/metadata.js +47 -0
- package/dist/schemas/monitoring.d.ts +95 -0
- package/dist/schemas/monitoring.js +69 -0
- package/dist/schemas/processes.d.ts +74 -0
- package/dist/schemas/processes.js +66 -0
- package/dist/schemas/scheduling.d.ts +13 -0
- package/dist/schemas/scheduling.js +13 -0
- package/dist/schemas/security.d.ts +19 -0
- package/dist/schemas/security.js +16 -0
- package/dist/schemas/subsets.d.ts +12 -0
- package/dist/schemas/subsets.js +12 -0
- package/dist/schemas/views.d.ts +9 -0
- package/dist/schemas/views.js +9 -0
- package/dist/session-manager.d.ts +79 -0
- package/dist/session-manager.js +281 -0
- package/dist/tm1-client/connection/profile.d.ts +13 -0
- package/dist/tm1-client/connection/profile.js +99 -0
- package/dist/tm1-client/dispatcher.d.ts +5 -0
- package/dist/tm1-client/dispatcher.js +31 -0
- package/dist/tm1-client/http.d.ts +81 -0
- package/dist/tm1-client/http.js +547 -0
- package/dist/tm1-client/services/batch-service.d.ts +123 -0
- package/dist/tm1-client/services/batch-service.js +455 -0
- package/dist/tm1-client/services/cell-service.d.ts +71 -0
- package/dist/tm1-client/services/cell-service.js +333 -0
- package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
- package/dist/tm1-client/services/cellset-transform.js +80 -0
- package/dist/tm1-client/services/chore-service.d.ts +68 -0
- package/dist/tm1-client/services/chore-service.js +179 -0
- package/dist/tm1-client/services/chore-status.d.ts +11 -0
- package/dist/tm1-client/services/chore-status.js +127 -0
- package/dist/tm1-client/services/cube-service.d.ts +134 -0
- package/dist/tm1-client/services/cube-service.js +294 -0
- package/dist/tm1-client/services/dimension-service.d.ts +118 -0
- package/dist/tm1-client/services/dimension-service.js +249 -0
- package/dist/tm1-client/services/element-service.d.ts +245 -0
- package/dist/tm1-client/services/element-service.js +809 -0
- package/dist/tm1-client/services/fallback.d.ts +44 -0
- package/dist/tm1-client/services/fallback.js +72 -0
- package/dist/tm1-client/services/file-service.d.ts +53 -0
- package/dist/tm1-client/services/file-service.js +218 -0
- package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
- package/dist/tm1-client/services/hierarchy-service.js +332 -0
- package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
- package/dist/tm1-client/services/monitoring-service.js +123 -0
- package/dist/tm1-client/services/odata-page.d.ts +71 -0
- package/dist/tm1-client/services/odata-page.js +87 -0
- package/dist/tm1-client/services/process-service.d.ts +278 -0
- package/dist/tm1-client/services/process-service.js +874 -0
- package/dist/tm1-client/services/process-status.d.ts +21 -0
- package/dist/tm1-client/services/process-status.js +89 -0
- package/dist/tm1-client/services/security-service.d.ts +50 -0
- package/dist/tm1-client/services/security-service.js +93 -0
- package/dist/tm1-client/services/server-service.d.ts +116 -0
- package/dist/tm1-client/services/server-service.js +504 -0
- package/dist/tm1-client/services/subset-service.d.ts +37 -0
- package/dist/tm1-client/services/subset-service.js +122 -0
- package/dist/tm1-client/services/view-service.d.ts +46 -0
- package/dist/tm1-client/services/view-service.js +287 -0
- package/dist/tm1-client.d.ts +56 -0
- package/dist/tm1-client.js +126 -0
- package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
- package/dist/tools/analysis/analyze-callgraph.js +350 -0
- package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
- package/dist/tools/analysis/analyze-chore-graph.js +148 -0
- package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
- package/dist/tools/analysis/analyze-object-usage.js +143 -0
- package/dist/tools/analysis/audit-complexity.d.ts +2 -0
- package/dist/tools/analysis/audit-complexity.js +255 -0
- package/dist/tools/analysis/audit-feeders.d.ts +2 -0
- package/dist/tools/analysis/audit-feeders.js +417 -0
- package/dist/tools/analysis/audit-naming.d.ts +2 -0
- package/dist/tools/analysis/audit-naming.js +379 -0
- package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
- package/dist/tools/analysis/check-v12-readiness.js +136 -0
- package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
- package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
- package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
- package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
- package/dist/tools/analysis/trace-data-flow.js +138 -0
- package/dist/tools/annotations.d.ts +12 -0
- package/dist/tools/annotations.js +61 -0
- package/dist/tools/celldata/check-feeders.d.ts +2 -0
- package/dist/tools/celldata/check-feeders.js +48 -0
- package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
- package/dist/tools/celldata/check-writable-coords.js +126 -0
- package/dist/tools/celldata/execute-mdx.d.ts +17 -0
- package/dist/tools/celldata/execute-mdx.js +126 -0
- package/dist/tools/celldata/get-cell-value.d.ts +2 -0
- package/dist/tools/celldata/get-cell-value.js +30 -0
- package/dist/tools/celldata/get-view-definition.d.ts +2 -0
- package/dist/tools/celldata/get-view-definition.js +29 -0
- package/dist/tools/celldata/get-view.d.ts +2 -0
- package/dist/tools/celldata/get-view.js +55 -0
- package/dist/tools/celldata/sample-cells.d.ts +2 -0
- package/dist/tools/celldata/sample-cells.js +101 -0
- package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
- package/dist/tools/celldata/trace-cell-calculation.js +53 -0
- package/dist/tools/celldata/trace-feeders.d.ts +2 -0
- package/dist/tools/celldata/trace-feeders.js +44 -0
- package/dist/tools/celldata/write-cells.d.ts +2 -0
- package/dist/tools/celldata/write-cells.js +65 -0
- package/dist/tools/confirm.d.ts +10 -0
- package/dist/tools/confirm.js +64 -0
- package/dist/tools/define-tool.d.ts +51 -0
- package/dist/tools/define-tool.js +49 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
- package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
- package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/create-dimension.js +22 -0
- package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
- package/dist/tools/dimension-management/create-element-attribute.js +26 -0
- package/dist/tools/dimension-management/create-element.d.ts +2 -0
- package/dist/tools/dimension-management/create-element.js +31 -0
- package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/create-hierarchy.js +22 -0
- package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
- package/dist/tools/dimension-management/delete-dimension.js +25 -0
- package/dist/tools/dimension-management/delete-element.d.ts +2 -0
- package/dist/tools/dimension-management/delete-element.js +26 -0
- package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
- package/dist/tools/dimension-management/delete-elements.js +44 -0
- package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
- package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
- package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
- package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
- package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
- package/dist/tools/dimension-management/list-element-attributes.js +31 -0
- package/dist/tools/dimension-management/move-element.d.ts +2 -0
- package/dist/tools/dimension-management/move-element.js +28 -0
- package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
- package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
- package/dist/tools/dimension-management/update-element.d.ts +2 -0
- package/dist/tools/dimension-management/update-element.js +35 -0
- package/dist/tools/error-format.d.ts +22 -0
- package/dist/tools/error-format.js +130 -0
- package/dist/tools/fileops/delete-file.d.ts +2 -0
- package/dist/tools/fileops/delete-file.js +32 -0
- package/dist/tools/fileops/get-file-content.d.ts +2 -0
- package/dist/tools/fileops/get-file-content.js +76 -0
- package/dist/tools/fileops/list-files.d.ts +2 -0
- package/dist/tools/fileops/list-files.js +43 -0
- package/dist/tools/fileops/search-files.d.ts +2 -0
- package/dist/tools/fileops/search-files.js +76 -0
- package/dist/tools/fileops/upload-file.d.ts +2 -0
- package/dist/tools/fileops/upload-file.js +69 -0
- package/dist/tools/format.d.ts +57 -0
- package/dist/tools/format.js +157 -0
- package/dist/tools/hierarchy.d.ts +6 -0
- package/dist/tools/hierarchy.js +27 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.js +263 -0
- package/dist/tools/local-file.d.ts +16 -0
- package/dist/tools/local-file.js +88 -0
- package/dist/tools/metadata/get-ancestors.d.ts +2 -0
- package/dist/tools/metadata/get-ancestors.js +36 -0
- package/dist/tools/metadata/get-descendants.d.ts +2 -0
- package/dist/tools/metadata/get-descendants.js +64 -0
- package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
- package/dist/tools/metadata/get-hierarchy.js +130 -0
- package/dist/tools/metadata/list-chores.d.ts +2 -0
- package/dist/tools/metadata/list-chores.js +62 -0
- package/dist/tools/metadata/list-cubes.d.ts +2 -0
- package/dist/tools/metadata/list-cubes.js +128 -0
- package/dist/tools/metadata/list-dimensions.d.ts +2 -0
- package/dist/tools/metadata/list-dimensions.js +131 -0
- package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
- package/dist/tools/metadata/list-processes-grouped.js +96 -0
- package/dist/tools/metadata/list-processes.d.ts +2 -0
- package/dist/tools/metadata/list-processes.js +108 -0
- package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
- package/dist/tools/metadata/resolve-default-members.js +46 -0
- package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
- package/dist/tools/model-building/check-cube-rule.js +51 -0
- package/dist/tools/model-building/clear-cube.d.ts +2 -0
- package/dist/tools/model-building/clear-cube.js +46 -0
- package/dist/tools/model-building/create-cube.d.ts +2 -0
- package/dist/tools/model-building/create-cube.js +34 -0
- package/dist/tools/model-building/delete-cube.d.ts +2 -0
- package/dist/tools/model-building/delete-cube.js +27 -0
- package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-all-cube-rules.js +149 -0
- package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/get-cube-rules.js +69 -0
- package/dist/tools/model-building/rules-source.d.ts +21 -0
- package/dist/tools/model-building/rules-source.js +49 -0
- package/dist/tools/model-building/search-rules.d.ts +2 -0
- package/dist/tools/model-building/search-rules.js +132 -0
- package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
- package/dist/tools/model-building/set-cube-rules.js +81 -0
- package/dist/tools/model-building/unload-cube.d.ts +2 -0
- package/dist/tools/model-building/unload-cube.js +23 -0
- package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
- package/dist/tools/operations/diagnose-process-error.js +178 -0
- package/dist/tools/operations/error-log-helpers.d.ts +25 -0
- package/dist/tools/operations/error-log-helpers.js +57 -0
- package/dist/tools/operations/get-audit-log.d.ts +2 -0
- package/dist/tools/operations/get-audit-log.js +70 -0
- package/dist/tools/operations/get-cube-stats.d.ts +2 -0
- package/dist/tools/operations/get-cube-stats.js +107 -0
- package/dist/tools/operations/get-error-log-content.d.ts +2 -0
- package/dist/tools/operations/get-error-log-content.js +164 -0
- package/dist/tools/operations/get-jobs.d.ts +3 -0
- package/dist/tools/operations/get-jobs.js +51 -0
- package/dist/tools/operations/get-message-log.d.ts +2 -0
- package/dist/tools/operations/get-message-log.js +63 -0
- package/dist/tools/operations/get-server-info.d.ts +2 -0
- package/dist/tools/operations/get-server-info.js +180 -0
- package/dist/tools/operations/get-server-state.d.ts +2 -0
- package/dist/tools/operations/get-server-state.js +129 -0
- package/dist/tools/operations/get-sessions.d.ts +2 -0
- package/dist/tools/operations/get-sessions.js +76 -0
- package/dist/tools/operations/get-threads.d.ts +3 -0
- package/dist/tools/operations/get-threads.js +50 -0
- package/dist/tools/operations/get-transaction-log.d.ts +2 -0
- package/dist/tools/operations/get-transaction-log.js +63 -0
- package/dist/tools/operations/list-error-logs.d.ts +8 -0
- package/dist/tools/operations/list-error-logs.js +157 -0
- package/dist/tools/operations/save-data.d.ts +2 -0
- package/dist/tools/operations/save-data.js +50 -0
- package/dist/tools/pagination.d.ts +32 -0
- package/dist/tools/pagination.js +116 -0
- package/dist/tools/scheduling/create-chore.d.ts +2 -0
- package/dist/tools/scheduling/create-chore.js +93 -0
- package/dist/tools/scheduling/delete-chore.d.ts +2 -0
- package/dist/tools/scheduling/delete-chore.js +22 -0
- package/dist/tools/scheduling/execute-chore.d.ts +2 -0
- package/dist/tools/scheduling/execute-chore.js +52 -0
- package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
- package/dist/tools/scheduling/toggle-chore.js +22 -0
- package/dist/tools/scheduling/update-chore.d.ts +2 -0
- package/dist/tools/scheduling/update-chore.js +71 -0
- package/dist/tools/schemas/common.d.ts +10 -0
- package/dist/tools/schemas/common.js +23 -0
- package/dist/tools/schemas/items-analysis.d.ts +394 -0
- package/dist/tools/schemas/items-analysis.js +419 -0
- package/dist/tools/schemas/items-cells.d.ts +70 -0
- package/dist/tools/schemas/items-cells.js +65 -0
- package/dist/tools/schemas/items-common.d.ts +18 -0
- package/dist/tools/schemas/items-common.js +39 -0
- package/dist/tools/schemas/items-fileops.d.ts +11 -0
- package/dist/tools/schemas/items-fileops.js +13 -0
- package/dist/tools/schemas/items-metadata.d.ts +262 -0
- package/dist/tools/schemas/items-metadata.js +184 -0
- package/dist/tools/schemas/items-monitoring.d.ts +79 -0
- package/dist/tools/schemas/items-monitoring.js +78 -0
- package/dist/tools/schemas/items-processes.d.ts +279 -0
- package/dist/tools/schemas/items-processes.js +235 -0
- package/dist/tools/schemas/items-scheduling.d.ts +25 -0
- package/dist/tools/schemas/items-scheduling.js +26 -0
- package/dist/tools/schemas/items-security.d.ts +19 -0
- package/dist/tools/schemas/items-security.js +12 -0
- package/dist/tools/schemas/items-subsets.d.ts +2 -0
- package/dist/tools/schemas/items-subsets.js +4 -0
- package/dist/tools/schemas/items-views.d.ts +38 -0
- package/dist/tools/schemas/items-views.js +26 -0
- package/dist/tools/schemas/items.d.ts +12 -0
- package/dist/tools/schemas/items.js +23 -0
- package/dist/tools/schemas/markdown-capable.d.ts +21 -0
- package/dist/tools/schemas/markdown-capable.js +58 -0
- package/dist/tools/schemas/output-schema.d.ts +24 -0
- package/dist/tools/schemas/output-schema.js +25 -0
- package/dist/tools/security/assign-client-group.d.ts +2 -0
- package/dist/tools/security/assign-client-group.js +20 -0
- package/dist/tools/security/create-client.d.ts +2 -0
- package/dist/tools/security/create-client.js +28 -0
- package/dist/tools/security/delete-client.d.ts +2 -0
- package/dist/tools/security/delete-client.js +22 -0
- package/dist/tools/security/get-client.d.ts +2 -0
- package/dist/tools/security/get-client.js +20 -0
- package/dist/tools/security/list-clients.d.ts +2 -0
- package/dist/tools/security/list-clients.js +86 -0
- package/dist/tools/security/list-groups.d.ts +2 -0
- package/dist/tools/security/list-groups.js +43 -0
- package/dist/tools/security/remove-client-group.d.ts +2 -0
- package/dist/tools/security/remove-client-group.js +27 -0
- package/dist/tools/security/update-client.d.ts +2 -0
- package/dist/tools/security/update-client.js +22 -0
- package/dist/tools/subsets/create-subset.d.ts +2 -0
- package/dist/tools/subsets/create-subset.js +44 -0
- package/dist/tools/subsets/delete-subset.d.ts +2 -0
- package/dist/tools/subsets/delete-subset.js +26 -0
- package/dist/tools/subsets/get-subset.d.ts +2 -0
- package/dist/tools/subsets/get-subset.js +29 -0
- package/dist/tools/subsets/list-subsets.d.ts +2 -0
- package/dist/tools/subsets/list-subsets.js +36 -0
- package/dist/tools/subsets/update-subset.d.ts +2 -0
- package/dist/tools/subsets/update-subset.js +33 -0
- package/dist/tools/ti-development/check-process-code.d.ts +2 -0
- package/dist/tools/ti-development/check-process-code.js +96 -0
- package/dist/tools/ti-development/compile-process.d.ts +2 -0
- package/dist/tools/ti-development/compile-process.js +32 -0
- package/dist/tools/ti-development/copy-process.d.ts +2 -0
- package/dist/tools/ti-development/copy-process.js +32 -0
- package/dist/tools/ti-development/delete-process.d.ts +2 -0
- package/dist/tools/ti-development/delete-process.js +26 -0
- package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
- package/dist/tools/ti-development/diff-process-with-file.js +208 -0
- package/dist/tools/ti-development/diff-processes.d.ts +2 -0
- package/dist/tools/ti-development/diff-processes.js +312 -0
- package/dist/tools/ti-development/execute-process.d.ts +8 -0
- package/dist/tools/ti-development/execute-process.js +109 -0
- package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-git.js +113 -0
- package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
- package/dist/tools/ti-development/export-process-to-pro.js +117 -0
- package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
- package/dist/tools/ti-development/get-all-processes-code.js +131 -0
- package/dist/tools/ti-development/get-process-code.d.ts +2 -0
- package/dist/tools/ti-development/get-process-code.js +100 -0
- package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
- package/dist/tools/ti-development/get-process-datasource.js +20 -0
- package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
- package/dist/tools/ti-development/get-process-parameters.js +25 -0
- package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
- package/dist/tools/ti-development/get-process-variables.js +38 -0
- package/dist/tools/ti-development/get-process.d.ts +2 -0
- package/dist/tools/ti-development/get-process.js +163 -0
- package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
- package/dist/tools/ti-development/import-pro-file.js +153 -0
- package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
- package/dist/tools/ti-development/import-process-from-git.js +198 -0
- package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
- package/dist/tools/ti-development/install-pro-bundle.js +288 -0
- package/dist/tools/ti-development/preflight.d.ts +39 -0
- package/dist/tools/ti-development/preflight.js +56 -0
- package/dist/tools/ti-development/process-backup.d.ts +29 -0
- package/dist/tools/ti-development/process-backup.js +118 -0
- package/dist/tools/ti-development/search-code.d.ts +2 -0
- package/dist/tools/ti-development/search-code.js +208 -0
- package/dist/tools/ti-development/upsert-process.d.ts +2 -0
- package/dist/tools/ti-development/upsert-process.js +167 -0
- package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
- package/dist/tools/ti-development/validate-process-refs.js +73 -0
- package/dist/tools/views/create-mdx-view.d.ts +2 -0
- package/dist/tools/views/create-mdx-view.js +21 -0
- package/dist/tools/views/create-native-view.d.ts +2 -0
- package/dist/tools/views/create-native-view.js +81 -0
- package/dist/tools/views/delete-view.d.ts +2 -0
- package/dist/tools/views/delete-view.js +23 -0
- package/dist/tools/views/list-views.d.ts +2 -0
- package/dist/tools/views/list-views.js +32 -0
- package/dist/tools/with-annotations.d.ts +6 -0
- package/dist/tools/with-annotations.js +339 -0
- package/dist/types.d.ts +409 -0
- package/dist/types.js +91 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +18 -0
- package/package.json +107 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createServer, } from "node:http";
|
|
2
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
3
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
4
|
+
// Streamable HTTP transport (stateless JSON, single /mcp endpoint).
|
|
5
|
+
//
|
|
6
|
+
// Stateless mode (sessionIdGenerator omitted) means each StreamableHTTPServerTransport
|
|
7
|
+
// is single-use: the SDK throws "Stateless transport cannot be reused across requests"
|
|
8
|
+
// on the second handleRequest. So we build a *fresh* McpServer + transport per request
|
|
9
|
+
// and tear both down when the response closes — the SDK-documented stateless pattern.
|
|
10
|
+
// This is cheap: registration is pure in-memory wiring with no I/O, and the shared
|
|
11
|
+
// TM1 client (captured by the buildServer closure) is not rebuilt.
|
|
12
|
+
//
|
|
13
|
+
// Consequence: there is no standing server->client stream, so subscribe/logging
|
|
14
|
+
// notifications are not delivered over HTTP. That is acceptable for the intended
|
|
15
|
+
// deployment (one process per TM1 identity; stdio remains the push-capable default).
|
|
16
|
+
//
|
|
17
|
+
// Per MCP best practices: bind 127.0.0.1 by default and enable DNS-rebinding
|
|
18
|
+
// protection. allowedHosts/Origins narrow what the transport accepts.
|
|
19
|
+
export async function startHttpTransport(buildServer, config, logger) {
|
|
20
|
+
const allowedHost = `${config.httpHost}:${config.httpPort}`;
|
|
21
|
+
if (!config.httpToken) {
|
|
22
|
+
logger.warn("HTTP transport has no TM1_MCP_HTTP_TOKEN set — /mcp requests are unauthenticated. " +
|
|
23
|
+
"Bind loopback only, or front the server with an authenticating reverse proxy.");
|
|
24
|
+
}
|
|
25
|
+
const httpServer = createServer(
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- async request handler intentional; errors are caught internally
|
|
27
|
+
async (req, res) => {
|
|
28
|
+
// Match the exact /mcp endpoint (optionally with a query string) or a real
|
|
29
|
+
// subpath under /mcp/. A loose startsWith("/mcp") would also accept
|
|
30
|
+
// /mcpFoo, routing an unrelated path into the MCP transport.
|
|
31
|
+
const path = (req.url ?? "").split(/[?#]/, 1)[0] ?? "";
|
|
32
|
+
if (path !== "/mcp" && !path.startsWith("/mcp/")) {
|
|
33
|
+
res.statusCode = 404;
|
|
34
|
+
res.setHeader("Content-Type", "application/json");
|
|
35
|
+
res.end(JSON.stringify({ error: "Not found. Use POST /mcp." }));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (config.httpToken) {
|
|
39
|
+
// Constant-time comparison: hashing both sides to fixed-length digests avoids
|
|
40
|
+
// both the length-mismatch throw and the per-character timing oracle that `!==`
|
|
41
|
+
// would leak, so the token can't be brute-forced via response-timing analysis.
|
|
42
|
+
const expected = createHash("sha256")
|
|
43
|
+
.update(`Bearer ${config.httpToken}`)
|
|
44
|
+
.digest();
|
|
45
|
+
const provided = createHash("sha256")
|
|
46
|
+
.update(req.headers.authorization ?? "")
|
|
47
|
+
.digest();
|
|
48
|
+
if (!timingSafeEqual(expected, provided)) {
|
|
49
|
+
res.statusCode = 401;
|
|
50
|
+
res.setHeader("Content-Type", "application/json");
|
|
51
|
+
res.setHeader("WWW-Authenticate", "Bearer");
|
|
52
|
+
res.end(JSON.stringify({ error: "Unauthorized" }));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let body;
|
|
57
|
+
if (req.method === "POST") {
|
|
58
|
+
try {
|
|
59
|
+
const chunks = [];
|
|
60
|
+
for await (const chunk of req) {
|
|
61
|
+
chunks.push(typeof chunk === "string"
|
|
62
|
+
? Buffer.from(chunk)
|
|
63
|
+
: chunk);
|
|
64
|
+
}
|
|
65
|
+
const raw = Buffer.concat(chunks).toString("utf8");
|
|
66
|
+
body = raw ? JSON.parse(raw) : undefined;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
logger.warn({ err }, "Bad JSON in /mcp body");
|
|
70
|
+
res.statusCode = 400;
|
|
71
|
+
res.setHeader("Content-Type", "application/json");
|
|
72
|
+
res.end(JSON.stringify({ error: "Invalid JSON" }));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Fresh server + transport per request (stateless single-use); tear both down
|
|
77
|
+
// once the response is fully written so nothing leaks between requests.
|
|
78
|
+
const { server, dispose } = buildServer();
|
|
79
|
+
const transport = new StreamableHTTPServerTransport({
|
|
80
|
+
// sessionIdGenerator omitted → stateless mode (single-use per request)
|
|
81
|
+
enableJsonResponse: true,
|
|
82
|
+
enableDnsRebindingProtection: true,
|
|
83
|
+
allowedHosts: [allowedHost, "127.0.0.1", "localhost"],
|
|
84
|
+
allowedOrigins: config.httpAllowedOrigins,
|
|
85
|
+
});
|
|
86
|
+
res.on("close", () => {
|
|
87
|
+
// dispose() FIRST and synchronously: it detaches the per-build listener
|
|
88
|
+
// from the process-global tm1Events emitter, which server.close() has no
|
|
89
|
+
// knowledge of. Skipping it leaks one listener plus the server graph it
|
|
90
|
+
// retains on every request — the transport builds a fresh server each
|
|
91
|
+
// time, so the leak is unbounded, not one-off.
|
|
92
|
+
dispose();
|
|
93
|
+
void transport.close();
|
|
94
|
+
void server.close();
|
|
95
|
+
});
|
|
96
|
+
try {
|
|
97
|
+
// Cast: StreamableHTTPServerTransport.onclose is `(() => void) | undefined`
|
|
98
|
+
// while Transport expects `() => void`; the cast papers over that library-
|
|
99
|
+
// internal signature mismatch without changing behaviour. Cast to the
|
|
100
|
+
// parameter's own type rather than `any`, so only this mismatch is
|
|
101
|
+
// waived and the argument stays checked against the real signature.
|
|
102
|
+
await server.connect(transport);
|
|
103
|
+
await transport.handleRequest(req, res, body);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
logger.error({ err }, "Transport handleRequest threw");
|
|
107
|
+
if (!res.headersSent) {
|
|
108
|
+
res.statusCode = 500;
|
|
109
|
+
res.setHeader("Content-Type", "application/json");
|
|
110
|
+
res.end(JSON.stringify({ error: "Internal transport error" }));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
await new Promise((resolve, reject) => {
|
|
115
|
+
httpServer.once("error", reject);
|
|
116
|
+
httpServer.listen(config.httpPort, config.httpHost, () => {
|
|
117
|
+
httpServer.off("error", reject);
|
|
118
|
+
resolve();
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
logger.info({
|
|
122
|
+
host: config.httpHost,
|
|
123
|
+
port: config.httpPort,
|
|
124
|
+
endpoint: "/mcp",
|
|
125
|
+
allowedOrigins: config.httpAllowedOrigins,
|
|
126
|
+
dnsRebindingProtection: true,
|
|
127
|
+
}, "MCP server listening on HTTP (Streamable, stateless, per-request)");
|
|
128
|
+
return async () => {
|
|
129
|
+
await new Promise((resolve) => httpServer.close(() => resolve()));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=http-transport.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./load-env.js";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
export interface BuiltMcpServer {
|
|
5
|
+
server: McpServer;
|
|
6
|
+
/**
|
|
7
|
+
* Detach everything this build attached to PROCESS-GLOBAL state — today the
|
|
8
|
+
* SubscriptionRegistry's `tm1Events` listener. `server.close()` does NOT do
|
|
9
|
+
* this: the registry holds its listener on an emitter the server knows
|
|
10
|
+
* nothing about, so closing the server leaves it subscribed forever.
|
|
11
|
+
*
|
|
12
|
+
* The stateless HTTP transport builds one server per request, so skipping
|
|
13
|
+
* this leaks a listener (and the whole server object graph it closes over)
|
|
14
|
+
* on every single call. Must be invoked by every transport teardown path.
|
|
15
|
+
*/
|
|
16
|
+
dispose: () => void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./load-env.js";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { loadConfig } from "./config.js";
|
|
6
|
+
import { createLogger } from "./logger.js";
|
|
7
|
+
import { SessionManager } from "./session-manager.js";
|
|
8
|
+
import { TM1Client } from "./tm1-client.js";
|
|
9
|
+
import { registerAllPrompts } from "./prompts/index.js";
|
|
10
|
+
import { registerAllResources } from "./resources/index.js";
|
|
11
|
+
import { SubscriptionRegistry } from "./resources/subscriptions.js";
|
|
12
|
+
import { installPaginatedListHandler } from "./resources/list-handler.js";
|
|
13
|
+
import { registerAllTools } from "./tools/index.js";
|
|
14
|
+
import { withAnnotations } from "./tools/with-annotations.js";
|
|
15
|
+
import { startHttpTransport } from "./http-transport.js";
|
|
16
|
+
import { NAME, VERSION } from "./version.js";
|
|
17
|
+
// stdio transport: existing Claude-Code/Desktop entry path.
|
|
18
|
+
async function startStdioTransport(server, logger) {
|
|
19
|
+
const transport = new StdioServerTransport();
|
|
20
|
+
await server.connect(transport);
|
|
21
|
+
logger.info("MCP server listening on stdio");
|
|
22
|
+
return async () => {
|
|
23
|
+
await transport.close();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function buildMcpServer(tm1Client, config, logger) {
|
|
27
|
+
const server = new McpServer({
|
|
28
|
+
name: NAME,
|
|
29
|
+
version: VERSION,
|
|
30
|
+
}, {
|
|
31
|
+
capabilities: {
|
|
32
|
+
tools: { listChanged: true },
|
|
33
|
+
resources: { listChanged: true, subscribe: true },
|
|
34
|
+
prompts: { listChanged: true },
|
|
35
|
+
logging: {},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// Register all tools — wrap the server so each registration receives the
|
|
39
|
+
// annotation hint from ANNOTATION_MAP without editing call sites. In readonly
|
|
40
|
+
// mode the proxy silently drops write/destructive tools so they never appear
|
|
41
|
+
// in the tool listing — no autoApprove lists needed.
|
|
42
|
+
registerAllTools(withAnnotations(server, logger, config.mode, config.responseMode, config.maxResponseChars), tm1Client);
|
|
43
|
+
logger.debug(`All MCP tools registered (mode: ${config.mode})`);
|
|
44
|
+
// Register MCP Resources (URI-addressable read-only views over TM1 objects).
|
|
45
|
+
const resourceCatalog = registerAllResources(server, tm1Client);
|
|
46
|
+
// R2-07: replace the SDK's default ListResourcesRequestSchema handler with a
|
|
47
|
+
// cursor-aware override that paginates the combined static + template list.
|
|
48
|
+
installPaginatedListHandler(server, resourceCatalog, logger);
|
|
49
|
+
// R2-05: install subscribe/unsubscribe handlers and bridge HTTP-layer mutation
|
|
50
|
+
// events to notifications/resources/updated for subscribers of tm1://server/state.
|
|
51
|
+
const subscriptions = new SubscriptionRegistry(server, logger);
|
|
52
|
+
subscriptions.install();
|
|
53
|
+
// Register MCP Prompts (parameterised workflow templates surfaced as slash-commands).
|
|
54
|
+
registerAllPrompts(server);
|
|
55
|
+
logger.debug("All MCP resources and prompts registered");
|
|
56
|
+
return {
|
|
57
|
+
server,
|
|
58
|
+
dispose: () => {
|
|
59
|
+
subscriptions.dispose();
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function main() {
|
|
64
|
+
const config = loadConfig();
|
|
65
|
+
const logger = createLogger(config);
|
|
66
|
+
logger.info("Starting TM1 MCP Server");
|
|
67
|
+
const sessionManager = new SessionManager(config, logger);
|
|
68
|
+
const tm1Client = new TM1Client(config, sessionManager, logger);
|
|
69
|
+
// Try to connect to TM1, but don't block MCP server startup.
|
|
70
|
+
// request() calls ensureSession() on every tool invocation, so a tool call
|
|
71
|
+
// will retry auth if the initial connect failed. Keeps Claude able to list
|
|
72
|
+
// tools and report a meaningful error instead of crashing the whole process.
|
|
73
|
+
try {
|
|
74
|
+
await tm1Client.connect();
|
|
75
|
+
logger.info("TM1 client connected");
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
logger.warn({ err }, "Initial TM1 connection failed — server will retry on first tool call");
|
|
79
|
+
}
|
|
80
|
+
if (config.mode === "readonly") {
|
|
81
|
+
logger.info("TM1_MODE=readonly — write and destructive tools will not be registered");
|
|
82
|
+
}
|
|
83
|
+
// Branch on transport. stdio is the default for local MCP-client setups
|
|
84
|
+
// (Claude Code, Claude Desktop) and gets one long-lived server. http
|
|
85
|
+
// (Streamable HTTP, stateless) is for remote/multi-client deploys and builds a
|
|
86
|
+
// fresh server per request (single-use transport); binds to 127.0.0.1 by
|
|
87
|
+
// default with DNS-rebinding protection per MCP spec recommendation.
|
|
88
|
+
// stdio builds exactly one server for the process lifetime, so its disposer
|
|
89
|
+
// runs in shutdown(). http builds one per request and disposes each in the
|
|
90
|
+
// transport's own teardown — nothing process-scoped is left for us here.
|
|
91
|
+
let stdioDispose;
|
|
92
|
+
const httpCloser = config.transport === "http"
|
|
93
|
+
? await startHttpTransport(() => buildMcpServer(tm1Client, config, logger), config, logger)
|
|
94
|
+
: await (async () => {
|
|
95
|
+
const built = buildMcpServer(tm1Client, config, logger);
|
|
96
|
+
stdioDispose = built.dispose;
|
|
97
|
+
return startStdioTransport(built.server, logger);
|
|
98
|
+
})();
|
|
99
|
+
logger.info(`MCP server configured (mode: ${config.mode}, transport: ${config.transport})`);
|
|
100
|
+
// Graceful shutdown — ensure TM1 session is always cleaned up.
|
|
101
|
+
let shuttingDown = false;
|
|
102
|
+
const shutdown = async (signal, exitCode = 0) => {
|
|
103
|
+
if (shuttingDown)
|
|
104
|
+
return;
|
|
105
|
+
shuttingDown = true;
|
|
106
|
+
logger.info({ signal }, "Shutting down TM1 MCP Server");
|
|
107
|
+
try {
|
|
108
|
+
stdioDispose?.();
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
logger.error({ err }, "Error disposing server subscriptions");
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
await httpCloser?.();
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
logger.error({ err }, "Error closing transport");
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
await tm1Client.disconnect();
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
logger.error({ err }, "Error during disconnect");
|
|
124
|
+
}
|
|
125
|
+
process.exit(exitCode);
|
|
126
|
+
};
|
|
127
|
+
process.on("SIGINT", () => {
|
|
128
|
+
void shutdown("SIGINT");
|
|
129
|
+
});
|
|
130
|
+
process.on("SIGTERM", () => {
|
|
131
|
+
void shutdown("SIGTERM");
|
|
132
|
+
});
|
|
133
|
+
process.on("SIGHUP", () => {
|
|
134
|
+
void shutdown("SIGHUP");
|
|
135
|
+
});
|
|
136
|
+
// Parent process death — only meaningful on stdio (Claude spawns us as a
|
|
137
|
+
// child). For http we ignore stdin events since the process lifecycle is
|
|
138
|
+
// independent.
|
|
139
|
+
if (config.transport === "stdio") {
|
|
140
|
+
process.stdin.on("end", () => {
|
|
141
|
+
logger.info("stdin ended (parent process gone), shutting down");
|
|
142
|
+
void shutdown("stdin-end");
|
|
143
|
+
});
|
|
144
|
+
process.stdin.on("close", () => {
|
|
145
|
+
logger.info("stdin closed, shutting down");
|
|
146
|
+
void shutdown("stdin-close");
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// Last resort — try to clean up the TM1 session on uncaught errors.
|
|
150
|
+
process.on("uncaughtException", (err) => {
|
|
151
|
+
logger.error({ err }, "Uncaught exception, attempting cleanup");
|
|
152
|
+
// Exit non-zero: a crash must not look like a clean shutdown to a
|
|
153
|
+
// supervisor/systemd, which would otherwise not restart or would mask it.
|
|
154
|
+
void shutdown("uncaughtException", 1);
|
|
155
|
+
});
|
|
156
|
+
process.on("unhandledRejection", (reason) => {
|
|
157
|
+
logger.error({ reason }, "Unhandled rejection");
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
main().catch((err) => {
|
|
161
|
+
console.error("Fatal error starting TM1 MCP Server:", err);
|
|
162
|
+
process.exit(1);
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ReferenceIndex, CallParam, CallParamResolution, UnresolvedCall } from "./referenceIndex.js";
|
|
2
|
+
/**
|
|
3
|
+
* Effective parameter value in the context of a specific graph node.
|
|
4
|
+
* - literal: fully resolved value (from explicit literal, propagated literal, or process default)
|
|
5
|
+
* - unknown: value would need to flow in from an upstream param we cannot see (root input)
|
|
6
|
+
* `viaParam` is the name of the originating root-level param (for display: pX=«pX»)
|
|
7
|
+
* - dynamic: resolution is known to be impossible (CellGet, concat, IF, loops, …)
|
|
8
|
+
*/
|
|
9
|
+
export type EffectiveValue = {
|
|
10
|
+
kind: "literal";
|
|
11
|
+
value: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "unknown";
|
|
14
|
+
viaParam: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "dynamic";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* One edge in the call graph = one ExecuteProcess/RunProcess call site.
|
|
20
|
+
* Each call site has its own params (same caller→callee pair can appear
|
|
21
|
+
* multiple times with different params).
|
|
22
|
+
*/
|
|
23
|
+
export interface CallEdge {
|
|
24
|
+
caller: string;
|
|
25
|
+
callee: string;
|
|
26
|
+
section: string;
|
|
27
|
+
line: number;
|
|
28
|
+
funcName: string;
|
|
29
|
+
snippet: string;
|
|
30
|
+
params: CallParam[];
|
|
31
|
+
/**
|
|
32
|
+
* Effective value per call-param at THIS edge (parent env applied).
|
|
33
|
+
* Only populated for downstream direction. Index matches `params`.
|
|
34
|
+
*/
|
|
35
|
+
effectiveParams?: Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
effective: EffectiveValue;
|
|
38
|
+
valueRaw: string;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A node in the call graph tree. Parent→child edge is described by `incomingEdge`
|
|
43
|
+
* (the call that reached this node). The root node has incomingEdge = null.
|
|
44
|
+
*/
|
|
45
|
+
export interface CallGraphNode {
|
|
46
|
+
process: string;
|
|
47
|
+
incomingEdge: CallEdge | null;
|
|
48
|
+
/**
|
|
49
|
+
* Effective parameter environment AT this node (after call-site resolution).
|
|
50
|
+
* Keys are lowercased param names. Only populated for downstream direction.
|
|
51
|
+
*/
|
|
52
|
+
env?: Map<string, EffectiveValue> | undefined;
|
|
53
|
+
children: CallGraphNode[];
|
|
54
|
+
cycle: boolean;
|
|
55
|
+
depthLimitReached?: boolean | undefined;
|
|
56
|
+
/** Outgoing calls whose target could not be statically resolved (downstream only). */
|
|
57
|
+
unresolvedCalls?: UnresolvedCall[] | undefined;
|
|
58
|
+
}
|
|
59
|
+
export type Direction = "downstream" | "upstream";
|
|
60
|
+
export interface BuildCallGraphOptions {
|
|
61
|
+
direction: Direction;
|
|
62
|
+
maxDepth?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Include system objects (names starting with `}`) as children/ancestors.
|
|
65
|
+
* The root node is always shown regardless of this flag.
|
|
66
|
+
* Default: true.
|
|
67
|
+
*/
|
|
68
|
+
includeSystem?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Resolve one call-site CallParamResolution against the parent node's env.
|
|
72
|
+
* - literal stays literal
|
|
73
|
+
* - passthrough → look up the named caller-param in parent env:
|
|
74
|
+
* known literal → propagate; unknown → mark unknown; dynamic → dynamic
|
|
75
|
+
* - dynamic stays dynamic
|
|
76
|
+
*/
|
|
77
|
+
export declare function resolveEdgeParam(res: CallParamResolution, parentEnv: Map<string, EffectiveValue>): EffectiveValue;
|
|
78
|
+
/**
|
|
79
|
+
* Recursively build the call graph starting from `start`.
|
|
80
|
+
*
|
|
81
|
+
* downstream: children = processes that THIS process calls (with env-propagation)
|
|
82
|
+
* upstream: children = processes that CALL this process (no env-propagation)
|
|
83
|
+
*
|
|
84
|
+
* Cycle detection uses the ancestor chain: if a candidate child is already
|
|
85
|
+
* on the path from the root, `cycle = true` and children are empty.
|
|
86
|
+
*
|
|
87
|
+
* Duplicate edges (same caller→callee, different lines/sections) are kept
|
|
88
|
+
* as separate nodes — each represents a distinct call site.
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildCallGraph(index: ReferenceIndex, start: string, opts: BuildCallGraphOptions): CallGraphNode;
|
|
91
|
+
export declare function classifyAccess(funcName: string | undefined, sourceKind: "process" | "rule"): "read" | "write" | "other";
|
|
92
|
+
/** Flat usage reference — one occurrence where a cube/dimension is referenced. */
|
|
93
|
+
export interface UsageRef {
|
|
94
|
+
sourceKind: "process" | "rule";
|
|
95
|
+
sourceName: string;
|
|
96
|
+
section: string;
|
|
97
|
+
line: number;
|
|
98
|
+
funcName?: string | undefined;
|
|
99
|
+
snippet: string;
|
|
100
|
+
/** Classified access type: 'read' (CellGetN/S, DB), 'write' (CellPutN/S, ViewZeroOut, …), 'other' (structural). */
|
|
101
|
+
accessType: "read" | "write" | "other";
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Collect all references to a cube or dimension as a flat list, sorted by
|
|
105
|
+
* source name and line. Self-references (a cube's own rules reading from the
|
|
106
|
+
* cube itself via DB()/`[...]`) are filtered out to avoid noise — the rule
|
|
107
|
+
* editor already shows them inline.
|
|
108
|
+
*/
|
|
109
|
+
export declare function buildCubeOrDimUsages(index: ReferenceIndex, kind: "cube" | "dimension", name: string, opts?: {
|
|
110
|
+
includeSystem?: boolean;
|
|
111
|
+
accessMode?: "read" | "write" | "all";
|
|
112
|
+
}): UsageRef[];
|
|
113
|
+
/** Flattens the tree depth-first for simple list rendering. */
|
|
114
|
+
export declare function flattenCallGraph(root: CallGraphNode): Array<{
|
|
115
|
+
node: CallGraphNode;
|
|
116
|
+
depth: number;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Human-readable param summary using effective values (env-propagated).
|
|
120
|
+
* Falls back to raw resolution if no effective values are available (upstream mode).
|
|
121
|
+
* pRegion='UK', pYear=2026, pSource=«pCaller», pDate=?
|
|
122
|
+
*/
|
|
123
|
+
export declare function formatEdgeParams(edge: CallEdge): string;
|
|
124
|
+
//# sourceMappingURL=callGraph.d.ts.map
|