mcp4openapi 0.2.8 → 0.3.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 (310) hide show
  1. package/README.md +143 -63
  2. package/dist/scripts/validate-profile.js +3 -3
  3. package/dist/scripts/validate-profile.js.map +1 -1
  4. package/dist/src/{oauth-provider.d.ts → auth/oauth-provider.d.ts} +7 -2
  5. package/dist/src/auth/oauth-provider.d.ts.map +1 -0
  6. package/dist/src/{oauth-provider.js → auth/oauth-provider.js} +30 -2
  7. package/dist/src/auth/oauth-provider.js.map +1 -0
  8. package/dist/src/core/cli-config.d.ts +9 -0
  9. package/dist/src/core/cli-config.d.ts.map +1 -0
  10. package/dist/src/core/cli-config.js +124 -0
  11. package/dist/src/core/cli-config.js.map +1 -0
  12. package/dist/src/{constants.d.ts → core/constants.d.ts} +1 -0
  13. package/dist/src/core/constants.d.ts.map +1 -0
  14. package/dist/src/{constants.js → core/constants.js} +1 -0
  15. package/dist/src/core/constants.js.map +1 -0
  16. package/dist/src/{errors.d.ts → core/errors.d.ts} +6 -0
  17. package/dist/src/core/errors.d.ts.map +1 -0
  18. package/dist/src/{errors.js → core/errors.js} +15 -6
  19. package/dist/src/core/errors.js.map +1 -0
  20. package/dist/src/core/filtering.d.ts +19 -0
  21. package/dist/src/core/filtering.d.ts.map +1 -0
  22. package/dist/src/core/filtering.js +292 -0
  23. package/dist/src/core/filtering.js.map +1 -0
  24. package/dist/src/core/index.d.ts +26 -0
  25. package/dist/src/core/index.d.ts.map +1 -0
  26. package/dist/src/core/index.js +275 -0
  27. package/dist/src/core/index.js.map +1 -0
  28. package/dist/src/core/lib.d.ts +8 -0
  29. package/dist/src/core/lib.d.ts.map +1 -0
  30. package/dist/src/core/lib.js +7 -0
  31. package/dist/src/core/lib.js.map +1 -0
  32. package/dist/src/{logger.d.ts → core/logger.d.ts} +6 -1
  33. package/dist/src/core/logger.d.ts.map +1 -0
  34. package/dist/src/{logger.js → core/logger.js} +30 -2
  35. package/dist/src/core/logger.js.map +1 -0
  36. package/dist/src/{metrics.d.ts → core/metrics.d.ts} +11 -0
  37. package/dist/src/core/metrics.d.ts.map +1 -0
  38. package/dist/src/{metrics.js → core/metrics.js} +61 -0
  39. package/dist/src/core/metrics.js.map +1 -0
  40. package/dist/src/core/naming-warnings.d.ts.map +1 -0
  41. package/dist/src/core/naming-warnings.js.map +1 -0
  42. package/dist/src/core/naming.d.ts.map +1 -0
  43. package/dist/src/core/naming.js.map +1 -0
  44. package/dist/src/generated-schemas.d.ts +245 -79
  45. package/dist/src/generated-schemas.d.ts.map +1 -1
  46. package/dist/src/generated-schemas.js +14 -2
  47. package/dist/src/generated-schemas.js.map +1 -1
  48. package/dist/src/index.d.ts +1 -6
  49. package/dist/src/index.d.ts.map +1 -1
  50. package/dist/src/index.js +1 -170
  51. package/dist/src/index.js.map +1 -1
  52. package/dist/src/lib.d.ts +1 -7
  53. package/dist/src/lib.d.ts.map +1 -1
  54. package/dist/src/lib.js +1 -6
  55. package/dist/src/lib.js.map +1 -1
  56. package/dist/src/mcp/mcp-server-manager.d.ts +20 -0
  57. package/dist/src/mcp/mcp-server-manager.d.ts.map +1 -0
  58. package/dist/src/mcp/mcp-server-manager.js +38 -0
  59. package/dist/src/mcp/mcp-server-manager.js.map +1 -0
  60. package/dist/src/{mcp-server.d.ts → mcp/mcp-server.d.ts} +31 -1
  61. package/dist/src/mcp/mcp-server.d.ts.map +1 -0
  62. package/dist/src/{mcp-server.js → mcp/mcp-server.js} +547 -146
  63. package/dist/src/mcp/mcp-server.js.map +1 -0
  64. package/dist/src/{openapi-parser.d.ts → openapi/openapi-parser.d.ts} +1 -1
  65. package/dist/src/openapi/openapi-parser.d.ts.map +1 -0
  66. package/dist/src/{openapi-parser.js → openapi/openapi-parser.js} +2 -2
  67. package/dist/src/openapi/openapi-parser.js.map +1 -0
  68. package/dist/src/{profile-loader.d.ts → profile/profile-loader.d.ts} +3 -2
  69. package/dist/src/profile/profile-loader.d.ts.map +1 -0
  70. package/dist/src/{profile-loader.js → profile/profile-loader.js} +17 -6
  71. package/dist/src/profile/profile-loader.js.map +1 -0
  72. package/dist/src/profile/profile-registry.d.ts +18 -0
  73. package/dist/src/profile/profile-registry.d.ts.map +1 -0
  74. package/dist/src/profile/profile-registry.js +26 -0
  75. package/dist/src/profile/profile-registry.js.map +1 -0
  76. package/dist/src/profile/profile-resolver.d.ts +25 -0
  77. package/dist/src/profile/profile-resolver.d.ts.map +1 -0
  78. package/dist/src/profile/profile-resolver.js +204 -0
  79. package/dist/src/profile/profile-resolver.js.map +1 -0
  80. package/dist/src/profile/startup-profile.d.ts +17 -0
  81. package/dist/src/profile/startup-profile.d.ts.map +1 -0
  82. package/dist/src/profile/startup-profile.js +30 -0
  83. package/dist/src/profile/startup-profile.js.map +1 -0
  84. package/dist/src/profile/startup-validation.d.ts +11 -0
  85. package/dist/src/profile/startup-validation.d.ts.map +1 -0
  86. package/dist/src/profile/startup-validation.js +21 -0
  87. package/dist/src/profile/startup-validation.js.map +1 -0
  88. package/dist/src/testing/dynamic-mock-server.d.ts +24 -0
  89. package/dist/src/testing/dynamic-mock-server.d.ts.map +1 -0
  90. package/dist/src/testing/dynamic-mock-server.js +138 -0
  91. package/dist/src/testing/dynamic-mock-server.js.map +1 -0
  92. package/dist/src/testing/request-assertions.d.ts +5 -0
  93. package/dist/src/testing/request-assertions.d.ts.map +1 -0
  94. package/dist/src/testing/request-assertions.js +165 -0
  95. package/dist/src/testing/request-assertions.js.map +1 -0
  96. package/dist/src/testing/template-utils.d.ts +10 -0
  97. package/dist/src/testing/template-utils.d.ts.map +1 -0
  98. package/dist/src/testing/template-utils.js +72 -0
  99. package/dist/src/testing/template-utils.js.map +1 -0
  100. package/dist/src/testing/test-http-utils.d.ts +1 -1
  101. package/dist/src/testing/test-http-utils.d.ts.map +1 -1
  102. package/dist/src/testing/test-http-utils.js +1 -1
  103. package/dist/src/testing/test-http-utils.js.map +1 -1
  104. package/dist/src/testing/test-loader.d.ts +6 -0
  105. package/dist/src/testing/test-loader.d.ts.map +1 -0
  106. package/dist/src/testing/test-loader.js +212 -0
  107. package/dist/src/testing/test-loader.js.map +1 -0
  108. package/dist/src/testing/test-schema.d.ts +1270 -0
  109. package/dist/src/testing/test-schema.d.ts.map +1 -0
  110. package/dist/src/testing/test-schema.js +76 -0
  111. package/dist/src/testing/test-schema.js.map +1 -0
  112. package/dist/src/tool-filter/compat.d.ts +49 -0
  113. package/dist/src/tool-filter/compat.d.ts.map +1 -0
  114. package/dist/src/tool-filter/compat.js +72 -0
  115. package/dist/src/tool-filter/compat.js.map +1 -0
  116. package/dist/src/tool-filter/config/env-config-parser.d.ts +38 -0
  117. package/dist/src/tool-filter/config/env-config-parser.d.ts.map +1 -0
  118. package/dist/src/tool-filter/config/env-config-parser.js +103 -0
  119. package/dist/src/tool-filter/config/env-config-parser.js.map +1 -0
  120. package/dist/src/tool-filter/config/header-config-parser.d.ts +37 -0
  121. package/dist/src/tool-filter/config/header-config-parser.d.ts.map +1 -0
  122. package/dist/src/tool-filter/config/header-config-parser.js +118 -0
  123. package/dist/src/tool-filter/config/header-config-parser.js.map +1 -0
  124. package/dist/src/tool-filter/errors.d.ts +18 -0
  125. package/dist/src/tool-filter/errors.d.ts.map +1 -0
  126. package/dist/src/tool-filter/errors.js +21 -0
  127. package/dist/src/tool-filter/errors.js.map +1 -0
  128. package/dist/src/tool-filter/filter/filter-engine.d.ts +45 -0
  129. package/dist/src/tool-filter/filter/filter-engine.d.ts.map +1 -0
  130. package/dist/src/tool-filter/filter/filter-engine.js +94 -0
  131. package/dist/src/tool-filter/filter/filter-engine.js.map +1 -0
  132. package/dist/src/tool-filter/filter/filter-rules.d.ts +44 -0
  133. package/dist/src/tool-filter/filter/filter-rules.d.ts.map +1 -0
  134. package/dist/src/tool-filter/filter/filter-rules.js +72 -0
  135. package/dist/src/tool-filter/filter/filter-rules.js.map +1 -0
  136. package/dist/src/tool-filter/filter/global-tool-filter.d.ts +40 -0
  137. package/dist/src/tool-filter/filter/global-tool-filter.d.ts.map +1 -0
  138. package/dist/src/tool-filter/filter/global-tool-filter.js +92 -0
  139. package/dist/src/tool-filter/filter/global-tool-filter.js.map +1 -0
  140. package/dist/src/tool-filter/filter/session-tool-filter.d.ts +29 -0
  141. package/dist/src/tool-filter/filter/session-tool-filter.d.ts.map +1 -0
  142. package/dist/src/tool-filter/filter/session-tool-filter.js +69 -0
  143. package/dist/src/tool-filter/filter/session-tool-filter.js.map +1 -0
  144. package/dist/src/tool-filter/index.d.ts +25 -0
  145. package/dist/src/tool-filter/index.d.ts.map +1 -0
  146. package/dist/src/tool-filter/index.js +30 -0
  147. package/dist/src/tool-filter/index.js.map +1 -0
  148. package/dist/src/tool-filter/integration/tool-filter-service.d.ts +44 -0
  149. package/dist/src/tool-filter/integration/tool-filter-service.d.ts.map +1 -0
  150. package/dist/src/tool-filter/integration/tool-filter-service.js +68 -0
  151. package/dist/src/tool-filter/integration/tool-filter-service.js.map +1 -0
  152. package/dist/src/tool-filter/operation/operation-classifier.d.ts +20 -0
  153. package/dist/src/tool-filter/operation/operation-classifier.d.ts.map +1 -0
  154. package/dist/src/tool-filter/operation/operation-classifier.js +26 -0
  155. package/dist/src/tool-filter/operation/operation-classifier.js.map +1 -0
  156. package/dist/src/tool-filter/operation/operation-detector.d.ts +30 -0
  157. package/dist/src/tool-filter/operation/operation-detector.d.ts.map +1 -0
  158. package/dist/src/tool-filter/operation/operation-detector.js +96 -0
  159. package/dist/src/tool-filter/operation/operation-detector.js.map +1 -0
  160. package/dist/src/tool-filter/operation/operation-resolver.d.ts +22 -0
  161. package/dist/src/tool-filter/operation/operation-resolver.d.ts.map +1 -0
  162. package/dist/src/tool-filter/operation/operation-resolver.js +32 -0
  163. package/dist/src/tool-filter/operation/operation-resolver.js.map +1 -0
  164. package/dist/src/tool-filter/regex/regex-compiler.d.ts +22 -0
  165. package/dist/src/tool-filter/regex/regex-compiler.d.ts.map +1 -0
  166. package/dist/src/tool-filter/regex/regex-compiler.js +56 -0
  167. package/dist/src/tool-filter/regex/regex-compiler.js.map +1 -0
  168. package/dist/src/tool-filter/regex/regex-validator.d.ts +24 -0
  169. package/dist/src/tool-filter/regex/regex-validator.d.ts.map +1 -0
  170. package/dist/src/tool-filter/regex/regex-validator.js +58 -0
  171. package/dist/src/tool-filter/regex/regex-validator.js.map +1 -0
  172. package/dist/src/tool-filter/types.d.ts +92 -0
  173. package/dist/src/tool-filter/types.d.ts.map +1 -0
  174. package/dist/src/tool-filter/types.js +5 -0
  175. package/dist/src/tool-filter/types.js.map +1 -0
  176. package/dist/src/tool-filter/utils.d.ts +11 -0
  177. package/dist/src/tool-filter/utils.d.ts.map +1 -0
  178. package/dist/src/tool-filter/utils.js +13 -0
  179. package/dist/src/tool-filter/utils.js.map +1 -0
  180. package/dist/src/{composite-executor.d.ts → tooling/composite-executor.d.ts} +3 -3
  181. package/dist/src/tooling/composite-executor.d.ts.map +1 -0
  182. package/dist/src/{composite-executor.js → tooling/composite-executor.js} +1 -1
  183. package/dist/src/tooling/composite-executor.js.map +1 -0
  184. package/dist/src/{dag-executor.d.ts → tooling/dag-executor.d.ts} +1 -1
  185. package/dist/src/tooling/dag-executor.d.ts.map +1 -0
  186. package/dist/src/tooling/dag-executor.js.map +1 -0
  187. package/dist/src/{proxy-executor.d.ts → tooling/proxy-executor.d.ts} +2 -2
  188. package/dist/src/tooling/proxy-executor.d.ts.map +1 -0
  189. package/dist/src/{proxy-executor.js → tooling/proxy-executor.js} +8 -1
  190. package/dist/src/tooling/proxy-executor.js.map +1 -0
  191. package/dist/src/{tool-generator.d.ts → tooling/tool-generator.d.ts} +4 -3
  192. package/dist/src/tooling/tool-generator.d.ts.map +1 -0
  193. package/dist/src/{tool-generator.js → tooling/tool-generator.js} +23 -7
  194. package/dist/src/tooling/tool-generator.js.map +1 -0
  195. package/dist/src/{http-client-factory.d.ts → transport/http-client-factory.d.ts} +4 -1
  196. package/dist/src/transport/http-client-factory.d.ts.map +1 -0
  197. package/dist/src/{http-client-factory.js → transport/http-client-factory.js} +13 -3
  198. package/dist/src/transport/http-client-factory.js.map +1 -0
  199. package/dist/src/transport/http-transport-config.d.ts +6 -0
  200. package/dist/src/transport/http-transport-config.d.ts.map +1 -0
  201. package/dist/src/transport/http-transport-config.js +62 -0
  202. package/dist/src/transport/http-transport-config.js.map +1 -0
  203. package/dist/src/{http-transport.d.ts → transport/http-transport.d.ts} +72 -14
  204. package/dist/src/transport/http-transport.d.ts.map +1 -0
  205. package/dist/src/{http-transport.js → transport/http-transport.js} +1166 -493
  206. package/dist/src/transport/http-transport.js.map +1 -0
  207. package/dist/src/{interceptors.d.ts → transport/interceptors.d.ts} +6 -2
  208. package/dist/src/transport/interceptors.d.ts.map +1 -0
  209. package/dist/src/{interceptors.js → transport/interceptors.js} +72 -41
  210. package/dist/src/transport/interceptors.js.map +1 -0
  211. package/dist/src/types/http-transport.d.ts +25 -0
  212. package/dist/src/types/http-transport.d.ts.map +1 -1
  213. package/dist/src/types/profile.d.ts +13 -1
  214. package/dist/src/types/profile.d.ts.map +1 -1
  215. package/dist/src/validation/argument-normalizer.d.ts +6 -0
  216. package/dist/src/validation/argument-normalizer.d.ts.map +1 -0
  217. package/dist/src/validation/argument-normalizer.js +70 -0
  218. package/dist/src/validation/argument-normalizer.js.map +1 -0
  219. package/dist/src/validation/jsonrpc-validator.d.ts.map +1 -0
  220. package/dist/src/validation/jsonrpc-validator.js.map +1 -0
  221. package/dist/src/{schema-validator.d.ts → validation/schema-validator.d.ts} +2 -2
  222. package/dist/src/validation/schema-validator.d.ts.map +1 -0
  223. package/dist/src/validation/schema-validator.js.map +1 -0
  224. package/dist/src/validation/validation-utils.d.ts.map +1 -0
  225. package/dist/src/validation/validation-utils.js.map +1 -0
  226. package/package.json +9 -3
  227. package/profile-schema.json +63 -3
  228. package/profiles/gitlab/developer-profile-oauth.json +1520 -0
  229. package/profiles/gitlab/developer-profile-oauth.test.json +3432 -0
  230. package/profiles/gitlab/openapi.yaml +6891 -0
  231. package/profiles/n8n/openapi.yaml +2441 -0
  232. package/profiles/n8n/profile-optimized.json +965 -0
  233. package/profiles/n8n/profile-optimized.test.json +1078 -0
  234. package/profiles/n8n/profile.json +1033 -0
  235. package/profiles/n8n/profile.test.json +983 -0
  236. package/profiles/n8n-nodes/openapi.yaml +24 -0
  237. package/profiles/n8n-nodes/profile-nodes.json +44 -0
  238. package/profiles/n8n-nodes/profile-nodes.test.json +91 -0
  239. package/profiles/semgrep/openapi.yaml +4706 -0
  240. package/profiles/semgrep/profile.json +692 -0
  241. package/profiles/semgrep/profile.test.json +471 -0
  242. package/profiles/youtrack/openapi.json +16976 -0
  243. package/profiles/youtrack/profile.json +608 -0
  244. package/profiles/youtrack/profile.test.json +1926 -0
  245. package/dist/src/composite-executor.d.ts.map +0 -1
  246. package/dist/src/composite-executor.js.map +0 -1
  247. package/dist/src/constants.d.ts.map +0 -1
  248. package/dist/src/constants.js.map +0 -1
  249. package/dist/src/dag-executor.d.ts.map +0 -1
  250. package/dist/src/dag-executor.js.map +0 -1
  251. package/dist/src/errors.d.ts.map +0 -1
  252. package/dist/src/errors.js.map +0 -1
  253. package/dist/src/http-client-factory.d.ts.map +0 -1
  254. package/dist/src/http-client-factory.js.map +0 -1
  255. package/dist/src/http-transport.d.ts.map +0 -1
  256. package/dist/src/http-transport.js.map +0 -1
  257. package/dist/src/interceptors.d.ts.map +0 -1
  258. package/dist/src/interceptors.js.map +0 -1
  259. package/dist/src/jsonrpc-validator.d.ts.map +0 -1
  260. package/dist/src/jsonrpc-validator.js.map +0 -1
  261. package/dist/src/logger.d.ts.map +0 -1
  262. package/dist/src/logger.js.map +0 -1
  263. package/dist/src/mcp-server.d.ts.map +0 -1
  264. package/dist/src/mcp-server.js.map +0 -1
  265. package/dist/src/metrics.d.ts.map +0 -1
  266. package/dist/src/metrics.js.map +0 -1
  267. package/dist/src/naming-warnings.d.ts.map +0 -1
  268. package/dist/src/naming-warnings.js.map +0 -1
  269. package/dist/src/naming.d.ts.map +0 -1
  270. package/dist/src/naming.js.map +0 -1
  271. package/dist/src/oauth-provider.d.ts.map +0 -1
  272. package/dist/src/oauth-provider.js.map +0 -1
  273. package/dist/src/openapi-parser.d.ts.map +0 -1
  274. package/dist/src/openapi-parser.js.map +0 -1
  275. package/dist/src/profile-loader.d.ts.map +0 -1
  276. package/dist/src/profile-loader.js.map +0 -1
  277. package/dist/src/proxy-executor.d.ts.map +0 -1
  278. package/dist/src/proxy-executor.js.map +0 -1
  279. package/dist/src/schema-validator.d.ts.map +0 -1
  280. package/dist/src/schema-validator.js.map +0 -1
  281. package/dist/src/testing/fixtures.d.ts +0 -684
  282. package/dist/src/testing/fixtures.d.ts.map +0 -1
  283. package/dist/src/testing/fixtures.js +0 -528
  284. package/dist/src/testing/fixtures.js.map +0 -1
  285. package/dist/src/testing/mock-gitlab-server.d.ts +0 -43
  286. package/dist/src/testing/mock-gitlab-server.d.ts.map +0 -1
  287. package/dist/src/testing/mock-gitlab-server.js +0 -1026
  288. package/dist/src/testing/mock-gitlab-server.js.map +0 -1
  289. package/dist/src/testing/mock-semgrep-server.d.ts +0 -32
  290. package/dist/src/testing/mock-semgrep-server.d.ts.map +0 -1
  291. package/dist/src/testing/mock-semgrep-server.js +0 -213
  292. package/dist/src/testing/mock-semgrep-server.js.map +0 -1
  293. package/dist/src/testing/mock-youtrack-server.d.ts +0 -11
  294. package/dist/src/testing/mock-youtrack-server.d.ts.map +0 -1
  295. package/dist/src/testing/mock-youtrack-server.js +0 -152
  296. package/dist/src/testing/mock-youtrack-server.js.map +0 -1
  297. package/dist/src/tool-generator.d.ts.map +0 -1
  298. package/dist/src/tool-generator.js.map +0 -1
  299. package/dist/src/validation-utils.d.ts.map +0 -1
  300. package/dist/src/validation-utils.js.map +0 -1
  301. /package/dist/src/{naming-warnings.d.ts → core/naming-warnings.d.ts} +0 -0
  302. /package/dist/src/{naming-warnings.js → core/naming-warnings.js} +0 -0
  303. /package/dist/src/{naming.d.ts → core/naming.d.ts} +0 -0
  304. /package/dist/src/{naming.js → core/naming.js} +0 -0
  305. /package/dist/src/{dag-executor.js → tooling/dag-executor.js} +0 -0
  306. /package/dist/src/{jsonrpc-validator.d.ts → validation/jsonrpc-validator.d.ts} +0 -0
  307. /package/dist/src/{jsonrpc-validator.js → validation/jsonrpc-validator.js} +0 -0
  308. /package/dist/src/{schema-validator.js → validation/schema-validator.js} +0 -0
  309. /package/dist/src/{validation-utils.d.ts → validation/validation-utils.d.ts} +0 -0
  310. /package/dist/src/{validation-utils.js → validation/validation-utils.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-schema.d.ts","sourceRoot":"","sources":["../../../src/testing/test-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc/B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAShC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ const RequestExpectationSchema = z.object({
3
+ method: z.string().optional().describe('Expected HTTP method'),
4
+ path: z.string().optional().describe('Expected request path'),
5
+ path_regex: z.string().optional().describe('Regex to match request path'),
6
+ origin: z.string().optional().describe('Expected request origin (protocol + host + port)'),
7
+ origin_regex: z.string().optional().describe('Regex to match request origin (protocol + host + port)'),
8
+ query: z
9
+ .record(z.union([z.string(), z.number(), z.boolean(), z.array(z.union([z.string(), z.number(), z.boolean()]))]))
10
+ .optional()
11
+ .describe('Expected query parameters (strings, numbers, booleans, or arrays)'),
12
+ query_absent: z.array(z.string()).optional().describe('Query parameters that must NOT be present'),
13
+ query_regex: z.record(z.string()).optional().describe('Regex to match query parameter values'),
14
+ headers: z.record(z.string()).optional().describe('Expected HTTP headers'),
15
+ headers_regex: z.record(z.string()).optional().describe('Regex to match header values'),
16
+ headers_absent: z.array(z.string()).optional().describe('Headers that must NOT be present on the request'),
17
+ body: z.any().optional().describe('Expected request body (partial match allowed)'),
18
+ body_exact: z.any().optional().describe('Expected request body (exact match required)'),
19
+ body_regex: z.string().optional().describe('Regex to match stringified request body')
20
+ });
21
+ export const MockDefinitionSchema = z.object({
22
+ operationId: z.string().optional().describe('The OpenAPI operationId to mock'),
23
+ path: z.string().optional().describe('Raw URL path pattern (e.g. /api/v4/projects)'),
24
+ method: z.string().optional().describe('HTTP method (GET, POST, etc.)'),
25
+ response: z
26
+ .object({
27
+ status: z.number().optional().default(200),
28
+ body: z.any().optional(),
29
+ headers: z.record(z.string()).optional(),
30
+ delay: z.number().optional().describe('Response delay in milliseconds')
31
+ })
32
+ .optional()
33
+ }).refine(data => data.operationId || (data.path && data.method), {
34
+ message: 'Either operationId or (path and method) must be provided'
35
+ });
36
+ export const TestExpectationSchema = z.object({
37
+ success: z.boolean().default(true).describe('Whether the tool call should succeed'),
38
+ result: z.any().optional().describe('Expected exact result (partial match)'),
39
+ result_exact: z.any().optional().describe('Expected result with deep equality (no extra fields)'),
40
+ error_code: z.string().optional().describe('Expected error code if success is false'),
41
+ error_message_regex: z.string().optional().describe('Regex to match error message'),
42
+ request: RequestExpectationSchema.optional().describe('Expected HTTP request details for the scenario'),
43
+ requests: z.array(RequestExpectationSchema).optional().describe('Expected ordered list of HTTP requests'),
44
+ allow_additional_requests: z.boolean().optional().describe('If true, additional captured requests are allowed beyond expectations')
45
+ });
46
+ export const TestScenarioSchema = z.object({
47
+ name: z.string(),
48
+ description: z.string().optional(),
49
+ tool: z.string().describe('Name of the MCP tool to call'),
50
+ arguments: z.record(z.any()).describe('Arguments to pass to the tool'),
51
+ mocks: z.array(MockDefinitionSchema).optional().describe('Scenario-specific mock overrides'),
52
+ expect: TestExpectationSchema,
53
+ timeout_ms: z.number().optional()
54
+ });
55
+ const CoverageRulesSchema = z
56
+ .object({
57
+ require_all_actions: z.boolean().default(false),
58
+ skip_actions: z.record(z.string().min(1)).default({}),
59
+ require_request_assertions: z.boolean().default(false),
60
+ skip_request_assertions: z.record(z.string().min(1)).default({})
61
+ })
62
+ .default({
63
+ require_all_actions: false,
64
+ skip_actions: {},
65
+ require_request_assertions: false,
66
+ skip_request_assertions: {}
67
+ });
68
+ export const ProfileTestDefinitionSchema = z.object({
69
+ $schema: z.string().optional(),
70
+ profile_name: z.string().optional(),
71
+ variables: z.record(z.any()).optional().describe('Global variables for templating'),
72
+ global_mocks: z.array(MockDefinitionSchema).optional().describe('Default mocks applied to all scenarios'),
73
+ scenarios: z.array(TestScenarioSchema),
74
+ coverage: CoverageRulesSchema
75
+ });
76
+ //# sourceMappingUR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A0B,EAAE,KAAK;IACjC,uBAAuB,EAAE,EAAE;CAC5B,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACnF,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IACzG,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACtC,QAAQ,EAAE,mBAAmB;CAC9B,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Compatibility functions for legacy code
3
+ *
4
+ * These functions provide backward-compatible API for code that hasn't
5
+ * been migrated to use the new modular architecture yet.
6
+ */
7
+ import type { ToolDefinition } from '../types/profile.js';
8
+ import type { SessionToolFilterRequest } from './types.js';
9
+ export interface SessionToolFilter {
10
+ allowedToolNames: Set<string>;
11
+ reasons: Map<string, string[]>;
12
+ patterns: {
13
+ allow: RegExp[];
14
+ };
15
+ normalizedHeader: string;
16
+ }
17
+ /**
18
+ * Normalize tool filter header value
19
+ *
20
+ * @param value - Raw header value
21
+ * @returns Normalized value or undefined if empty
22
+ */
23
+ export declare function normalizeToolFilterHeaderValue(value?: string): string | undefined;
24
+ /**
25
+ * Parse session tool filter header
26
+ *
27
+ * Legacy wrapper around HeaderConfigParser for backward compatibility.
28
+ * New code should use HeaderConfigParser directly.
29
+ *
30
+ * @param headerValue - Header value to parse
31
+ * @returns Parsed session filter request
32
+ */
33
+ export declare function parseSessionToolFilterHeader(headerValue: string): SessionToolFilterRequest;
34
+ /**
35
+ * Apply session tool filter
36
+ *
37
+ * Legacy function for backward compatibility.
38
+ * New code should use SessionToolFilter class directly.
39
+ *
40
+ * @param tools - Tools to filter
41
+ * @param request - Filter request from header
42
+ * @param resolver - Operation resolver (optional, for legacy compatibility)
43
+ * @returns Session filter result
44
+ */
45
+ export declare function applySessionToolFilter(tools: ToolDefinition[], request: SessionToolFilterRequest, resolver?: {
46
+ getOperationById?: (id: string) => any;
47
+ getOperationForCall?: (call: string) => any;
48
+ }): SessionToolFilter;
49
+ //# sourceMappingURL=compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../../src/tool-filter/compat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAqB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAS9E,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWjF;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,wBAAwB,CAM1F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,wBAAwB,EACjC,QAAQ,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,GAAG,CAAC;IAAC,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG,CAAA;CAAE,GACjG,iBAAiB,CAqBnB"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Compatibility functions for legacy code
3
+ *
4
+ * These functions provide backward-compatible API for code that hasn't
5
+ * been migrated to use the new modular architecture yet.
6
+ */
7
+ import { HeaderConfigParser } from './config/header-config-parser.js';
8
+ import { RegexCompiler } from './regex/regex-compiler.js';
9
+ import { RegexValidator } from './regex/regex-validator.js';
10
+ import { SessionToolFilter as SessionToolFilterClass } from './filter/session-tool-filter.js';
11
+ import { OperationClassifier } from './operation/operation-classifier.js';
12
+ import { OperationDetector } from './operation/operation-detector.js';
13
+ /**
14
+ * Normalize tool filter header value
15
+ *
16
+ * @param value - Raw header value
17
+ * @returns Normalized value or undefined if empty
18
+ */
19
+ export function normalizeToolFilterHeaderValue(value) {
20
+ if (value === undefined || value === null) {
21
+ return undefined;
22
+ }
23
+ const trimmed = value.trim();
24
+ if (trimmed === '') {
25
+ return undefined;
26
+ }
27
+ return trimmed;
28
+ }
29
+ /**
30
+ * Parse session tool filter header
31
+ *
32
+ * Legacy wrapper around HeaderConfigParser for backward compatibility.
33
+ * New code should use HeaderConfigParser directly.
34
+ *
35
+ * @param headerValue - Header value to parse
36
+ * @returns Parsed session filter request
37
+ */
38
+ export function parseSessionToolFilterHeader(headerValue) {
39
+ const validator = new RegexValidator();
40
+ const compiler = new RegexCompiler(validator);
41
+ const parser = new HeaderConfigParser(compiler);
42
+ return parser.parse(headerValue);
43
+ }
44
+ /**
45
+ * Apply session tool filter
46
+ *
47
+ * Legacy function for backward compatibility.
48
+ * New code should use SessionToolFilter class directly.
49
+ *
50
+ * @param tools - Tools to filter
51
+ * @param request - Filter request from header
52
+ * @param resolver - Operation resolver (optional, for legacy compatibility)
53
+ * @returns Session filter result
54
+ */
55
+ export function applySessionToolFilter(tools, request, resolver) {
56
+ const detector = resolver
57
+ ? new OperationDetector(new OperationClassifier(), {
58
+ getOperationById: (operationId) => resolver.getOperationById?.(operationId),
59
+ getOperationForCall: (call) => resolver.getOperationForCall?.(call),
60
+ })
61
+ : undefined;
62
+ const filter = new SessionToolFilterClass(request, detector);
63
+ const result = filter.apply(tools);
64
+ // Convert to legacy format
65
+ return {
66
+ allowedToolNames: result.allowedToolNames,
67
+ reasons: result.reasons,
68
+ patterns: { allow: [] }, // Not tracked in new architecture
69
+ normalizedHeader: request.normalizedHeader
70
+ };
71
+ }
72
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../src/tool-filter/compat.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAc;IAC3D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAAC,WAAmB;IAC9D,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAuB,EACvB,OAAiC,EACjC,QAAkG;IAElG,MAAM,QAAQ,GAAG,QAAQ;QACvB,CAAC,CAAC,IAAI,iBAAiB,CACnB,IAAI,mBAAmB,EAAE,EACzB;YACE,gBAAgB,EAAE,CAAC,WAAmB,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,WAAW,CAAC;YACnF,mBAAmB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,IAAI,CAAC;SAChD,CAC9B;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,MAAM,GAAG,IAAI,sBAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnC,2BAA2B;IAC3B,OAAO;QACL,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,kCAAkC;QAC3D,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Environment variable config parser
3
+ */
4
+ import type { ToolFilterConfig } from '../types.js';
5
+ import type { RegexCompiler } from '../regex/regex-compiler.js';
6
+ /**
7
+ * Parses tool filter configuration from environment variables
8
+ */
9
+ export declare class EnvConfigParser {
10
+ private compiler;
11
+ constructor(compiler: RegexCompiler);
12
+ /**
13
+ * Parse config from environment variables
14
+ * @returns Config or undefined if no env vars set
15
+ */
16
+ parse(env: NodeJS.ProcessEnv): ToolFilterConfig | undefined;
17
+ /**
18
+ * Extract raw config from env vars
19
+ */
20
+ private extractRawConfig;
21
+ /**
22
+ * Build typed config from raw config
23
+ */
24
+ private buildConfig;
25
+ /**
26
+ * Parse categories from string array
27
+ */
28
+ private parseCategories;
29
+ /**
30
+ * Parse CSV list from env var value
31
+ */
32
+ private parseCsvList;
33
+ /**
34
+ * Check if all arrays are empty
35
+ */
36
+ private isEmpty;
37
+ }
38
+ //# sourceMappingURL=env-config-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config-parser.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/config/env-config-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE;;GAEG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,aAAa;IAE3C;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,gBAAgB,GAAG,SAAS;IAS3D;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAexB;;OAEG;IACH,OAAO,CAAC,WAAW;IAoCnB;;OAEG;IACH,OAAO,CAAC,eAAe;IAsBvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAWpB;;OAEG;IACH,OAAO,CAAC,OAAO;CAGhB"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Environment variable config parser
3
+ */
4
+ import { ConfigurationError } from '../../core/errors.js';
5
+ /**
6
+ * Parses tool filter configuration from environment variables
7
+ */
8
+ export class EnvConfigParser {
9
+ constructor(compiler) {
10
+ this.compiler = compiler;
11
+ }
12
+ /**
13
+ * Parse config from environment variables
14
+ * @returns Config or undefined if no env vars set
15
+ */
16
+ parse(env) {
17
+ const raw = this.extractRawConfig(env);
18
+ if (!raw) {
19
+ return undefined;
20
+ }
21
+ return this.buildConfig(raw);
22
+ }
23
+ /**
24
+ * Extract raw config from env vars
25
+ */
26
+ extractRawConfig(env) {
27
+ const allowList = this.parseCsvList(env.MCP4_TOOL_FILTER_ALLOW_NAMES);
28
+ const allowRegex = this.parseCsvList(env.MCP4_TOOL_FILTER_ALLOW_NAME_REGEX);
29
+ const denyList = this.parseCsvList(env.MCP4_TOOL_FILTER_DENY_NAMES);
30
+ const denyRegex = this.parseCsvList(env.MCP4_TOOL_FILTER_DENY_NAME_REGEX);
31
+ const allowCategories = this.parseCsvList(env.MCP4_TOOL_FILTER_ALLOW_CATEGORIES);
32
+ // Check if any config present
33
+ if (this.isEmpty(allowList, allowRegex, denyList, denyRegex, allowCategories)) {
34
+ return undefined;
35
+ }
36
+ return { allowList, allowRegex, denyList, denyRegex, allowCategories };
37
+ }
38
+ /**
39
+ * Build typed config from raw config
40
+ */
41
+ buildConfig(raw) {
42
+ const allowList = new Set(raw.allowList.map(name => name.normalize('NFC')));
43
+ const denyList = new Set(raw.denyList.map(name => name.normalize('NFC')));
44
+ const allowRegex = raw.allowRegex.map(pattern => this.compiler.compile(pattern, 'MCP4_TOOL_FILTER_ALLOW_NAME_REGEX'));
45
+ const denyRegex = raw.denyRegex.map(pattern => this.compiler.compile(pattern, 'MCP4_TOOL_FILTER_DENY_NAME_REGEX'));
46
+ const allowCategories = this.parseCategories(raw.allowCategories);
47
+ const hasAllowRules = raw.allowList.length > 0 ||
48
+ raw.allowRegex.length > 0 ||
49
+ allowCategories.size > 0;
50
+ return {
51
+ allowList,
52
+ denyList,
53
+ allowRegex,
54
+ denyRegex,
55
+ allowCategories,
56
+ hasAllowRules,
57
+ sources: {
58
+ allowList: raw.allowList,
59
+ allowRegex: raw.allowRegex,
60
+ denyList: raw.denyList,
61
+ denyRegex: raw.denyRegex,
62
+ allowCategories: raw.allowCategories
63
+ }
64
+ };
65
+ }
66
+ /**
67
+ * Parse categories from string array
68
+ */
69
+ parseCategories(entries) {
70
+ const categories = new Set();
71
+ for (const entry of entries) {
72
+ if (!entry) {
73
+ continue;
74
+ }
75
+ const normalized = entry.trim().toLowerCase();
76
+ if (normalized === 'list' || normalized === 'read') {
77
+ categories.add(normalized);
78
+ continue;
79
+ }
80
+ throw new ConfigurationError(`MCP4_TOOL_FILTER_ALLOW_CATEGORIES supports only 'list' and 'read', got '${entry}'`);
81
+ }
82
+ return categories;
83
+ }
84
+ /**
85
+ * Parse CSV list from env var value
86
+ */
87
+ parseCsvList(value) {
88
+ if (!value) {
89
+ return [];
90
+ }
91
+ return value
92
+ .split(',')
93
+ .map(part => part.trim())
94
+ .filter(Boolean);
95
+ }
96
+ /**
97
+ * Check if all arrays are empty
98
+ */
99
+ isEmpty(...arrays) {
100
+ return arrays.every(arr => arr.length === 0);
101
+ }
102
+ }
103
+ //# sourceMappingURL=env-config-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config-parser.js","sourceRoot":"","sources":["../../../../src/tool-filter/config/env-config-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,YAAoB,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAE/C;;;OAGG;IACH,KAAK,CAAC,GAAsB;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,GAAsB;QAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QACtE,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG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,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aACxB,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED;;OAEG;IACK,OAAO,CAAC,GAAG,MAAkB;QACnC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Header config parser for session-based filtering
3
+ */
4
+ import type { SessionToolFilterRequest } from '../types.js';
5
+ import type { RegexCompiler } from '../regex/regex-compiler.js';
6
+ /**
7
+ * Parses X-Mcp4-Tools header for session filtering
8
+ */
9
+ export declare class HeaderConfigParser {
10
+ private compiler;
11
+ constructor(compiler: RegexCompiler);
12
+ /**
13
+ * Parse header value into session filter request
14
+ */
15
+ parse(headerValue: string): SessionToolFilterRequest;
16
+ /**
17
+ * Normalize header value
18
+ */
19
+ private normalizeHeader;
20
+ /**
21
+ * Split and validate header parts
22
+ */
23
+ private splitAndValidate;
24
+ /**
25
+ * Parse header parts into structured data
26
+ */
27
+ private parseParts;
28
+ /**
29
+ * Get max entries from env var
30
+ */
31
+ private getMaxEntries;
32
+ /**
33
+ * Create empty request
34
+ */
35
+ private emptyRequest;
36
+ }
37
+ //# sourceMappingURL=header-config-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-config-parser.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/config/header-config-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAiB,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAMhE;;GAEG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,aAAa;IAE3C;;OAEG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,wBAAwB;IAmBpD;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;OAEG;IACH,OAAO,CAAC,UAAU;IA6BlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;IACH,OAAO,CAAC,YAAY;CAUrB"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Header config parser for session-based filtering
3
+ */
4
+ import { ValidationError, ConfigurationError } from '../../core/errors.js';
5
+ const MAX_HEADER_ENTRY_LENGTH = 255;
6
+ const DEFAULT_MAX_ENTRIES = 100;
7
+ /**
8
+ * Parses X-Mcp4-Tools header for session filtering
9
+ */
10
+ export class HeaderConfigParser {
11
+ constructor(compiler) {
12
+ this.compiler = compiler;
13
+ }
14
+ /**
15
+ * Parse header value into session filter request
16
+ */
17
+ parse(headerValue) {
18
+ const normalized = this.normalizeHeader(headerValue);
19
+ if (!normalized) {
20
+ return this.emptyRequest();
21
+ }
22
+ const parts = this.splitAndValidate(normalized);
23
+ const parsed = this.parseParts(parts);
24
+ return {
25
+ exactNames: parsed.exactNames,
26
+ regexPatterns: parsed.regexPatterns,
27
+ allowCategories: parsed.allowCategories,
28
+ normalizedHeader: normalized,
29
+ rawEntries: parts,
30
+ hasRules: parts.length > 0
31
+ };
32
+ }
33
+ /**
34
+ * Normalize header value
35
+ */
36
+ normalizeHeader(value) {
37
+ const trimmed = value.trim();
38
+ return trimmed.length > 0 ? trimmed : '';
39
+ }
40
+ /**
41
+ * Split and validate header parts
42
+ */
43
+ splitAndValidate(value) {
44
+ const parts = value.split(',').map(p => p.trim()).filter(Boolean);
45
+ const maxEntries = this.getMaxEntries();
46
+ if (parts.length > maxEntries) {
47
+ throw new ValidationError(`X-Mcp4-Tools contains too many entries (${parts.length} > ${maxEntries}). ` +
48
+ `Reduce to ${maxEntries} or configure MCP4_TOOL_FILTER_SESSION_MAX_TOOLS.`);
49
+ }
50
+ // Validate entry lengths
51
+ for (const part of parts) {
52
+ if (part.length > MAX_HEADER_ENTRY_LENGTH) {
53
+ throw new ValidationError(`X-Mcp4-Tools entry exceeds ${MAX_HEADER_ENTRY_LENGTH} chars: ` +
54
+ `'${part}' (${part.length} chars)`);
55
+ }
56
+ }
57
+ return parts;
58
+ }
59
+ /**
60
+ * Parse header parts into structured data
61
+ */
62
+ parseParts(parts) {
63
+ const exactNames = new Set();
64
+ const regexPatterns = [];
65
+ const allowCategories = new Set();
66
+ for (const part of parts) {
67
+ if (part === '_allow_list') {
68
+ allowCategories.add('list');
69
+ }
70
+ else if (part === '_allow_read') {
71
+ allowCategories.add('read');
72
+ }
73
+ else if (part.startsWith('_allow_')) {
74
+ throw new ValidationError('X-Mcp4-Tools supports only _allow_list and _allow_read. ' +
75
+ 'Other _allow_* keywords are not supported here. (Did you mean to use X-Mcp4-Params?)');
76
+ }
77
+ else if (part.startsWith('regex:')) {
78
+ const pattern = part.slice('regex:'.length).trim();
79
+ if (!pattern) {
80
+ throw new ValidationError('X-Mcp4-Tools regex entry is empty');
81
+ }
82
+ regexPatterns.push(this.compiler.compile(pattern, 'X-Mcp4-Tools'));
83
+ }
84
+ else {
85
+ exactNames.add(part.normalize('NFC'));
86
+ }
87
+ }
88
+ return { exactNames, regexPatterns, allowCategories };
89
+ }
90
+ /**
91
+ * Get max entries from env var
92
+ */
93
+ getMaxEntries() {
94
+ const raw = process.env.MCP4_TOOL_FILTER_SESSION_MAX_TOOLS;
95
+ if (!raw) {
96
+ return DEFAULT_MAX_ENTRIES;
97
+ }
98
+ const parsed = parseInt(raw, 10);
99
+ if (Number.isNaN(parsed) || parsed <= 0) {
100
+ throw new ConfigurationError(`Invalid MCP4_TOOL_FILTER_SESSION_MAX_TOOLS: '${raw}' (must be positive integer)`);
101
+ }
102
+ return parsed;
103
+ }
104
+ /**
105
+ * Create empty request
106
+ */
107
+ emptyRequest() {
108
+ return {
109
+ exactNames: new Set(),
110
+ regexPatterns: [],
111
+ allowCategories: new Set(),
112
+ normalizedHeader: '',
113
+ rawEntries: [],
114
+ hasRules: false
115
+ };
116
+ }
117
+ }
118
+ //# sourceMappingURL=header-config-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header-config-parser.js","sourceRoot":"","sources":["../../../../src/tool-filter/config/header-config-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B,YAAoB,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,WAAmB;QACvB,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAEtC,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,gBAAgB,EAAE,UAAU;YAC5B,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;SAC3B,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,KAAa;QACnC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACK,gBAAgB,CA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,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Tool filter specific errors
3
+ */
4
+ import { ConfigurationError as BaseConfigError, ValidationError as BaseValidationError } from '../core/errors.js';
5
+ /**
6
+ * Invalid regex pattern error
7
+ */
8
+ export declare class InvalidRegexError extends BaseConfigError {
9
+ readonly context: string;
10
+ readonly pattern: string;
11
+ readonly reason: string;
12
+ constructor(context: string, pattern: string, reason: string);
13
+ }
14
+ /**
15
+ * Re-export base errors for convenience
16
+ */
17
+ export { BaseConfigError as ConfigurationError, BaseValidationError as ValidationError };
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/tool-filter/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,IAAI,eAAe,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElH;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;aAElC,OAAO,EAAE,MAAM;aACf,OAAO,EAAE,MAAM;aACf,MAAM,EAAE,MAAM;gBAFd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM;CAKjC;AAED;;GAEG;AACH,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,mBAAmB,IAAI,eAAe,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tool filter specific errors
3
+ */
4
+ import { ConfigurationError as BaseConfigError, ValidationError as BaseValidationError } from '../core/errors.js';
5
+ /**
6
+ * Invalid regex pattern error
7
+ */
8
+ export class InvalidRegexError extends BaseConfigError {
9
+ constructor(context, pattern, reason) {
10
+ super(`${context} regex '${pattern}' is invalid: ${reason}`);
11
+ this.context = context;
12
+ this.pattern = pattern;
13
+ this.reason = reason;
14
+ this.name = 'InvalidRegexError';
15
+ }
16
+ }
17
+ /**
18
+ * Re-export base errors for convenience
19
+ */
20
+ export { BaseConfigError as ConfigurationError, BaseValidationError as ValidationError };
21
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/tool-filter/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,IAAI,eAAe,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAElH;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD,YACkB,OAAe,EACf,OAAe,EACf,MAAc;QAE9B,KAAK,CAAC,GAAG,OAAO,WAAW,OAAO,iBAAiB,MAAM,EAAE,CAAC,CAAC;QAJ7C,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;GAEG;AACH,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,mBAAmB,IAAI,eAAe,EAAE,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Filter engine - orchestrates filter rules
3
+ */
4
+ import type { FilterRule } from './filter-rules.js';
5
+ import type { ToolDefinition } from '../../types/profile.js';
6
+ /**
7
+ * Filter result
8
+ */
9
+ export declare class FilterResult {
10
+ readonly allowed: boolean;
11
+ readonly reason?: string | undefined;
12
+ private constructor();
13
+ static allowed(reason?: string): FilterResult;
14
+ static denied(reason: string): FilterResult;
15
+ }
16
+ /**
17
+ * Filter engine that evaluates tools against rules
18
+ */
19
+ export declare class FilterEngine {
20
+ private allowRules;
21
+ private denyRules;
22
+ constructor(allowRules: FilterRule[], denyRules: FilterRule[]);
23
+ /**
24
+ * Evaluate tool name against rules
25
+ *
26
+ * Rule precedence:
27
+ * 1. Deny rules (if any match, deny immediately)
28
+ * 2. If no allow rules, allow by default
29
+ * 3. Allow rules (must match at least one)
30
+ */
31
+ evaluate(toolName: string): FilterResult;
32
+ /**
33
+ * Evaluate tool definition against rules
34
+ *
35
+ * Used when rules need full tool definition (e.g., CategoryMatchRule).
36
+ * Tool name is normalized (NFC) before passing to name-based rules.
37
+ *
38
+ * Rule precedence:
39
+ * 1. Deny rules (if any match, deny immediately)
40
+ * 2. If no allow rules, allow by default
41
+ * 3. Allow rules (must match at least one)
42
+ */
43
+ evaluateTool(tool: ToolDefinition): FilterResult;
44
+ }
45
+ //# sourceMappingURL=filter-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-engine.d.ts","sourceRoot":"","sources":["../../../../src/tool-filter/filter/filter-engine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;GAEG;AACH,qBAAa,YAAY;aAEL,OAAO,EAAE,OAAO;aAChB,MAAM,CAAC,EAAE,MAAM;IAFjC,OAAO;IAKP,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;IAI7C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;CAG5C;AAED;;GAEG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,SAAS;gBADT,UAAU,EAAE,UAAU,EAAE,EACxB,SAAS,EAAE,UAAU,EAAE;IAGjC;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IA2BxC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,YAAY;CA6BjD"}