toolcraft 0.0.111 → 0.0.113

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.
@@ -1,22 +1,24 @@
1
1
  import { describe, expect, it, vi } from "vitest";
2
- import { nodeFetch } from "tiny-http-mcp-server/testing";
2
+ import { installInMemoryHttp, nodeFetch } from "tiny-http-mcp-server/test-support";
3
3
  import type { OAuthSessionStore, StoredOAuthSession } from "mcp-oauth";
4
4
  import {
5
5
  HttpTransport,
6
6
  type OAuthDiscoveryCache,
7
7
  type OAuthDiscoveryResult,
8
8
  parseBearerWwwAuthenticateHeader,
9
- resolveAuthorizationServerMetadataUrl,
9
+ resolveAuthorizationServerMetadataUrl
10
10
  } from "./internal.js";
11
11
  import { OAuthMetadataDiscovery, discoverOAuthMetadata } from "./oauth-discovery.js";
12
12
 
13
+ installInMemoryHttp();
14
+
13
15
  function jsonResponse(body: unknown, init?: ResponseInit): Response {
14
16
  return new Response(JSON.stringify(body), {
15
17
  status: 200,
16
18
  headers: {
17
- "Content-Type": "application/json",
19
+ "Content-Type": "application/json"
18
20
  },
19
- ...init,
21
+ ...init
20
22
  });
21
23
  }
22
24
 
@@ -35,7 +37,7 @@ describe("discoverOAuthMetadata", () => {
35
37
  get: vi.fn(async (key: string) => sharedCacheStore.get(key)),
36
38
  set: vi.fn(async (key: string, value: OAuthDiscoveryResult) => {
37
39
  sharedCacheStore.set(key, value);
38
- }),
40
+ })
39
41
  };
40
42
 
41
43
  const fetchMock = vi.fn(async (input: string | URL): Promise<Response> => {
@@ -46,15 +48,15 @@ describe("discoverOAuthMetadata", () => {
46
48
  resource: resourceUrl,
47
49
  authorization_servers: [
48
50
  "https://auth.example.com/issuer-a",
49
- "https://auth.example.com/issuer-b",
50
- ],
51
+ "https://auth.example.com/issuer-b"
52
+ ]
51
53
  });
52
54
  }
53
55
 
54
56
  if (url === failingAuthorizationServerMetadataUrl) {
55
57
  return new Response("no metadata here", {
56
58
  status: 404,
57
- statusText: "Not Found",
59
+ statusText: "Not Found"
58
60
  });
59
61
  }
60
62
 
@@ -64,7 +66,7 @@ describe("discoverOAuthMetadata", () => {
64
66
  authorization_endpoint: "https://auth.example.com/issuer-b/authorize",
65
67
  token_endpoint: "https://auth.example.com/issuer-b/token",
66
68
  response_types_supported: ["code"],
67
- code_challenge_methods_supported: ["plain", "S256"],
69
+ code_challenge_methods_supported: ["plain", "S256"]
68
70
  });
69
71
  }
70
72
 
@@ -73,7 +75,7 @@ describe("discoverOAuthMetadata", () => {
73
75
 
74
76
  const discoveryClient = new OAuthMetadataDiscovery({
75
77
  fetch: fetchMock,
76
- cache,
78
+ cache
77
79
  });
78
80
  const firstDiscovery = await discoveryClient.discover(resourceUrl);
79
81
 
@@ -84,17 +86,17 @@ describe("discoverOAuthMetadata", () => {
84
86
  resourceMetadata: {
85
87
  authorization_servers: [
86
88
  "https://auth.example.com/issuer-a",
87
- "https://auth.example.com/issuer-b",
88
- ],
89
+ "https://auth.example.com/issuer-b"
90
+ ]
89
91
  },
90
92
  authorizationServerMetadata: {
91
- issuer: "https://auth.example.com/issuer-b",
92
- },
93
+ issuer: "https://auth.example.com/issuer-b"
94
+ }
93
95
  });
94
96
  expect(fetchMock.mock.calls.map(([input]) => input.toString())).toEqual([
95
97
  resourceMetadataUrl,
96
98
  failingAuthorizationServerMetadataUrl,
97
- successfulAuthorizationServerMetadataUrl,
99
+ successfulAuthorizationServerMetadataUrl
98
100
  ]);
99
101
  expect(cache.set).toHaveBeenCalledWith(resourceUrl, firstDiscovery);
100
102
 
@@ -109,7 +111,7 @@ describe("discoverOAuthMetadata", () => {
109
111
  });
110
112
  const secondDiscoveryClient = new OAuthMetadataDiscovery({
111
113
  fetch: secondFetch,
112
- cache,
114
+ cache
113
115
  });
114
116
  const cachedDiscovery = await secondDiscoveryClient.discover(resourceUrl);
115
117
 
@@ -120,10 +122,11 @@ describe("discoverOAuthMetadata", () => {
120
122
  it("rejects invalid protected resource metadata with a clear error", async () => {
121
123
  const resourceUrl = "https://resource.example.com/tenant/mcp";
122
124
 
123
- const fetchMock = vi.fn(async (): Promise<Response> =>
124
- jsonResponse({
125
- resource: resourceUrl,
126
- })
125
+ const fetchMock = vi.fn(
126
+ async (): Promise<Response> =>
127
+ jsonResponse({
128
+ resource: resourceUrl
129
+ })
127
130
  );
128
131
 
129
132
  await expect(discoverOAuthMetadata(resourceUrl, { fetch: fetchMock })).rejects.toThrow(
@@ -140,7 +143,7 @@ describe("discoverOAuthMetadata", () => {
140
143
  if (url.includes("oauth-protected-resource")) {
141
144
  return jsonResponse({
142
145
  resource: resourceUrl,
143
- authorization_servers: ["https://auth.example.com/issuer-a"],
146
+ authorization_servers: ["https://auth.example.com/issuer-a"]
144
147
  });
145
148
  }
146
149
 
@@ -149,7 +152,7 @@ describe("discoverOAuthMetadata", () => {
149
152
  authorization_endpoint: "https://auth.example.com/issuer-a/authorize",
150
153
  token_endpoint: "https://auth.example.com/issuer-a/token",
151
154
  response_types_supported: ["code"],
152
- code_challenge_methods_supported: ["plain"],
155
+ code_challenge_methods_supported: ["plain"]
153
156
  });
154
157
  });
155
158
 
@@ -170,7 +173,7 @@ describe("discoverOAuthMetadata", () => {
170
173
  if (url.includes("oauth-protected-resource")) {
171
174
  return jsonResponse({
172
175
  resource: resourceUrl,
173
- authorization_servers: [`${normalizedAuthorizationServer}/`],
176
+ authorization_servers: [`${normalizedAuthorizationServer}/`]
174
177
  });
175
178
  }
176
179
 
@@ -180,7 +183,7 @@ describe("discoverOAuthMetadata", () => {
180
183
  authorization_endpoint: `${normalizedAuthorizationServer}/authorize`,
181
184
  token_endpoint: `${normalizedAuthorizationServer}/token`,
182
185
  response_types_supported: ["code"],
183
- code_challenge_methods_supported: ["S256"],
186
+ code_challenge_methods_supported: ["S256"]
184
187
  });
185
188
  }
186
189
 
@@ -193,7 +196,7 @@ describe("discoverOAuthMetadata", () => {
193
196
  expect(discovery.authorizationServerMetadataUrl).toBe(authorizationServerMetadataUrl);
194
197
  expect(fetchMock.mock.calls.map(([input]) => input.toString())).toEqual([
195
198
  "https://resource.example.com/.well-known/oauth-protected-resource/tenant/mcp",
196
- authorizationServerMetadataUrl,
199
+ authorizationServerMetadataUrl
197
200
  ]);
198
201
  });
199
202
 
@@ -213,7 +216,7 @@ describe("discoverOAuthMetadata", () => {
213
216
  return jsonResponse({
214
217
  resource: resourceUrl,
215
218
  authorization_servers: [authorizationServer],
216
- resource_name: "Example MCP",
219
+ resource_name: "Example MCP"
217
220
  });
218
221
  }
219
222
 
@@ -224,12 +227,12 @@ describe("discoverOAuthMetadata", () => {
224
227
  token_endpoint: `${authorizationServer}/token`,
225
228
  response_types_supported: ["code"],
226
229
  code_challenge_methods_supported: ["S256"],
227
- service_documentation: `${authorizationServer}/docs`,
230
+ service_documentation: `${authorizationServer}/docs`
228
231
  });
229
232
  }
230
233
 
231
234
  throw new Error(`Unexpected fetch URL: ${url}`);
232
- }),
235
+ })
233
236
  });
234
237
 
235
238
  expect(discovery.resourceMetadata.resource_name).toBe("Example MCP");
@@ -249,7 +252,7 @@ describe("discoverOAuthMetadata", () => {
249
252
  if (url.includes("oauth-protected-resource")) {
250
253
  return jsonResponse({
251
254
  resource: resourceUrl,
252
- authorization_servers: ["https://auth.example.com/issuer-a"],
255
+ authorization_servers: ["https://auth.example.com/issuer-a"]
253
256
  });
254
257
  }
255
258
 
@@ -257,9 +260,9 @@ describe("discoverOAuthMetadata", () => {
257
260
  issuer: "https://auth.example.com/issuer-a",
258
261
  authorization_endpoint: "https://auth.example.com/issuer-a/authorize",
259
262
  token_endpoint: "https://auth.example.com/issuer-a/token",
260
- code_challenge_methods_supported: ["S256"],
263
+ code_challenge_methods_supported: ["S256"]
261
264
  });
262
- }),
265
+ })
263
266
  })
264
267
  ).rejects.toThrow("response_types_supported");
265
268
  });
@@ -272,7 +275,7 @@ describe("discoverOAuthMetadata", () => {
272
275
  if (url.includes("oauth-protected-resource")) {
273
276
  return jsonResponse({
274
277
  resource: resourceUrl,
275
- authorization_servers: ["http://auth.example.com/issuer-a"],
278
+ authorization_servers: ["http://auth.example.com/issuer-a"]
276
279
  });
277
280
  }
278
281
 
@@ -283,7 +286,7 @@ describe("discoverOAuthMetadata", () => {
283
286
  "must use https unless it targets a loopback host"
284
287
  );
285
288
  expect(fetchMock.mock.calls.map(([input]) => input.toString())).toEqual([
286
- "https://resource.example.com/.well-known/oauth-protected-resource/tenant/mcp",
289
+ "https://resource.example.com/.well-known/oauth-protected-resource/tenant/mcp"
287
290
  ]);
288
291
  });
289
292
 
@@ -309,12 +312,12 @@ describe("discoverOAuthMetadata", () => {
309
312
  if (url.includes("oauth-protected-resource")) {
310
313
  return jsonResponse({
311
314
  resource: resourceUrl,
312
- authorization_servers: ["https://auth.example.com/issuer-a?tenant=acme"],
315
+ authorization_servers: ["https://auth.example.com/issuer-a?tenant=acme"]
313
316
  });
314
317
  }
315
318
 
316
319
  throw new Error(`Unexpected fetch URL: ${url}`);
317
- }),
320
+ })
318
321
  })
319
322
  ).rejects.toThrow("Authorization server issuer must not include query or fragment");
320
323
  });
@@ -334,7 +337,7 @@ describe("discoverOAuthMetadata", () => {
334
337
  if (url === resourceMetadataUrl) {
335
338
  return jsonResponse({
336
339
  resource: resourceUrl,
337
- authorization_servers: [authorizationServer],
340
+ authorization_servers: [authorizationServer]
338
341
  });
339
342
  }
340
343
 
@@ -344,12 +347,12 @@ describe("discoverOAuthMetadata", () => {
344
347
  authorization_endpoint: `${authorizationServer}/authorize`,
345
348
  token_endpoint: `${authorizationServer}/token`,
346
349
  response_types_supported: ["code"],
347
- code_challenge_methods_supported: ["S256"],
350
+ code_challenge_methods_supported: ["S256"]
348
351
  });
349
352
  }
350
353
 
351
354
  throw new Error(`Unexpected fetch URL: ${url}`);
352
- }),
355
+ })
353
356
  });
354
357
 
355
358
  expect(discovery.authorizationServerMetadataUrl).toBe(authorizationServerMetadataUrl);
@@ -359,8 +362,7 @@ describe("discoverOAuthMetadata", () => {
359
362
  const resourceUrl = "https://resource.example.com/tenant/mcp";
360
363
  const originalResourceMetadataUrl =
361
364
  "https://resource.example.com/.well-known/oauth-protected-resource/tenant/mcp";
362
- const hintedResourceMetadataUrl =
363
- "https://resource.example.com/metadata/rotated";
365
+ const hintedResourceMetadataUrl = "https://resource.example.com/metadata/rotated";
364
366
  const originalAuthorizationServer = "https://auth.example.com/issuer-a";
365
367
  const hintedAuthorizationServer = "https://auth.example.com/issuer-b";
366
368
  const originalAuthorizationServerMetadataUrl =
@@ -374,14 +376,14 @@ describe("discoverOAuthMetadata", () => {
374
376
  if (url === originalResourceMetadataUrl) {
375
377
  return jsonResponse({
376
378
  resource: resourceUrl,
377
- authorization_servers: [originalAuthorizationServer],
379
+ authorization_servers: [originalAuthorizationServer]
378
380
  });
379
381
  }
380
382
 
381
383
  if (url === hintedResourceMetadataUrl) {
382
384
  return jsonResponse({
383
385
  resource: resourceUrl,
384
- authorization_servers: [hintedAuthorizationServer],
386
+ authorization_servers: [hintedAuthorizationServer]
385
387
  });
386
388
  }
387
389
 
@@ -391,7 +393,7 @@ describe("discoverOAuthMetadata", () => {
391
393
  authorization_endpoint: `${originalAuthorizationServer}/authorize`,
392
394
  token_endpoint: `${originalAuthorizationServer}/token`,
393
395
  response_types_supported: ["code"],
394
- code_challenge_methods_supported: ["S256"],
396
+ code_challenge_methods_supported: ["S256"]
395
397
  });
396
398
  }
397
399
 
@@ -401,7 +403,7 @@ describe("discoverOAuthMetadata", () => {
401
403
  authorization_endpoint: `${hintedAuthorizationServer}/authorize`,
402
404
  token_endpoint: `${hintedAuthorizationServer}/token`,
403
405
  response_types_supported: ["code"],
404
- code_challenge_methods_supported: ["S256"],
406
+ code_challenge_methods_supported: ["S256"]
405
407
  });
406
408
  }
407
409
 
@@ -409,11 +411,11 @@ describe("discoverOAuthMetadata", () => {
409
411
  });
410
412
 
411
413
  const discoveryClient = new OAuthMetadataDiscovery({
412
- fetch: fetchMock,
414
+ fetch: fetchMock
413
415
  });
414
416
  const originalDiscovery = await discoveryClient.discover(resourceUrl);
415
417
  const hintedDiscovery = await discoveryClient.discover(resourceUrl, {
416
- resourceMetadataUrl: hintedResourceMetadataUrl,
418
+ resourceMetadataUrl: hintedResourceMetadataUrl
417
419
  });
418
420
 
419
421
  expect(originalDiscovery.resourceMetadataUrl).toBe(originalResourceMetadataUrl);
@@ -424,7 +426,7 @@ describe("discoverOAuthMetadata", () => {
424
426
  originalResourceMetadataUrl,
425
427
  originalAuthorizationServerMetadataUrl,
426
428
  hintedResourceMetadataUrl,
427
- hintedAuthorizationServerMetadataUrl,
429
+ hintedAuthorizationServerMetadataUrl
428
430
  ]);
429
431
  });
430
432
 
@@ -440,7 +442,7 @@ describe("discoverOAuthMetadata", () => {
440
442
  if (url === resourceMetadataUrl) {
441
443
  return jsonResponse({
442
444
  resource: resourceUrl,
443
- authorization_servers: [rotated ? secondIssuer : firstIssuer],
445
+ authorization_servers: [rotated ? secondIssuer : firstIssuer]
444
446
  });
445
447
  }
446
448
  const issuer = url.includes("issuer-a") ? firstIssuer : secondIssuer;
@@ -449,7 +451,7 @@ describe("discoverOAuthMetadata", () => {
449
451
  authorization_endpoint: `${issuer}/authorize`,
450
452
  token_endpoint: `${issuer}/token`,
451
453
  response_types_supported: ["code"],
452
- code_challenge_methods_supported: ["S256"],
454
+ code_challenge_methods_supported: ["S256"]
453
455
  });
454
456
  });
455
457
  const discoveryClient = new OAuthMetadataDiscovery({ fetch: fetchMock });
@@ -463,7 +465,7 @@ describe("discoverOAuthMetadata", () => {
463
465
  resourceMetadataUrl,
464
466
  "https://auth.example.com/.well-known/oauth-authorization-server/issuer-a",
465
467
  resourceMetadataUrl,
466
- "https://auth.example.com/.well-known/oauth-authorization-server/issuer-b",
468
+ "https://auth.example.com/.well-known/oauth-authorization-server/issuer-b"
467
469
  ]);
468
470
  });
469
471
  });
@@ -478,12 +480,10 @@ describe("parseBearerWwwAuthenticateHeader", () => {
478
480
  scheme: "Bearer",
479
481
  params: {
480
482
  realm: "Example, Inc",
481
- resource_metadata:
482
- "https://resource.example.com/.well-known/oauth-protected-resource/mcp",
483
- error: "invalid_token",
483
+ resource_metadata: "https://resource.example.com/.well-known/oauth-protected-resource/mcp",
484
+ error: "invalid_token"
484
485
  },
485
- raw:
486
- 'Basic realm="legacy", Bearer realm="Example, Inc", resource_metadata="https://resource.example.com/.well-known/oauth-protected-resource/mcp", error="invalid_token"',
486
+ raw: 'Basic realm="legacy", Bearer realm="Example, Inc", resource_metadata="https://resource.example.com/.well-known/oauth-protected-resource/mcp", error="invalid_token"'
487
487
  });
488
488
  });
489
489
 
@@ -496,11 +496,9 @@ describe("parseBearerWwwAuthenticateHeader", () => {
496
496
  scheme: "Bearer",
497
497
  params: {
498
498
  realm: "mcp",
499
- resource_metadata:
500
- "https://resource.example.com/.well-known/oauth-protected-resource/mcp",
499
+ resource_metadata: "https://resource.example.com/.well-known/oauth-protected-resource/mcp"
501
500
  },
502
- raw:
503
- 'Digest abc123==, Bearer abc123==, Bearer realm="mcp", resource_metadata="https://resource.example.com/.well-known/oauth-protected-resource/mcp"',
501
+ raw: 'Digest abc123==, Bearer abc123==, Bearer realm="mcp", resource_metadata="https://resource.example.com/.well-known/oauth-protected-resource/mcp"'
504
502
  });
505
503
  });
506
504
 
@@ -564,7 +562,7 @@ describe("HttpTransport OAuth authorization", () => {
564
562
  if (url === resourceMetadataUrl) {
565
563
  return jsonResponse({
566
564
  resource: requestUrl,
567
- authorization_servers: [authorizationServer],
565
+ authorization_servers: [authorizationServer]
568
566
  });
569
567
  }
570
568
 
@@ -575,7 +573,7 @@ describe("HttpTransport OAuth authorization", () => {
575
573
  token_endpoint: tokenEndpoint,
576
574
  registration_endpoint: registrationEndpoint,
577
575
  response_types_supported: ["code"],
578
- code_challenge_methods_supported: ["S256"],
576
+ code_challenge_methods_supported: ["S256"]
579
577
  });
580
578
  }
581
579
 
@@ -588,7 +586,7 @@ describe("HttpTransport OAuth authorization", () => {
588
586
  return jsonResponse(
589
587
  {
590
588
  client_id: clientId,
591
- token_endpoint_auth_method: "none",
589
+ token_endpoint_auth_method: "none"
592
590
  },
593
591
  { status: 201 }
594
592
  );
@@ -618,7 +616,7 @@ describe("HttpTransport OAuth authorization", () => {
618
616
  access_token: issueAccessToken(),
619
617
  token_type: "Bearer",
620
618
  expires_in: 3600,
621
- refresh_token: "refresh-1",
619
+ refresh_token: "refresh-1"
622
620
  });
623
621
  }
624
622
 
@@ -632,8 +630,8 @@ describe("HttpTransport OAuth authorization", () => {
632
630
  headers: {
633
631
  "WWW-Authenticate":
634
632
  `Bearer realm="Example, Inc", error="invalid_token", ` +
635
- `resource_metadata="${resourceMetadataUrl}"`,
636
- },
633
+ `resource_metadata="${resourceMetadataUrl}"`
634
+ }
637
635
  });
638
636
  }
639
637
 
@@ -648,8 +646,8 @@ describe("HttpTransport OAuth authorization", () => {
648
646
  jsonrpc: "2.0",
649
647
  id: resourceAuthorizations.length,
650
648
  result: {
651
- ok: true,
652
- },
649
+ ok: true
650
+ }
653
651
  });
654
652
  }
655
653
 
@@ -670,7 +668,7 @@ describe("HttpTransport OAuth authorization", () => {
670
668
  authorizationCodes.set(code, {
671
669
  clientId,
672
670
  redirectUri: url.searchParams.get("redirect_uri") ?? "",
673
- codeChallenge: url.searchParams.get("code_challenge") ?? "",
671
+ codeChallenge: url.searchParams.get("code_challenge") ?? ""
674
672
  });
675
673
 
676
674
  expect(url.searchParams.get("resource")).toBe(requestUrl);
@@ -690,7 +688,7 @@ describe("HttpTransport OAuth authorization", () => {
690
688
  },
691
689
  async clear(resource: string): Promise<void> {
692
690
  storedSessions.delete(resource);
693
- },
691
+ }
694
692
  };
695
693
 
696
694
  const transport = new HttpTransport({
@@ -700,14 +698,14 @@ describe("HttpTransport OAuth authorization", () => {
700
698
  client: {
701
699
  mode: "dynamic",
702
700
  metadata: {
703
- clientName: "tiny-mcp-client test",
704
- },
701
+ clientName: "tiny-mcp-client test"
702
+ }
705
703
  },
706
704
  browser: {
707
- openBrowser,
705
+ openBrowser
708
706
  },
709
- sessionStore,
710
- },
707
+ sessionStore
708
+ }
711
709
  });
712
710
 
713
711
  transport.writable.write('{"jsonrpc":"2.0","id":1,"method":"ping"}\n');
@@ -715,8 +713,8 @@ describe("HttpTransport OAuth authorization", () => {
715
713
  jsonrpc: "2.0",
716
714
  id: 2,
717
715
  result: {
718
- ok: true,
719
- },
716
+ ok: true
717
+ }
720
718
  });
721
719
 
722
720
  transport.writable.write('{"jsonrpc":"2.0","id":2,"method":"ping"}\n');
@@ -724,8 +722,8 @@ describe("HttpTransport OAuth authorization", () => {
724
722
  jsonrpc: "2.0",
725
723
  id: 3,
726
724
  result: {
727
- ok: true,
728
- },
725
+ ok: true
726
+ }
729
727
  });
730
728
 
731
729
  expect(registrationBodies).toHaveLength(1);
@@ -769,7 +767,7 @@ describe("HttpTransport OAuth authorization", () => {
769
767
  if (url === resourceMetadataUrl) {
770
768
  return jsonResponse({
771
769
  resource: requestUrl,
772
- authorization_servers: [authorizationServer],
770
+ authorization_servers: [authorizationServer]
773
771
  });
774
772
  }
775
773
 
@@ -780,7 +778,7 @@ describe("HttpTransport OAuth authorization", () => {
780
778
  token_endpoint: tokenEndpoint,
781
779
  registration_endpoint: registrationEndpoint,
782
780
  response_types_supported: ["code"],
783
- code_challenge_methods_supported: ["S256"],
781
+ code_challenge_methods_supported: ["S256"]
784
782
  });
785
783
  }
786
784
 
@@ -788,7 +786,7 @@ describe("HttpTransport OAuth authorization", () => {
788
786
  return jsonResponse(
789
787
  {
790
788
  client_id: "client-1",
791
- token_endpoint_auth_method: "none",
789
+ token_endpoint_auth_method: "none"
792
790
  },
793
791
  { status: 201 }
794
792
  );
@@ -814,7 +812,7 @@ describe("HttpTransport OAuth authorization", () => {
814
812
  access_token: "access-1",
815
813
  token_type: "Bearer",
816
814
  expires_in: 3600,
817
- refresh_token: "refresh-1",
815
+ refresh_token: "refresh-1"
818
816
  });
819
817
  }
820
818
 
@@ -826,8 +824,8 @@ describe("HttpTransport OAuth authorization", () => {
826
824
  return new Response(null, {
827
825
  status: 401,
828
826
  headers: {
829
- "WWW-Authenticate": 'Bearer realm="Example, Inc", error="invalid_token"',
830
- },
827
+ "WWW-Authenticate": 'Bearer realm="Example, Inc", error="invalid_token"'
828
+ }
831
829
  });
832
830
  }
833
831
 
@@ -835,8 +833,8 @@ describe("HttpTransport OAuth authorization", () => {
835
833
  jsonrpc: "2.0",
836
834
  id: 1,
837
835
  result: {
838
- ok: true,
839
- },
836
+ ok: true
837
+ }
840
838
  });
841
839
  }
842
840
 
@@ -850,7 +848,7 @@ describe("HttpTransport OAuth authorization", () => {
850
848
  authorizationCodes.set(code, {
851
849
  clientId: url.searchParams.get("client_id") ?? "",
852
850
  redirectUri: url.searchParams.get("redirect_uri") ?? "",
853
- codeChallenge: url.searchParams.get("code_challenge") ?? "",
851
+ codeChallenge: url.searchParams.get("code_challenge") ?? ""
854
852
  });
855
853
 
856
854
  const callbackUrl = new URL(url.searchParams.get("redirect_uri") ?? "");
@@ -868,7 +866,7 @@ describe("HttpTransport OAuth authorization", () => {
868
866
  },
869
867
  async clear(resource: string): Promise<void> {
870
868
  storedSessions.delete(resource);
871
- },
869
+ }
872
870
  };
873
871
 
874
872
  const transport = new HttpTransport({
@@ -878,14 +876,14 @@ describe("HttpTransport OAuth authorization", () => {
878
876
  client: {
879
877
  mode: "dynamic",
880
878
  metadata: {
881
- clientName: "tiny-mcp-client test",
882
- },
879
+ clientName: "tiny-mcp-client test"
880
+ }
883
881
  },
884
882
  browser: {
885
- openBrowser,
883
+ openBrowser
886
884
  },
887
- sessionStore,
888
- },
885
+ sessionStore
886
+ }
889
887
  });
890
888
 
891
889
  transport.writable.write('{"jsonrpc":"2.0","id":1,"method":"ping"}\n');
@@ -893,8 +891,8 @@ describe("HttpTransport OAuth authorization", () => {
893
891
  jsonrpc: "2.0",
894
892
  id: 1,
895
893
  result: {
896
- ok: true,
897
- },
894
+ ok: true
895
+ }
898
896
  });
899
897
 
900
898
  expect(resourceAuthorizations).toEqual([null, "Bearer access-1"]);
@@ -911,9 +909,11 @@ function readTransportLine(transport: HttpTransport): Promise<string> {
911
909
  transport.readable.once("data", (chunk: Buffer | string) => {
912
910
  resolve(chunk.toString("utf8").trim());
913
911
  });
914
- transport.closed.then((event) => {
915
- reject(event.reason);
916
- }).catch(reject);
912
+ transport.closed
913
+ .then((event) => {
914
+ reject(event.reason);
915
+ })
916
+ .catch(reject);
917
917
  });
918
918
  }
919
919
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -151,7 +151,7 @@
151
151
  "auth-store"
152
152
  ],
153
153
  "optionalDependencies": {
154
- "toolcraft-schema": "0.0.111",
154
+ "toolcraft-schema": "0.0.113",
155
155
  "toolcraft-design": "^0.0.2",
156
156
  "@poe-code/frontmatter": "*",
157
157
  "@poe-code/agent-mcp-config": "*",