@cyanmycelium/mcp-broker 1.0.1 → 1.2.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 (188) hide show
  1. package/.mcp-broker.example/README.md +3 -3
  2. package/README.md +6 -2
  3. package/dist/bin.d.ts +0 -1
  4. package/dist/bin.js +176 -253
  5. package/dist/bin.js.map +1 -1
  6. package/dist/chunk-FTDKH2C4.js +3670 -0
  7. package/dist/chunk-FTDKH2C4.js.map +1 -0
  8. package/dist/{broker/grammars → grammars}/claude/en.json +1 -1
  9. package/dist/{broker/grammars → grammars}/claude/fr.json +1 -1
  10. package/dist/index.d.ts +1790 -22
  11. package/dist/index.js +2 -18
  12. package/dist/index.js.map +1 -1
  13. package/package.json +9 -7
  14. package/scripts/copy-assets.mjs +16 -10
  15. package/scripts/gen-cert.mjs +5 -5
  16. package/scripts/pack-mcpb.mjs +5 -5
  17. package/scripts/sign-bundle.mjs +6 -6
  18. package/src/auth/auth.config.ts +3 -3
  19. package/src/auth/auth.types.ts +34 -59
  20. package/src/auth/http.auth.ts +18 -22
  21. package/src/auth/index.ts +12 -12
  22. package/src/auth/jwt.validator.ts +3 -3
  23. package/src/auth/provider.auth.ts +1 -1
  24. package/src/auth/resource.metadata.ts +14 -21
  25. package/src/authorization/audit.ts +2 -2
  26. package/src/authorization/capability.classifier.ts +1 -1
  27. package/src/authorization/index.ts +13 -13
  28. package/src/authorization/policy.engine.ts +3 -3
  29. package/src/authorization/policy.types.ts +1 -1
  30. package/src/authorization/runtime.ts +5 -5
  31. package/src/authorization/slot.resource.ts +1 -1
  32. package/src/authorization/subject.mapper.ts +1 -1
  33. package/src/bin.ts +38 -8
  34. package/src/broker/adapters/broker.adapter.info.ts +1 -1
  35. package/src/broker/adapters/broker.adapter.providers.ts +1 -1
  36. package/src/broker/aggregate/aggregate.catalog.ts +1 -1
  37. package/src/broker/aggregate/aggregate.server.ts +7 -7
  38. package/src/broker/aggregate/provider.client.session.ts +2 -2
  39. package/src/broker/behaviors/broker.behavior.info.ts +3 -3
  40. package/src/broker/behaviors/broker.behavior.providers.ts +5 -5
  41. package/src/broker/broker.grammars.ts +9 -9
  42. package/src/broker/broker.server.ts +6 -6
  43. package/src/broker/grammars/claude/en.json +1 -1
  44. package/src/broker/grammars/claude/fr.json +1 -1
  45. package/src/broker/index.ts +9 -9
  46. package/src/config.ts +25 -3
  47. package/src/index.ts +24 -24
  48. package/src/{mcpb.loader.ts → mcpb/mcpb.loader.ts} +11 -11
  49. package/src/{mcpb.unzip.ts → mcpb/mcpb.unzip.ts} +2 -2
  50. package/src/remote.transports.ts +3 -3
  51. package/src/remote.upstream.ts +3 -3
  52. package/src/stdio.upstream.ts +2 -2
  53. package/src/upstream.ts +2 -2
  54. package/src/ws/ws.interfaces.ts +357 -0
  55. package/src/{ws.tunnel.builder.ts → ws/ws.tunnel.builder.ts} +28 -5
  56. package/src/{ws.tunnel.ts → ws/ws.tunnel.ts} +231 -467
  57. package/web/README.md +3 -3
  58. package/web/broker-self-mcp.html +9 -9
  59. package/web/css/styles.css +1 -1
  60. package/web/demos/DemoPlaceholder.html +6 -6
  61. package/web/demos/broker-explorer/css/app.css +1 -1
  62. package/web/demos/broker-explorer/index.html +2 -2
  63. package/web/demos/broker-explorer/js/app.js +4 -4
  64. package/web/demos/broker-explorer/js/mcp-ws-client.js +2 -2
  65. package/web/demos/oauth-lab/README.md +26 -0
  66. package/web/demos/oauth-lab/config.json +1 -0
  67. package/web/demos/oauth-lab/js/app.js +40 -16
  68. package/web/demos/oauth-lab/server/smoke-test.mjs +57 -10
  69. package/web/demos/provider-tunnel/css/app.css +1 -1
  70. package/web/demos/provider-tunnel/index.html +3 -3
  71. package/web/demos/provider-tunnel/js/app.js +10 -10
  72. package/web/demos/provider-tunnel/js/toolbox-server.js +5 -5
  73. package/web/index.html +11 -11
  74. package/web/js/lib/broker-tunnel.js +12 -12
  75. package/dist/auth/auth.config.d.ts +0 -40
  76. package/dist/auth/auth.config.js +0 -62
  77. package/dist/auth/auth.config.js.map +0 -1
  78. package/dist/auth/auth.types.d.ts +0 -119
  79. package/dist/auth/auth.types.js +0 -38
  80. package/dist/auth/auth.types.js.map +0 -1
  81. package/dist/auth/http.auth.d.ts +0 -51
  82. package/dist/auth/http.auth.js +0 -121
  83. package/dist/auth/http.auth.js.map +0 -1
  84. package/dist/auth/index.d.ts +0 -16
  85. package/dist/auth/index.js +0 -12
  86. package/dist/auth/index.js.map +0 -1
  87. package/dist/auth/jwt.validator.d.ts +0 -35
  88. package/dist/auth/jwt.validator.js +0 -46
  89. package/dist/auth/jwt.validator.js.map +0 -1
  90. package/dist/auth/provider.auth.d.ts +0 -51
  91. package/dist/auth/provider.auth.js +0 -80
  92. package/dist/auth/provider.auth.js.map +0 -1
  93. package/dist/auth/resource.metadata.d.ts +0 -32
  94. package/dist/auth/resource.metadata.js +0 -26
  95. package/dist/auth/resource.metadata.js.map +0 -1
  96. package/dist/authorization/audit.d.ts +0 -14
  97. package/dist/authorization/audit.js +0 -20
  98. package/dist/authorization/audit.js.map +0 -1
  99. package/dist/authorization/capability.classifier.d.ts +0 -30
  100. package/dist/authorization/capability.classifier.js +0 -85
  101. package/dist/authorization/capability.classifier.js.map +0 -1
  102. package/dist/authorization/index.d.ts +0 -13
  103. package/dist/authorization/index.js +0 -8
  104. package/dist/authorization/index.js.map +0 -1
  105. package/dist/authorization/policy.engine.d.ts +0 -11
  106. package/dist/authorization/policy.engine.js +0 -192
  107. package/dist/authorization/policy.engine.js.map +0 -1
  108. package/dist/authorization/policy.types.d.ts +0 -92
  109. package/dist/authorization/policy.types.js +0 -2
  110. package/dist/authorization/policy.types.js.map +0 -1
  111. package/dist/authorization/resource.path.d.ts +0 -27
  112. package/dist/authorization/resource.path.js +0 -122
  113. package/dist/authorization/resource.path.js.map +0 -1
  114. package/dist/authorization/runtime.d.ts +0 -22
  115. package/dist/authorization/runtime.js +0 -34
  116. package/dist/authorization/runtime.js.map +0 -1
  117. package/dist/authorization/slot.resource.d.ts +0 -12
  118. package/dist/authorization/slot.resource.js +0 -41
  119. package/dist/authorization/slot.resource.js.map +0 -1
  120. package/dist/authorization/subject.mapper.d.ts +0 -15
  121. package/dist/authorization/subject.mapper.js +0 -67
  122. package/dist/authorization/subject.mapper.js.map +0 -1
  123. package/dist/broker/adapters/broker.adapter.info.d.ts +0 -16
  124. package/dist/broker/adapters/broker.adapter.info.js +0 -43
  125. package/dist/broker/adapters/broker.adapter.info.js.map +0 -1
  126. package/dist/broker/adapters/broker.adapter.providers.d.ts +0 -18
  127. package/dist/broker/adapters/broker.adapter.providers.js +0 -61
  128. package/dist/broker/adapters/broker.adapter.providers.js.map +0 -1
  129. package/dist/broker/aggregate/aggregate.catalog.d.ts +0 -66
  130. package/dist/broker/aggregate/aggregate.catalog.js +0 -119
  131. package/dist/broker/aggregate/aggregate.catalog.js.map +0 -1
  132. package/dist/broker/aggregate/aggregate.server.d.ts +0 -66
  133. package/dist/broker/aggregate/aggregate.server.js +0 -257
  134. package/dist/broker/aggregate/aggregate.server.js.map +0 -1
  135. package/dist/broker/aggregate/provider.client.session.d.ts +0 -52
  136. package/dist/broker/aggregate/provider.client.session.js +0 -140
  137. package/dist/broker/aggregate/provider.client.session.js.map +0 -1
  138. package/dist/broker/behaviors/broker.behavior.info.d.ts +0 -15
  139. package/dist/broker/behaviors/broker.behavior.info.js +0 -41
  140. package/dist/broker/behaviors/broker.behavior.info.js.map +0 -1
  141. package/dist/broker/behaviors/broker.behavior.providers.d.ts +0 -19
  142. package/dist/broker/behaviors/broker.behavior.providers.js +0 -69
  143. package/dist/broker/behaviors/broker.behavior.providers.js.map +0 -1
  144. package/dist/broker/broker.context.d.ts +0 -63
  145. package/dist/broker/broker.context.js +0 -2
  146. package/dist/broker/broker.context.js.map +0 -1
  147. package/dist/broker/broker.grammars.d.ts +0 -132
  148. package/dist/broker/broker.grammars.js +0 -229
  149. package/dist/broker/broker.grammars.js.map +0 -1
  150. package/dist/broker/broker.server.d.ts +0 -68
  151. package/dist/broker/broker.server.js +0 -73
  152. package/dist/broker/broker.server.js.map +0 -1
  153. package/dist/broker/index.d.ts +0 -9
  154. package/dist/broker/index.js +0 -7
  155. package/dist/broker/index.js.map +0 -1
  156. package/dist/config.d.ts +0 -182
  157. package/dist/config.js +0 -61
  158. package/dist/config.js.map +0 -1
  159. package/dist/mcpb.loader.d.ts +0 -26
  160. package/dist/mcpb.loader.js +0 -161
  161. package/dist/mcpb.loader.js.map +0 -1
  162. package/dist/mcpb.unzip.d.ts +0 -6
  163. package/dist/mcpb.unzip.js +0 -95
  164. package/dist/mcpb.unzip.js.map +0 -1
  165. package/dist/remote.transports.d.ts +0 -18
  166. package/dist/remote.transports.js +0 -297
  167. package/dist/remote.transports.js.map +0 -1
  168. package/dist/remote.upstream.d.ts +0 -38
  169. package/dist/remote.upstream.js +0 -52
  170. package/dist/remote.upstream.js.map +0 -1
  171. package/dist/stdio.upstream.d.ts +0 -47
  172. package/dist/stdio.upstream.js +0 -85
  173. package/dist/stdio.upstream.js.map +0 -1
  174. package/dist/upstream.d.ts +0 -35
  175. package/dist/upstream.js +0 -2
  176. package/dist/upstream.js.map +0 -1
  177. package/dist/version.d.ts +0 -2
  178. package/dist/version.js +0 -9
  179. package/dist/version.js.map +0 -1
  180. package/dist/ws.tunnel.builder.d.ts +0 -176
  181. package/dist/ws.tunnel.builder.js +0 -271
  182. package/dist/ws.tunnel.builder.js.map +0 -1
  183. package/dist/ws.tunnel.d.ts +0 -455
  184. package/dist/ws.tunnel.js +0 -1425
  185. package/dist/ws.tunnel.js.map +0 -1
  186. /package/dist/{broker/grammars → grammars}/default/en.json +0 -0
  187. /package/dist/{broker/grammars → grammars}/default/fr.json +0 -0
  188. /package/dist/{broker/grammars → grammars}/default/zh.json +0 -0
package/dist/index.js CHANGED
@@ -1,19 +1,3 @@
1
- export { WsTunnel } from "./ws.tunnel.js";
2
- export { WsTunnelBuilder } from "./ws.tunnel.builder.js";
3
- export { StdioUpstream } from "./stdio.upstream.js";
4
- export { RemoteUpstream } from "./remote.upstream.js";
5
- // `.mcpb` bundle loading — verifies + unpacks a bundle into a stdio upstream.
6
- export { loadMcpbBundle } from "./mcpb.loader.js";
7
- export { unzipMcpb } from "./mcpb.unzip.js";
8
- // Broker introspection — tier 1.
9
- export { BrokerInfoBehavior, BrokerProvidersBehavior, startBrokerServer, BROKER_PROVIDER_NAME } from "./broker/index.js";
10
- export { brokerGrammarKey, iterAvailableBrokerGrammars, iterBrokerGrammarsFrom, loadBrokerGrammar } from "./broker/index.js";
11
- export { VERSION, PACKAGE_NAME } from "./version.js";
12
- // OAuth 2.1 resource-server authorization.
13
- export { AuthError, scopesOf, JwtTokenValidator, buildResourceMetadata, HttpAuthGuard, buildJwtAuth, normalizeProviderAuthentication, providerMayPublish, SharedSecretProviderAuthenticator, } from "./auth/index.js";
14
- // Hierarchical, domain-neutral authorization.
15
- export { ConfigPolicyEngine, ConfiguredCapabilityClassifier, DefaultSlotResourceResolver, JwtSubjectMapper, ResourcePath, ResourcePathPattern, SubjectMappingError, authorizationWithEngine, compileAuthorizationPolicy, hasAuthorizationPolicies, validateCapability, } from "./authorization/index.js";
16
- // JSON config file used by `bin.ts` at startup. Exported so a programmatic
17
- // embedder can re-use the same loader against a custom path.
18
- export { loadBrokerConfig, DEFAULT_CONFIG_FILENAME } from "./config.js";
1
+ export { AuthError, BROKER_PROVIDER_NAME, BrokerInfoBehavior, BrokerProvidersBehavior, ConfigPolicyEngine, ConfiguredCapabilityClassifier, DEFAULT_CONFIG_FILENAME, DefaultSlotResourceResolver, HttpAuthGuard, JwtSubjectMapper, JwtTokenValidator, PACKAGE_NAME, RemoteUpstream, ResourcePath, ResourcePathPattern, SharedSecretProviderAuthenticator, StdioUpstream, SubjectMappingError, VERSION, WsTunnel, WsTunnelBuilder, authorizationWithEngine, brokerGrammarKey, buildJwtAuth, buildResourceMetadata, compileAuthorizationPolicy, hasAuthorizationPolicies, iterAvailableBrokerGrammars, iterBrokerGrammarsFrom, loadBrokerConfig, loadBrokerGrammar, loadMcpbBundle, normalizeProviderAuthentication, providerMayPublish, scopesOf, startBrokerServer, unzipMcpb, validateCapability } from './chunk-FTDKH2C4.js';
2
+ //# sourceMappingURL=index.js.map
19
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,8EAA8E;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,iCAAiC;AACjC,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzH,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAa7H,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAErD,2CAA2C;AAC3C,OAAO,EACH,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,+BAA+B,EAC/B,kBAAkB,EAClB,iCAAiC,GACpC,MAAM,iBAAiB,CAAC;AA0BzB,8CAA8C;AAC9C,OAAO,EACH,kBAAkB,EAClB,8BAA8B,EAC9B,2BAA2B,EAC3B,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,GACrB,MAAM,0BAA0B,CAAC;AAyClC,2EAA2E;AAC3E,6DAA6D;AAC7D,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanmycelium/mcp-broker",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "WebSocket-based Model Context Protocol broker. Aggregates multiple MCP providers behind a single endpoint with stdio, SSE, and Streamable HTTP client transports.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -8,7 +8,7 @@
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/pandaGaume/mcp-broker.git",
11
- "directory": "node"
11
+ "directory": "node/packages/broker"
12
12
  },
13
13
  "homepage": "https://github.com/pandaGaume/mcp-broker#readme",
14
14
  "bugs": {
@@ -49,11 +49,11 @@
49
49
  }
50
50
  },
51
51
  "scripts": {
52
- "build": "npm run clean && npm run compile && npm run copy:assets",
53
- "clean": "rimraf dist tsconfig.build.tsbuildinfo",
54
- "compile": "tsc -b tsconfig.build.json",
52
+ "build": "tsup && npm run copy:assets",
53
+ "clean": "rimraf dist",
55
54
  "copy:assets": "node scripts/copy-assets.mjs",
56
- "watch": "tsc -b tsconfig.build.json -w",
55
+ "watch": "tsup --watch",
56
+ "typecheck": "tsc -p tsconfig.json --noEmit",
57
57
  "start": "node dist/bin.js",
58
58
  "pack:mcpb": "npm run build && node scripts/pack-mcpb.mjs",
59
59
  "test": "vitest run",
@@ -68,12 +68,13 @@
68
68
  "prepublishOnly": "npm run lint && npm run build && npm test"
69
69
  },
70
70
  "dependencies": {
71
- "@cyanmycelium/mcp-core": "^0.3.0",
71
+ "@cyanmycelium/mcp-core": "^0.7.0",
72
72
  "jose": "^6.2.3",
73
73
  "open": "^11.0.0",
74
74
  "ws": "^8.18.0"
75
75
  },
76
76
  "devDependencies": {
77
+ "@cyanmycelium/mcp-broker-provider": "^0.1.0",
77
78
  "@types/node": "^20.11.0",
78
79
  "@types/ws": "^8.5.0",
79
80
  "@typescript-eslint/eslint-plugin": "^7.0.0",
@@ -85,6 +86,7 @@
85
86
  "rimraf": "~6.0.1",
86
87
  "selfsigned": "^2.4.1",
87
88
  "tslib": "^2.8.1",
89
+ "tsup": "^8.5.1",
88
90
  "typescript": "^5.4.0",
89
91
  "vitest": "^4.1.9"
90
92
  }
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * Copies non-TypeScript assets from `src/` to `dist/`.
3
3
  *
4
- * tsc does not copy non-`.ts` files (e.g. `.json`, `.proto`, `.txt`) to the
5
- * output directory. This script walks the known asset directories and mirrors
6
- * them under `dist/`, preserving their relative layout so runtime
7
- * `fileURLToPath(import.meta.url)`-based resolution keeps working.
4
+ * A bundler emits no `.json`, and it also **flattens the module tree**: code
5
+ * that lived in `src/broker/` ends up in a bundle at the root of `dist/`. Any
6
+ * asset resolved at runtime from `fileURLToPath(import.meta.url)` must therefore
7
+ * be copied next to the bundle, not to a path mirroring the source layout.
8
+ *
9
+ * That is why each entry below is an explicit `from → to` pair rather than a
10
+ * single relative path: the two sides genuinely differ, and assuming otherwise
11
+ * builds a `dist` that passes every test (they run against `src`) and fails
12
+ * the moment the published artifact is executed.
8
13
  *
9
14
  * Usage (called from npm scripts):
10
15
  * node scripts/copy-assets.mjs
@@ -18,17 +23,18 @@ const here = dirname(fileURLToPath(import.meta.url));
18
23
  const root = join(here, "..");
19
24
 
20
25
  const assets = [
21
- // Broker grammar resources (loaded at runtime by broker.grammars.ts)
22
- "broker/grammars",
26
+ // Broker grammars, read at runtime by broker.grammars.ts relative to its own
27
+ // module. Bundled, that module sits at the root of `dist`.
28
+ { from: "broker/grammars", to: "grammars" },
23
29
  ];
24
30
 
25
- for (const rel of assets) {
26
- const src = join(root, "src", rel);
27
- const dst = join(root, "dist", rel);
31
+ for (const { from, to } of assets) {
32
+ const src = join(root, "src", from);
33
+ const dst = join(root, "dist", to);
28
34
  if (!existsSync(src)) {
29
35
  console.warn(`[copy-assets] skipping missing source: ${src}`);
30
36
  continue;
31
37
  }
32
38
  cpSync(src, dst, { recursive: true });
33
- console.log(`[copy-assets] copied ${rel}`);
39
+ console.log(`[copy-assets] copied ${from} -> dist/${to}`);
34
40
  }
@@ -2,12 +2,12 @@
2
2
  * Generates a self-signed TLS certificate for local development.
3
3
  *
4
4
  * Usage (from the `node/` directory):
5
- * npm run gen-cert — writes to ../certs/ (repo root)
6
- * npm run gen-cert -- --out <dir> — writes to a custom directory
5
+ * npm run gen-cert , writes to ../certs/ (repo root)
6
+ * npm run gen-cert -- --out <dir> , writes to a custom directory
7
7
  *
8
8
  * Outputs:
9
- * <outDir>/cert.pem — TLS certificate (pass as MCP_BROKER_TLS_CERT)
10
- * <outDir>/key.pem — Private key (pass as MCP_BROKER_TLS_KEY)
9
+ * <outDir>/cert.pem , TLS certificate (pass as MCP_BROKER_TLS_CERT)
10
+ * <outDir>/key.pem , Private key (pass as MCP_BROKER_TLS_KEY)
11
11
  *
12
12
  * The certificate covers: localhost, 127.0.0.1, ::1
13
13
  * Validity: 365 days | Key: RSA 2048-bit
@@ -20,7 +20,7 @@ import { mkdirSync, writeFileSync } from "fs";
20
20
  import { resolve, join } from "path";
21
21
  import { createRequire } from "module";
22
22
 
23
- // selfsigned is a CJS module — use createRequire for a clean import from ESM.
23
+ // selfsigned is a CJS module, use createRequire for a clean import from ESM.
24
24
  const require = createRequire(import.meta.url);
25
25
  const selfsigned = require("selfsigned");
26
26
 
@@ -12,7 +12,7 @@
12
12
  * ├── node_modules/ ← npm install --omit=dev (the host does not install)
13
13
  * └── dist/ ← compiled broker
14
14
  *
15
- * Requires `dist/` to exist — run `npm run build` first (the `pack:mcpb`
15
+ * Requires `dist/` to exist, run `npm run build` first (the `pack:mcpb`
16
16
  * npm script chains it).
17
17
  *
18
18
  * Usage (from node/):
@@ -35,13 +35,13 @@ function run(command, args, cwd) {
35
35
  }
36
36
  }
37
37
 
38
- // ── Read package metadata — single source of truth for version + deps ───────
38
+ // ── Read package metadata, single source of truth for version + deps ───────
39
39
  const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
40
40
  const { version, dependencies } = pkg;
41
41
 
42
42
  // ── Preconditions ───────────────────────────────────────────────────────────
43
43
  if (!existsSync(join(root, "dist", "bin.js"))) {
44
- console.error("[pack-mcpb] dist/bin.js not found — run `npm run build` first.");
44
+ console.error("[pack-mcpb] dist/bin.js not found, run `npm run build` first.");
45
45
  process.exit(1);
46
46
  }
47
47
 
@@ -55,7 +55,7 @@ mkdirSync(stage, { recursive: true });
55
55
  cpSync(join(root, "dist"), join(stage, "dist"), { recursive: true });
56
56
  console.log("[pack-mcpb] copied dist/");
57
57
 
58
- // ── Production package.json — drives the bundled npm install ────────────────
58
+ // ── Production package.json, drives the bundled npm install ────────────────
59
59
  // type=module is required so Node treats the compiled .js as ESM.
60
60
  writeFileSync(
61
61
  join(stage, "package.json"),
@@ -81,4 +81,4 @@ console.log("[pack-mcpb] running mcpb pack …");
81
81
  run("npx", ["--yes", "@anthropic-ai/mcpb@2", "pack", stage, output]);
82
82
 
83
83
  const sizeMb = (statSync(output).size / 1024 / 1024).toFixed(2);
84
- console.log(`[pack-mcpb] done — ${output} (${sizeMb} MB)`);
84
+ console.log(`[pack-mcpb] done, ${output} (${sizeMb} MB)`);
@@ -1,22 +1,22 @@
1
1
  /**
2
- * Signs `.mcpb` bundles for the broker's bundle loader — built-ins only.
2
+ * Signs `.mcpb` bundles for the broker's bundle loader, built-ins only.
3
3
  *
4
4
  * The broker verifies a **detached signature** of a `.mcpb` file against a
5
5
  * trusted public key (see `src/mcpb.loader.ts`). This script produces that
6
- * signature using `node:crypto` only — no dependency on OpenSSL or the
6
+ * signature using `node:crypto` only: no dependency on OpenSSL or the
7
7
  * `@anthropic-ai/mcpb` CLI.
8
8
  *
9
9
  * Usage (from the `node/` directory):
10
10
  *
11
11
  * node scripts/sign-bundle.mjs keygen [outDir]
12
12
  * Generates an Ed25519 key pair:
13
- * <outDir>/mcpb-signing.key.pem — private key (keep secret)
14
- * <outDir>/mcpb-signing.pub.pem — public key (point `publicKey` at this)
13
+ * <outDir>/mcpb-signing.key.pem , private key (keep secret)
14
+ * <outDir>/mcpb-signing.pub.pem , public key (point `publicKey` at this)
15
15
  * outDir defaults to the current directory.
16
16
  *
17
17
  * node scripts/sign-bundle.mjs sign <bundle.mcpb> <privateKey.pem> [signaturePath]
18
18
  * Writes the detached signature. signaturePath defaults to
19
- * `<bundle.mcpb>.sig` — the path the broker looks for by default.
19
+ * `<bundle.mcpb>.sig`: the path the broker looks for by default.
20
20
  */
21
21
  import { generateKeyPairSync, createPrivateKey, sign } from "node:crypto";
22
22
  import { readFileSync, writeFileSync } from "node:fs";
@@ -57,5 +57,5 @@ if (command === "keygen") {
57
57
  writeFileSync(sigPath, signature);
58
58
  console.log(`[sign-bundle] signature (${keyType}) → ${sigPath}`);
59
59
  } else {
60
- fail('unknown command — use "keygen" or "sign". See the file header for usage.');
60
+ fail('unknown command, use "keygen" or "sign". See the file header for usage.');
61
61
  }
@@ -1,6 +1,6 @@
1
- import { JwtTokenValidator } from "./jwt.validator.js";
2
- import type { AggregateScopeFilter, IResolvedAuth } from "./auth.types.js";
3
- import { compileAuthorizationPolicy, DefaultSlotResourceResolver, hasAuthorizationPolicies, type IAuthorizationPolicyConfig } from "../authorization/index.js";
1
+ import { JwtTokenValidator } from "./jwt.validator";
2
+ import type { AggregateScopeFilter, IResolvedAuth } from "./auth.types";
3
+ import { compileAuthorizationPolicy, DefaultSlotResourceResolver, hasAuthorizationPolicies, type IAuthorizationPolicyConfig } from "../authorization/index";
4
4
 
5
5
  /**
6
6
  * High-level options for the default JWT/JWKS resource-server setup. Mirrors the
@@ -6,73 +6,44 @@
6
6
  * Protected Resource Metadata (RFC 9728). These types are the seam every other
7
7
  * auth module builds on, so a host can drop in a custom {@link ITokenValidator}
8
8
  * (e.g. RFC 7662 introspection) without touching the enforcement code.
9
+ *
10
+ * Everything the MCP specification itself defines comes from `mcp-core` and is
11
+ * re-exported here under the broker's historical names: the claim shape, the
12
+ * validator seam, the error carrying a challenge. What stays broker-owned is
13
+ * what the spec does not define, namely a multi-slot resource server whose
14
+ * principals feed a hierarchical policy engine.
9
15
  */
10
- import type { IAuthorizationSubject, IPolicyAuthorization, ISlotResourceResolver } from "../authorization/index.js";
11
-
12
- /**
13
- * The subset of OAuth 2.1 / RFC 9068 access-token claims a resource server
14
- * cares about. `aud` carries the audience binding (RFC 8707), `scope` the
15
- * space-delimited granted scopes; some authorization servers emit `scopes` as
16
- * an array instead. Unknown claims are preserved via the index signature.
17
- */
18
- export interface IAccessTokenClaims {
19
- /** Subject — the principal the token was issued for. */
20
- sub?: string;
21
- /** Intended audience(s). MUST include the slot's canonical resource URI. */
22
- aud?: string | string[];
23
- /** Issuer (the authorization server). */
24
- iss?: string;
25
- /** Expiry, seconds since the epoch. */
26
- exp?: number;
27
- /** Space-delimited granted scopes (RFC 8693). */
28
- scope?: string;
29
- /** Array-form granted scopes, emitted by some authorization servers. */
30
- scopes?: string[];
31
- [claim: string]: unknown;
32
- }
16
+ import { McpAuthError, scopesOf as mcpScopesOf, type IAccessTokenClaims, type IMcpPrincipal, type ITokenValidator } from "@cyanmycelium/mcp-core";
17
+ import type { IAuthorizationSubject, IPolicyAuthorization, ISlotResourceResolver } from "../authorization/index";
33
18
 
34
- /**
35
- * Validates a bearer access token for a specific resource. Implementations MUST
36
- * verify the token's signature/validity **and** that it was issued for
37
- * `resource` (audience binding, RFC 8707). On any failure they MUST throw an
38
- * {@link AuthError} with status `401` and code `invalid_token`; unexpected
39
- * infrastructure failures (e.g. JWKS unreachable) should throw a plain error so
40
- * the caller can surface a `500` rather than a misleading `401`.
41
- */
42
- export interface ITokenValidator {
43
- validate(token: string, resource: string): Promise<IAccessTokenClaims>;
44
- }
19
+ export type { IAccessTokenClaims, ITokenValidator } from "@cyanmycelium/mcp-core";
45
20
 
46
21
  /** OAuth 2.1 error codes the broker emits in `WWW-Authenticate` challenges. */
47
- export type AuthErrorCode = "invalid_token" | "insufficient_scope" | "invalid_request";
22
+ export type AuthErrorCode = import("@cyanmycelium/mcp-core").McpAuthErrorCode;
48
23
 
49
24
  /**
50
25
  * A thrown authorization failure carrying the HTTP status and OAuth error code
51
26
  * the enforcement point should surface. `scope` is set for `insufficient_scope`
52
27
  * challenges to advertise the scope(s) the resource requires.
28
+ *
29
+ * The broker's own name for `mcp-core`'s `McpAuthError`, kept so `instanceof`
30
+ * checks and the published API survive the consolidation. There is one class at
31
+ * runtime, so an error thrown by `mcp-core` is caught by the broker and the
32
+ * other way round.
53
33
  */
54
- export class AuthError extends Error {
55
- readonly status: 401 | 403 | 400;
56
- readonly code: AuthErrorCode;
57
- readonly description?: string;
58
- readonly scope?: string;
59
-
60
- constructor(status: 401 | 403 | 400, code: AuthErrorCode, description?: string, scope?: string) {
61
- super(description ?? code);
62
- this.name = "AuthError";
63
- this.status = status;
64
- this.code = code;
65
- this.description = description;
66
- this.scope = scope;
67
- }
68
- }
34
+ export const AuthError = McpAuthError;
35
+ export type AuthError = McpAuthError;
69
36
 
70
37
  /**
71
38
  * The authenticated caller, produced once a token passes validation and the
72
39
  * required scopes are satisfied. Threaded through the request so downstream
73
40
  * components (e.g. the `_all` aggregate) can make scope-aware decisions.
41
+ *
42
+ * Extends `mcp-core`'s principal with the subject the policy engine reasons
43
+ * about, which the specification says nothing about and which therefore stays
44
+ * here.
74
45
  */
75
- export interface IPrincipal {
46
+ export interface IPrincipal extends IMcpPrincipal {
76
47
  readonly claims: IAccessTokenClaims;
77
48
  readonly scopes: ReadonlySet<string>;
78
49
  /** Subjects derived exclusively from validated token claims. */
@@ -121,16 +92,20 @@ export interface IResolvedAuth {
121
92
  }
122
93
 
123
94
  /**
124
- * Extracts the effective set of granted scopes from token claims, unioning the
125
- * space-delimited `scope` string and the array-form `scopes` claim.
95
+ * Extracts the effective set of granted scopes from token claims.
96
+ *
97
+ * A deliberate superset of `mcp-core`'s: OAuth 2.1 only defines the
98
+ * space-delimited `scope` string, which is what the spec-level helper reads,
99
+ * but several authorization servers emit an array-form `scopes` claim instead.
100
+ * Dropping that here would silently strip every scope for those deployments, so
101
+ * the two are unioned. The `scope` half is parsed by `mcp-core` rather than
102
+ * re-implemented.
126
103
  */
127
104
  export function scopesOf(claims: IAccessTokenClaims): Set<string> {
128
- const set = new Set<string>();
129
- if (typeof claims.scope === "string") {
130
- for (const s of claims.scope.split(/\s+/)) if (s) set.add(s);
131
- }
132
- if (Array.isArray(claims.scopes)) {
133
- for (const s of claims.scopes) if (typeof s === "string" && s) set.add(s);
105
+ const set = new Set<string>(mcpScopesOf(claims));
106
+ const arrayForm: unknown = claims["scopes"];
107
+ if (Array.isArray(arrayForm)) {
108
+ for (const scope of arrayForm) if (typeof scope === "string" && scope) set.add(scope);
134
109
  }
135
110
  return set;
136
111
  }
@@ -1,22 +1,16 @@
1
1
  import type { IncomingMessage, ServerResponse } from "http";
2
- import { AuthError, scopesOf, type IPrincipal, type IResolvedAuth } from "./auth.types.js";
3
- import { buildResourceMetadata, type IProtectedResourceMetadata } from "./resource.metadata.js";
4
- import { SubjectMappingError } from "../authorization/index.js";
2
+ import { bearerToken, buildChallengeHeader, PROTECTED_RESOURCE_METADATA_PREFIX } from "@cyanmycelium/mcp-core";
3
+ import { AuthError, scopesOf, type IPrincipal, type IResolvedAuth } from "./auth.types";
4
+ import { buildResourceMetadata, type IProtectedResourceMetadata } from "./resource.metadata";
5
+ import { SubjectMappingError } from "../authorization/index";
5
6
 
6
- /** Well-known prefix under which per-slot Protected Resource Metadata is served. */
7
- const PRM_PREFIX = "/.well-known/oauth-protected-resource/";
8
-
9
- /** Extracts the bearer token from an `Authorization` header, or `null`. */
10
- function extractBearer(header: string | string[] | undefined): string | null {
11
- if (typeof header !== "string") return null;
12
- const match = /^Bearer\s+(.+)$/i.exec(header.trim());
13
- return match ? match[1].trim() : null;
14
- }
15
-
16
- /** Strips characters that would break (or inject into) an HTTP header value. */
17
- function headerSafe(value: string): string {
18
- return value.replace(/[\r\n"]/g, " ").trim();
19
- }
7
+ /**
8
+ * Well-known prefix under which per-slot Protected Resource Metadata is served.
9
+ *
10
+ * Carries a trailing slash because every use here splits a slot off it, while
11
+ * `mcp-core` exports the bare RFC 9728 prefix.
12
+ */
13
+ const PRM_PREFIX = `${PROTECTED_RESOURCE_METADATA_PREFIX}/`;
20
14
 
21
15
  /**
22
16
  * The HTTP enforcement point for the resource-server layer. Wraps a
@@ -81,7 +75,7 @@ export class HttpAuthGuard {
81
75
  * `403` insufficient scope) otherwise.
82
76
  */
83
77
  async authorize(req: IncomingMessage, slot: string): Promise<IPrincipal> {
84
- const token = extractBearer(req.headers["authorization"]);
78
+ const token = bearerToken(req.headers["authorization"]);
85
79
  if (!token) {
86
80
  throw new AuthError(401, "invalid_token", "Missing bearer token");
87
81
  }
@@ -114,10 +108,12 @@ export class HttpAuthGuard {
114
108
  * authorization server and retry. Shared by the HTTP and WebSocket paths.
115
109
  */
116
110
  challengeHeader(slot: string, err: AuthError): string {
117
- const params = [`resource_metadata="${this.metadataUrlFor(slot)}"`, `error="${err.code}"`];
118
- if (err.description) params.push(`error_description="${headerSafe(err.description)}"`);
119
- if (err.scope) params.push(`scope="${headerSafe(err.scope)}"`);
120
- return `Bearer ${params.join(", ")}`;
111
+ return buildChallengeHeader({
112
+ resourceMetadata: this.metadataUrlFor(slot),
113
+ error: err.code,
114
+ errorDescription: err.description,
115
+ scope: err.scope,
116
+ });
121
117
  }
122
118
 
123
119
  /**
package/src/auth/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Barrel for the broker's OAuth 2.1 resource-server layer. See the individual
3
3
  * modules for details; the transport wires these up in `ws.tunnel.ts`.
4
4
  */
5
- export { AuthError, scopesOf } from "./auth.types.js";
5
+ export { AuthError, scopesOf } from "./auth.types";
6
6
  export type {
7
7
  IAccessTokenClaims,
8
8
  ITokenValidator,
@@ -14,16 +14,16 @@ export type {
14
14
  TokenValidator,
15
15
  Principal,
16
16
  ResolvedAuth,
17
- } from "./auth.types.js";
18
- export { JwtTokenValidator } from "./jwt.validator.js";
19
- export type { IJwtValidatorOptions, JwtValidatorOptions } from "./jwt.validator.js";
20
- export { buildResourceMetadata } from "./resource.metadata.js";
21
- export type { IProtectedResourceMetadata, ProtectedResourceMetadata } from "./resource.metadata.js";
22
- export { HttpAuthGuard } from "./http.auth.js";
23
- export { buildJwtAuth } from "./auth.config.js";
24
- export type { IJwtAuthOptions, JwtAuthOptions } from "./auth.config.js";
25
- export { SharedSecretProviderAuthenticator } from "./provider.auth.js";
26
- export { normalizeProviderAuthentication, providerMayPublish } from "./provider.auth.js";
17
+ } from "./auth.types";
18
+ export { JwtTokenValidator } from "./jwt.validator";
19
+ export type { IJwtValidatorOptions, JwtValidatorOptions } from "./jwt.validator";
20
+ export { buildResourceMetadata } from "./resource.metadata";
21
+ export type { IProtectedResourceMetadata, ProtectedResourceMetadata } from "./resource.metadata";
22
+ export { HttpAuthGuard } from "./http.auth";
23
+ export { buildJwtAuth } from "./auth.config";
24
+ export type { IJwtAuthOptions, JwtAuthOptions } from "./auth.config";
25
+ export { SharedSecretProviderAuthenticator } from "./provider.auth";
26
+ export { normalizeProviderAuthentication, providerMayPublish } from "./provider.auth";
27
27
  export type {
28
28
  IProviderAuthenticator,
29
29
  IProviderPrincipal,
@@ -31,4 +31,4 @@ export type {
31
31
  ProviderAuthenticator,
32
32
  ProviderAuthenticatorReturn,
33
33
  ProviderPrincipal,
34
- } from "./provider.auth.js";
34
+ } from "./provider.auth";
@@ -1,5 +1,5 @@
1
1
  import { createRemoteJWKSet, jwtVerify, errors, type JWTVerifyGetKey } from "jose";
2
- import { AuthError, type IAccessTokenClaims, type ITokenValidator } from "./auth.types.js";
2
+ import { AuthError, type IAccessTokenClaims, type ITokenValidator } from "./auth.types";
3
3
 
4
4
  /**
5
5
  * Options for {@link JwtTokenValidator}. `jwksUri` points at the authorization
@@ -21,8 +21,8 @@ export interface IJwtValidatorOptions {
21
21
  * no per-request round-trip to the AS, no shared introspection secret.
22
22
  *
23
23
  * Audience binding (RFC 8707) is enforced by passing the per-request canonical
24
- * resource URI as the required `audience`, so a token minted for another slot —
25
- * or another service — is rejected.
24
+ * resource URI as the required `audience`, so a token minted for another slot ,
25
+ * or another service, is rejected.
26
26
  *
27
27
  * The JWKS is fetched lazily and cached (with rotation/cooldown) by
28
28
  * `jose.createRemoteJWKSet`.
@@ -1,6 +1,6 @@
1
1
  import { timingSafeEqual } from "crypto";
2
2
  import type { IncomingMessage } from "http";
3
- import { ResourcePath, ResourcePathPattern } from "../authorization/index.js";
3
+ import { ResourcePath, ResourcePathPattern } from "../authorization/index";
4
4
 
5
5
  export interface IProviderPrincipal {
6
6
  readonly id: string;
@@ -8,33 +8,26 @@
8
8
  * `<publicBaseUrl>/.well-known/oauth-protected-resource/<slot>/<mcp>`.
9
9
  */
10
10
 
11
+ import { buildProtectedResourceMetadata, type IProtectedResourceMetadata } from "@cyanmycelium/mcp-core";
12
+
11
13
  /** The RFC 9728 metadata document for a single protected resource. */
12
- export interface IProtectedResourceMetadata {
13
- /** Canonical resource identifier (RFC 8707) — the slot's `/mcp` endpoint. */
14
- resource: string;
15
- /** Authorization server issuer URLs; MUST contain at least one. */
16
- authorization_servers: string[];
17
- /** Scopes the resource understands, when advertised. */
18
- scopes_supported?: string[];
19
- /** How bearer tokens may be presented. The broker only reads the header. */
20
- bearer_methods_supported: string[];
21
- }
14
+ export type { IProtectedResourceMetadata } from "@cyanmycelium/mcp-core";
22
15
 
23
16
  /**
24
- * Builds the RFC 9728 metadata document for one slot. `bearer_methods_supported`
25
- * is fixed to `["header"]` because the broker rejects tokens passed any other
26
- * way (never the query string, per OAuth 2.1 §5).
17
+ * Builds the RFC 9728 metadata document for one slot.
18
+ *
19
+ * The document itself is shaped by `mcp-core`: it is defined by the MCP
20
+ * specification, identically for every server. What is broker-specific is only
21
+ * which resource a slot maps to, and that is decided by the caller.
22
+ * `bearer_methods_supported` comes out fixed to `["header"]`, matching the
23
+ * broker's refusal to read a token from anywhere but the header (OAuth 2.1 §5).
27
24
  */
28
25
  export function buildResourceMetadata(params: { resource: string; authorizationServers: string[]; scopesSupported?: string[] }): IProtectedResourceMetadata {
29
- const doc: IProtectedResourceMetadata = {
26
+ return buildProtectedResourceMetadata({
30
27
  resource: params.resource,
31
- authorization_servers: params.authorizationServers,
32
- bearer_methods_supported: ["header"],
33
- };
34
- if (params.scopesSupported && params.scopesSupported.length > 0) {
35
- doc.scopes_supported = params.scopesSupported;
36
- }
37
- return doc;
28
+ authorizationServers: params.authorizationServers,
29
+ scopesSupported: params.scopesSupported,
30
+ });
38
31
  }
39
32
 
40
33
  /** @deprecated Use {@link IProtectedResourceMetadata}. */
@@ -1,5 +1,5 @@
1
- import type { IAuthorizationAuditEvent, IAuthorizationDecision, IAuthorizationSubject } from "./policy.types.js";
2
- import type { ResourcePath } from "./resource.path.js";
1
+ import type { IAuthorizationAuditEvent, IAuthorizationDecision, IAuthorizationSubject } from "./policy.types";
2
+ import type { ResourcePath } from "./resource.path";
3
3
 
4
4
  export interface IAuditContext {
5
5
  readonly subject: IAuthorizationSubject;
@@ -1,4 +1,4 @@
1
- import { ResourcePath, ResourcePathPattern } from "./resource.path.js";
1
+ import { ResourcePath, ResourcePathPattern } from "./resource.path";
2
2
 
3
3
  export interface IMcpOperation {
4
4
  readonly method?: string;
@@ -1,15 +1,15 @@
1
- export { ResourcePath, ResourcePathPattern } from "./resource.path.js";
2
- export { ConfiguredCapabilityClassifier, validateCapability } from "./capability.classifier.js";
3
- export type { CapabilityClassifier, ClassifiedCapability, ICapabilityClassifier, IClassifiedCapability, IMcpOperation, McpOperation } from "./capability.classifier.js";
4
- export { ConfigPolicyEngine } from "./policy.engine.js";
5
- export { JwtSubjectMapper, SubjectMappingError } from "./subject.mapper.js";
6
- export type { ISubjectMapper, SubjectMapper } from "./subject.mapper.js";
7
- export { DefaultSlotResourceResolver } from "./slot.resource.js";
8
- export type { ISlotResourceResolver, SlotResourceResolver } from "./slot.resource.js";
9
- export { authorizationWithEngine, compileAuthorizationPolicy, hasAuthorizationPolicies } from "./runtime.js";
10
- export type { IPolicyAuthorization, PolicyAuthorization } from "./runtime.js";
11
- export { makeAuthorizationAuditEvent, writeAuthorizationAuditEvent } from "./audit.js";
12
- export type { AuditContext, IAuditContext } from "./audit.js";
1
+ export { ResourcePath, ResourcePathPattern } from "./resource.path";
2
+ export { ConfiguredCapabilityClassifier, validateCapability } from "./capability.classifier";
3
+ export type { CapabilityClassifier, ClassifiedCapability, ICapabilityClassifier, IClassifiedCapability, IMcpOperation, McpOperation } from "./capability.classifier";
4
+ export { ConfigPolicyEngine } from "./policy.engine";
5
+ export { JwtSubjectMapper, SubjectMappingError } from "./subject.mapper";
6
+ export type { ISubjectMapper, SubjectMapper } from "./subject.mapper";
7
+ export { DefaultSlotResourceResolver } from "./slot.resource";
8
+ export type { ISlotResourceResolver, SlotResourceResolver } from "./slot.resource";
9
+ export { authorizationWithEngine, compileAuthorizationPolicy, hasAuthorizationPolicies } from "./runtime";
10
+ export type { IPolicyAuthorization, PolicyAuthorization } from "./runtime";
11
+ export { makeAuthorizationAuditEvent, writeAuthorizationAuditEvent } from "./audit";
12
+ export type { AuditContext, IAuditContext } from "./audit";
13
13
  export type {
14
14
  AuthorizationAuditConfig,
15
15
  AuthorizationAuditEvent,
@@ -34,4 +34,4 @@ export type {
34
34
  PolicyEngine,
35
35
  RoleDefinition,
36
36
  SubjectMappingConfig,
37
- } from "./policy.types.js";
37
+ } from "./policy.types";
@@ -1,6 +1,6 @@
1
- import { validateCapability } from "./capability.classifier.js";
2
- import type { IAuthorizationDecision, IAuthorizationRequest, IDenyPolicy, IPolicyAssignment, IPolicyEngine, IRoleDefinition } from "./policy.types.js";
3
- import { ResourcePathPattern } from "./resource.path.js";
1
+ import { validateCapability } from "./capability.classifier";
2
+ import type { IAuthorizationDecision, IAuthorizationRequest, IDenyPolicy, IPolicyAssignment, IPolicyEngine, IRoleDefinition } from "./policy.types";
3
+ import { ResourcePathPattern } from "./resource.path";
4
4
 
5
5
  interface ICompiledAssignment {
6
6
  readonly id: string;
@@ -1,4 +1,4 @@
1
- import type { ResourcePath } from "./resource.path.js";
1
+ import type { ResourcePath } from "./resource.path";
2
2
 
3
3
  export interface IAuthorizationSubject {
4
4
  readonly ids: readonly string[];
@@ -1,8 +1,8 @@
1
- import { ConfiguredCapabilityClassifier, type ICapabilityClassifier } from "./capability.classifier.js";
2
- import { ConfigPolicyEngine } from "./policy.engine.js";
3
- import type { IAuthorizationAuditConfig, IAuthorizationPolicyConfig, IPolicyEngine } from "./policy.types.js";
4
- import { DefaultSlotResourceResolver, type ISlotResourceResolver } from "./slot.resource.js";
5
- import { JwtSubjectMapper, type ISubjectMapper } from "./subject.mapper.js";
1
+ import { ConfiguredCapabilityClassifier, type ICapabilityClassifier } from "./capability.classifier";
2
+ import { ConfigPolicyEngine } from "./policy.engine";
3
+ import type { IAuthorizationAuditConfig, IAuthorizationPolicyConfig, IPolicyEngine } from "./policy.types";
4
+ import { DefaultSlotResourceResolver, type ISlotResourceResolver } from "./slot.resource";
5
+ import { JwtSubjectMapper, type ISubjectMapper } from "./subject.mapper";
6
6
 
7
7
  export interface IPolicyAuthorization {
8
8
  readonly engine: IPolicyEngine;