@whook/mcp 26.0.5

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2017 Nicolas Froidure
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the “Software”), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ [//]: # ( )
2
+ [//]: # (This file is automatically generated by a `metapak`)
3
+ [//]: # (module. Do not change it except between the)
4
+ [//]: # (`content:start/end` flags, your changes would)
5
+ [//]: # (be overridden.)
6
+ [//]: # ( )
7
+ # @whook/mcp
8
+ > Adds an MCP server that proxies the API routes
9
+
10
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/whook/blob/main/packages/whook-mcp/LICENSE)
11
+
12
+
13
+ [//]: # (::contents:start)
14
+
15
+ This module provides MCP capabilities to a
16
+ [Whook](https://github.com/nfroidure/whook) server !
17
+
18
+ ## Usage
19
+
20
+ This module requires `@whook/authorization`.
21
+
22
+ ## Setup
23
+
24
+ Install the module:
25
+
26
+ ```sh
27
+ npm i @whook/mcp
28
+ ```
29
+
30
+ Update the types (usually in `src/whook.d.ts`):
31
+
32
+ ```diff
33
+ +import {
34
+ + type WhookMCPServerConfig,
35
+ + type WhookMCPHandlerConfig,
36
+ + type WhookMCPRouteConfig,
37
+ +} from '@whook/mcp';
38
+
39
+ // ...
40
+
41
+ declare module 'application-services' {
42
+
43
+ export interface AppConfig
44
+ extends WhookBaseConfigs,
45
+ // (...)
46
+ + WhookMCPServerConfig,
47
+ + WhookMCPHandlerConfig,
48
+ JWTServiceConfig {}
49
+
50
+ // ...
51
+
52
+ declare module '@whook/whook' {
53
+ export interface WhookRouteConfig
54
+ - extends WhookBaseRouteConfig {}
55
+ + extends WhookBaseRouteConfig,
56
+ + WhookMCPRouteConfig {}
57
+ }
58
+
59
+ }
60
+ ```
61
+
62
+ Declare the plugin into your `src/index.ts` file:
63
+
64
+ ```diff
65
+
66
+ // (...)
67
+
68
+ // Setup your own whook plugins or avoid whook defaults by leaving it empty
69
+ $.register(
70
+ constant('WHOOK_PLUGINS', [
71
+ ...WHOOK_DEFAULT_PLUGINS,
72
+ + '@whook/mcp',
73
+ '@whook/cors',
74
+ ]),
75
+ );
76
+
77
+ // ...
78
+
79
+ ```
80
+
81
+ Alternatively, you can use the HTTP router wrapper if you wish to use several
82
+ wrappers for it by cloning the [`httpRouter`](./src/services/httpRouter.ts)
83
+ service file in your project.
84
+
85
+ [//]: # (::contents:end)
86
+
87
+ # API
88
+
89
+ # Authors
90
+ - [Nicolas Froidure](http://insertafter.com/en/index.html)
91
+
92
+ # License
93
+ [MIT](https://github.com/nfroidure/whook/blob/main/packages/whook-mcp/LICENSE)
@@ -0,0 +1,7 @@
1
+ export type * from './wrappers/wrapHTTPRouterWithMCPServer.js';
2
+ export type * from './services/httpRouter.js';
3
+ export type * from './services/mcpHandler.js';
4
+ import wrapHTTPRouterWithMCPServer from './wrappers/wrapHTTPRouterWithMCPServer.js';
5
+ import initHTTPRouter from './services/httpRouter.js';
6
+ import initMCPHandler from './services/mcpHandler.js';
7
+ export { wrapHTTPRouterWithMCPServer, initHTTPRouter, initMCPHandler };
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import wrapHTTPRouterWithMCPServer from './wrappers/wrapHTTPRouterWithMCPServer.js';
2
+ import initHTTPRouter from './services/httpRouter.js';
3
+ import initMCPHandler from './services/mcpHandler.js';
4
+ export { wrapHTTPRouterWithMCPServer, initHTTPRouter, initMCPHandler };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,2BAA2B,MAAM,2CAA2C,CAAC;AACpF,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,2BAA2B,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,550 @@
1
+ import { describe, test, beforeEach, jest, expect } from '@jest/globals';
2
+ import { constant, initializer } from 'knifecycle';
3
+ import axios from 'axios';
4
+ import { prepareProcess, prepareEnvironment, getPingDefinition, initHTTPRouter, } from '@whook/whook';
5
+ import { YError } from 'yerror';
6
+ import { wrapHTTPRouterWithMCPServer, initMCPHandler, } from './index.js';
7
+ describe('wrapHTTPRouterWithMCPServer', () => {
8
+ const HOST = 'localhost';
9
+ const BASE_PATH = '/v1';
10
+ const API = {
11
+ openapi: '3.1.0',
12
+ info: {
13
+ version: '1.0.0',
14
+ title: 'Sample OpenAPI',
15
+ description: 'A sample OpenAPI file for testing purpose.',
16
+ },
17
+ paths: {
18
+ [`${BASE_PATH}${getPingDefinition.path}`]: {
19
+ [getPingDefinition.method]: getPingDefinition.operation,
20
+ },
21
+ },
22
+ };
23
+ const logger = {
24
+ output: jest.fn(),
25
+ error: jest.fn(),
26
+ debug: jest.fn(),
27
+ };
28
+ const time = jest.fn();
29
+ const authentication = {
30
+ check: jest.fn(),
31
+ };
32
+ const $autoload = jest.fn(async (serviceName) => {
33
+ throw new YError('E_UNMATCHED_DEPENDENCY', [serviceName]);
34
+ });
35
+ const MCP_OPTIONS = {
36
+ metadata: {
37
+ name: 'MCP Server',
38
+ version: '1.0.0',
39
+ },
40
+ path: '/mcp',
41
+ prebuildTools: true,
42
+ securityKeys: ['bearerAuth'],
43
+ };
44
+ const DEFINITIONS = {
45
+ components: {},
46
+ paths: {
47
+ '/ping': {
48
+ get: getPingDefinition.operation,
49
+ },
50
+ },
51
+ security: [],
52
+ configs: {
53
+ getPing: {
54
+ type: 'route',
55
+ path: '/ping',
56
+ method: 'get',
57
+ config: {},
58
+ operation: getPingDefinition.operation,
59
+ },
60
+ },
61
+ };
62
+ let $;
63
+ beforeEach(() => {
64
+ logger.output.mockReset();
65
+ logger.error.mockReset();
66
+ logger.debug.mockReset();
67
+ time.mockReset();
68
+ authentication.check.mockReset();
69
+ $autoload.mockClear();
70
+ });
71
+ beforeEach(async () => {
72
+ $ = await prepareEnvironment();
73
+ $.register(initializer({
74
+ name: '$autoload',
75
+ type: 'service',
76
+ singleton: true,
77
+ }, async () => $autoload));
78
+ $.register(constant('DEV_ACCESS_TOKEN', 'oudelali'));
79
+ $.register(constant('BASE_PATH', BASE_PATH));
80
+ $.register(constant('HOST', HOST));
81
+ $.register(constant('APP_ENV', 'local'));
82
+ $.register(constant('API', API));
83
+ $.register(constant('DEFINITIONS', DEFINITIONS));
84
+ $.register(constant('ROUTES_WRAPPERS_NAMES', []));
85
+ $.register(constant('authentication', authentication));
86
+ $.register(constant('ROUTES_HANDLERS', {
87
+ getPing: jest.fn(async () => ({
88
+ status: 200,
89
+ headers: { 'content-type': 'application/json' },
90
+ body: { ping: 'pong' },
91
+ })),
92
+ }));
93
+ $.register(constant('logger', logger));
94
+ $.register(constant('time', time));
95
+ $.register(constant('MCP_OPTIONS', MCP_OPTIONS));
96
+ $.register(initMCPHandler);
97
+ $.register(wrapHTTPRouterWithMCPServer(initHTTPRouter));
98
+ $.register(constant('CONFIG', {}));
99
+ $.register(constant('DEBUG_NODE_ENVS', ['test']));
100
+ $.register(constant('ENV', {
101
+ NODE_ENV: 'test',
102
+ DEV_MODE: '1',
103
+ }));
104
+ });
105
+ test('should list tools', async () => {
106
+ const PORT = 11111;
107
+ $.register(constant('PORT', PORT));
108
+ time.mockReturnValue(new Date('2010-03-06T00:00:00Z').getTime());
109
+ const { $instance } = await prepareProcess(['$instance', 'httpServer', 'process'], $);
110
+ authentication.check.mockResolvedValueOnce({
111
+ scopes: ['user'],
112
+ });
113
+ const { status, headers, data } = await axios({
114
+ method: 'post',
115
+ url: `http://${HOST}:${PORT}${MCP_OPTIONS.path}`,
116
+ headers: {
117
+ 'user-agent': '__avoid_axios_version__',
118
+ Authorization: 'bearer a_valid_token',
119
+ Accept: 'application/json; text/event-stream',
120
+ 'Content-Type': 'application/json',
121
+ },
122
+ data: { jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} },
123
+ validateStatus: () => true,
124
+ });
125
+ await $instance.destroy();
126
+ expect({
127
+ status,
128
+ headers: {
129
+ ...headers,
130
+ // Erasing the Date header that may be added by Axios :/
131
+ date: undefined,
132
+ etag: undefined,
133
+ 'last-modified': undefined,
134
+ server: undefined,
135
+ connection: undefined,
136
+ 'keep-alive': undefined,
137
+ },
138
+ data,
139
+ }).toMatchInlineSnapshot(`
140
+ {
141
+ "data": "event: message
142
+ data: {"result":{"tools":[{"name":"getPing","description":"Checks API's availability.","annotations":{"readOnlyHint":true,"idempotentHint":true,"destructiveHint":false,"openWorldHint":true},"inputSchema":{"type":"object","required":[],"properties":{}},"outputSchema":{"type":"object","required":["status","body"],"properties":{"status":{"const":200},"body":{"type":"object","additionalProperties":false,"properties":{"pong":{"type":"string","enum":["pong"]}}}}}}]},"jsonrpc":"2.0","id":2}
143
+
144
+ ",
145
+ "headers": {
146
+ "cache-control": "no-cache, no-transform",
147
+ "connection": undefined,
148
+ "content-type": "text/event-stream",
149
+ "date": undefined,
150
+ "etag": undefined,
151
+ "keep-alive": undefined,
152
+ "last-modified": undefined,
153
+ "server": undefined,
154
+ "transfer-encoding": "chunked",
155
+ "x-accel-buffering": "no",
156
+ },
157
+ "status": 200,
158
+ }
159
+ `);
160
+ expect({
161
+ debugCalls: logger.debug.mock.calls.sort(sortLogs),
162
+ logErrorCalls: logger.error.mock.calls,
163
+ autoloaderCalls: $autoload.mock.calls,
164
+ authenticationCheckCalls: authentication.check.mock.calls,
165
+ }).toMatchInlineSnapshot(`
166
+ {
167
+ "authenticationCheckCalls": [
168
+ [
169
+ "bearer",
170
+ {
171
+ "hash": "a_valid_token",
172
+ },
173
+ ],
174
+ ],
175
+ "autoloaderCalls": [
176
+ [
177
+ "BUFFER_LIMIT",
178
+ ],
179
+ [
180
+ "PARSERS",
181
+ ],
182
+ [
183
+ "STRINGIFIERS",
184
+ ],
185
+ [
186
+ "DECODERS",
187
+ ],
188
+ [
189
+ "ENCODERS",
190
+ ],
191
+ [
192
+ "COERCION_OPTIONS",
193
+ ],
194
+ [
195
+ "SCHEMA_VALIDATORS_OPTIONS",
196
+ ],
197
+ [
198
+ "TIMEOUT",
199
+ ],
200
+ [
201
+ "TRANSACTIONS",
202
+ ],
203
+ [
204
+ "SHIELD_CHAR",
205
+ ],
206
+ [
207
+ "MAX_CLEAR_CHARS",
208
+ ],
209
+ [
210
+ "MAX_CLEAR_RATIO",
211
+ ],
212
+ [
213
+ "SENSIBLE_PROPS",
214
+ ],
215
+ [
216
+ "SENSIBLE_HEADERS",
217
+ ],
218
+ [
219
+ "uniqueId",
220
+ ],
221
+ [
222
+ "ERRORS_DESCRIPTORS",
223
+ ],
224
+ [
225
+ "DEFAULT_ERROR_CODE",
226
+ ],
227
+ [
228
+ "QUERY_PARSER_OPTIONS",
229
+ ],
230
+ [
231
+ "PROCESS_NAME",
232
+ ],
233
+ [
234
+ "SIGNALS",
235
+ ],
236
+ [
237
+ "HTTP_SERVER_OPTIONS",
238
+ ],
239
+ ],
240
+ "debugCalls": [
241
+ [
242
+ "⌛ - Delay service initialized.",
243
+ ],
244
+ [
245
+ "⏳ - Cancelling pending timeouts:",
246
+ 0,
247
+ ],
248
+ [
249
+ "✅ - Closing HTTP server.",
250
+ ],
251
+ [
252
+ "✔️ - HTTP server closed!",
253
+ ],
254
+ [
255
+ "❤️ - Initializing the APM service.",
256
+ ],
257
+ [
258
+ "➕ - Found 1 tools!",
259
+ ],
260
+ [
261
+ "➕ - Listing tools!",
262
+ ],
263
+ [
264
+ "➕ - MCP request authenticated",
265
+ ],
266
+ [
267
+ "👣 - Logging service initialized.",
268
+ ],
269
+ [
270
+ "💱 - HTTP Transaction initialized.",
271
+ ],
272
+ [
273
+ "📇 - Process service initialized.",
274
+ ],
275
+ [
276
+ "🔧 - Building tool for getPing!",
277
+ ],
278
+ [
279
+ "🔧 - Pre-building tools!",
280
+ ],
281
+ [
282
+ "🕶️ - Initializing the obfuscator service.",
283
+ ],
284
+ [
285
+ "🙋 - MCP authentication: ",
286
+ "{"scopes":["user"]}",
287
+ ],
288
+ [
289
+ "🚦 - HTTP Router initialized.",
290
+ ],
291
+ ],
292
+ "logErrorCalls": [
293
+ [
294
+ "🖃 - Initializing the validators service.",
295
+ ],
296
+ [
297
+ "⌨️ - Initializing the basic query parser.",
298
+ ],
299
+ [
300
+ "💻 - Starting the MCPServer service.",
301
+ ],
302
+ [
303
+ "💁 - Serving API through MCP (path: /mcp)",
304
+ ],
305
+ [
306
+ "🎙️ - HTTP Server listening at "http://localhost:11111".",
307
+ ],
308
+ [
309
+ "On air 🚀🌕",
310
+ ],
311
+ ],
312
+ }
313
+ `);
314
+ });
315
+ test('should run a tool', async () => {
316
+ const PORT = 11112;
317
+ $.register(constant('PORT', PORT));
318
+ time.mockReturnValue(new Date('2010-03-06T00:00:00Z').getTime());
319
+ const { $instance } = await prepareProcess(['$instance', 'httpServer', 'process'], $);
320
+ authentication.check.mockResolvedValueOnce({
321
+ scopes: ['user'],
322
+ });
323
+ const { status, headers, data } = await axios({
324
+ method: 'post',
325
+ url: `http://${HOST}:${PORT}${MCP_OPTIONS.path}`,
326
+ headers: {
327
+ 'user-agent': '__avoid_axios_version__',
328
+ Authorization: 'bearer a_valid_token',
329
+ Accept: 'application/json; text/event-stream',
330
+ 'Content-Type': 'application/json',
331
+ },
332
+ data: {
333
+ jsonrpc: '2.0',
334
+ id: 2,
335
+ method: 'tools/call',
336
+ params: {
337
+ name: 'getPing',
338
+ arguments: {},
339
+ },
340
+ },
341
+ validateStatus: () => true,
342
+ });
343
+ await $instance.destroy();
344
+ expect({
345
+ status,
346
+ headers: {
347
+ ...headers,
348
+ // Erasing the Date header that may be added by Axios :/
349
+ date: undefined,
350
+ etag: undefined,
351
+ 'last-modified': undefined,
352
+ server: undefined,
353
+ connection: undefined,
354
+ 'keep-alive': undefined,
355
+ },
356
+ data,
357
+ }).toMatchInlineSnapshot(`
358
+ {
359
+ "data": "event: message
360
+ data: {"result":{"content":[{"type":"text","text":"{\\"status\\":200,\\"headers\\":{\\"content-type\\":\\"application/json\\"},\\"body\\":{\\"ping\\":\\"pong\\"}}"}]},"jsonrpc":"2.0","id":2}
361
+
362
+ ",
363
+ "headers": {
364
+ "cache-control": "no-cache, no-transform",
365
+ "connection": undefined,
366
+ "content-type": "text/event-stream",
367
+ "date": undefined,
368
+ "etag": undefined,
369
+ "keep-alive": undefined,
370
+ "last-modified": undefined,
371
+ "server": undefined,
372
+ "transfer-encoding": "chunked",
373
+ "x-accel-buffering": "no",
374
+ },
375
+ "status": 200,
376
+ }
377
+ `);
378
+ expect({
379
+ debugCalls: logger.debug.mock.calls.sort(sortLogs),
380
+ logErrorCalls: logger.error.mock.calls,
381
+ autoloaderCalls: $autoload.mock.calls,
382
+ authenticationCheckCalls: authentication.check.mock.calls,
383
+ }).toMatchInlineSnapshot(`
384
+ {
385
+ "authenticationCheckCalls": [
386
+ [
387
+ "bearer",
388
+ {
389
+ "hash": "a_valid_token",
390
+ },
391
+ ],
392
+ ],
393
+ "autoloaderCalls": [
394
+ [
395
+ "BUFFER_LIMIT",
396
+ ],
397
+ [
398
+ "PARSERS",
399
+ ],
400
+ [
401
+ "STRINGIFIERS",
402
+ ],
403
+ [
404
+ "DECODERS",
405
+ ],
406
+ [
407
+ "ENCODERS",
408
+ ],
409
+ [
410
+ "COERCION_OPTIONS",
411
+ ],
412
+ [
413
+ "SCHEMA_VALIDATORS_OPTIONS",
414
+ ],
415
+ [
416
+ "TIMEOUT",
417
+ ],
418
+ [
419
+ "TRANSACTIONS",
420
+ ],
421
+ [
422
+ "SHIELD_CHAR",
423
+ ],
424
+ [
425
+ "MAX_CLEAR_CHARS",
426
+ ],
427
+ [
428
+ "MAX_CLEAR_RATIO",
429
+ ],
430
+ [
431
+ "SENSIBLE_PROPS",
432
+ ],
433
+ [
434
+ "SENSIBLE_HEADERS",
435
+ ],
436
+ [
437
+ "uniqueId",
438
+ ],
439
+ [
440
+ "ERRORS_DESCRIPTORS",
441
+ ],
442
+ [
443
+ "DEFAULT_ERROR_CODE",
444
+ ],
445
+ [
446
+ "QUERY_PARSER_OPTIONS",
447
+ ],
448
+ [
449
+ "PROCESS_NAME",
450
+ ],
451
+ [
452
+ "SIGNALS",
453
+ ],
454
+ [
455
+ "HTTP_SERVER_OPTIONS",
456
+ ],
457
+ ],
458
+ "debugCalls": [
459
+ [
460
+ "{"type":"object","required":[],"properties":{}}",
461
+ ],
462
+ [
463
+ "⌛ - Delay service initialized.",
464
+ ],
465
+ [
466
+ "⏳ - Cancelling pending timeouts:",
467
+ 0,
468
+ ],
469
+ [
470
+ "⚠️ - Prefer using $ref to OpenAPI schemas components to build more efficiently!",
471
+ ],
472
+ [
473
+ "✅ - Closing HTTP server.",
474
+ ],
475
+ [
476
+ "✔️ - HTTP server closed!",
477
+ ],
478
+ [
479
+ "❤️ - Initializing the APM service.",
480
+ ],
481
+ [
482
+ "➕ - MCP request authenticated",
483
+ ],
484
+ [
485
+ "➕ - Parameters "{"path":{},"query":{},"cookies":{},"headers":{}}"",
486
+ ],
487
+ [
488
+ "➕ - Response "{"status":200,"headers":{"content-type":"application/json"},"body":{"ping":"pong"}}"!",
489
+ ],
490
+ [
491
+ "➕ - Running call getPing!",
492
+ ],
493
+ [
494
+ "👣 - Logging service initialized.",
495
+ ],
496
+ [
497
+ "💱 - HTTP Transaction initialized.",
498
+ ],
499
+ [
500
+ "📇 - Process service initialized.",
501
+ ],
502
+ [
503
+ "🔧 - Building tool for getPing!",
504
+ ],
505
+ [
506
+ "🔧 - Pre-building tools!",
507
+ ],
508
+ [
509
+ "🕶️ - Initializing the obfuscator service.",
510
+ ],
511
+ [
512
+ "🙋 - MCP authentication: ",
513
+ "{"scopes":["user"]}",
514
+ ],
515
+ [
516
+ "🚦 - HTTP Router initialized.",
517
+ ],
518
+ ],
519
+ "logErrorCalls": [
520
+ [
521
+ "🖃 - Initializing the validators service.",
522
+ ],
523
+ [
524
+ "⌨️ - Initializing the basic query parser.",
525
+ ],
526
+ [
527
+ "💻 - Starting the MCPServer service.",
528
+ ],
529
+ [
530
+ "💁 - Serving API through MCP (path: /mcp)",
531
+ ],
532
+ [
533
+ "🎙️ - HTTP Server listening at "http://localhost:11112".",
534
+ ],
535
+ [
536
+ "On air 🚀🌕",
537
+ ],
538
+ ],
539
+ }
540
+ `);
541
+ });
542
+ });
543
+ function sortLogs(strs1, strs2) {
544
+ return strs1[0] > strs2[0]
545
+ ? 1
546
+ : strs1[0] === strs2[0]
547
+ ? 0
548
+ : -1;
549
+ }
550
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzE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