@webpieces/mcp-server 0.4.772 → 0.4.774

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 (42) hide show
  1. package/README.md +114 -8
  2. package/package.json +11 -5
  3. package/src/McpApiBinding.d.ts +14 -0
  4. package/src/McpApiBinding.js +42 -0
  5. package/src/McpApiBinding.js.map +1 -0
  6. package/src/McpApiDispatcher.d.ts +10 -19
  7. package/src/McpApiDispatcher.js +35 -44
  8. package/src/McpApiDispatcher.js.map +1 -1
  9. package/src/McpAuth.d.ts +11 -2
  10. package/src/McpAuth.js +5 -1
  11. package/src/McpAuth.js.map +1 -1
  12. package/src/McpAuthorityCompileAssertions.js.map +1 -1
  13. package/src/McpBindOptions.d.ts +17 -0
  14. package/src/McpBindOptions.js +36 -0
  15. package/src/McpBindOptions.js.map +1 -0
  16. package/src/McpDeployment.d.ts +11 -0
  17. package/src/McpDeployment.js +32 -0
  18. package/src/McpDeployment.js.map +1 -0
  19. package/src/McpInvocationContext.d.ts +14 -0
  20. package/src/McpInvocationContext.js +25 -0
  21. package/src/McpInvocationContext.js.map +1 -0
  22. package/src/McpToolRegistry.d.ts +7 -4
  23. package/src/McpToolRegistry.js +20 -16
  24. package/src/McpToolRegistry.js.map +1 -1
  25. package/src/WpMcpErrorTranslator.d.ts +69 -0
  26. package/src/WpMcpErrorTranslator.js +168 -0
  27. package/src/WpMcpErrorTranslator.js.map +1 -0
  28. package/src/WpMcpServer.d.ts +55 -24
  29. package/src/WpMcpServer.js +331 -154
  30. package/src/WpMcpServer.js.map +1 -1
  31. package/src/__tests__/McpHttpTestHarness.d.ts +40 -0
  32. package/src/__tests__/McpHttpTestHarness.js +158 -0
  33. package/src/__tests__/McpHttpTestHarness.js.map +1 -0
  34. package/src/__tests__/McpRemoteFixtures.d.ts +93 -0
  35. package/src/__tests__/McpRemoteFixtures.js +409 -0
  36. package/src/__tests__/McpRemoteFixtures.js.map +1 -0
  37. package/src/__tests__/WpMcpServerTestFixtures.d.ts +60 -0
  38. package/src/__tests__/WpMcpServerTestFixtures.js +269 -0
  39. package/src/__tests__/WpMcpServerTestFixtures.js.map +1 -0
  40. package/src/index.d.ts +10 -3
  41. package/src/index.js +18 -4
  42. package/src/index.js.map +1 -1
@@ -0,0 +1,269 @@
1
+ "use strict";
2
+ var SearchController_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RecordingLoggerFactory = exports.RecordedLogLine = exports.TestTokenAuthority = exports.TestJwtHook = exports.RemoteSearchClient = exports.SearchController = exports.RemoteSearchApi = exports.SearchApi = exports.SearchResponse = exports.SearchRequest = exports.MODERN_VERSION = exports.ENDPOINT_PATH = exports.USER_ID = void 0;
5
+ const tslib_1 = require("tslib");
6
+ require("reflect-metadata");
7
+ const inversify_1 = require("inversify");
8
+ const core_util_1 = require("@webpieces/core-util");
9
+ const core_context_1 = require("@webpieces/core-context");
10
+ const http_routing_1 = require("@webpieces/http-routing");
11
+ const McpAuth_1 = require("../McpAuth");
12
+ const McpInvocationContext_1 = require("../McpInvocationContext");
13
+ exports.USER_ID = core_util_1.ContextKey.trusted('mcpSpecUserId', 'proven by a credential verifier');
14
+ exports.ENDPOINT_PATH = '/app-owned/mcp';
15
+ exports.MODERN_VERSION = '2026-07-28';
16
+ let SearchRequest = class SearchRequest {
17
+ query;
18
+ };
19
+ exports.SearchRequest = SearchRequest;
20
+ tslib_1.__decorate([
21
+ (0, core_util_1.WpDtoField)(new core_util_1.WpDtoFieldOptions('Search text', true, undefined, false, undefined, undefined, undefined, new core_util_1.WpMcpHeader('query'))),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], SearchRequest.prototype, "query", void 0);
24
+ exports.SearchRequest = SearchRequest = tslib_1.__decorate([
25
+ (0, core_util_1.WpDto)()
26
+ ], SearchRequest);
27
+ let SearchResponse = class SearchResponse {
28
+ userId;
29
+ result;
30
+ };
31
+ exports.SearchResponse = SearchResponse;
32
+ tslib_1.__decorate([
33
+ (0, core_util_1.WpDtoField)(new core_util_1.WpDtoFieldOptions('Authenticated user', true)),
34
+ tslib_1.__metadata("design:type", String)
35
+ ], SearchResponse.prototype, "userId", void 0);
36
+ tslib_1.__decorate([
37
+ (0, core_util_1.WpDtoField)(new core_util_1.WpDtoFieldOptions('Search result', true)),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], SearchResponse.prototype, "result", void 0);
40
+ exports.SearchResponse = SearchResponse = tslib_1.__decorate([
41
+ (0, core_util_1.WpDto)()
42
+ ], SearchResponse);
43
+ let SearchApi = class SearchApi {
44
+ search(_request) {
45
+ throw new Error('contract only');
46
+ }
47
+ admin(_request) {
48
+ throw new Error('contract only');
49
+ }
50
+ };
51
+ exports.SearchApi = SearchApi;
52
+ tslib_1.__decorate([
53
+ (0, core_util_1.WpMcpAuthJwt)({ allRolesAllowed: true }),
54
+ (0, core_util_1.WpAuthJwt)({ allRolesAllowed: true }),
55
+ (0, core_util_1.Endpoint)('/search', 'rpc'),
56
+ (0, core_util_1.WpResponseDto)(() => SearchResponse),
57
+ (0, core_util_1.WpMcpTool)({
58
+ name: 'account_search',
59
+ description: 'Search records owned by the authenticated user.',
60
+ readOnlyHint: true,
61
+ idempotentHint: true,
62
+ openWorldHint: false,
63
+ }),
64
+ tslib_1.__metadata("design:type", Function),
65
+ tslib_1.__metadata("design:paramtypes", [SearchRequest]),
66
+ tslib_1.__metadata("design:returntype", Promise)
67
+ ], SearchApi.prototype, "search", null);
68
+ tslib_1.__decorate([
69
+ (0, core_util_1.WpMcpAuthJwt)({ roles: ['admin'] }),
70
+ (0, core_util_1.WpAuthJwt)({ roles: ['admin'] }),
71
+ (0, core_util_1.Endpoint)('/admin', 'rpc'),
72
+ (0, core_util_1.WpResponseDto)(() => SearchResponse),
73
+ (0, core_util_1.WpMcpTool)({
74
+ name: 'admin_search',
75
+ description: 'Administrative search.',
76
+ readOnlyHint: false,
77
+ destructiveHint: false,
78
+ idempotentHint: false,
79
+ openWorldHint: false,
80
+ }),
81
+ tslib_1.__metadata("design:type", Function),
82
+ tslib_1.__metadata("design:paramtypes", [SearchRequest]),
83
+ tslib_1.__metadata("design:returntype", Promise)
84
+ ], SearchApi.prototype, "admin", null);
85
+ exports.SearchApi = SearchApi = tslib_1.__decorate([
86
+ (0, core_util_1.ApiPath)('/mcp-spec')
87
+ ], SearchApi);
88
+ let RemoteSearchApi = class RemoteSearchApi {
89
+ search(_request) {
90
+ throw new Error('contract only');
91
+ }
92
+ };
93
+ exports.RemoteSearchApi = RemoteSearchApi;
94
+ tslib_1.__decorate([
95
+ (0, core_util_1.WpMcpAuthJwt)({ allRolesAllowed: true }),
96
+ (0, core_util_1.WpAuthOidc)(),
97
+ (0, core_util_1.Endpoint)('/search', 'rpc'),
98
+ (0, core_util_1.WpResponseDto)(() => SearchResponse),
99
+ (0, core_util_1.WpMcpTool)({
100
+ name: 'remote_search',
101
+ description: 'Search a remote binding.',
102
+ readOnlyHint: false,
103
+ destructiveHint: false,
104
+ idempotentHint: false,
105
+ openWorldHint: false,
106
+ }),
107
+ tslib_1.__metadata("design:type", Function),
108
+ tslib_1.__metadata("design:paramtypes", [SearchRequest]),
109
+ tslib_1.__metadata("design:returntype", Promise)
110
+ ], RemoteSearchApi.prototype, "search", null);
111
+ exports.RemoteSearchApi = RemoteSearchApi = tslib_1.__decorate([
112
+ (0, core_util_1.ApiPath)('/remote-spec')
113
+ ], RemoteSearchApi);
114
+ let SearchController = class SearchController extends SearchApi {
115
+ static { SearchController_1 = this; }
116
+ static waitStartedHook;
117
+ static waitAbortedHook;
118
+ adminInvocations = 0;
119
+ async search(request) {
120
+ if (request.query === 'internal')
121
+ throw new Error('database password appeared here');
122
+ if (request.query === 'human')
123
+ throw new core_util_1.ApiEndUserError('Safe human message', 'SAFE');
124
+ if (request.query === 'malformed') {
125
+ throw new core_util_1.ApiBadRequestError('operator-only: column tenant_7 rejected', '$.query', 'query is malformed');
126
+ }
127
+ const invocation = core_context_1.RequestContext.getTrusted(McpInvocationContext_1.MCP_INVOCATION_CONTEXT);
128
+ if (request.query === 'progress') {
129
+ await invocation?.reportProgress?.(1, 2, 'halfway');
130
+ }
131
+ if (request.query === 'wait' && invocation) {
132
+ await invocation.reportProgress?.(0, 1, 'waiting');
133
+ SearchController_1.waitStartedHook?.();
134
+ await new Promise((resolve) => {
135
+ const finish = () => {
136
+ SearchController_1.waitAbortedHook?.();
137
+ resolve();
138
+ };
139
+ if (invocation.signal.aborted)
140
+ finish();
141
+ else
142
+ invocation.signal.addEventListener('abort', finish, { once: true });
143
+ });
144
+ }
145
+ return { userId: core_context_1.RequestContext.getTrusted(exports.USER_ID) ?? 'missing', result: request.query };
146
+ }
147
+ async admin(request) {
148
+ this.adminInvocations += 1;
149
+ return this.search(request);
150
+ }
151
+ };
152
+ exports.SearchController = SearchController;
153
+ exports.SearchController = SearchController = SearchController_1 = tslib_1.__decorate([
154
+ (0, inversify_1.injectable)()
155
+ ], SearchController);
156
+ class RemoteSearchClient extends RemoteSearchApi {
157
+ seenAuthorization;
158
+ async search(request) {
159
+ this.seenAuthorization = core_context_1.RequestContext.getRequest()?.getHeader('authorization');
160
+ return { userId: core_context_1.RequestContext.getTrusted(exports.USER_ID) ?? 'missing', result: request.query };
161
+ }
162
+ }
163
+ exports.RemoteSearchClient = RemoteSearchClient;
164
+ class TestJwtHook extends http_routing_1.JwtHook {
165
+ mintedTokens = [];
166
+ lifetimeSeconds = 60;
167
+ failWith;
168
+ async mint(subject) {
169
+ if (this.failWith)
170
+ throw this.failWith;
171
+ const token = subject === 'passthrough'
172
+ ? 'mcp-passthrough'
173
+ : `${subject}-endpoint-${this.mintedTokens.length + 1}`;
174
+ this.mintedTokens.push(token);
175
+ return new http_routing_1.MintedJwt(token, Math.floor(Date.now() / 1000) + this.lifetimeSeconds);
176
+ }
177
+ async parseJwt(token) {
178
+ if (token.startsWith('admin-endpoint-')) {
179
+ return new http_routing_1.AuthenticatedCaller('admin-7', ['admin'], [new core_util_1.ContextTuple(exports.USER_ID, 'admin-7')]);
180
+ }
181
+ if (!token.startsWith('user-endpoint-'))
182
+ throw new Error('invalid endpoint token');
183
+ return new http_routing_1.AuthenticatedCaller('user-7', [], [new core_util_1.ContextTuple(exports.USER_ID, 'user-7')]);
184
+ }
185
+ }
186
+ exports.TestJwtHook = TestJwtHook;
187
+ class TestTokenAuthority {
188
+ verificationCount = 0;
189
+ roles = [];
190
+ async mintAccessToken(_grant) {
191
+ throw new Error('not used');
192
+ }
193
+ async verifyAccessToken(token, resource) {
194
+ this.verificationCount += 1;
195
+ if (token === 'invalid')
196
+ throw new core_util_1.ApiUnauthorizedError('invalid token');
197
+ if (token === 'authority-bug')
198
+ throw new Error('SECRET-internal-detail');
199
+ const now = Math.floor(Date.now() / 1000);
200
+ const actualResource = token === 'wrong-resource' ? 'https://attacker.example/mcp' : resource;
201
+ const subject = token === 'mcp-passthrough' ? 'passthrough' : 'user';
202
+ const issuer = token === 'wrong-issuer' ? 'https://attacker.example' : 'https://login.example.test';
203
+ const expiresAt = token === 'expired' ? now - 1 : now + 60;
204
+ const scopes = token === 'missing-scope' ? [] : ['tools'];
205
+ const validatedAt = token === 'stale-account' ? now - 3_601 : now;
206
+ const credential = new McpAuth_1.VerifiedMcpCredential(subject, issuer, actualResource, token === 'expired' ? now - 61 : now, expiresAt, scopes, validatedAt, this.roles, [new core_util_1.ContextTuple(exports.USER_ID, `${subject}-delegated`)]);
207
+ if (token === 'list-bug') {
208
+ Object.defineProperty(credential, 'listingRoles', {
209
+ get: () => {
210
+ throw new Error('SECRET-internal-detail');
211
+ },
212
+ });
213
+ }
214
+ return credential;
215
+ }
216
+ }
217
+ exports.TestTokenAuthority = TestTokenAuthority;
218
+ class RecordedLogLine {
219
+ logger;
220
+ level;
221
+ message;
222
+ error;
223
+ constructor(logger, level, message, error) {
224
+ this.logger = logger;
225
+ this.level = level;
226
+ this.message = message;
227
+ this.error = error;
228
+ }
229
+ /** The rendered line an operator would see, including an attached error's message and stack. */
230
+ rendered() {
231
+ return `${this.message} ${this.error?.message ?? ''} ${this.error?.stack ?? ''}`;
232
+ }
233
+ }
234
+ exports.RecordedLogLine = RecordedLogLine;
235
+ class RecordingLogger {
236
+ name;
237
+ lines;
238
+ constructor(name, lines) {
239
+ this.name = name;
240
+ this.lines = lines;
241
+ }
242
+ trace(message, err) {
243
+ this.lines.push(new RecordedLogLine(this.name, 'trace', message, err));
244
+ }
245
+ debug(message, err) {
246
+ this.lines.push(new RecordedLogLine(this.name, 'debug', message, err));
247
+ }
248
+ info(message, err) {
249
+ this.lines.push(new RecordedLogLine(this.name, 'info', message, err));
250
+ }
251
+ warn(message, err) {
252
+ this.lines.push(new RecordedLogLine(this.name, 'warn', message, err));
253
+ }
254
+ error(message, err) {
255
+ this.lines.push(new RecordedLogLine(this.name, 'error', message, err));
256
+ }
257
+ }
258
+ /** Captures every log line in-process so tests can count and level-check operator output. */
259
+ class RecordingLoggerFactory {
260
+ lines = [];
261
+ getLogger(name) {
262
+ return new RecordingLogger(name, this.lines);
263
+ }
264
+ containing(text) {
265
+ return this.lines.filter((line) => line.rendered().includes(text));
266
+ }
267
+ }
268
+ exports.RecordingLoggerFactory = RecordingLoggerFactory;
269
+ //# sourceMappingURL=WpMcpServerTestFixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WpMcpServerTestFixtures.js","sourceRoot":"","sources":["../../../../../../packages/http/mcp-server/src/__tests__/WpMcpServerTestFixtures.ts"],"names":[],"mappings":";;;;;AAAA,4BAA0B;AAC1B,yCAAuC;AACvC,oDAoB8B;AAC9B,0DAAyD;AACzD,0DAAkF;AAClF,wCAA4E;AAC5E,kEAAiE;AAEpD,QAAA,OAAO,GAAG,sBAAU,CAAC,OAAO,CACrC,eAAe,EACf,iCAAiC,CACpC,CAAC;AACW,QAAA,aAAa,GAAG,gBAAgB,CAAC;AACjC,QAAA,cAAc,GAAG,YAAY,CAAC;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAatB,KAAK,CAAU;CAClB,CAAA;AAdY,sCAAa;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AAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAW;QAC9B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3E,CAAC;CACJ;AAED,6FAA6F;AAC7F,MAAa,sBAAsB;IACtB,KAAK,GAAsB,EAAE,CAAC;IAEvC,SAAS,CAAC,IAAY;QAClB,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,UAAU,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAqB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,CAAC;CACJ;AAVD,wDAUC","sourcesContent":["import 'reflect-metadata';\nimport { injectable } from 'inversify';\nimport {\n ApiBadRequestError,\n ApiEndUserError,\n ApiPath,\n ApiUnauthorizedError,\n Logger,\n LoggerFactory,\n LogLevel,\n ContextKey,\n ContextTuple,\n Endpoint,\n WpAuthJwt,\n WpAuthOidc,\n WpDto,\n WpDtoField,\n WpDtoFieldOptions,\n WpMcpAuthJwt,\n WpMcpHeader,\n WpMcpTool,\n WpResponseDto,\n} from '@webpieces/core-util';\nimport { RequestContext } from '@webpieces/core-context';\nimport { AuthenticatedCaller, JwtHook, MintedJwt } from '@webpieces/http-routing';\nimport { McpAccessTokenAuthority, VerifiedMcpCredential } from '../McpAuth';\nimport { MCP_INVOCATION_CONTEXT } from '../McpInvocationContext';\n\nexport const USER_ID = ContextKey.trusted<string>(\n 'mcpSpecUserId',\n 'proven by a credential verifier',\n);\nexport const ENDPOINT_PATH = '/app-owned/mcp';\nexport const MODERN_VERSION = '2026-07-28';\n\n@WpDto()\nexport class SearchRequest {\n @WpDtoField(\n new WpDtoFieldOptions(\n 'Search text',\n true,\n undefined,\n false,\n undefined,\n undefined,\n undefined,\n new WpMcpHeader('query'),\n ),\n )\n query!: string;\n}\n\n@WpDto()\nexport class SearchResponse {\n @WpDtoField(new WpDtoFieldOptions('Authenticated user', true))\n userId!: string;\n\n @WpDtoField(new WpDtoFieldOptions('Search result', true))\n result!: string;\n}\n\n@ApiPath('/mcp-spec')\nexport abstract class SearchApi {\n @WpMcpAuthJwt({ allRolesAllowed: true })\n @WpAuthJwt({ allRolesAllowed: true })\n @Endpoint('/search', 'rpc')\n @WpResponseDto(() => SearchResponse)\n @WpMcpTool({\n name: 'account_search',\n description: 'Search records owned by the authenticated user.',\n readOnlyHint: true,\n idempotentHint: true,\n openWorldHint: false,\n })\n search(_request: SearchRequest): Promise<SearchResponse> {\n throw new Error('contract only');\n }\n\n @WpMcpAuthJwt({ roles: ['admin'] })\n @WpAuthJwt({ roles: ['admin'] })\n @Endpoint('/admin', 'rpc')\n @WpResponseDto(() => SearchResponse)\n @WpMcpTool({\n name: 'admin_search',\n description: 'Administrative search.',\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n })\n admin(_request: SearchRequest): Promise<SearchResponse> {\n throw new Error('contract only');\n }\n}\n\n@ApiPath('/remote-spec')\nexport abstract class RemoteSearchApi {\n @WpMcpAuthJwt({ allRolesAllowed: true })\n @WpAuthOidc()\n @Endpoint('/search', 'rpc')\n @WpResponseDto(() => SearchResponse)\n @WpMcpTool({\n name: 'remote_search',\n description: 'Search a remote binding.',\n readOnlyHint: false,\n destructiveHint: false,\n idempotentHint: false,\n openWorldHint: false,\n })\n search(_request: SearchRequest): Promise<SearchResponse> {\n throw new Error('contract only');\n }\n}\n\n@injectable()\nexport class SearchController extends SearchApi {\n static waitStartedHook?: () => void;\n static waitAbortedHook?: () => void;\n adminInvocations = 0;\n\n override async search(request: SearchRequest): Promise<SearchResponse> {\n if (request.query === 'internal') throw new Error('database password appeared here');\n if (request.query === 'human') throw new ApiEndUserError('Safe human message', 'SAFE');\n if (request.query === 'malformed') {\n throw new ApiBadRequestError(\n 'operator-only: column tenant_7 rejected',\n '$.query',\n 'query is malformed',\n );\n }\n const invocation = RequestContext.getTrusted(MCP_INVOCATION_CONTEXT);\n if (request.query === 'progress') {\n await invocation?.reportProgress?.(1, 2, 'halfway');\n }\n if (request.query === 'wait' && invocation) {\n await invocation.reportProgress?.(0, 1, 'waiting');\n SearchController.waitStartedHook?.();\n await new Promise<void>((resolve: () => void) => {\n const finish = (): void => {\n SearchController.waitAbortedHook?.();\n resolve();\n };\n if (invocation.signal.aborted) finish();\n else invocation.signal.addEventListener('abort', finish, { once: true });\n });\n }\n return { userId: RequestContext.getTrusted(USER_ID) ?? 'missing', result: request.query };\n }\n\n override async admin(request: SearchRequest): Promise<SearchResponse> {\n this.adminInvocations += 1;\n return this.search(request);\n }\n}\n\nexport class RemoteSearchClient extends RemoteSearchApi {\n seenAuthorization?: string;\n\n override async search(request: SearchRequest): Promise<SearchResponse> {\n this.seenAuthorization = RequestContext.getRequest()?.getHeader('authorization');\n return { userId: RequestContext.getTrusted(USER_ID) ?? 'missing', result: request.query };\n }\n}\n\nexport class TestJwtHook extends JwtHook<string> {\n mintedTokens: string[] = [];\n lifetimeSeconds = 60;\n failWith?: Error;\n\n override async mint(subject: string): Promise<MintedJwt> {\n if (this.failWith) throw this.failWith;\n const token =\n subject === 'passthrough'\n ? 'mcp-passthrough'\n : `${subject}-endpoint-${this.mintedTokens.length + 1}`;\n this.mintedTokens.push(token);\n return new MintedJwt(token, Math.floor(Date.now() / 1000) + this.lifetimeSeconds);\n }\n\n override async parseJwt(token: string): Promise<AuthenticatedCaller> {\n if (token.startsWith('admin-endpoint-')) {\n return new AuthenticatedCaller(\n 'admin-7',\n ['admin'],\n [new ContextTuple(USER_ID, 'admin-7')],\n );\n }\n if (!token.startsWith('user-endpoint-')) throw new Error('invalid endpoint token');\n return new AuthenticatedCaller('user-7', [], [new ContextTuple(USER_ID, 'user-7')]);\n }\n}\n\nexport class TestTokenAuthority implements McpAccessTokenAuthority<string> {\n verificationCount = 0;\n roles: readonly string[] = [];\n\n async mintAccessToken(_grant: string): Promise<never> {\n throw new Error('not used');\n }\n\n async verifyAccessToken(token: string, resource: string): Promise<VerifiedMcpCredential> {\n this.verificationCount += 1;\n if (token === 'invalid') throw new ApiUnauthorizedError('invalid token');\n if (token === 'authority-bug') throw new Error('SECRET-internal-detail');\n const now = Math.floor(Date.now() / 1000);\n const actualResource =\n token === 'wrong-resource' ? 'https://attacker.example/mcp' : resource;\n const subject = token === 'mcp-passthrough' ? 'passthrough' : 'user';\n const issuer =\n token === 'wrong-issuer' ? 'https://attacker.example' : 'https://login.example.test';\n const expiresAt = token === 'expired' ? now - 1 : now + 60;\n const scopes = token === 'missing-scope' ? [] : ['tools'];\n const validatedAt = token === 'stale-account' ? now - 3_601 : now;\n const credential = new VerifiedMcpCredential(\n subject,\n issuer,\n actualResource,\n token === 'expired' ? now - 61 : now,\n expiresAt,\n scopes,\n validatedAt,\n this.roles,\n [new ContextTuple(USER_ID, `${subject}-delegated`)],\n );\n if (token === 'list-bug') {\n Object.defineProperty(credential, 'listingRoles', {\n get: (): readonly string[] => {\n throw new Error('SECRET-internal-detail');\n },\n });\n }\n return credential;\n }\n}\n\nexport class RecordedLogLine {\n constructor(\n public readonly logger: string,\n public readonly level: LogLevel,\n public readonly message: string,\n public readonly error?: Error,\n ) {}\n\n /** The rendered line an operator would see, including an attached error's message and stack. */\n rendered(): string {\n return `${this.message} ${this.error?.message ?? ''} ${this.error?.stack ?? ''}`;\n }\n}\n\nclass RecordingLogger implements Logger {\n constructor(\n private readonly name: string,\n private readonly lines: RecordedLogLine[],\n ) {}\n\n trace(message: string, err?: Error): void {\n this.lines.push(new RecordedLogLine(this.name, 'trace', message, err));\n }\n\n debug(message: string, err?: Error): void {\n this.lines.push(new RecordedLogLine(this.name, 'debug', message, err));\n }\n\n info(message: string, err?: Error): void {\n this.lines.push(new RecordedLogLine(this.name, 'info', message, err));\n }\n\n warn(message: string, err?: Error): void {\n this.lines.push(new RecordedLogLine(this.name, 'warn', message, err));\n }\n\n error(message: string, err?: Error): void {\n this.lines.push(new RecordedLogLine(this.name, 'error', message, err));\n }\n}\n\n/** Captures every log line in-process so tests can count and level-check operator output. */\nexport class RecordingLoggerFactory implements LoggerFactory {\n readonly lines: RecordedLogLine[] = [];\n\n getLogger(name: string): Logger {\n return new RecordingLogger(name, this.lines);\n }\n\n containing(text: string): RecordedLogLine[] {\n return this.lines.filter((line: RecordedLogLine) => line.rendered().includes(text));\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  export { MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS, MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS, MAX_MCP_ENDPOINT_JWT_LIFETIME_SECONDS, McpEndpointDescriptor, MintedMcpAccessToken, McpProtectedResourceMetadata, VerifiedMcpCredential, WpMcpServerConfig, } from './McpAuth';
2
2
  export type { McpAccessTokenAuthority, McpEndpointMintRequestFactory } from './McpAuth';
3
3
  export { McpToolRegistry, RegisteredMcpTool } from './McpToolRegistry';
4
- export { McpApiDispatcher, McpDispatchFailure, McpDispatchSuccess, } from './McpApiDispatcher';
5
- export type { McpDispatchResult } from './McpApiDispatcher';
6
- export { ModelVisibleToolError, WpMcpServer } from './WpMcpServer';
4
+ export { McpApiBinding } from './McpApiBinding';
5
+ export type { McpBindingTopology } from './McpApiBinding';
6
+ export { MCP_INVOCATION_CONTEXT, McpInvocationContext } from './McpInvocationContext';
7
+ export type { McpProgressReporter } from './McpInvocationContext';
8
+ export { McpBindOptions } from './McpBindOptions';
9
+ export { McpDeployment } from './McpDeployment';
10
+ export type { McpDeploymentMode } from './McpDeployment';
11
+ export { McpApiDispatcher } from './McpApiDispatcher';
12
+ export { WpMcpServer } from './WpMcpServer';
13
+ export { MCP_REQUEST_ID_META_KEY, McpErrorData, McpFailureScope, McpHttpErrorBody, McpHttpErrorDetail, ModelVisibleToolError, WpMcpErrorTranslator, } from './WpMcpErrorTranslator';
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WpMcpServer = exports.ModelVisibleToolError = exports.McpDispatchSuccess = exports.McpDispatchFailure = exports.McpApiDispatcher = exports.RegisteredMcpTool = exports.McpToolRegistry = exports.WpMcpServerConfig = exports.VerifiedMcpCredential = exports.McpProtectedResourceMetadata = exports.MintedMcpAccessToken = exports.McpEndpointDescriptor = exports.MAX_MCP_ENDPOINT_JWT_LIFETIME_SECONDS = exports.MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS = exports.MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS = void 0;
3
+ exports.WpMcpErrorTranslator = exports.ModelVisibleToolError = exports.McpHttpErrorDetail = exports.McpHttpErrorBody = exports.McpFailureScope = exports.McpErrorData = exports.MCP_REQUEST_ID_META_KEY = exports.WpMcpServer = exports.McpApiDispatcher = exports.McpDeployment = exports.McpBindOptions = exports.McpInvocationContext = exports.MCP_INVOCATION_CONTEXT = exports.McpApiBinding = exports.RegisteredMcpTool = exports.McpToolRegistry = exports.WpMcpServerConfig = exports.VerifiedMcpCredential = exports.McpProtectedResourceMetadata = exports.MintedMcpAccessToken = exports.McpEndpointDescriptor = exports.MAX_MCP_ENDPOINT_JWT_LIFETIME_SECONDS = exports.MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS = exports.MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS = void 0;
4
4
  var McpAuth_1 = require("./McpAuth");
5
5
  Object.defineProperty(exports, "MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS", { enumerable: true, get: function () { return McpAuth_1.MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS; } });
6
6
  Object.defineProperty(exports, "MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS", { enumerable: true, get: function () { return McpAuth_1.MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS; } });
@@ -13,11 +13,25 @@ Object.defineProperty(exports, "WpMcpServerConfig", { enumerable: true, get: fun
13
13
  var McpToolRegistry_1 = require("./McpToolRegistry");
14
14
  Object.defineProperty(exports, "McpToolRegistry", { enumerable: true, get: function () { return McpToolRegistry_1.McpToolRegistry; } });
15
15
  Object.defineProperty(exports, "RegisteredMcpTool", { enumerable: true, get: function () { return McpToolRegistry_1.RegisteredMcpTool; } });
16
+ var McpApiBinding_1 = require("./McpApiBinding");
17
+ Object.defineProperty(exports, "McpApiBinding", { enumerable: true, get: function () { return McpApiBinding_1.McpApiBinding; } });
18
+ var McpInvocationContext_1 = require("./McpInvocationContext");
19
+ Object.defineProperty(exports, "MCP_INVOCATION_CONTEXT", { enumerable: true, get: function () { return McpInvocationContext_1.MCP_INVOCATION_CONTEXT; } });
20
+ Object.defineProperty(exports, "McpInvocationContext", { enumerable: true, get: function () { return McpInvocationContext_1.McpInvocationContext; } });
21
+ var McpBindOptions_1 = require("./McpBindOptions");
22
+ Object.defineProperty(exports, "McpBindOptions", { enumerable: true, get: function () { return McpBindOptions_1.McpBindOptions; } });
23
+ var McpDeployment_1 = require("./McpDeployment");
24
+ Object.defineProperty(exports, "McpDeployment", { enumerable: true, get: function () { return McpDeployment_1.McpDeployment; } });
16
25
  var McpApiDispatcher_1 = require("./McpApiDispatcher");
17
26
  Object.defineProperty(exports, "McpApiDispatcher", { enumerable: true, get: function () { return McpApiDispatcher_1.McpApiDispatcher; } });
18
- Object.defineProperty(exports, "McpDispatchFailure", { enumerable: true, get: function () { return McpApiDispatcher_1.McpDispatchFailure; } });
19
- Object.defineProperty(exports, "McpDispatchSuccess", { enumerable: true, get: function () { return McpApiDispatcher_1.McpDispatchSuccess; } });
20
27
  var WpMcpServer_1 = require("./WpMcpServer");
21
- Object.defineProperty(exports, "ModelVisibleToolError", { enumerable: true, get: function () { return WpMcpServer_1.ModelVisibleToolError; } });
22
28
  Object.defineProperty(exports, "WpMcpServer", { enumerable: true, get: function () { return WpMcpServer_1.WpMcpServer; } });
29
+ var WpMcpErrorTranslator_1 = require("./WpMcpErrorTranslator");
30
+ Object.defineProperty(exports, "MCP_REQUEST_ID_META_KEY", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.MCP_REQUEST_ID_META_KEY; } });
31
+ Object.defineProperty(exports, "McpErrorData", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.McpErrorData; } });
32
+ Object.defineProperty(exports, "McpFailureScope", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.McpFailureScope; } });
33
+ Object.defineProperty(exports, "McpHttpErrorBody", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.McpHttpErrorBody; } });
34
+ Object.defineProperty(exports, "McpHttpErrorDetail", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.McpHttpErrorDetail; } });
35
+ Object.defineProperty(exports, "ModelVisibleToolError", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.ModelVisibleToolError; } });
36
+ Object.defineProperty(exports, "WpMcpErrorTranslator", { enumerable: true, get: function () { return WpMcpErrorTranslator_1.WpMcpErrorTranslator; } });
23
37
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/mcp-server/src/index.ts"],"names":[],"mappings":";;;AAAA,qCASmB;AARf,gIAAA,qCAAqC,OAAA;AACrC,iIAAA,sCAAsC,OAAA;AACtC,gIAAA,qCAAqC,OAAA;AACrC,gHAAA,qBAAqB,OAAA;AACrB,+GAAA,oBAAoB,OAAA;AACpB,uHAAA,4BAA4B,OAAA;AAC5B,gHAAA,qBAAqB,OAAA;AACrB,4GAAA,iBAAiB,OAAA;AAGrB,qDAAuE;AAA9D,kHAAA,eAAe,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC3C,uDAI4B;AAHxB,oHAAA,gBAAgB,OAAA;AAChB,sHAAA,kBAAkB,OAAA;AAClB,sHAAA,kBAAkB,OAAA;AAGtB,6CAAmE;AAA1D,oHAAA,qBAAqB,OAAA;AAAE,0GAAA,WAAW,OAAA","sourcesContent":["export {\n MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS,\n MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS,\n MAX_MCP_ENDPOINT_JWT_LIFETIME_SECONDS,\n McpEndpointDescriptor,\n MintedMcpAccessToken,\n McpProtectedResourceMetadata,\n VerifiedMcpCredential,\n WpMcpServerConfig,\n} from './McpAuth';\nexport type { McpAccessTokenAuthority, McpEndpointMintRequestFactory } from './McpAuth';\nexport { McpToolRegistry, RegisteredMcpTool } from './McpToolRegistry';\nexport {\n McpApiDispatcher,\n McpDispatchFailure,\n McpDispatchSuccess,\n} from './McpApiDispatcher';\nexport type { McpDispatchResult } from './McpApiDispatcher';\nexport { ModelVisibleToolError, WpMcpServer } from './WpMcpServer';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/mcp-server/src/index.ts"],"names":[],"mappings":";;;AAAA,qCASmB;AARf,gIAAA,qCAAqC,OAAA;AACrC,iIAAA,sCAAsC,OAAA;AACtC,gIAAA,qCAAqC,OAAA;AACrC,gHAAA,qBAAqB,OAAA;AACrB,+GAAA,oBAAoB,OAAA;AACpB,uHAAA,4BAA4B,OAAA;AAC5B,gHAAA,qBAAqB,OAAA;AACrB,4GAAA,iBAAiB,OAAA;AAGrB,qDAAuE;AAA9D,kHAAA,eAAe,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC3C,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,+DAAsF;AAA7E,8HAAA,sBAAsB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAErD,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,+DAQgC;AAP5B,+HAAA,uBAAuB,OAAA;AACvB,oHAAA,YAAY,OAAA;AACZ,uHAAA,eAAe,OAAA;AACf,wHAAA,gBAAgB,OAAA;AAChB,0HAAA,kBAAkB,OAAA;AAClB,6HAAA,qBAAqB,OAAA;AACrB,4HAAA,oBAAoB,OAAA","sourcesContent":["export {\n MAX_MCP_ACCESS_TOKEN_LIFETIME_SECONDS,\n MAX_MCP_ACCOUNT_VALIDATION_AGE_SECONDS,\n MAX_MCP_ENDPOINT_JWT_LIFETIME_SECONDS,\n McpEndpointDescriptor,\n MintedMcpAccessToken,\n McpProtectedResourceMetadata,\n VerifiedMcpCredential,\n WpMcpServerConfig,\n} from './McpAuth';\nexport type { McpAccessTokenAuthority, McpEndpointMintRequestFactory } from './McpAuth';\nexport { McpToolRegistry, RegisteredMcpTool } from './McpToolRegistry';\nexport { McpApiBinding } from './McpApiBinding';\nexport type { McpBindingTopology } from './McpApiBinding';\nexport { MCP_INVOCATION_CONTEXT, McpInvocationContext } from './McpInvocationContext';\nexport type { McpProgressReporter } from './McpInvocationContext';\nexport { McpBindOptions } from './McpBindOptions';\nexport { McpDeployment } from './McpDeployment';\nexport type { McpDeploymentMode } from './McpDeployment';\nexport { McpApiDispatcher } from './McpApiDispatcher';\nexport { WpMcpServer } from './WpMcpServer';\nexport {\n MCP_REQUEST_ID_META_KEY,\n McpErrorData,\n McpFailureScope,\n McpHttpErrorBody,\n McpHttpErrorDetail,\n ModelVisibleToolError,\n WpMcpErrorTranslator,\n} from './WpMcpErrorTranslator';\n"]}