@haneinfo/mcp-server 3.5.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +177 -12
  2. package/dist/admin-access.d.ts +24 -0
  3. package/dist/admin-access.d.ts.map +1 -0
  4. package/dist/admin-access.js +54 -0
  5. package/dist/admin-access.js.map +1 -0
  6. package/dist/authenticator.d.ts +31 -0
  7. package/dist/authenticator.d.ts.map +1 -0
  8. package/dist/authenticator.js +37 -0
  9. package/dist/authenticator.js.map +1 -0
  10. package/dist/deployment-config.d.ts +67 -0
  11. package/dist/deployment-config.d.ts.map +1 -0
  12. package/dist/deployment-config.js +157 -0
  13. package/dist/deployment-config.js.map +1 -0
  14. package/dist/discovery-push.service.d.ts +11 -9
  15. package/dist/discovery-push.service.d.ts.map +1 -1
  16. package/dist/discovery-push.service.js +27 -11
  17. package/dist/discovery-push.service.js.map +1 -1
  18. package/dist/enabled-resources.d.ts +53 -0
  19. package/dist/enabled-resources.d.ts.map +1 -0
  20. package/dist/enabled-resources.js +243 -0
  21. package/dist/enabled-resources.js.map +1 -0
  22. package/dist/iam-authenticator.d.ts +29 -0
  23. package/dist/iam-authenticator.d.ts.map +1 -0
  24. package/dist/iam-authenticator.js +269 -0
  25. package/dist/iam-authenticator.js.map +1 -0
  26. package/dist/index.d.ts +10 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +10 -5
  29. package/dist/index.js.map +1 -1
  30. package/dist/mcp-tool.registry.d.ts +21 -76
  31. package/dist/mcp-tool.registry.d.ts.map +1 -1
  32. package/dist/mcp-tool.registry.js +66 -240
  33. package/dist/mcp-tool.registry.js.map +1 -1
  34. package/dist/mcp.controller.d.ts +21 -5
  35. package/dist/mcp.controller.d.ts.map +1 -1
  36. package/dist/mcp.controller.js +273 -48
  37. package/dist/mcp.controller.js.map +1 -1
  38. package/dist/mcp.module.d.ts +5 -0
  39. package/dist/mcp.module.d.ts.map +1 -1
  40. package/dist/mcp.module.js +71 -8
  41. package/dist/mcp.module.js.map +1 -1
  42. package/dist/mcp.service.d.ts +31 -18
  43. package/dist/mcp.service.d.ts.map +1 -1
  44. package/dist/mcp.service.js +784 -194
  45. package/dist/mcp.service.js.map +1 -1
  46. package/dist/pg-rate-limiter.d.ts +46 -0
  47. package/dist/pg-rate-limiter.d.ts.map +1 -0
  48. package/dist/pg-rate-limiter.js +161 -0
  49. package/dist/pg-rate-limiter.js.map +1 -0
  50. package/dist/plugin.d.ts +41 -4
  51. package/dist/plugin.d.ts.map +1 -1
  52. package/dist/plugin.js +26 -14
  53. package/dist/plugin.js.map +1 -1
  54. package/dist/prm.controller.d.ts +17 -0
  55. package/dist/prm.controller.d.ts.map +1 -0
  56. package/dist/prm.controller.js +77 -0
  57. package/dist/prm.controller.js.map +1 -0
  58. package/dist/protocol-config.d.ts +36 -0
  59. package/dist/protocol-config.d.ts.map +1 -0
  60. package/dist/protocol-config.js +142 -0
  61. package/dist/protocol-config.js.map +1 -0
  62. package/dist/rate-limit-config.d.ts +25 -0
  63. package/dist/rate-limit-config.d.ts.map +1 -0
  64. package/dist/rate-limit-config.js +85 -0
  65. package/dist/rate-limit-config.js.map +1 -0
  66. package/dist/rate-limit-http.d.ts +11 -0
  67. package/dist/rate-limit-http.d.ts.map +1 -0
  68. package/dist/rate-limit-http.js +68 -0
  69. package/dist/rate-limit-http.js.map +1 -0
  70. package/dist/request-state.d.ts +14 -9
  71. package/dist/request-state.d.ts.map +1 -1
  72. package/dist/request-state.js +37 -3
  73. package/dist/request-state.js.map +1 -1
  74. package/dist/types.d.ts +24 -7
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/types.js +3 -0
  77. package/dist/types.js.map +1 -1
  78. package/dist/write-confirmation.d.ts +82 -0
  79. package/dist/write-confirmation.d.ts.map +1 -0
  80. package/dist/write-confirmation.js +207 -0
  81. package/dist/write-confirmation.js.map +1 -0
  82. package/haneinfo.plugin.json +19 -11
  83. package/package.json +23 -11
  84. package/prisma/mcp-rate-limit.prisma +34 -0
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ var IamMcpRequestAuthenticator_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.IamMcpRequestAuthenticator = exports.MCP_SIGNING_KEY_RESOLVER = void 0;
20
+ const commands_1 = require("@haneinfo/commands");
21
+ const plugin_api_1 = require("@haneinfo/plugin-api");
22
+ const common_1 = require("@nestjs/common");
23
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
24
+ const jwks_rsa_1 = __importDefault(require("jwks-rsa"));
25
+ const admin_access_1 = require("./admin-access");
26
+ const authenticator_1 = require("./authenticator");
27
+ const deployment_config_1 = require("./deployment-config");
28
+ exports.MCP_SIGNING_KEY_RESOLVER = Symbol.for('haneinfo.mcp-server.signing-key-resolver');
29
+ const WORKFLOW_ID_HEADER = 'x-haneinfo-workflow-id';
30
+ function readWorkflowId(headers) {
31
+ const value = headers[WORKFLOW_ID_HEADER];
32
+ return typeof value === 'string' && value.length > 0 ? value : null;
33
+ }
34
+ function invalidTokenResult(prmUrl) {
35
+ return {
36
+ ok: false,
37
+ status: 401,
38
+ error: 'invalid_token',
39
+ wwwAuthenticate: `Bearer error="invalid_token", resource_metadata="${prmUrl}"`,
40
+ };
41
+ }
42
+ function hasValidHeader(header, signingAlgorithms) {
43
+ return (typeof header.kid === 'string' &&
44
+ header.kid.length > 0 &&
45
+ typeof header.alg === 'string' &&
46
+ signingAlgorithms.includes(header.alg));
47
+ }
48
+ /**
49
+ * OAuth access token authenticator for `/mcp` and `/mcp/admin` (1A §2, §3).
50
+ *
51
+ * Verifies JWT signature, claims, timestamps, deployment allowlists, local `(issuer, subject)`
52
+ * mapping (read-only, never provisioning), and per-request local account admission.
53
+ */
54
+ let IamMcpRequestAuthenticator = IamMcpRequestAuthenticator_1 = class IamMcpRequestAuthenticator {
55
+ constructor(deployment, iamProfile, oidcIdentityLookup, identityStore, rbacPolicy, signingKeyResolver) {
56
+ this.deployment = deployment;
57
+ this.iamProfile = iamProfile;
58
+ this.oidcIdentityLookup = oidcIdentityLookup;
59
+ this.identityStore = identityStore;
60
+ this.rbacPolicy = rbacPolicy;
61
+ this.signingKeyResolver = signingKeyResolver;
62
+ this.logger = new common_1.Logger(IamMcpRequestAuthenticator_1.name);
63
+ this.jwksClients = new Map();
64
+ }
65
+ async authenticate(request, kind) {
66
+ const resourceConfig = this.deployment.mcp[kind];
67
+ const prmUrl = (0, deployment_config_1.derivePrmUrl)(resourceConfig.canonicalResourceUrl);
68
+ const headers = (request.headers ?? {});
69
+ const token = (0, authenticator_1.extractBearerToken)(headers.authorization);
70
+ if (!token) {
71
+ return invalidTokenResult(prmUrl);
72
+ }
73
+ // 1. Decode header: kid must be non-empty string and alg must be in IAM_PROFILE.signingAlgorithms
74
+ const decoded = jsonwebtoken_1.default.decode(token, { complete: true });
75
+ if (!decoded ||
76
+ typeof decoded === 'string' ||
77
+ !hasValidHeader(decoded.header, this.iamProfile.signingAlgorithms)) {
78
+ this.logger.warn('MCP token verification failed at stage: header');
79
+ return invalidTokenResult(prmUrl);
80
+ }
81
+ // 2. Resolve signing key via trusted metadata jwksUri (or test resolver)
82
+ let signingKey;
83
+ try {
84
+ const metadata = await this.iamProfile.getTrustedMetadata();
85
+ signingKey = await this.resolveSigningKey(decoded.header.kid, metadata.jwksUri);
86
+ }
87
+ catch {
88
+ this.logger.warn('MCP token verification failed at stage: jwks');
89
+ return invalidTokenResult(prmUrl);
90
+ }
91
+ // 3. Verify cryptographic signature (ignoreExpiration: true; timestamps checked in step 6)
92
+ let payload;
93
+ try {
94
+ payload = await this.verifySignature(token, signingKey);
95
+ }
96
+ catch {
97
+ this.logger.warn('MCP token verification failed at stage: signature');
98
+ return invalidTokenResult(prmUrl);
99
+ }
100
+ // 4. Normalize & validate claims via IAM_PROFILE
101
+ const tokenUse = kind === 'admin' ? 'mcp-admin' : 'mcp-employee';
102
+ let normalized;
103
+ try {
104
+ normalized = this.iamProfile.normalizeClaims(tokenUse, payload, decoded.header);
105
+ }
106
+ catch (error) {
107
+ const reason = readRejectionReason(error);
108
+ this.logger.warn(reason
109
+ ? `MCP token verification failed at stage: claims (reason=${reason})`
110
+ : `MCP token verification failed at stage: claims (${error instanceof Error ? error.message : 'unknown'})`);
111
+ return invalidTokenResult(prmUrl);
112
+ }
113
+ // 5. Defense-in-depth checks against this server's deployment configuration
114
+ if (normalized.issuer !== this.deployment.issuer ||
115
+ normalized.audience !== resourceConfig.canonicalResourceUrl ||
116
+ !resourceConfig.allowedClientIds.includes(normalized.clientId)) {
117
+ this.logger.warn('MCP token verification failed at stage: deployment-allowlist');
118
+ return invalidTokenResult(prmUrl);
119
+ }
120
+ // 6. Validate token timestamps using shared rules
121
+ const timeResult = (0, plugin_api_1.validateTokenTimestamps)({
122
+ iat: normalized.issuedAt,
123
+ exp: normalized.expiresAt,
124
+ nowSeconds: Math.floor(Date.now() / 1000),
125
+ clockToleranceSeconds: this.iamProfile.tokenValidation.clockToleranceSeconds,
126
+ maxIssuedLifetimeSeconds: this.iamProfile.tokenValidation.maxIssuedLifetimeSeconds,
127
+ });
128
+ if (!timeResult.ok) {
129
+ this.logger.warn(`MCP token verification failed at stage: timestamps (code=${timeResult.code})`);
130
+ return invalidTokenResult(prmUrl);
131
+ }
132
+ // 7-8. Backend identity, admission, and RBAC lookups; fail with 503 without leaking details
133
+ let user;
134
+ try {
135
+ const userId = await this.oidcIdentityLookup.findUserIdByIssuerSubject(normalized.issuer, normalized.subject);
136
+ if (!userId) {
137
+ return {
138
+ ok: false,
139
+ status: 403,
140
+ error: 'account_not_provisioned',
141
+ message: 'Local account is not provisioned. Please sign in to the web app once first.',
142
+ };
143
+ }
144
+ user = await this.identityStore.findById(userId);
145
+ if (!user) {
146
+ return {
147
+ ok: false,
148
+ status: 403,
149
+ error: 'app_admission_denied',
150
+ };
151
+ }
152
+ const actor = {
153
+ surface: kind === 'admin' ? 'mcp-admin' : 'mcp',
154
+ principalKind: kind === 'admin' ? 'oauth-admin' : 'oauth-employee',
155
+ issuer: normalized.issuer,
156
+ subject: normalized.subject,
157
+ actingUserId: user.id,
158
+ isServiceAccount: user.isServiceAccount,
159
+ isActive: user.isActive,
160
+ scopes: normalized.scopes,
161
+ };
162
+ const admitted = await (0, commands_1.checkAppAdmission)(actor, this.rbacPolicy);
163
+ if (!admitted) {
164
+ return {
165
+ ok: false,
166
+ status: 403,
167
+ error: 'app_admission_denied',
168
+ };
169
+ }
170
+ if (kind === 'admin') {
171
+ const roles = await this.rbacPolicy.rolesForUser(user.id);
172
+ const roleNames = roles.map((role) => role.name);
173
+ const adminCheck = (0, admin_access_1.checkAdminAccess)({
174
+ claims: normalized,
175
+ roleNames,
176
+ deployment: this.deployment,
177
+ nowSeconds: Math.floor(Date.now() / 1000),
178
+ });
179
+ if (!adminCheck.ok) {
180
+ return adminCheck;
181
+ }
182
+ }
183
+ }
184
+ catch {
185
+ this.logger.warn('MCP authentication backend lookup failed');
186
+ return {
187
+ ok: false,
188
+ status: 503,
189
+ error: 'service_unavailable',
190
+ };
191
+ }
192
+ // 9. Build McpCallContext 4.0
193
+ const adminClaims = kind === 'admin' ? normalized : null;
194
+ const context = {
195
+ kind,
196
+ issuer: normalized.issuer,
197
+ sub: normalized.subject,
198
+ actingUserId: user.id,
199
+ actingUserEmail: user.email,
200
+ resource: normalized.audience,
201
+ clientId: normalized.clientId,
202
+ authTime: adminClaims ? (adminClaims.authTime ?? null) : null,
203
+ mfa: adminClaims ? Boolean(adminClaims.mfa) : false,
204
+ scopes: normalized.scopes,
205
+ tokenExp: normalized.expiresAt,
206
+ workflowId: readWorkflowId(headers),
207
+ };
208
+ return { ok: true, context };
209
+ }
210
+ getJwksClient(jwksUri) {
211
+ let client = this.jwksClients.get(jwksUri);
212
+ if (!client) {
213
+ client = (0, jwks_rsa_1.default)({
214
+ cache: true,
215
+ rateLimit: true,
216
+ jwksRequestsPerMinute: 5,
217
+ jwksUri,
218
+ });
219
+ this.jwksClients.set(jwksUri, client);
220
+ }
221
+ return client;
222
+ }
223
+ async resolveSigningKey(kid, jwksUri) {
224
+ if (this.signingKeyResolver) {
225
+ return this.signingKeyResolver(kid, jwksUri);
226
+ }
227
+ const key = await this.getJwksClient(jwksUri).getSigningKey(kid);
228
+ return key.getPublicKey();
229
+ }
230
+ verifySignature(token, signingKey) {
231
+ return new Promise((resolve, reject) => {
232
+ jsonwebtoken_1.default.verify(token, signingKey, {
233
+ algorithms: [...this.iamProfile.signingAlgorithms],
234
+ ignoreExpiration: true,
235
+ clockTolerance: this.iamProfile.tokenValidation.clockToleranceSeconds,
236
+ }, (error, payload) => {
237
+ if (error) {
238
+ reject(error);
239
+ return;
240
+ }
241
+ if (!payload || Array.isArray(payload) || typeof payload === 'string') {
242
+ reject(new Error('Invalid token payload'));
243
+ return;
244
+ }
245
+ resolve(payload);
246
+ });
247
+ });
248
+ }
249
+ };
250
+ exports.IamMcpRequestAuthenticator = IamMcpRequestAuthenticator;
251
+ exports.IamMcpRequestAuthenticator = IamMcpRequestAuthenticator = IamMcpRequestAuthenticator_1 = __decorate([
252
+ (0, common_1.Injectable)(),
253
+ __param(0, (0, common_1.Inject)(deployment_config_1.MCP_DEPLOYMENT_CONFIG)),
254
+ __param(1, (0, common_1.Inject)(plugin_api_1.IAM_PROFILE)),
255
+ __param(2, (0, common_1.Inject)(plugin_api_1.OIDC_IDENTITY_LOOKUP)),
256
+ __param(3, (0, common_1.Inject)(plugin_api_1.IDENTITY_STORE)),
257
+ __param(4, (0, common_1.Inject)(plugin_api_1.RBAC_POLICY)),
258
+ __param(5, (0, common_1.Optional)()),
259
+ __param(5, (0, common_1.Inject)(exports.MCP_SIGNING_KEY_RESOLVER)),
260
+ __metadata("design:paramtypes", [Object, Object, Object, Object, Object, Function])
261
+ ], IamMcpRequestAuthenticator);
262
+ function readRejectionReason(error) {
263
+ if (!error || typeof error !== 'object') {
264
+ return undefined;
265
+ }
266
+ const reason = error.reason;
267
+ return typeof reason === 'string' && reason.length > 0 ? reason : undefined;
268
+ }
269
+ //# sourceMappingURL=iam-authenticator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iam-authenticator.js","sourceRoot":"","sources":["../src/iam-authenticator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,iDAA0E;AAC1E,qDAY8B;AAC9B,2CAAsE;AAEtE,gEAAmD;AACnD,wDAAuD;AACvD,iDAAkD;AAClD,mDAIyB;AACzB,2DAI6B;AAGhB,QAAA,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;AAI/F,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAEpD,SAAS,cAAc,CAAC,OAAgC;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC;AAED,SAAS,kBAAkB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,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,gCAAwB,CAAC,CAAA;;GAXxB,0BAA0B,CAuOtC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAI,KAA8B,CAAC,MAAM,CAAC;IACtD,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,11 +1,18 @@
1
- export { MCP_TOOLS, type McpToolsPort } from '@haneinfo/plugin-api';
1
+ export * from './admin-access';
2
+ export * from './authenticator';
3
+ export * from './deployment-config';
2
4
  export * from './discovery-push.service';
5
+ export * from './enabled-resources';
6
+ export * from './iam-authenticator';
3
7
  export * from './mcp.controller';
4
8
  export * from './mcp.module';
5
9
  export * from './mcp.service';
6
- export * from './mcp-tool.decorator';
7
10
  export * from './mcp-tool.registry';
8
- export * from './stateful-mcp-handler';
11
+ export * from './pg-rate-limiter';
12
+ export * from './prm.controller';
13
+ export * from './rate-limit-config';
14
+ export * from './request-state';
9
15
  export * from './tool-error';
10
16
  export * from './types';
17
+ export * from './write-confirmation';
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -14,16 +14,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MCP_TOOLS = void 0;
18
- var plugin_api_1 = require("@haneinfo/plugin-api");
19
- Object.defineProperty(exports, "MCP_TOOLS", { enumerable: true, get: function () { return plugin_api_1.MCP_TOOLS; } });
17
+ __exportStar(require("./admin-access"), exports);
18
+ __exportStar(require("./authenticator"), exports);
19
+ __exportStar(require("./deployment-config"), exports);
20
20
  __exportStar(require("./discovery-push.service"), exports);
21
+ __exportStar(require("./enabled-resources"), exports);
22
+ __exportStar(require("./iam-authenticator"), exports);
21
23
  __exportStar(require("./mcp.controller"), exports);
22
24
  __exportStar(require("./mcp.module"), exports);
23
25
  __exportStar(require("./mcp.service"), exports);
24
- __exportStar(require("./mcp-tool.decorator"), exports);
25
26
  __exportStar(require("./mcp-tool.registry"), exports);
26
- __exportStar(require("./stateful-mcp-handler"), exports);
27
+ __exportStar(require("./pg-rate-limiter"), exports);
28
+ __exportStar(require("./prm.controller"), exports);
29
+ __exportStar(require("./rate-limit-config"), exports);
30
+ __exportStar(require("./request-state"), exports);
27
31
  __exportStar(require("./tool-error"), exports);
28
32
  __exportStar(require("./types"), exports);
33
+ __exportStar(require("./write-confirmation"), exports);
29
34
  //# 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,mDAAoE;AAA3D,uGAAA,SAAS,OAAA;AAClB,2DAAyC;AACzC,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,uDAAqC;AACrC,sDAAoC;AACpC,yDAAuC;AACvC,+CAA6B;AAC7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,kDAAgC;AAChC,sDAAoC;AACpC,2DAAyC;AACzC,sDAAoC;AACpC,sDAAoC;AACpC,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,sDAAoC;AACpC,oDAAkC;AAClC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,+CAA6B;AAC7B,0CAAwB;AACxB,uDAAqC"}
@@ -1,13 +1,12 @@
1
- import { type McpCatalogEntryPort, type McpToolSourcePort, type McpToolsPort, type ScopeMatcherPort, type SettingDeclarationRegistry, type SettingsPort } from '@haneinfo/plugin-api';
1
+ import { type McpCatalogEntryPort, type SettingDeclarationRegistry, type SettingsPort } from '@haneinfo/plugin-api';
2
2
  import { type OnModuleInit } from '@nestjs/common';
3
- import type { McpCallContext, McpToolDefinition } from './types';
3
+ import { McpEnabledResources } from './enabled-resources';
4
+ import { type McpModuleOptions, type McpResourceKind } from './types';
4
5
  /**
5
6
  * Built-in setting (decision 202610-e6c1, point 12), declared only when `@haneinfo/settings` is
6
- * installed: tool names listed here are hidden from tools/list and refused with TOOL_DISABLED.
7
+ * installed: command names listed here are hidden from `tools/list` and refused as `tool_unavailable`.
7
8
  */
8
9
  export declare const MCP_DISABLED_TOOLS_SETTING = "mcp-server.disabledTools";
9
- /** Error code returned (without running the handler) when a disabled tool is called by name. */
10
- export declare const MCP_TOOL_DISABLED = "TOOL_DISABLED";
11
10
  /**
12
11
  * Reads the app-level tool prefix from `MCP_TOOL_PREFIX` (002 env var convention). Returns
13
12
  * `undefined` when unset. The prefix only names the app; it registers nothing on its own — see
@@ -22,90 +21,36 @@ export declare function getConfiguredToolPrefix(): string | undefined;
22
21
  * here doubles the tool list and can push names past the 64-character limit.
23
22
  */
24
23
  export declare function getToolAliasPrefix(): string | undefined;
25
- export declare function classifyToolAsReadOnly(requiredScopes: string[], mutates?: true): boolean;
26
24
  export interface McpCatalogEntry extends McpCatalogEntryPort {
27
25
  }
28
- export declare class McpToolRegistry implements McpToolsPort<McpToolDefinition>, OnModuleInit {
29
- private readonly scopeMatcher?;
26
+ /**
27
+ * Manages `mcp-server.disabledTools` and generates discovery catalog snapshots from the sealed
28
+ * `@haneinfo/commands` registry (`mcp-connector-contract.md` §9.2; W5-04b).
29
+ */
30
+ export declare class McpToolRegistry implements OnModuleInit {
30
31
  private readonly settings?;
31
32
  private readonly declarations?;
32
- private readonly logger;
33
- private readonly toolMap;
34
- private readonly logicalTools;
35
- /** Registered name (bare or prefixed alias) -> logical name, for the disabled-tools setting. */
36
- private readonly logicalNames;
37
- /** Last value of mcp-server.disabledTools; always empty without @haneinfo/settings. */
33
+ private readonly enabledResources?;
34
+ private readonly commands;
35
+ /** Last value of `mcp-server.disabledTools`; always empty without `@haneinfo/settings`. */
38
36
  private disabled;
39
- /**
40
- * Runtime-changing tool sources (decision 202610-c5e8, e.g. @haneinfo/mcp-generated-tools).
41
- * Without a source every map below stays empty and the registry behaves exactly as before.
42
- */
43
- private readonly sources;
44
- /** Current source tools by registered name (bare or prefixed alias); rebuilt on refresh. */
45
- private dynamicMap;
46
- /** Current source tools, pre-prefixing. */
47
- private dynamicLogical;
48
- /** Registered source-tool name (bare or alias) -> logical name. */
49
- private dynamicLogicalNames;
50
- private readonly skippedSourceNames;
51
- constructor(scopeMatcher?: ScopeMatcherPort | undefined, settings?: SettingsPort | undefined, declarations?: SettingDeclarationRegistry | undefined);
52
- /** Declares mcp-server.disabledTools when the optional settings capability is installed. */
37
+ constructor(commandsOptions?: McpModuleOptions, settings?: SettingsPort | undefined, declarations?: SettingDeclarationRegistry | undefined, enabledResources?: McpEnabledResources | undefined);
38
+ /** Declares `mcp-server.disabledTools` when the optional settings capability is installed. */
53
39
  onModuleInit(): void;
54
- /** True only when @haneinfo/settings is installed; otherwise no tool can ever be disabled. */
40
+ /** True only when `@haneinfo/settings` is installed; otherwise no tool can ever be disabled. */
55
41
  get disabledToolsSupported(): boolean;
56
42
  /**
57
- * Re-reads mcp-server.disabledTools (served from the settings cache) before a request. Without
43
+ * Re-reads `mcp-server.disabledTools` (served from the settings cache) before a request. Without
58
44
  * settings it does nothing. A failed read propagates, so a disabled tool never runs by accident.
59
45
  */
60
46
  refreshDisabledTools(): Promise<ReadonlySet<string>>;
61
- /** Whether a registered (or aliased) tool name is currently switched off. */
47
+ /** Whether a command (by bare name or prefixed alias) is currently switched off. */
62
48
  isToolDisabled(name: string): boolean;
63
49
  /**
64
- * Adds a runtime-changing tool source (decision 202610-c5e8). Its tools never override a
65
- * registered tool, and MCP requests see them only after `refreshToolSources`.
66
- */
67
- registerToolSource(source: McpToolSourcePort<McpToolDefinition>): void;
68
- /** True once a tool source is registered; false keeps every request path exactly as before. */
69
- get hasToolSources(): boolean;
70
- /**
71
- * Lets every source recompute (each one throttles itself), then rebuilds the source tools. A
72
- * name already registered, or taken by an earlier source tool, is skipped with one warning.
73
- */
74
- refreshToolSources(): Promise<void>;
75
- /** The current source tool registered under `name` (bare or alias), if any. */
76
- getSourceTool(name: string): McpToolDefinition | undefined;
77
- /** Current source tools by registered name (aliases included), as of the last refresh. */
78
- getSourceTools(): McpToolDefinition[];
79
- hasScopesFor(ctx: McpCallContext, tool: McpToolDefinition): boolean;
80
- /**
81
- * Whether this exact registration is visible to the caller. `includeDisabled` lets a direct call
82
- * reach the handler wrapper, which then answers TOOL_DISABLED instead of running the tool.
83
- */
84
- isListed(ctx: McpCallContext, tool: McpToolDefinition, options?: {
85
- includeDisabled?: boolean;
86
- }): boolean;
87
- listTools(ctx: McpCallContext): McpToolDefinition[];
88
- /** A registered tool, or else the current source tool of that name. */
89
- getTool(name: string): McpToolDefinition | undefined;
90
- /**
91
- * Internal registration inventory of registered tools (source tools: getSourceTools); request
92
- * visibility must still go through listTools.
93
- */
94
- getAllTools(): McpToolDefinition[];
95
- getToolCount(): number;
96
- /**
97
- * Registers `tool` under its bare name. When `MCP_TOOL_PREFIXED_ALIASES=true` is set, it is also
98
- * registered as `<MCP_TOOL_PREFIX>_<name>` pointing at the same handler/scopes. Aliases are off by
99
- * default; the bare name is the canonical one.
100
- */
101
- registerTool(tool: McpToolDefinition): void;
102
- /**
103
- * External-facing catalog snapshot (023 §2.1 discovery push, T-9700) — one entry per
104
- * logical tool, named however an outside caller would actually have to call it: the bare name,
105
- * or the prefixed alias when aliases are enabled.
50
+ * External-facing catalog snapshot derived from enabled resource surfaces
51
+ * (023 §2.1 discovery push, T-9700; `mcp-connector-contract.md` §1, §7.3, §9.2).
106
52
  */
107
- getCatalogSnapshot(): McpCatalogEntry[];
108
- private matchesScope;
109
- private registerSingle;
53
+ getCatalogSnapshot(kinds?: readonly McpResourceKind[]): McpCatalogEntry[];
54
+ private knownCommandNames;
110
55
  }
111
56
  //# sourceMappingURL=mcp-tool.registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-tool.registry.d.ts","sourceRoot":"","sources":["../src/mcp-tool.registry.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,i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