@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.
- package/.mcp-broker.example/README.md +3 -3
- package/README.md +6 -2
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +176 -253
- package/dist/bin.js.map +1 -1
- package/dist/chunk-FTDKH2C4.js +3670 -0
- package/dist/chunk-FTDKH2C4.js.map +1 -0
- package/dist/{broker/grammars → grammars}/claude/en.json +1 -1
- package/dist/{broker/grammars → grammars}/claude/fr.json +1 -1
- package/dist/index.d.ts +1790 -22
- package/dist/index.js +2 -18
- package/dist/index.js.map +1 -1
- package/package.json +9 -7
- package/scripts/copy-assets.mjs +16 -10
- package/scripts/gen-cert.mjs +5 -5
- package/scripts/pack-mcpb.mjs +5 -5
- package/scripts/sign-bundle.mjs +6 -6
- package/src/auth/auth.config.ts +3 -3
- package/src/auth/auth.types.ts +34 -59
- package/src/auth/http.auth.ts +18 -22
- package/src/auth/index.ts +12 -12
- package/src/auth/jwt.validator.ts +3 -3
- package/src/auth/provider.auth.ts +1 -1
- package/src/auth/resource.metadata.ts +14 -21
- package/src/authorization/audit.ts +2 -2
- package/src/authorization/capability.classifier.ts +1 -1
- package/src/authorization/index.ts +13 -13
- package/src/authorization/policy.engine.ts +3 -3
- package/src/authorization/policy.types.ts +1 -1
- package/src/authorization/runtime.ts +5 -5
- package/src/authorization/slot.resource.ts +1 -1
- package/src/authorization/subject.mapper.ts +1 -1
- package/src/bin.ts +38 -8
- package/src/broker/adapters/broker.adapter.info.ts +1 -1
- package/src/broker/adapters/broker.adapter.providers.ts +1 -1
- package/src/broker/aggregate/aggregate.catalog.ts +1 -1
- package/src/broker/aggregate/aggregate.server.ts +7 -7
- package/src/broker/aggregate/provider.client.session.ts +2 -2
- package/src/broker/behaviors/broker.behavior.info.ts +3 -3
- package/src/broker/behaviors/broker.behavior.providers.ts +5 -5
- package/src/broker/broker.grammars.ts +9 -9
- package/src/broker/broker.server.ts +6 -6
- package/src/broker/grammars/claude/en.json +1 -1
- package/src/broker/grammars/claude/fr.json +1 -1
- package/src/broker/index.ts +9 -9
- package/src/config.ts +25 -3
- package/src/index.ts +24 -24
- package/src/{mcpb.loader.ts → mcpb/mcpb.loader.ts} +11 -11
- package/src/{mcpb.unzip.ts → mcpb/mcpb.unzip.ts} +2 -2
- package/src/remote.transports.ts +3 -3
- package/src/remote.upstream.ts +3 -3
- package/src/stdio.upstream.ts +2 -2
- package/src/upstream.ts +2 -2
- package/src/ws/ws.interfaces.ts +357 -0
- package/src/{ws.tunnel.builder.ts → ws/ws.tunnel.builder.ts} +28 -5
- package/src/{ws.tunnel.ts → ws/ws.tunnel.ts} +231 -467
- package/web/README.md +3 -3
- package/web/broker-self-mcp.html +9 -9
- package/web/css/styles.css +1 -1
- package/web/demos/DemoPlaceholder.html +6 -6
- package/web/demos/broker-explorer/css/app.css +1 -1
- package/web/demos/broker-explorer/index.html +2 -2
- package/web/demos/broker-explorer/js/app.js +4 -4
- package/web/demos/broker-explorer/js/mcp-ws-client.js +2 -2
- package/web/demos/oauth-lab/README.md +26 -0
- package/web/demos/oauth-lab/config.json +1 -0
- package/web/demos/oauth-lab/js/app.js +40 -16
- package/web/demos/oauth-lab/server/smoke-test.mjs +57 -10
- package/web/demos/provider-tunnel/css/app.css +1 -1
- package/web/demos/provider-tunnel/index.html +3 -3
- package/web/demos/provider-tunnel/js/app.js +10 -10
- package/web/demos/provider-tunnel/js/toolbox-server.js +5 -5
- package/web/index.html +11 -11
- package/web/js/lib/broker-tunnel.js +12 -12
- package/dist/auth/auth.config.d.ts +0 -40
- package/dist/auth/auth.config.js +0 -62
- package/dist/auth/auth.config.js.map +0 -1
- package/dist/auth/auth.types.d.ts +0 -119
- package/dist/auth/auth.types.js +0 -38
- package/dist/auth/auth.types.js.map +0 -1
- package/dist/auth/http.auth.d.ts +0 -51
- package/dist/auth/http.auth.js +0 -121
- package/dist/auth/http.auth.js.map +0 -1
- package/dist/auth/index.d.ts +0 -16
- package/dist/auth/index.js +0 -12
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/jwt.validator.d.ts +0 -35
- package/dist/auth/jwt.validator.js +0 -46
- package/dist/auth/jwt.validator.js.map +0 -1
- package/dist/auth/provider.auth.d.ts +0 -51
- package/dist/auth/provider.auth.js +0 -80
- package/dist/auth/provider.auth.js.map +0 -1
- package/dist/auth/resource.metadata.d.ts +0 -32
- package/dist/auth/resource.metadata.js +0 -26
- package/dist/auth/resource.metadata.js.map +0 -1
- package/dist/authorization/audit.d.ts +0 -14
- package/dist/authorization/audit.js +0 -20
- package/dist/authorization/audit.js.map +0 -1
- package/dist/authorization/capability.classifier.d.ts +0 -30
- package/dist/authorization/capability.classifier.js +0 -85
- package/dist/authorization/capability.classifier.js.map +0 -1
- package/dist/authorization/index.d.ts +0 -13
- package/dist/authorization/index.js +0 -8
- package/dist/authorization/index.js.map +0 -1
- package/dist/authorization/policy.engine.d.ts +0 -11
- package/dist/authorization/policy.engine.js +0 -192
- package/dist/authorization/policy.engine.js.map +0 -1
- package/dist/authorization/policy.types.d.ts +0 -92
- package/dist/authorization/policy.types.js +0 -2
- package/dist/authorization/policy.types.js.map +0 -1
- package/dist/authorization/resource.path.d.ts +0 -27
- package/dist/authorization/resource.path.js +0 -122
- package/dist/authorization/resource.path.js.map +0 -1
- package/dist/authorization/runtime.d.ts +0 -22
- package/dist/authorization/runtime.js +0 -34
- package/dist/authorization/runtime.js.map +0 -1
- package/dist/authorization/slot.resource.d.ts +0 -12
- package/dist/authorization/slot.resource.js +0 -41
- package/dist/authorization/slot.resource.js.map +0 -1
- package/dist/authorization/subject.mapper.d.ts +0 -15
- package/dist/authorization/subject.mapper.js +0 -67
- package/dist/authorization/subject.mapper.js.map +0 -1
- package/dist/broker/adapters/broker.adapter.info.d.ts +0 -16
- package/dist/broker/adapters/broker.adapter.info.js +0 -43
- package/dist/broker/adapters/broker.adapter.info.js.map +0 -1
- package/dist/broker/adapters/broker.adapter.providers.d.ts +0 -18
- package/dist/broker/adapters/broker.adapter.providers.js +0 -61
- package/dist/broker/adapters/broker.adapter.providers.js.map +0 -1
- package/dist/broker/aggregate/aggregate.catalog.d.ts +0 -66
- package/dist/broker/aggregate/aggregate.catalog.js +0 -119
- package/dist/broker/aggregate/aggregate.catalog.js.map +0 -1
- package/dist/broker/aggregate/aggregate.server.d.ts +0 -66
- package/dist/broker/aggregate/aggregate.server.js +0 -257
- package/dist/broker/aggregate/aggregate.server.js.map +0 -1
- package/dist/broker/aggregate/provider.client.session.d.ts +0 -52
- package/dist/broker/aggregate/provider.client.session.js +0 -140
- package/dist/broker/aggregate/provider.client.session.js.map +0 -1
- package/dist/broker/behaviors/broker.behavior.info.d.ts +0 -15
- package/dist/broker/behaviors/broker.behavior.info.js +0 -41
- package/dist/broker/behaviors/broker.behavior.info.js.map +0 -1
- package/dist/broker/behaviors/broker.behavior.providers.d.ts +0 -19
- package/dist/broker/behaviors/broker.behavior.providers.js +0 -69
- package/dist/broker/behaviors/broker.behavior.providers.js.map +0 -1
- package/dist/broker/broker.context.d.ts +0 -63
- package/dist/broker/broker.context.js +0 -2
- package/dist/broker/broker.context.js.map +0 -1
- package/dist/broker/broker.grammars.d.ts +0 -132
- package/dist/broker/broker.grammars.js +0 -229
- package/dist/broker/broker.grammars.js.map +0 -1
- package/dist/broker/broker.server.d.ts +0 -68
- package/dist/broker/broker.server.js +0 -73
- package/dist/broker/broker.server.js.map +0 -1
- package/dist/broker/index.d.ts +0 -9
- package/dist/broker/index.js +0 -7
- package/dist/broker/index.js.map +0 -1
- package/dist/config.d.ts +0 -182
- package/dist/config.js +0 -61
- package/dist/config.js.map +0 -1
- package/dist/mcpb.loader.d.ts +0 -26
- package/dist/mcpb.loader.js +0 -161
- package/dist/mcpb.loader.js.map +0 -1
- package/dist/mcpb.unzip.d.ts +0 -6
- package/dist/mcpb.unzip.js +0 -95
- package/dist/mcpb.unzip.js.map +0 -1
- package/dist/remote.transports.d.ts +0 -18
- package/dist/remote.transports.js +0 -297
- package/dist/remote.transports.js.map +0 -1
- package/dist/remote.upstream.d.ts +0 -38
- package/dist/remote.upstream.js +0 -52
- package/dist/remote.upstream.js.map +0 -1
- package/dist/stdio.upstream.d.ts +0 -47
- package/dist/stdio.upstream.js +0 -85
- package/dist/stdio.upstream.js.map +0 -1
- package/dist/upstream.d.ts +0 -35
- package/dist/upstream.js +0 -2
- package/dist/upstream.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -9
- package/dist/version.js.map +0 -1
- package/dist/ws.tunnel.builder.d.ts +0 -176
- package/dist/ws.tunnel.builder.js +0 -271
- package/dist/ws.tunnel.builder.js.map +0 -1
- package/dist/ws.tunnel.d.ts +0 -455
- package/dist/ws.tunnel.js +0 -1425
- package/dist/ws.tunnel.js.map +0 -1
- /package/dist/{broker/grammars → grammars}/default/en.json +0 -0
- /package/dist/{broker/grammars → grammars}/default/fr.json +0 -0
- /package/dist/{broker/grammars → grammars}/default/zh.json +0 -0
package/dist/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
export { WsTunnel } from
|
|
2
|
-
|
|
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,"
|
|
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
|
|
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": "
|
|
53
|
-
"clean": "rimraf dist
|
|
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": "
|
|
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.
|
|
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
|
}
|
package/scripts/copy-assets.mjs
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copies non-TypeScript assets from `src/` to `dist/`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
22
|
-
|
|
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
|
|
26
|
-
const src = join(root, "src",
|
|
27
|
-
const dst = join(root, "dist",
|
|
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 ${
|
|
39
|
+
console.log(`[copy-assets] copied ${from} -> dist/${to}`);
|
|
34
40
|
}
|
package/scripts/gen-cert.mjs
CHANGED
|
@@ -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
|
|
6
|
-
* npm run gen-cert -- --out <dir>
|
|
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
|
|
10
|
-
* <outDir>/key.pem
|
|
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
|
|
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
|
|
package/scripts/pack-mcpb.mjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
84
|
+
console.log(`[pack-mcpb] done, ${output} (${sizeMb} MB)`);
|
package/scripts/sign-bundle.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Signs `.mcpb` bundles for the broker's bundle loader
|
|
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
|
|
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
|
|
14
|
-
* <outDir>/mcpb-signing.pub.pem
|
|
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
|
|
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
|
|
60
|
+
fail('unknown command, use "keygen" or "sign". See the file header for usage.');
|
|
61
61
|
}
|
package/src/auth/auth.config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JwtTokenValidator } from "./jwt.validator
|
|
2
|
-
import type { AggregateScopeFilter, IResolvedAuth } from "./auth.types
|
|
3
|
-
import { compileAuthorizationPolicy, DefaultSlotResourceResolver, hasAuthorizationPolicies, type IAuthorizationPolicyConfig } from "../authorization/index
|
|
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
|
package/src/auth/auth.types.ts
CHANGED
|
@@ -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
|
|
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 = "
|
|
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
|
|
55
|
-
|
|
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
|
|
125
|
-
*
|
|
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
|
-
|
|
130
|
-
|
|
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
|
}
|
package/src/auth/http.auth.ts
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 =
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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
|
-
|
|
26
|
+
return buildProtectedResourceMetadata({
|
|
30
27
|
resource: params.resource,
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
2
|
-
import type { ResourcePath } from "./resource.path
|
|
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,15 +1,15 @@
|
|
|
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
|
|
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
|
|
37
|
+
} from "./policy.types";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { validateCapability } from "./capability.classifier
|
|
2
|
-
import type { IAuthorizationDecision, IAuthorizationRequest, IDenyPolicy, IPolicyAssignment, IPolicyEngine, IRoleDefinition } from "./policy.types
|
|
3
|
-
import { ResourcePathPattern } from "./resource.path
|
|
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,8 +1,8 @@
|
|
|
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
|
|
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;
|