@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.
Files changed (475) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +34 -0
  4. package/README.md +276 -0
  5. package/dist/config.d.ts +35 -0
  6. package/dist/config.js +238 -0
  7. package/dist/http-transport.d.ts +8 -0
  8. package/dist/http-transport.js +132 -0
  9. package/dist/index.d.ts +18 -0
  10. package/dist/index.js +164 -0
  11. package/dist/lib/callgraph/callGraph.d.ts +124 -0
  12. package/dist/lib/callgraph/callGraph.js +334 -0
  13. package/dist/lib/callgraph/choreGraph.d.ts +23 -0
  14. package/dist/lib/callgraph/choreGraph.js +102 -0
  15. package/dist/lib/callgraph/dataFlow.d.ts +74 -0
  16. package/dist/lib/callgraph/dataFlow.js +271 -0
  17. package/dist/lib/callgraph/datasourceMembership.d.ts +31 -0
  18. package/dist/lib/callgraph/datasourceMembership.js +142 -0
  19. package/dist/lib/callgraph/lintTypes.d.ts +28 -0
  20. package/dist/lib/callgraph/lintTypes.js +2 -0
  21. package/dist/lib/callgraph/mdxMembers.d.ts +29 -0
  22. package/dist/lib/callgraph/mdxMembers.js +97 -0
  23. package/dist/lib/callgraph/referenceIndex.d.ts +179 -0
  24. package/dist/lib/callgraph/referenceIndex.js +584 -0
  25. package/dist/lib/callgraph/rulesLinter.d.ts +55 -0
  26. package/dist/lib/callgraph/rulesLinter.js +776 -0
  27. package/dist/lib/callgraph/rulesParser.d.ts +26 -0
  28. package/dist/lib/callgraph/rulesParser.js +71 -0
  29. package/dist/lib/callgraph/subsetUsage.d.ts +16 -0
  30. package/dist/lib/callgraph/subsetUsage.js +134 -0
  31. package/dist/lib/callgraph/tiParser.d.ts +21 -0
  32. package/dist/lib/callgraph/tiParser.js +672 -0
  33. package/dist/lib/callgraph/tiSignatures.d.ts +32 -0
  34. package/dist/lib/callgraph/tiSignatures.js +6185 -0
  35. package/dist/lib/callgraph/tm1-adapter.d.ts +32 -0
  36. package/dist/lib/callgraph/tm1-adapter.js +159 -0
  37. package/dist/lib/callgraph/types.d.ts +53 -0
  38. package/dist/lib/callgraph/types.js +2 -0
  39. package/dist/lib/callgraph/variableEnv.d.ts +86 -0
  40. package/dist/lib/callgraph/variableEnv.js +214 -0
  41. package/dist/lib/cell-address.d.ts +12 -0
  42. package/dist/lib/cell-address.js +71 -0
  43. package/dist/lib/complexity/antipatterns.d.ts +22 -0
  44. package/dist/lib/complexity/antipatterns.js +302 -0
  45. package/dist/lib/complexity/comment-classifier.d.ts +24 -0
  46. package/dist/lib/complexity/comment-classifier.js +43 -0
  47. package/dist/lib/complexity/cross-process.d.ts +78 -0
  48. package/dist/lib/complexity/cross-process.js +114 -0
  49. package/dist/lib/complexity/process-metrics.d.ts +78 -0
  50. package/dist/lib/complexity/process-metrics.js +278 -0
  51. package/dist/lib/complexity/rules-metrics.d.ts +31 -0
  52. package/dist/lib/complexity/rules-metrics.js +99 -0
  53. package/dist/lib/concurrency.d.ts +11 -0
  54. package/dist/lib/concurrency.js +27 -0
  55. package/dist/lib/control-name.d.ts +10 -0
  56. package/dist/lib/control-name.js +10 -0
  57. package/dist/lib/coordinate-error.d.ts +3 -0
  58. package/dist/lib/coordinate-error.js +29 -0
  59. package/dist/lib/credential-format.d.ts +23 -0
  60. package/dist/lib/credential-format.js +25 -0
  61. package/dist/lib/cube-stats/fetcher.d.ts +106 -0
  62. package/dist/lib/cube-stats/fetcher.js +194 -0
  63. package/dist/lib/feeders/brackets.d.ts +47 -0
  64. package/dist/lib/feeders/brackets.js +195 -0
  65. package/dist/lib/feeders/element-type-cache.d.ts +42 -0
  66. package/dist/lib/feeders/element-type-cache.js +86 -0
  67. package/dist/lib/feeders/static-heuristics.d.ts +101 -0
  68. package/dist/lib/feeders/static-heuristics.js +202 -0
  69. package/dist/lib/git-process.d.ts +67 -0
  70. package/dist/lib/git-process.js +243 -0
  71. package/dist/lib/mask-secrets.d.ts +10 -0
  72. package/dist/lib/mask-secrets.js +99 -0
  73. package/dist/lib/mdx.d.ts +3 -0
  74. package/dist/lib/mdx.js +13 -0
  75. package/dist/lib/naming/odata-filter.d.ts +15 -0
  76. package/dist/lib/naming/odata-filter.js +81 -0
  77. package/dist/lib/naming/rules.d.ts +34 -0
  78. package/dist/lib/naming/rules.js +215 -0
  79. package/dist/lib/pro-parser.d.ts +19 -0
  80. package/dist/lib/pro-parser.js +260 -0
  81. package/dist/lib/pro-serializer.d.ts +19 -0
  82. package/dist/lib/pro-serializer.js +170 -0
  83. package/dist/lib/process-parts-schema.d.ts +45 -0
  84. package/dist/lib/process-parts-schema.js +46 -0
  85. package/dist/lib/process-refs.d.ts +88 -0
  86. package/dist/lib/process-refs.js +441 -0
  87. package/dist/lib/rules-outline.d.ts +29 -0
  88. package/dist/lib/rules-outline.js +68 -0
  89. package/dist/lib/rules-patch.d.ts +6 -0
  90. package/dist/lib/rules-patch.js +59 -0
  91. package/dist/lib/safe-regex.d.ts +15 -0
  92. package/dist/lib/safe-regex.js +37 -0
  93. package/dist/lib/sample-cells.d.ts +48 -0
  94. package/dist/lib/sample-cells.js +146 -0
  95. package/dist/lib/slim-json-schema.d.ts +20 -0
  96. package/dist/lib/slim-json-schema.js +68 -0
  97. package/dist/lib/strip-comments.d.ts +23 -0
  98. package/dist/lib/strip-comments.js +61 -0
  99. package/dist/lib/tm1-events.d.ts +16 -0
  100. package/dist/lib/tm1-events.js +29 -0
  101. package/dist/lib/v12-compat/deprecated-ti.d.ts +17 -0
  102. package/dist/lib/v12-compat/deprecated-ti.js +257 -0
  103. package/dist/lib/v12-compat/scanner.d.ts +10 -0
  104. package/dist/lib/v12-compat/scanner.js +43 -0
  105. package/dist/lib/variables-ui-data.d.ts +26 -0
  106. package/dist/lib/variables-ui-data.js +77 -0
  107. package/dist/load-env.d.ts +2 -0
  108. package/dist/load-env.js +29 -0
  109. package/dist/logger.d.ts +4 -0
  110. package/dist/logger.js +60 -0
  111. package/dist/prompts/index.d.ts +3 -0
  112. package/dist/prompts/index.js +141 -0
  113. package/dist/resources/index.d.ts +5 -0
  114. package/dist/resources/index.js +237 -0
  115. package/dist/resources/list-handler.d.ts +40 -0
  116. package/dist/resources/list-handler.js +86 -0
  117. package/dist/resources/subscriptions.d.ts +19 -0
  118. package/dist/resources/subscriptions.js +80 -0
  119. package/dist/schemas/cells.d.ts +17 -0
  120. package/dist/schemas/cells.js +13 -0
  121. package/dist/schemas/common.d.ts +16 -0
  122. package/dist/schemas/common.js +14 -0
  123. package/dist/schemas/index.d.ts +10 -0
  124. package/dist/schemas/index.js +23 -0
  125. package/dist/schemas/metadata.d.ts +70 -0
  126. package/dist/schemas/metadata.js +47 -0
  127. package/dist/schemas/monitoring.d.ts +95 -0
  128. package/dist/schemas/monitoring.js +69 -0
  129. package/dist/schemas/processes.d.ts +74 -0
  130. package/dist/schemas/processes.js +66 -0
  131. package/dist/schemas/scheduling.d.ts +13 -0
  132. package/dist/schemas/scheduling.js +13 -0
  133. package/dist/schemas/security.d.ts +19 -0
  134. package/dist/schemas/security.js +16 -0
  135. package/dist/schemas/subsets.d.ts +12 -0
  136. package/dist/schemas/subsets.js +12 -0
  137. package/dist/schemas/views.d.ts +9 -0
  138. package/dist/schemas/views.js +9 -0
  139. package/dist/session-manager.d.ts +79 -0
  140. package/dist/session-manager.js +281 -0
  141. package/dist/tm1-client/connection/profile.d.ts +13 -0
  142. package/dist/tm1-client/connection/profile.js +99 -0
  143. package/dist/tm1-client/dispatcher.d.ts +5 -0
  144. package/dist/tm1-client/dispatcher.js +31 -0
  145. package/dist/tm1-client/http.d.ts +81 -0
  146. package/dist/tm1-client/http.js +547 -0
  147. package/dist/tm1-client/services/batch-service.d.ts +123 -0
  148. package/dist/tm1-client/services/batch-service.js +455 -0
  149. package/dist/tm1-client/services/cell-service.d.ts +71 -0
  150. package/dist/tm1-client/services/cell-service.js +333 -0
  151. package/dist/tm1-client/services/cellset-transform.d.ts +26 -0
  152. package/dist/tm1-client/services/cellset-transform.js +80 -0
  153. package/dist/tm1-client/services/chore-service.d.ts +68 -0
  154. package/dist/tm1-client/services/chore-service.js +179 -0
  155. package/dist/tm1-client/services/chore-status.d.ts +11 -0
  156. package/dist/tm1-client/services/chore-status.js +127 -0
  157. package/dist/tm1-client/services/cube-service.d.ts +134 -0
  158. package/dist/tm1-client/services/cube-service.js +294 -0
  159. package/dist/tm1-client/services/dimension-service.d.ts +118 -0
  160. package/dist/tm1-client/services/dimension-service.js +249 -0
  161. package/dist/tm1-client/services/element-service.d.ts +245 -0
  162. package/dist/tm1-client/services/element-service.js +809 -0
  163. package/dist/tm1-client/services/fallback.d.ts +44 -0
  164. package/dist/tm1-client/services/fallback.js +72 -0
  165. package/dist/tm1-client/services/file-service.d.ts +53 -0
  166. package/dist/tm1-client/services/file-service.js +218 -0
  167. package/dist/tm1-client/services/hierarchy-service.d.ts +129 -0
  168. package/dist/tm1-client/services/hierarchy-service.js +332 -0
  169. package/dist/tm1-client/services/monitoring-service.d.ts +34 -0
  170. package/dist/tm1-client/services/monitoring-service.js +123 -0
  171. package/dist/tm1-client/services/odata-page.d.ts +71 -0
  172. package/dist/tm1-client/services/odata-page.js +87 -0
  173. package/dist/tm1-client/services/process-service.d.ts +278 -0
  174. package/dist/tm1-client/services/process-service.js +874 -0
  175. package/dist/tm1-client/services/process-status.d.ts +21 -0
  176. package/dist/tm1-client/services/process-status.js +89 -0
  177. package/dist/tm1-client/services/security-service.d.ts +50 -0
  178. package/dist/tm1-client/services/security-service.js +93 -0
  179. package/dist/tm1-client/services/server-service.d.ts +116 -0
  180. package/dist/tm1-client/services/server-service.js +504 -0
  181. package/dist/tm1-client/services/subset-service.d.ts +37 -0
  182. package/dist/tm1-client/services/subset-service.js +122 -0
  183. package/dist/tm1-client/services/view-service.d.ts +46 -0
  184. package/dist/tm1-client/services/view-service.js +287 -0
  185. package/dist/tm1-client.d.ts +56 -0
  186. package/dist/tm1-client.js +126 -0
  187. package/dist/tools/analysis/analyze-callgraph.d.ts +28 -0
  188. package/dist/tools/analysis/analyze-callgraph.js +350 -0
  189. package/dist/tools/analysis/analyze-chore-graph.d.ts +2 -0
  190. package/dist/tools/analysis/analyze-chore-graph.js +148 -0
  191. package/dist/tools/analysis/analyze-object-usage.d.ts +2 -0
  192. package/dist/tools/analysis/analyze-object-usage.js +143 -0
  193. package/dist/tools/analysis/audit-complexity.d.ts +2 -0
  194. package/dist/tools/analysis/audit-complexity.js +255 -0
  195. package/dist/tools/analysis/audit-feeders.d.ts +2 -0
  196. package/dist/tools/analysis/audit-feeders.js +417 -0
  197. package/dist/tools/analysis/audit-naming.d.ts +2 -0
  198. package/dist/tools/analysis/audit-naming.js +379 -0
  199. package/dist/tools/analysis/check-v12-readiness.d.ts +2 -0
  200. package/dist/tools/analysis/check-v12-readiness.js +136 -0
  201. package/dist/tools/analysis/find-orphan-dimensions.d.ts +2 -0
  202. package/dist/tools/analysis/find-orphan-dimensions.js +55 -0
  203. package/dist/tools/analysis/invalidate-callgraph-cache.d.ts +2 -0
  204. package/dist/tools/analysis/invalidate-callgraph-cache.js +40 -0
  205. package/dist/tools/analysis/trace-data-flow.d.ts +2 -0
  206. package/dist/tools/analysis/trace-data-flow.js +138 -0
  207. package/dist/tools/annotations.d.ts +12 -0
  208. package/dist/tools/annotations.js +61 -0
  209. package/dist/tools/celldata/check-feeders.d.ts +2 -0
  210. package/dist/tools/celldata/check-feeders.js +48 -0
  211. package/dist/tools/celldata/check-writable-coords.d.ts +2 -0
  212. package/dist/tools/celldata/check-writable-coords.js +126 -0
  213. package/dist/tools/celldata/execute-mdx.d.ts +17 -0
  214. package/dist/tools/celldata/execute-mdx.js +126 -0
  215. package/dist/tools/celldata/get-cell-value.d.ts +2 -0
  216. package/dist/tools/celldata/get-cell-value.js +30 -0
  217. package/dist/tools/celldata/get-view-definition.d.ts +2 -0
  218. package/dist/tools/celldata/get-view-definition.js +29 -0
  219. package/dist/tools/celldata/get-view.d.ts +2 -0
  220. package/dist/tools/celldata/get-view.js +55 -0
  221. package/dist/tools/celldata/sample-cells.d.ts +2 -0
  222. package/dist/tools/celldata/sample-cells.js +101 -0
  223. package/dist/tools/celldata/trace-cell-calculation.d.ts +2 -0
  224. package/dist/tools/celldata/trace-cell-calculation.js +53 -0
  225. package/dist/tools/celldata/trace-feeders.d.ts +2 -0
  226. package/dist/tools/celldata/trace-feeders.js +44 -0
  227. package/dist/tools/celldata/write-cells.d.ts +2 -0
  228. package/dist/tools/celldata/write-cells.js +65 -0
  229. package/dist/tools/confirm.d.ts +10 -0
  230. package/dist/tools/confirm.js +64 -0
  231. package/dist/tools/define-tool.d.ts +51 -0
  232. package/dist/tools/define-tool.js +49 -0
  233. package/dist/tools/dimension-management/bulk-upsert-elements.d.ts +2 -0
  234. package/dist/tools/dimension-management/bulk-upsert-elements.js +103 -0
  235. package/dist/tools/dimension-management/create-dimension.d.ts +2 -0
  236. package/dist/tools/dimension-management/create-dimension.js +22 -0
  237. package/dist/tools/dimension-management/create-element-attribute.d.ts +2 -0
  238. package/dist/tools/dimension-management/create-element-attribute.js +26 -0
  239. package/dist/tools/dimension-management/create-element.d.ts +2 -0
  240. package/dist/tools/dimension-management/create-element.js +31 -0
  241. package/dist/tools/dimension-management/create-hierarchy.d.ts +2 -0
  242. package/dist/tools/dimension-management/create-hierarchy.js +22 -0
  243. package/dist/tools/dimension-management/delete-dimension.d.ts +2 -0
  244. package/dist/tools/dimension-management/delete-dimension.js +25 -0
  245. package/dist/tools/dimension-management/delete-element.d.ts +2 -0
  246. package/dist/tools/dimension-management/delete-element.js +26 -0
  247. package/dist/tools/dimension-management/delete-elements.d.ts +2 -0
  248. package/dist/tools/dimension-management/delete-elements.js +44 -0
  249. package/dist/tools/dimension-management/delete-hierarchy.d.ts +2 -0
  250. package/dist/tools/dimension-management/delete-hierarchy.js +35 -0
  251. package/dist/tools/dimension-management/get-element-attribute-values.d.ts +2 -0
  252. package/dist/tools/dimension-management/get-element-attribute-values.js +77 -0
  253. package/dist/tools/dimension-management/list-element-attributes.d.ts +2 -0
  254. package/dist/tools/dimension-management/list-element-attributes.js +31 -0
  255. package/dist/tools/dimension-management/move-element.d.ts +2 -0
  256. package/dist/tools/dimension-management/move-element.js +28 -0
  257. package/dist/tools/dimension-management/update-element-attribute-value.d.ts +2 -0
  258. package/dist/tools/dimension-management/update-element-attribute-value.js +80 -0
  259. package/dist/tools/dimension-management/update-element.d.ts +2 -0
  260. package/dist/tools/dimension-management/update-element.js +35 -0
  261. package/dist/tools/error-format.d.ts +22 -0
  262. package/dist/tools/error-format.js +130 -0
  263. package/dist/tools/fileops/delete-file.d.ts +2 -0
  264. package/dist/tools/fileops/delete-file.js +32 -0
  265. package/dist/tools/fileops/get-file-content.d.ts +2 -0
  266. package/dist/tools/fileops/get-file-content.js +76 -0
  267. package/dist/tools/fileops/list-files.d.ts +2 -0
  268. package/dist/tools/fileops/list-files.js +43 -0
  269. package/dist/tools/fileops/search-files.d.ts +2 -0
  270. package/dist/tools/fileops/search-files.js +76 -0
  271. package/dist/tools/fileops/upload-file.d.ts +2 -0
  272. package/dist/tools/fileops/upload-file.js +69 -0
  273. package/dist/tools/format.d.ts +57 -0
  274. package/dist/tools/format.js +157 -0
  275. package/dist/tools/hierarchy.d.ts +6 -0
  276. package/dist/tools/hierarchy.js +27 -0
  277. package/dist/tools/index.d.ts +4 -0
  278. package/dist/tools/index.js +263 -0
  279. package/dist/tools/local-file.d.ts +16 -0
  280. package/dist/tools/local-file.js +88 -0
  281. package/dist/tools/metadata/get-ancestors.d.ts +2 -0
  282. package/dist/tools/metadata/get-ancestors.js +36 -0
  283. package/dist/tools/metadata/get-descendants.d.ts +2 -0
  284. package/dist/tools/metadata/get-descendants.js +64 -0
  285. package/dist/tools/metadata/get-hierarchy.d.ts +2 -0
  286. package/dist/tools/metadata/get-hierarchy.js +130 -0
  287. package/dist/tools/metadata/list-chores.d.ts +2 -0
  288. package/dist/tools/metadata/list-chores.js +62 -0
  289. package/dist/tools/metadata/list-cubes.d.ts +2 -0
  290. package/dist/tools/metadata/list-cubes.js +128 -0
  291. package/dist/tools/metadata/list-dimensions.d.ts +2 -0
  292. package/dist/tools/metadata/list-dimensions.js +131 -0
  293. package/dist/tools/metadata/list-processes-grouped.d.ts +2 -0
  294. package/dist/tools/metadata/list-processes-grouped.js +96 -0
  295. package/dist/tools/metadata/list-processes.d.ts +2 -0
  296. package/dist/tools/metadata/list-processes.js +108 -0
  297. package/dist/tools/metadata/resolve-default-members.d.ts +2 -0
  298. package/dist/tools/metadata/resolve-default-members.js +46 -0
  299. package/dist/tools/model-building/check-cube-rule.d.ts +2 -0
  300. package/dist/tools/model-building/check-cube-rule.js +51 -0
  301. package/dist/tools/model-building/clear-cube.d.ts +2 -0
  302. package/dist/tools/model-building/clear-cube.js +46 -0
  303. package/dist/tools/model-building/create-cube.d.ts +2 -0
  304. package/dist/tools/model-building/create-cube.js +34 -0
  305. package/dist/tools/model-building/delete-cube.d.ts +2 -0
  306. package/dist/tools/model-building/delete-cube.js +27 -0
  307. package/dist/tools/model-building/get-all-cube-rules.d.ts +2 -0
  308. package/dist/tools/model-building/get-all-cube-rules.js +149 -0
  309. package/dist/tools/model-building/get-cube-rules.d.ts +2 -0
  310. package/dist/tools/model-building/get-cube-rules.js +69 -0
  311. package/dist/tools/model-building/rules-source.d.ts +21 -0
  312. package/dist/tools/model-building/rules-source.js +49 -0
  313. package/dist/tools/model-building/search-rules.d.ts +2 -0
  314. package/dist/tools/model-building/search-rules.js +132 -0
  315. package/dist/tools/model-building/set-cube-rules.d.ts +2 -0
  316. package/dist/tools/model-building/set-cube-rules.js +81 -0
  317. package/dist/tools/model-building/unload-cube.d.ts +2 -0
  318. package/dist/tools/model-building/unload-cube.js +23 -0
  319. package/dist/tools/operations/diagnose-process-error.d.ts +2 -0
  320. package/dist/tools/operations/diagnose-process-error.js +178 -0
  321. package/dist/tools/operations/error-log-helpers.d.ts +25 -0
  322. package/dist/tools/operations/error-log-helpers.js +57 -0
  323. package/dist/tools/operations/get-audit-log.d.ts +2 -0
  324. package/dist/tools/operations/get-audit-log.js +70 -0
  325. package/dist/tools/operations/get-cube-stats.d.ts +2 -0
  326. package/dist/tools/operations/get-cube-stats.js +107 -0
  327. package/dist/tools/operations/get-error-log-content.d.ts +2 -0
  328. package/dist/tools/operations/get-error-log-content.js +164 -0
  329. package/dist/tools/operations/get-jobs.d.ts +3 -0
  330. package/dist/tools/operations/get-jobs.js +51 -0
  331. package/dist/tools/operations/get-message-log.d.ts +2 -0
  332. package/dist/tools/operations/get-message-log.js +63 -0
  333. package/dist/tools/operations/get-server-info.d.ts +2 -0
  334. package/dist/tools/operations/get-server-info.js +180 -0
  335. package/dist/tools/operations/get-server-state.d.ts +2 -0
  336. package/dist/tools/operations/get-server-state.js +129 -0
  337. package/dist/tools/operations/get-sessions.d.ts +2 -0
  338. package/dist/tools/operations/get-sessions.js +76 -0
  339. package/dist/tools/operations/get-threads.d.ts +3 -0
  340. package/dist/tools/operations/get-threads.js +50 -0
  341. package/dist/tools/operations/get-transaction-log.d.ts +2 -0
  342. package/dist/tools/operations/get-transaction-log.js +63 -0
  343. package/dist/tools/operations/list-error-logs.d.ts +8 -0
  344. package/dist/tools/operations/list-error-logs.js +157 -0
  345. package/dist/tools/operations/save-data.d.ts +2 -0
  346. package/dist/tools/operations/save-data.js +50 -0
  347. package/dist/tools/pagination.d.ts +32 -0
  348. package/dist/tools/pagination.js +116 -0
  349. package/dist/tools/scheduling/create-chore.d.ts +2 -0
  350. package/dist/tools/scheduling/create-chore.js +93 -0
  351. package/dist/tools/scheduling/delete-chore.d.ts +2 -0
  352. package/dist/tools/scheduling/delete-chore.js +22 -0
  353. package/dist/tools/scheduling/execute-chore.d.ts +2 -0
  354. package/dist/tools/scheduling/execute-chore.js +52 -0
  355. package/dist/tools/scheduling/toggle-chore.d.ts +2 -0
  356. package/dist/tools/scheduling/toggle-chore.js +22 -0
  357. package/dist/tools/scheduling/update-chore.d.ts +2 -0
  358. package/dist/tools/scheduling/update-chore.js +71 -0
  359. package/dist/tools/schemas/common.d.ts +10 -0
  360. package/dist/tools/schemas/common.js +23 -0
  361. package/dist/tools/schemas/items-analysis.d.ts +394 -0
  362. package/dist/tools/schemas/items-analysis.js +419 -0
  363. package/dist/tools/schemas/items-cells.d.ts +70 -0
  364. package/dist/tools/schemas/items-cells.js +65 -0
  365. package/dist/tools/schemas/items-common.d.ts +18 -0
  366. package/dist/tools/schemas/items-common.js +39 -0
  367. package/dist/tools/schemas/items-fileops.d.ts +11 -0
  368. package/dist/tools/schemas/items-fileops.js +13 -0
  369. package/dist/tools/schemas/items-metadata.d.ts +262 -0
  370. package/dist/tools/schemas/items-metadata.js +184 -0
  371. package/dist/tools/schemas/items-monitoring.d.ts +79 -0
  372. package/dist/tools/schemas/items-monitoring.js +78 -0
  373. package/dist/tools/schemas/items-processes.d.ts +279 -0
  374. package/dist/tools/schemas/items-processes.js +235 -0
  375. package/dist/tools/schemas/items-scheduling.d.ts +25 -0
  376. package/dist/tools/schemas/items-scheduling.js +26 -0
  377. package/dist/tools/schemas/items-security.d.ts +19 -0
  378. package/dist/tools/schemas/items-security.js +12 -0
  379. package/dist/tools/schemas/items-subsets.d.ts +2 -0
  380. package/dist/tools/schemas/items-subsets.js +4 -0
  381. package/dist/tools/schemas/items-views.d.ts +38 -0
  382. package/dist/tools/schemas/items-views.js +26 -0
  383. package/dist/tools/schemas/items.d.ts +12 -0
  384. package/dist/tools/schemas/items.js +23 -0
  385. package/dist/tools/schemas/markdown-capable.d.ts +21 -0
  386. package/dist/tools/schemas/markdown-capable.js +58 -0
  387. package/dist/tools/schemas/output-schema.d.ts +24 -0
  388. package/dist/tools/schemas/output-schema.js +25 -0
  389. package/dist/tools/security/assign-client-group.d.ts +2 -0
  390. package/dist/tools/security/assign-client-group.js +20 -0
  391. package/dist/tools/security/create-client.d.ts +2 -0
  392. package/dist/tools/security/create-client.js +28 -0
  393. package/dist/tools/security/delete-client.d.ts +2 -0
  394. package/dist/tools/security/delete-client.js +22 -0
  395. package/dist/tools/security/get-client.d.ts +2 -0
  396. package/dist/tools/security/get-client.js +20 -0
  397. package/dist/tools/security/list-clients.d.ts +2 -0
  398. package/dist/tools/security/list-clients.js +86 -0
  399. package/dist/tools/security/list-groups.d.ts +2 -0
  400. package/dist/tools/security/list-groups.js +43 -0
  401. package/dist/tools/security/remove-client-group.d.ts +2 -0
  402. package/dist/tools/security/remove-client-group.js +27 -0
  403. package/dist/tools/security/update-client.d.ts +2 -0
  404. package/dist/tools/security/update-client.js +22 -0
  405. package/dist/tools/subsets/create-subset.d.ts +2 -0
  406. package/dist/tools/subsets/create-subset.js +44 -0
  407. package/dist/tools/subsets/delete-subset.d.ts +2 -0
  408. package/dist/tools/subsets/delete-subset.js +26 -0
  409. package/dist/tools/subsets/get-subset.d.ts +2 -0
  410. package/dist/tools/subsets/get-subset.js +29 -0
  411. package/dist/tools/subsets/list-subsets.d.ts +2 -0
  412. package/dist/tools/subsets/list-subsets.js +36 -0
  413. package/dist/tools/subsets/update-subset.d.ts +2 -0
  414. package/dist/tools/subsets/update-subset.js +33 -0
  415. package/dist/tools/ti-development/check-process-code.d.ts +2 -0
  416. package/dist/tools/ti-development/check-process-code.js +96 -0
  417. package/dist/tools/ti-development/compile-process.d.ts +2 -0
  418. package/dist/tools/ti-development/compile-process.js +32 -0
  419. package/dist/tools/ti-development/copy-process.d.ts +2 -0
  420. package/dist/tools/ti-development/copy-process.js +32 -0
  421. package/dist/tools/ti-development/delete-process.d.ts +2 -0
  422. package/dist/tools/ti-development/delete-process.js +26 -0
  423. package/dist/tools/ti-development/diff-process-with-file.d.ts +2 -0
  424. package/dist/tools/ti-development/diff-process-with-file.js +208 -0
  425. package/dist/tools/ti-development/diff-processes.d.ts +2 -0
  426. package/dist/tools/ti-development/diff-processes.js +312 -0
  427. package/dist/tools/ti-development/execute-process.d.ts +8 -0
  428. package/dist/tools/ti-development/execute-process.js +109 -0
  429. package/dist/tools/ti-development/export-process-to-git.d.ts +2 -0
  430. package/dist/tools/ti-development/export-process-to-git.js +113 -0
  431. package/dist/tools/ti-development/export-process-to-pro.d.ts +2 -0
  432. package/dist/tools/ti-development/export-process-to-pro.js +117 -0
  433. package/dist/tools/ti-development/get-all-processes-code.d.ts +2 -0
  434. package/dist/tools/ti-development/get-all-processes-code.js +131 -0
  435. package/dist/tools/ti-development/get-process-code.d.ts +2 -0
  436. package/dist/tools/ti-development/get-process-code.js +100 -0
  437. package/dist/tools/ti-development/get-process-datasource.d.ts +2 -0
  438. package/dist/tools/ti-development/get-process-datasource.js +20 -0
  439. package/dist/tools/ti-development/get-process-parameters.d.ts +2 -0
  440. package/dist/tools/ti-development/get-process-parameters.js +25 -0
  441. package/dist/tools/ti-development/get-process-variables.d.ts +2 -0
  442. package/dist/tools/ti-development/get-process-variables.js +38 -0
  443. package/dist/tools/ti-development/get-process.d.ts +2 -0
  444. package/dist/tools/ti-development/get-process.js +163 -0
  445. package/dist/tools/ti-development/import-pro-file.d.ts +2 -0
  446. package/dist/tools/ti-development/import-pro-file.js +153 -0
  447. package/dist/tools/ti-development/import-process-from-git.d.ts +2 -0
  448. package/dist/tools/ti-development/import-process-from-git.js +198 -0
  449. package/dist/tools/ti-development/install-pro-bundle.d.ts +2 -0
  450. package/dist/tools/ti-development/install-pro-bundle.js +288 -0
  451. package/dist/tools/ti-development/preflight.d.ts +39 -0
  452. package/dist/tools/ti-development/preflight.js +56 -0
  453. package/dist/tools/ti-development/process-backup.d.ts +29 -0
  454. package/dist/tools/ti-development/process-backup.js +118 -0
  455. package/dist/tools/ti-development/search-code.d.ts +2 -0
  456. package/dist/tools/ti-development/search-code.js +208 -0
  457. package/dist/tools/ti-development/upsert-process.d.ts +2 -0
  458. package/dist/tools/ti-development/upsert-process.js +167 -0
  459. package/dist/tools/ti-development/validate-process-refs.d.ts +2 -0
  460. package/dist/tools/ti-development/validate-process-refs.js +73 -0
  461. package/dist/tools/views/create-mdx-view.d.ts +2 -0
  462. package/dist/tools/views/create-mdx-view.js +21 -0
  463. package/dist/tools/views/create-native-view.d.ts +2 -0
  464. package/dist/tools/views/create-native-view.js +81 -0
  465. package/dist/tools/views/delete-view.d.ts +2 -0
  466. package/dist/tools/views/delete-view.js +23 -0
  467. package/dist/tools/views/list-views.d.ts +2 -0
  468. package/dist/tools/views/list-views.js +32 -0
  469. package/dist/tools/with-annotations.d.ts +6 -0
  470. package/dist/tools/with-annotations.js +339 -0
  471. package/dist/types.d.ts +409 -0
  472. package/dist/types.js +91 -0
  473. package/dist/version.d.ts +4 -0
  474. package/dist/version.js +18 -0
  475. package/package.json +107 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 flameY3T1
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,34 @@
1
+ tm1-mcp-server
2
+ Copyright (c) 2026 flameY3T1
3
+
4
+ Licensed under the MIT License. See LICENSE for the full text.
5
+
6
+ -------------------------------------------------------------------------------
7
+ Provenance
8
+ -------------------------------------------------------------------------------
9
+ This codebase was generated by an AI coding agent (Anthropic's Claude). It has
10
+ been reviewed and tested, but it was not written line-by-line by a human. Treat
11
+ it accordingly:
12
+
13
+ * Verify behavior against your own IBM Planning Analytics / TM1 instance
14
+ before relying on it — especially any write or destructive operation.
15
+ * The automated test suite is also AI-generated and runs against mocks, not a
16
+ live TM1 server. Passing tests do not guarantee correct REST semantics on
17
+ your version of Planning Analytics.
18
+
19
+ -------------------------------------------------------------------------------
20
+ Safety defaults
21
+ -------------------------------------------------------------------------------
22
+ The server starts in TM1_MODE=readonly. Write and destructive tools (delete,
23
+ upsert, import, save-data, run-process, etc.) are NOT registered unless you
24
+ explicitly set TM1_MODE=readwrite. Do not run a readwrite server against a
25
+ production instance without reviewing the write path first.
26
+
27
+ -------------------------------------------------------------------------------
28
+ Warranty
29
+ -------------------------------------------------------------------------------
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. This is a
31
+ best-effort open-source project with no support guarantee. See LICENSE.
32
+
33
+ IBM, Planning Analytics, and TM1 are trademarks of IBM Corp. This project is
34
+ not affiliated with or endorsed by IBM.
package/README.md ADDED
@@ -0,0 +1,276 @@
1
+ # tm1-mcp-server
2
+
3
+ Model Context Protocol (MCP) server for IBM Planning Analytics / TM1.
4
+ Exposes the full TM1 model lifecycle — metadata, dimensions, cubes, cell I/O,
5
+ TI processes, chores, security, code-graph analysis — to any MCP-compatible
6
+ LLM client (Claude Code, Claude Desktop, etc.).
7
+
8
+ Tested against TM1 11.8 (REST, Basic/CAM auth) and TM1 12.5 / Planning Analytics
9
+ Engine (rerooted REST, `s2s` auth live-validated).
10
+
11
+ A fork of [flameY3T1/tm1-mcp-server](https://github.com/flameY3T1/tm1-mcp-server),
12
+ published as `@ffschrattenecker/tm1-mcp-server`. The command is still `tm1-mcp-server`.
13
+
14
+ > **Companion — TM1 IDE for VS Code.** Pair this server with the
15
+ > [**flameY3T1.vscode-tm1-ide**](https://marketplace.visualstudio.com/items?itemName=flameY3T1.vscode-tm1-ide)
16
+ > extension to browse and inspect the **live** data, cubes and TI code on the
17
+ > server — an in-place view of whatever MCP just changed.
18
+
19
+ ## Features
20
+
21
+ 115 tools across 12 categories — every one listed in
22
+ [docs/TOOLS.md](docs/TOOLS.md), with working JSON payloads in
23
+ [docs/EXAMPLES.md](docs/EXAMPLES.md). Past plain CRUD over the REST API:
24
+
25
+ - **Bulk reads instead of N round-trips.** Pull every process's source or every
26
+ cube's rules in one call, then regex-search across them with per-process and
27
+ total caps.
28
+ - **Code-graph analysis.** The ExecuteProcess/RunProcess call tree with
29
+ parameter propagation, a summary mode for triage and a global fan-in/fan-out
30
+ ranking; cube and dimension references across both TI and rules; a data-flow
31
+ trace saying which processes read a cube and which write it, classifying each
32
+ toucher of an element as source, write or zero-out.
33
+ - **Model audits.** Naming conventions (IBM PA 2.0/3.1), TI and rule complexity,
34
+ feeder overfeeding (static heuristics plus `}StatsByCube` runtime evidence),
35
+ v12 readiness, orphan dimensions.
36
+ - **Validation before you write.** Unbound compile of process code or a cube
37
+ rule without saving; a check that every cube/dimension named in TI resolves
38
+ live; a coordinate check that catches the silent no-op of writing to a
39
+ consolidated element.
40
+ - **TI lifecycle in version control.** Import, export, diff and bundle-install
41
+ native `.pro` files, or the diff-friendly two-file git layout
42
+ (`{name}.json` + `{name}.ti`).
43
+ - **Resources and prompts, not just tools.** Four read-only resources with name
44
+ autocomplete, so `#tm1://process/MyProcess/code` attaches a process as context
45
+ in chat, plus five starting-point prompts.
46
+
47
+ > **Token tip:** every registered tool's name + input schema costs context on
48
+ > *each* turn, so exposing all 114 is wasteful when a session needs a slice.
49
+ > Narrow the surface with your client's tool filter; `TM1_MODE=readonly` already
50
+ > trims it to read-only tools.
51
+
52
+ ## Install
53
+
54
+ **Option A — npm (recommended).** No clone, no build: `npx -y @ffschrattenecker/tm1-mcp-server`
55
+ always pulls the latest published version. Or install the CLI globally:
56
+
57
+ ```bash
58
+ npm install -g @ffschrattenecker/tm1-mcp-server
59
+ tm1-mcp-server
60
+ ```
61
+
62
+ **Option B — clone and build** (source / development install):
63
+
64
+ ```bash
65
+ git clone https://github.com/ffschrattenecker/tm1-mcp-server.git
66
+ cd tm1-mcp-server
67
+ npm install
68
+ npm run build
69
+ node dist/index.js
70
+ ```
71
+
72
+ To update: `npx` picks up new versions on next start (if one is cached,
73
+ `npm cache clean --force`); a global install takes
74
+ `npm install -g @ffschrattenecker/tm1-mcp-server@latest`; a source install takes
75
+ `git pull && npm install && npm run build`. Always **restart the MCP client**
76
+ afterwards — the server process is only spawned at client startup.
77
+
78
+ ## Configure
79
+
80
+ Copy `.env.example` to `.env` and set the TM1 connection details:
81
+
82
+ ```env
83
+ TM1_BASE_URL=https://your-tm1-server:8010
84
+ TM1_USER=admin
85
+ TM1_PASSWORD=your-password
86
+ TM1_SSL_REJECT_UNAUTHORIZED=false
87
+ TM1_VERSION=11.8
88
+ TM1_MODE=readonly # readonly (default) | readwrite
89
+ # TM1_RESPONSE_MODE=structured # legacy (default) | structured
90
+ # TM1_MAX_RESPONSE_CHARS=80000 # larger results fail with RESPONSE_TOO_LARGE
91
+ # TM1_LOCAL_FILE_ROOT=/srv/tm1-git # optional; enables host-disk file params
92
+ ```
93
+
94
+ `TM1_RESPONSE_MODE=structured` drops the text block and ships `structuredContent`
95
+ alone — half the wire bytes, but clients that read `content[]` (Kiro's IDE among
96
+ them) then see nothing. Worth it only for clients that copy the whole result into
97
+ the model prompt. [`.env.example`](.env.example) lists every variable with
98
+ inline comments; [docs/CONFIGURATION.md](docs/CONFIGURATION.md) covers the ones
99
+ needing more than a comment line — CAM/LDAP login, the TM1 v12 (Planning
100
+ Analytics Engine) connection and its auth modes, host-disk file access.
101
+
102
+ > **Safe by default:** the server starts in `TM1_MODE=readonly` — only read
103
+ > tools are registered, so it cannot mutate or delete anything. Set
104
+ > `TM1_MODE=readwrite` explicitly to enable the full lifecycle (cell writes,
105
+ > cube/dimension/process deletion, TI execution), and never point a `readwrite`
106
+ > server at production without reviewing the write path first.
107
+
108
+ Host-disk file access is default-off in the same spirit: the `.pro` and git
109
+ tools accept inline content, and touch host paths only once
110
+ `TM1_LOCAL_FILE_ROOT` names an allowed directory (paths outside it, and `..`
111
+ traversal, are rejected).
112
+
113
+ ### Positioning — this is a single-user tool
114
+
115
+ The server holds **one TM1 identity per process** and every call runs with it.
116
+ That is the design, not a limitation to work around, and it has consequences
117
+ worth stating plainly:
118
+
119
+ - **The HTTP transport is single-tenant.** A bearer token authenticates the
120
+ _endpoint_, not a caller. Everyone who reaches it shares the same TM1
121
+ credential, session, caches and audit identity. The "fresh MCP server per
122
+ request" wording in the architecture notes describes request isolation inside
123
+ the process — it is not a security boundary between users.
124
+ - **`TM1_MODE=readwrite` with an admin account is a developer configuration**,
125
+ not a production recommendation. In production, point the server at an account
126
+ whose TM1 rights already match what the agent should be able to do — the
127
+ server enforces no per-caller authorization of its own.
128
+ - **The confirmation guards are misuse protection, not access control.**
129
+ Seventeen tools require a `confirm` argument repeating the target name
130
+ verbatim: every `delete_*` and `clear_*`, plus `tm1_execute_process`,
131
+ `tm1_execute_chore`, `tm1_write_cells`, `tm1_set_cube_rules` and
132
+ `tm1_upload_file`. Anything that can call such a tool can also supply its
133
+ `confirm` value — the guard only stops an auto-approving client firing an
134
+ irreversible action without naming the target.
135
+
136
+ If you need multi-user access with per-caller identity, run one process per
137
+ identity behind your own front end rather than sharing one.
138
+
139
+ ### Secrets — `TM1_ALLOW_UNMASKED_SECRETS`
140
+
141
+ Credential masking is on by default everywhere it applies. Several tools take a
142
+ `maskSecrets` parameter, and a **model** can set it to `false` — an opt-out of a
143
+ security control chosen by the thing being guarded against. That request is
144
+ ignored unless the operator sets `TM1_ALLOW_UNMASKED_SECRETS=true`. The default
145
+ degrades to "mask anyway" rather than failing the call, so an audit still gets
146
+ its report, just redacted.
147
+
148
+ ## Use with Claude Code
149
+
150
+ Copy `mcp.json.example` to `.mcp.json` (project-local) or merge it into
151
+ `~/.claude/settings.json`. **Do not put `TM1_PASSWORD` in either file** — those
152
+ are routinely shared or committed; keep it in a gitignored `.env`
153
+ ([where the server looks for one](docs/CONFIGURATION.md#where-credentials-are-read-from)).
154
+
155
+ For the `npx` install:
156
+
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "tm1": {
161
+ "command": "npx",
162
+ "args": ["-y", "@ffschrattenecker/tm1-mcp-server"]
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ A **global** install uses `"command": "tm1-mcp-server"` (no `args`); a **source
169
+ build** uses `"command": "node"` with
170
+ `"args": ["/absolute/path/to/tm1-mcp-server/dist/index.js"]`, which is what
171
+ `mcp.json.example` shows. Restart Claude Code and the server appears as `tm1`.
172
+
173
+ ## HTTP transport
174
+
175
+ The default transport is **stdio**, and that is the normal way to run this. For
176
+ remote or multi-client setups, `TM1_MCP_TRANSPORT=http` switches to MCP
177
+ Streamable HTTP (stateless, single `POST /mcp` endpoint). It is single-tenant:
178
+ its optional bearer token authenticates the endpoint, not the caller. Setup,
179
+ security notes and the `autoApprove` allowlist:
180
+ [docs/HTTP-TRANSPORT.md](docs/HTTP-TRANSPORT.md).
181
+
182
+ ## Compatibility
183
+
184
+ - Node.js >= 20
185
+ - TM1 11.8 / Planning Analytics 2.0 — the primary target; some metadata-write
186
+ paths assume 11.x semantics, and v12-only fields (e.g.
187
+ `DataSource.usesUnicode`) are dropped when `TM1_VERSION` says `11.x`
188
+ - TM1 12.5 / Planning Analytics Engine — via `TM1_INSTANCE` + `TM1_DATABASE`,
189
+ live-validated with `s2s` auth only. `tm1_list_threads`, `tm1_cancel_thread`,
190
+ `tm1_save_data`, `tm1_unload_cube` and the three log readers
191
+ (`tm1_get_message_log`, `tm1_get_audit_log`, `tm1_get_transaction_log`) are
192
+ v11-only; `tm1_list_jobs` and `tm1_cancel_job` v12-only; v12 dropped demand
193
+ load, so unloading a cube has no successor endpoint there;
194
+ v12 ships no `}Stats*` control cubes, so `tm1_get_cube_stats` and
195
+ `tm1_audit_feeders` in `mode` `runtime`/`both` report the statistics as
196
+ unavailable instead of returning metrics (static feeder analysis is unaffected)
197
+
198
+ <!-- TOOLS-AUTOGEN:START -->
199
+
200
+ ## Tools (115)
201
+
202
+ Names and one-line descriptions: [docs/TOOLS.md](docs/TOOLS.md).
203
+
204
+ | Category | Tools |
205
+ |---|---|
206
+ | analysis | 10 |
207
+ | celldata | 10 |
208
+ | dimension-management | 14 |
209
+ | fileops | 5 |
210
+ | metadata | 9 |
211
+ | model-building | 9 |
212
+ | operations | 15 |
213
+ | scheduling | 5 |
214
+ | security | 8 |
215
+ | subsets | 5 |
216
+ | ti-development | 21 |
217
+ | views | 4 |
218
+ | **Total** | **115** |
219
+
220
+ <!-- TOOLS-AUTOGEN:END -->
221
+
222
+ `tm1_execute_process` and `tm1_save_data` return an `outcome` — `succeeded`,
223
+ `completed_with_errors`, `rolled_back` or `indeterminate` — and only `succeeded`
224
+ reports `success: true`, since TM1 answers HTTP 200 whatever happened.
225
+ `completed_with_errors` means changes **were** committed: retrying double-posts.
226
+
227
+ ## Troubleshooting
228
+
229
+ The first connection usually fails on a self-signed dev certificate (set
230
+ `TM1_SSL_REJECT_UNAUTHORIZED=false` — dev only) or a `401` from the wrong
231
+ credentials, port or CAM namespace. Those, plus v11/v12 feature errors, slow
232
+ transaction-log queries and startup validation errors, are in
233
+ [docs/CONFIGURATION.md](docs/CONFIGURATION.md#troubleshooting); HTTP-transport
234
+ specifics in [docs/HTTP-TRANSPORT.md](docs/HTTP-TRANSPORT.md#troubleshooting).
235
+
236
+ ## Development
237
+
238
+ ```bash
239
+ npm run dev # tsx live-reload
240
+ npm test # vitest
241
+ npm run lint # tsc --noEmit && eslint .
242
+ npm run coverage:check # vitest --coverage + coverage ratchet gate
243
+ npm run verify # everything CI runs (typecheck + lint gates + coverage:check)
244
+ ```
245
+
246
+ Contributions are welcome; run `npm run verify` before opening a PR.
247
+ [CONTRIBUTING.md](CONTRIBUTING.md) documents the gates, the coverage ratchet and
248
+ how to add a tool or service.
249
+
250
+ ## Documentation
251
+
252
+ - [docs/TOOLS.md](docs/TOOLS.md) — every tool, grouped, with one-line descriptions
253
+ - [docs/EXAMPLES.md](docs/EXAMPLES.md) — working JSON tool-call payloads for every major feature
254
+ - [docs/CONFIGURATION.md](docs/CONFIGURATION.md) — CAM login, TM1 v12 connection, host-disk file access
255
+ - [docs/HTTP-TRANSPORT.md](docs/HTTP-TRANSPORT.md) — Streamable HTTP setup, security, `autoApprove`
256
+ - [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — layering, service-class pattern, transports, the readonly/readwrite gate
257
+ - [CONTRIBUTING.md](CONTRIBUTING.md) — workflow, lint gates, coverage policy, how to add a tool
258
+ - [CHANGELOG.md](CHANGELOG.md) · [SECURITY.md](SECURITY.md) · [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
259
+
260
+ ## Provenance
261
+
262
+ This codebase was generated by an AI coding agent (Anthropic's Claude),
263
+ reviewed and tested but not written by hand. The test suite is also
264
+ AI-generated and runs against mocks, not a live TM1 server — passing tests do
265
+ not guarantee correct REST semantics on your Planning Analytics version. Verify
266
+ behavior against your own instance before relying on it, especially for any
267
+ write or destructive operation. Provided "as is", best-effort, no support
268
+ guarantee. See [NOTICE](NOTICE).
269
+
270
+ IBM, Planning Analytics, and TM1 are trademarks of IBM Corp. This project is
271
+ not affiliated with or endorsed by IBM.
272
+
273
+ ## License
274
+
275
+ MIT — see [LICENSE](LICENSE). The IBM trademarks named above are used solely to
276
+ describe compatibility with the TM1 REST API.
@@ -0,0 +1,35 @@
1
+ export interface TM1Config {
2
+ baseUrl: string;
3
+ user: string;
4
+ password: string;
5
+ namespace?: string | undefined;
6
+ camPassport?: string | undefined;
7
+ ssl: {
8
+ rejectUnauthorized: boolean;
9
+ };
10
+ keepAliveIntervalMs: number;
11
+ requestTimeoutMs: number;
12
+ logLevel: "debug" | "info" | "warn" | "error";
13
+ logFile?: string | undefined;
14
+ tm1Version: string;
15
+ transport: "stdio" | "http";
16
+ httpHost: string;
17
+ httpPort: number;
18
+ httpAllowedOrigins: string[];
19
+ httpToken?: string | undefined;
20
+ mode: "readwrite" | "readonly";
21
+ responseMode: "legacy" | "structured";
22
+ maxResponseChars: number;
23
+ version: 11 | 12;
24
+ instance?: string | undefined;
25
+ database?: string | undefined;
26
+ authMode?: "s2s" | "basic" | "access_token" | "oidc" | "iam" | undefined;
27
+ clientId?: string | undefined;
28
+ clientSecret?: string | undefined;
29
+ accessToken?: string | undefined;
30
+ apiKey?: string | undefined;
31
+ iamUrl?: string | undefined;
32
+ }
33
+ export declare const DEFAULT_MAX_RESPONSE_CHARS = 80000;
34
+ export declare function loadConfig(): TM1Config;
35
+ //# sourceMappingURL=config.d.ts.map
package/dist/config.js ADDED
@@ -0,0 +1,238 @@
1
+ const VALID_LOG_LEVELS = ["debug", "info", "warn", "error"];
2
+ const VALID_TRANSPORTS = ["stdio", "http"];
3
+ const VALID_MODES = ["readwrite", "readonly"];
4
+ const VALID_RESPONSE_MODES = ["legacy", "structured"];
5
+ const VALID_AUTH_MODES = [
6
+ "s2s",
7
+ "basic",
8
+ "access_token",
9
+ "oidc",
10
+ "iam",
11
+ ];
12
+ // Parse a positive-integer env var. Empty/unset → default. A non-numeric or
13
+ // non-positive value throws at startup instead of silently becoming NaN — NaN
14
+ // makes setInterval/setTimeout fire continuously and ports resolve to ":NaN".
15
+ export const DEFAULT_MAX_RESPONSE_CHARS = 80_000;
16
+ function parseIntEnv(name, raw, def) {
17
+ if (raw === undefined || raw === "")
18
+ return def;
19
+ const n = Number(raw);
20
+ if (!Number.isInteger(n) || n <= 0) {
21
+ throw new Error(`Invalid ${name}: "${raw}". Expected a positive integer.`);
22
+ }
23
+ return n;
24
+ }
25
+ export function loadConfig() {
26
+ const baseUrl = process.env.TM1_BASE_URL;
27
+ const user = process.env.TM1_USER;
28
+ const password = process.env.TM1_PASSWORD;
29
+ // CAM auth (mirrors TM1py's RestService._build_authorization_token):
30
+ // TM1_CAM_PASSPORT set → "CAMPassport <token>" (no user/password round-trip)
31
+ // TM1_NAMESPACE set → "CAMNamespace b64(u:p:ns)" (needs user + password + namespace)
32
+ // neither → "Basic b64(u:p)" (native TM1)
33
+ // SSO/gateway (Windows SSPI) is intentionally unsupported here: TM1py only does
34
+ // it via the Windows-only requests_negotiate_sspi package. Supply a passport
35
+ // obtained out-of-band via TM1_CAM_PASSPORT instead.
36
+ const namespace = process.env.TM1_NAMESPACE || undefined;
37
+ const camPassport = process.env.TM1_CAM_PASSPORT || undefined;
38
+ // Required: baseUrl always. user/password only when NOT using a passport — a
39
+ // passport carries the authenticated identity, so TM1 needs no credentials.
40
+ // Empty strings are rejected (treated as unset). Password may be empty — some
41
+ // TM1 setups allow a blank password for the admin account — so we warn but
42
+ // don't block, letting the real 401 (if any) surface with context.
43
+ const missing = [];
44
+ if (!baseUrl)
45
+ missing.push("TM1_BASE_URL");
46
+ if (!camPassport) {
47
+ if (!user)
48
+ missing.push("TM1_USER");
49
+ if (password === undefined)
50
+ missing.push("TM1_PASSWORD");
51
+ }
52
+ if (missing.length > 0) {
53
+ throw new Error(`Missing or empty required environment variables: ${missing.join(", ")}. ` +
54
+ `Set them in your shell or .env file before starting the server.`);
55
+ }
56
+ if (!camPassport && password === "") {
57
+ process.stderr.write("[tm1-mcp-server] WARNING: TM1_PASSWORD is empty. " +
58
+ "If TM1 rejects with 401, check whether the account actually allows blank passwords.\n");
59
+ }
60
+ const sslRaw = process.env.TM1_SSL_REJECT_UNAUTHORIZED;
61
+ const rejectUnauthorized = sslRaw === undefined ? true : sslRaw !== "false";
62
+ const keepAliveIntervalMs = parseIntEnv("TM1_KEEP_ALIVE_INTERVAL", process.env.TM1_KEEP_ALIVE_INTERVAL, 60000);
63
+ const requestTimeoutMs = parseIntEnv("TM1_REQUEST_TIMEOUT", process.env.TM1_REQUEST_TIMEOUT, 30000);
64
+ const logLevelRaw = process.env.TM1_LOG_LEVEL ?? "info";
65
+ const logLevel = VALID_LOG_LEVELS.includes(logLevelRaw)
66
+ ? logLevelRaw
67
+ : "info";
68
+ const logFile = process.env.TM1_LOG_FILE || undefined;
69
+ const tm1Version = process.env.TM1_VERSION || "11.8";
70
+ const transportRaw = process.env.TM1_MCP_TRANSPORT ?? "stdio";
71
+ const transport = VALID_TRANSPORTS.includes(transportRaw)
72
+ ? transportRaw
73
+ : "stdio";
74
+ // Default to loopback. Binding to 0.0.0.0 must be opt-in to avoid exposing
75
+ // a TM1-credentialed MCP server to the LAN by accident.
76
+ const httpHost = process.env.TM1_MCP_HTTP_HOST || "127.0.0.1";
77
+ const httpPort = parseIntEnv("TM1_MCP_HTTP_PORT", process.env.TM1_MCP_HTTP_PORT, 3000);
78
+ // Origin allow-list for DNS-rebinding protection. Loopback origins are
79
+ // always included so localhost dev clients work out of the box; if the
80
+ // server binds to a non-loopback host we add http://<host>:<port> too.
81
+ // TM1_MCP_HTTP_ALLOWED_ORIGINS (comma-separated) appends extras and is the
82
+ // hook for HTTPS reverse-proxies / browser clients on a different origin.
83
+ const defaultOrigins = [
84
+ `http://127.0.0.1:${httpPort}`,
85
+ `http://localhost:${httpPort}`,
86
+ ];
87
+ if (httpHost !== "127.0.0.1" &&
88
+ httpHost !== "localhost" &&
89
+ httpHost !== "0.0.0.0") {
90
+ defaultOrigins.push(`http://${httpHost}:${httpPort}`);
91
+ }
92
+ const extraOriginsRaw = process.env.TM1_MCP_HTTP_ALLOWED_ORIGINS;
93
+ const extraOrigins = extraOriginsRaw
94
+ ? extraOriginsRaw
95
+ .split(",")
96
+ .map((s) => s.trim())
97
+ .filter(Boolean)
98
+ : [];
99
+ const httpAllowedOrigins = Array.from(new Set([...defaultOrigins, ...extraOrigins]));
100
+ const httpToken = process.env.TM1_MCP_HTTP_TOKEN || undefined;
101
+ // Refuse a non-loopback HTTP bind without transport auth: TM1_MCP_HTTP_HOST=0.0.0.0
102
+ // (or any LAN address) with no bearer token would expose an unauthenticated,
103
+ // TM1-credentialed /mcp endpoint to the network. Loopback binds keep the
104
+ // warn-only behavior (see http-transport.ts).
105
+ const hostLower = httpHost.toLowerCase();
106
+ const isLoopbackHost = hostLower === "localhost" ||
107
+ hostLower === "::1" ||
108
+ /^127\./.test(hostLower);
109
+ if (transport === "http" && !isLoopbackHost && !httpToken) {
110
+ throw new Error(`TM1_MCP_HTTP_HOST="${httpHost}" is not loopback and TM1_MCP_HTTP_TOKEN is unset. ` +
111
+ `Refusing to expose an unauthenticated /mcp endpoint beyond localhost — set ` +
112
+ `TM1_MCP_HTTP_TOKEN, or bind to 127.0.0.1/localhost.`);
113
+ }
114
+ // Case-insensitive so a `TM1_MODE=ReadWrite` typo resolves to readwrite rather
115
+ // than silently falling back to readonly (dropping every write tool without a
116
+ // word). A genuinely-unknown value throws at startup — parity with the numeric
117
+ // env vars — instead of failing quietly.
118
+ const modeRaw = (process.env.TM1_MODE ?? "readonly").trim().toLowerCase();
119
+ if (!VALID_MODES.includes(modeRaw)) {
120
+ throw new Error(`Invalid TM1_MODE: "${process.env.TM1_MODE}". Expected "readwrite" or "readonly".`);
121
+ }
122
+ const mode = modeRaw;
123
+ // Same parse shape as TM1_MODE: case-insensitive, unknown value throws at
124
+ // startup rather than silently picking a wire format the operator did not ask
125
+ // for.
126
+ const responseModeRaw = (process.env.TM1_RESPONSE_MODE ?? "legacy")
127
+ .trim()
128
+ .toLowerCase();
129
+ if (!VALID_RESPONSE_MODES.includes(responseModeRaw)) {
130
+ throw new Error(`Invalid TM1_RESPONSE_MODE: "${process.env.TM1_RESPONSE_MODE}". Expected "legacy" or "structured".`);
131
+ }
132
+ const responseMode = responseModeRaw;
133
+ // ~80k characters sits under Claude Code's default MCP output cap (25k
134
+ // tokens) with room for the envelope; 23 recorded results overflowed it.
135
+ const maxResponseChars = parseIntEnv("TM1_MAX_RESPONSE_CHARS", process.env.TM1_MAX_RESPONSE_CHARS, DEFAULT_MAX_RESPONSE_CHARS);
136
+ // --- v12 (Planning Analytics Engine) connection ---------------------------
137
+ const instance = process.env.TM1_INSTANCE || undefined;
138
+ const database = process.env.TM1_DATABASE || undefined;
139
+ const versionMajor = Number.parseInt(tm1Version, 10);
140
+ const isV12 = Boolean(instance || database) || versionMajor === 12;
141
+ const version = isV12 ? 12 : 11;
142
+ // Keep the DISPLAY string (server_info, logs) consistent with the numeric
143
+ // `version`: a v12 connection (isV12, via TM1_INSTANCE/TM1_DATABASE) declared
144
+ // with a v11-looking TM1_VERSION="11.8" would otherwise report "11.8" to users
145
+ // while behaving as v12. Service branching keys off the numeric `version`
146
+ // (the authoritative source of truth), so this coercion is cosmetic-only — it
147
+ // stops the user-facing string from contradicting the real connection version.
148
+ const effectiveTm1Version = isV12 && versionMajor !== 12 ? "12.0" : tm1Version;
149
+ let authMode;
150
+ let clientId;
151
+ let clientSecret;
152
+ let accessToken;
153
+ let apiKey;
154
+ let iamUrl;
155
+ if (version === 12) {
156
+ if (!instance) {
157
+ throw new Error("v12 connection requires TM1_INSTANCE (set alongside TM1_DATABASE).");
158
+ }
159
+ if (!database) {
160
+ throw new Error("v12 connection requires TM1_DATABASE (set alongside TM1_INSTANCE).");
161
+ }
162
+ const authModeRaw = (process.env.TM1_AUTH_MODE ?? "s2s")
163
+ .trim()
164
+ .toLowerCase();
165
+ if (!VALID_AUTH_MODES.includes(authModeRaw)) {
166
+ throw new Error(`Invalid TM1_AUTH_MODE: "${process.env.TM1_AUTH_MODE}". ` +
167
+ `Expected one of: ${VALID_AUTH_MODES.join(", ")}.`);
168
+ }
169
+ authMode = authModeRaw;
170
+ clientId = process.env.TM1_CLIENT_ID || undefined;
171
+ clientSecret = process.env.TM1_CLIENT_SECRET || undefined;
172
+ accessToken = process.env.TM1_ACCESS_TOKEN || undefined;
173
+ apiKey = process.env.TM1_API_KEY || undefined;
174
+ iamUrl = process.env.TM1_IAM_URL || undefined;
175
+ const missingV12 = [];
176
+ // Every v12 mode — not just "basic" — sends `{ User: config.user }` in the
177
+ // session login body (profile.ts buildLoginRequest), so TM1_USER is required
178
+ // regardless of authMode. For authMode === "basic" the v11 `missing` check
179
+ // above (camPassport-gated) already pushed TM1_USER and threw before this
180
+ // block runs when it's absent, so this only actually fires for the
181
+ // non-basic modes — no duplicate report.
182
+ if (!user)
183
+ missingV12.push("TM1_USER");
184
+ if (authMode === "s2s") {
185
+ if (!clientId)
186
+ missingV12.push("TM1_CLIENT_ID");
187
+ if (!clientSecret)
188
+ missingV12.push("TM1_CLIENT_SECRET");
189
+ }
190
+ else if (authMode === "access_token" || authMode === "oidc") {
191
+ if (!accessToken)
192
+ missingV12.push("TM1_ACCESS_TOKEN");
193
+ }
194
+ else if (authMode === "iam") {
195
+ if (!apiKey)
196
+ missingV12.push("TM1_API_KEY");
197
+ if (!iamUrl)
198
+ missingV12.push("TM1_IAM_URL");
199
+ }
200
+ if (missingV12.length > 0) {
201
+ throw new Error(`TM1_AUTH_MODE="${authMode}" requires: ${missingV12.join(", ")}. ` +
202
+ `Set them before starting the server.`);
203
+ }
204
+ }
205
+ return {
206
+ baseUrl: baseUrl,
207
+ // In passport mode user/password are unused; default to "" so the type stays
208
+ // a plain string and the Authorization header is built from the passport.
209
+ user: user ?? "",
210
+ password: password ?? "",
211
+ namespace,
212
+ camPassport,
213
+ ssl: { rejectUnauthorized },
214
+ keepAliveIntervalMs,
215
+ requestTimeoutMs,
216
+ logLevel,
217
+ logFile,
218
+ tm1Version: effectiveTm1Version,
219
+ transport,
220
+ httpHost,
221
+ httpPort,
222
+ httpAllowedOrigins,
223
+ httpToken,
224
+ mode,
225
+ responseMode,
226
+ maxResponseChars,
227
+ version,
228
+ instance,
229
+ database,
230
+ authMode,
231
+ clientId,
232
+ clientSecret,
233
+ accessToken,
234
+ apiKey,
235
+ iamUrl,
236
+ };
237
+ }
238
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,8 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type pino from "pino";
3
+ import type { TM1Config } from "./config.js";
4
+ export declare function startHttpTransport(buildServer: () => {
5
+ server: McpServer;
6
+ dispose: () => void;
7
+ }, config: TM1Config, logger: pino.Logger): Promise<() => Promise<void>>;
8
+ //# sourceMappingURL=http-transport.d.ts.map