@mcp-use/inspector 20.0.0-beta.4 → 20.0.0-beta.6

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 (61) hide show
  1. package/dist/cdn/{ChatTab-UQAPDRQG.js → ChatTab-D6J3Gyp7.js} +885 -837
  2. package/dist/cdn/{ConnectionSettingsForm-DrY1p-NO.js → ConnectionSettingsForm-CWQueI8J.js} +1 -1
  3. package/dist/cdn/{ConnectionSettingsTab-B1cRD7hz.js → ConnectionSettingsTab-FGyt3QaI.js} +1 -1
  4. package/dist/cdn/{MarkdownRenderer-BoDJE8tP.js → MarkdownRenderer-gLqUICEd.js} +1 -1
  5. package/dist/cdn/{OAuthCallback-C9AvCkOn.js → OAuthCallback-Bg2bP-o9.js} +1 -1
  6. package/dist/cdn/{PromptsTab-CkAWyWVb.js → PromptsTab-C4LuwyWN.js} +1 -1
  7. package/dist/cdn/{ResourcesTab-BtBKxd4c.js → ResourcesTab-CQkKni-P.js} +5 -5
  8. package/dist/cdn/{SamplingTab-Czp7Rmhz.js → SamplingTab-D8q-iCMc.js} +3 -3
  9. package/dist/cdn/{ToolsTab-Dm4vCB8D.js → ToolsTab-6xaVH43x.js} +4 -4
  10. package/dist/cdn/{ViewPreview-CZvl_7x-.js → ViewPreview-Ohh6JwOn.js} +2 -2
  11. package/dist/cdn/{WidgetWrapper-DeiogRXV.js → WidgetWrapper-CruwjBOd.js} +2 -2
  12. package/dist/cdn/{dist-3QLh0dt8.js → dist-CXHFvGre.js} +5 -4
  13. package/dist/cdn/{index-browser-CIoYSwCt.js → index-browser-DkQOzkvX.js} +1 -1
  14. package/dist/cdn/inspector.js +5 -5
  15. package/dist/cdn/{react-0oJnFpBS.js → react-BLtCruam.js} +576 -569
  16. package/dist/cdn/{telemetry-BbhH1Z_E.js → telemetry-C7Ytz2BG.js} +2 -2
  17. package/dist/cdn/{useConfig-BNpU7Atw.js → useConfig-BW6uQf2m.js} +2 -2
  18. package/dist/cdn/{useViewHostProps-ru80AnlT.js → useViewHostProps-CINeSkth.js} +1 -1
  19. package/dist/cli.js +1 -1
  20. package/dist/client/components/chat/MessageList.d.ts +1 -0
  21. package/dist/client/components/chat/MessageList.d.ts.map +1 -1
  22. package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
  23. package/dist/client/components/chat/partialToolArgs.d.ts +10 -0
  24. package/dist/client/components/chat/partialToolArgs.d.ts.map +1 -0
  25. package/dist/client/components/chat/types.d.ts +1 -0
  26. package/dist/client/components/chat/types.d.ts.map +1 -1
  27. package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
  28. package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
  29. package/dist/client/index.js +158 -81
  30. package/dist/server/cdn-shell.js +2 -2
  31. package/dist/server/{chunk-PGN3B3MQ.js → chunk-GBY4WAVP.js} +1 -1
  32. package/dist/server/{chunk-BEJGHVKM.js → chunk-IFF5T5J4.js} +1 -1
  33. package/dist/server/{chunk-5L3HMC5B.js → chunk-NUHI6MJ6.js} +1 -1
  34. package/dist/server/cli.js +2 -2
  35. package/dist/server/index.js +3 -3
  36. package/dist/server/middleware.js +3 -3
  37. package/dist/server/version.js +1 -1
  38. package/dist/web/assets/ChatTab-CsBPVCSc.js +18 -0
  39. package/dist/web/assets/{ConnectionSettingsTab-XwjwKfsO.js → ConnectionSettingsTab-DQTXfnl1.js} +1 -1
  40. package/dist/web/assets/{ElicitationTab-BD1tfmYR.js → ElicitationTab-_FKB7nNG.js} +1 -1
  41. package/dist/web/assets/{ManufactOAuthCallback-DD3qfIC3.js → ManufactOAuthCallback-BRO6TPkZ.js} +1 -1
  42. package/dist/web/assets/{MarkdownRenderer-DH-7vpw0.js → MarkdownRenderer-gaJFjbtr.js} +1 -1
  43. package/dist/web/assets/{NotificationsTab-Cg48O6IH.js → NotificationsTab-LYcfRjyd.js} +1 -1
  44. package/dist/web/assets/{OAuthCallback-4i2i3YpE.js → OAuthCallback-D8UItgTB.js} +1 -1
  45. package/dist/web/assets/{PromptsTab-pAR6izrQ.js → PromptsTab-B2uVMRR2.js} +1 -1
  46. package/dist/web/assets/{ResourcesTab-CgvfWrsU.js → ResourcesTab-DhOZYPjE.js} +1 -1
  47. package/dist/web/assets/{SamplingTab-DfIWMQFY.js → SamplingTab-C-oY2hoi.js} +1 -1
  48. package/dist/web/assets/{ServerMetadataTab-Dsz8Qhyr.js → ServerMetadataTab-BkTxO5KS.js} +1 -1
  49. package/dist/web/assets/{ToolsTab-ln9w58BW.js → ToolsTab-DupHgo7A.js} +1 -1
  50. package/dist/web/assets/{ViewPreview-CQ3G3VP0.js → ViewPreview--z6jL0Zg.js} +1 -1
  51. package/dist/web/assets/{WidgetWrapper-A-zaxY5s.js → WidgetWrapper-CZaEVEw4.js} +1 -1
  52. package/dist/web/assets/{checkbox-DZWS_U_i.js → checkbox-BQ9mI_6k.js} +1 -1
  53. package/dist/web/assets/{dist-DxRFPg-B.js → dist-B8sA8Zml.js} +5 -5
  54. package/dist/web/assets/{index-CoRK2C3M.js → index-C_fCIJ4C.js} +6 -6
  55. package/dist/web/assets/{shared-Dbc2GbRx.js → shared-CCC9rTz4.js} +1 -1
  56. package/dist/web/assets/{tabs-subtle-CxMZqhP6.js → tabs-subtle-246ABJqx.js} +1 -1
  57. package/dist/web/assets/{useConfig-Cg-BtSHA.js → useConfig-BAsKhUxf.js} +1 -1
  58. package/dist/web/assets/{useViewHostProps-CMgPpdfy.js → useViewHostProps-CV5zBxUb.js} +1 -1
  59. package/dist/web/index.html +2 -2
  60. package/package.json +3 -3
  61. package/dist/web/assets/ChatTab-B_5S87J1.js +0 -18
@@ -1,144 +1,144 @@
1
1
  import { a as e, s as t, t as n } from "./react-BIs9pQ3H.js";
2
- import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as re, p as T, r as E, s as ie, t as D, v as O, w as k, x as ae, y as A } from "./cfWorker-Bxcs9rNe.js";
2
+ import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as T, p as E, r as re, s as ie, t as ae, v as D, w as O, x as oe, y as k } from "./cfWorker-Bxcs9rNe.js";
3
3
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+core@2.0.0-beta.4/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs
4
- var j = /* @__PURE__ */ t(n(), 1), oe = "io.modelcontextprotocol/related-task", M = "io.modelcontextprotocol/subscriptionId", N = ae(() => x([
4
+ var A = /* @__PURE__ */ t(n(), 1), se = "io.modelcontextprotocol/related-task", j = "io.modelcontextprotocol/subscriptionId", M = oe(() => x([
5
5
  r(),
6
6
  p(),
7
- O(),
7
+ D(),
8
8
  ne(),
9
- S(r(), N),
10
- m(N)
11
- ])), P = S(r(), N);
12
- m(N);
13
- var se = x([r(), p().int()]), F = r(), ce = o({ ttl: p().optional() }), le = o({ taskId: r() }), ue = i({
14
- progressToken: se.optional(),
15
- [oe]: le.optional()
16
- }), I = o({ _meta: ue.optional() }), de = I.extend({ task: ce.optional() }), L = o({
9
+ S(r(), M),
10
+ m(M)
11
+ ])), N = S(r(), M);
12
+ m(M);
13
+ var ce = x([r(), p().int()]), P = r(), le = o({ ttl: p().optional() }), ue = o({ taskId: r() }), de = i({
14
+ progressToken: ce.optional(),
15
+ [se]: ue.optional()
16
+ }), F = o({ _meta: de.optional() }), fe = F.extend({ task: le.optional() }), I = o({
17
17
  method: r(),
18
- params: I.loose().optional()
19
- }), R = o({ _meta: ue.optional() }), z = o({
18
+ params: F.loose().optional()
19
+ }), L = o({ _meta: de.optional() }), R = o({
20
20
  method: r(),
21
- params: R.loose().optional()
22
- }), B = i({ _meta: ue.optional() }), fe = x([r(), p().int()]), pe = o({
21
+ params: L.loose().optional()
22
+ }), z = i({ _meta: de.optional() }), pe = x([r(), p().int()]), me = o({
23
23
  jsonrpc: f("2.0"),
24
- id: fe,
25
- ...L.shape
26
- }).strict(), me = o({
27
- jsonrpc: f("2.0"),
28
- ...z.shape
24
+ id: pe,
25
+ ...I.shape
29
26
  }).strict(), he = o({
30
27
  jsonrpc: f("2.0"),
31
- id: fe,
32
- result: B
28
+ ...R.shape
33
29
  }).strict(), ge = o({
34
30
  jsonrpc: f("2.0"),
35
- id: fe.optional(),
31
+ id: pe,
32
+ result: z
33
+ }).strict(), _e = o({
34
+ jsonrpc: f("2.0"),
35
+ id: pe.optional(),
36
36
  error: o({
37
37
  code: p().int(),
38
38
  message: r(),
39
39
  data: c().optional()
40
40
  })
41
- }).strict(), _e = x([
42
- pe,
41
+ }).strict(), ve = x([
43
42
  me,
44
43
  he,
45
- ge
44
+ ge,
45
+ _e
46
46
  ]);
47
- x([he, ge]);
48
- var ve = B.strict(), ye = R.extend({
49
- requestId: fe.optional(),
47
+ x([ge, _e]);
48
+ var ye = z.strict(), be = L.extend({
49
+ requestId: pe.optional(),
50
50
  reason: r().optional()
51
- }), be = z.extend({
51
+ }), xe = R.extend({
52
52
  method: f("notifications/cancelled"),
53
- params: ye
54
- }), xe = o({ icons: m(o({
53
+ params: be
54
+ }), Se = o({ icons: m(o({
55
55
  src: r(),
56
56
  mimeType: r().optional(),
57
57
  sizes: m(r()).optional(),
58
- theme: T(["light", "dark"]).optional()
59
- })).optional() }), V = o({
58
+ theme: E(["light", "dark"]).optional()
59
+ })).optional() }), Ce = o({
60
60
  name: r(),
61
61
  title: r().optional()
62
- }), Se = V.extend({
63
- ...V.shape,
64
- ...xe.shape,
62
+ }), B = Ce.extend({
63
+ ...Ce.shape,
64
+ ...Se.shape,
65
65
  version: r(),
66
66
  websiteUrl: r().optional(),
67
67
  description: r().optional()
68
- }), Ce = u((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, g(o({
69
- form: g(o({ applyDefaults: O().optional() }), P).optional(),
70
- url: P.optional()
71
- }), P.optional())), we = i({
72
- list: P.optional(),
73
- cancel: P.optional(),
68
+ }), we = u((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, g(o({
69
+ form: g(o({ applyDefaults: D().optional() }), N).optional(),
70
+ url: N.optional()
71
+ }), N.optional())), Te = i({
72
+ list: N.optional(),
73
+ cancel: N.optional(),
74
74
  requests: i({
75
- sampling: i({ createMessage: P.optional() }).optional(),
76
- elicitation: i({ create: P.optional() }).optional()
75
+ sampling: i({ createMessage: N.optional() }).optional(),
76
+ elicitation: i({ create: N.optional() }).optional()
77
77
  }).optional()
78
- }), Te = i({
79
- list: P.optional(),
80
- cancel: P.optional(),
81
- requests: i({ tools: i({ call: P.optional() }).optional() }).optional()
82
- }), Ee = o({
83
- experimental: S(r(), P).optional(),
78
+ }), Ee = i({
79
+ list: N.optional(),
80
+ cancel: N.optional(),
81
+ requests: i({ tools: i({ call: N.optional() }).optional() }).optional()
82
+ }), De = o({
83
+ experimental: S(r(), N).optional(),
84
84
  sampling: o({
85
- context: P.optional(),
86
- tools: P.optional()
85
+ context: N.optional(),
86
+ tools: N.optional()
87
87
  }).optional(),
88
- elicitation: Ce.optional(),
89
- roots: o({ listChanged: O().optional() }).optional(),
90
- tasks: we.optional(),
91
- extensions: S(r(), P).optional()
92
- }), De = I.extend({
88
+ elicitation: we.optional(),
89
+ roots: o({ listChanged: D().optional() }).optional(),
90
+ tasks: Te.optional(),
91
+ extensions: S(r(), N).optional()
92
+ }), Oe = F.extend({
93
93
  protocolVersion: r(),
94
- capabilities: Ee,
95
- clientInfo: Se
96
- }), Oe = L.extend({
94
+ capabilities: De,
95
+ clientInfo: B
96
+ }), ke = I.extend({
97
97
  method: f("initialize"),
98
- params: De
99
- }), ke = o({
100
- experimental: S(r(), P).optional(),
101
- logging: P.optional(),
102
- completions: P.optional(),
103
- prompts: o({ listChanged: O().optional() }).optional(),
98
+ params: Oe
99
+ }), Ae = o({
100
+ experimental: S(r(), N).optional(),
101
+ logging: N.optional(),
102
+ completions: N.optional(),
103
+ prompts: o({ listChanged: D().optional() }).optional(),
104
104
  resources: o({
105
- subscribe: O().optional(),
106
- listChanged: O().optional()
105
+ subscribe: D().optional(),
106
+ listChanged: D().optional()
107
107
  }).optional(),
108
- tools: o({ listChanged: O().optional() }).optional(),
109
- tasks: Te.optional(),
110
- extensions: S(r(), P).optional()
111
- }), Ae = B.extend({
108
+ tools: o({ listChanged: D().optional() }).optional(),
109
+ tasks: Ee.optional(),
110
+ extensions: S(r(), N).optional()
111
+ }), V = z.extend({
112
112
  protocolVersion: r(),
113
- capabilities: ke,
114
- serverInfo: Se,
113
+ capabilities: Ae,
114
+ serverInfo: B,
115
115
  instructions: r().optional()
116
- }), je = z.extend({
116
+ }), je = R.extend({
117
117
  method: f("notifications/initialized"),
118
- params: R.optional()
119
- }), Me = L.extend({
118
+ params: L.optional()
119
+ }), Me = I.extend({
120
120
  method: f("server/discover"),
121
- params: I.optional()
122
- }), Ne = B.extend({
121
+ params: F.optional()
122
+ }), Ne = z.extend({
123
123
  supportedVersions: m(r()),
124
- capabilities: ke,
125
- serverInfo: Se,
124
+ capabilities: Ae,
125
+ serverInfo: B,
126
126
  instructions: r().optional()
127
- }), Pe = L.extend({
127
+ }), Pe = I.extend({
128
128
  method: f("ping"),
129
- params: I.optional()
129
+ params: F.optional()
130
130
  }), Fe = o({
131
131
  progress: p(),
132
132
  total: a(p()),
133
133
  message: a(r())
134
134
  }), H = o({
135
- ...R.shape,
135
+ ...L.shape,
136
136
  ...Fe.shape,
137
- progressToken: se
138
- }), Ie = z.extend({
137
+ progressToken: ce
138
+ }), Ie = R.extend({
139
139
  method: f("notifications/progress"),
140
140
  params: H
141
- }), Le = I.extend({ cursor: F.optional() }), U = L.extend({ params: Le.optional() }), Re = B.extend({ nextCursor: F.optional() }), W = o({
141
+ }), Le = F.extend({ cursor: P.optional() }), U = I.extend({ params: Le.optional() }), Re = z.extend({ nextCursor: P.optional() }), W = o({
142
142
  uri: r(),
143
143
  mimeType: a(r()),
144
144
  _meta: S(r(), c()).optional()
@@ -148,13 +148,13 @@ var ve = B.strict(), ye = R.extend({
148
148
  } catch {
149
149
  return !1;
150
150
  }
151
- }, { message: "Invalid Base64 string" }), K = W.extend({ blob: G }), Be = T(["user", "assistant"]), Ve = o({
151
+ }, { message: "Invalid Base64 string" }), K = W.extend({ blob: G }), Be = E(["user", "assistant"]), Ve = o({
152
152
  audience: m(Be).optional(),
153
153
  priority: p().min(0).max(1).optional(),
154
154
  lastModified: d({ offset: !0 }).optional()
155
155
  }), He = o({
156
- ...V.shape,
157
- ...xe.shape,
156
+ ...Ce.shape,
157
+ ...Se.shape,
158
158
  uri: r(),
159
159
  description: a(r()),
160
160
  mimeType: a(r()),
@@ -162,53 +162,53 @@ var ve = B.strict(), ye = R.extend({
162
162
  annotations: Ve.optional(),
163
163
  _meta: a(i({}))
164
164
  }), Ue = o({
165
- ...V.shape,
166
- ...xe.shape,
165
+ ...Ce.shape,
166
+ ...Se.shape,
167
167
  uriTemplate: r(),
168
168
  description: a(r()),
169
169
  mimeType: a(r()),
170
170
  annotations: Ve.optional(),
171
171
  _meta: a(i({}))
172
- }), We = U.extend({ method: f("resources/list") }), q = Re.extend({ resources: m(He) }), Ge = U.extend({ method: f("resources/templates/list") }), Ke = Re.extend({ resourceTemplates: m(Ue) }), qe = I.extend({ uri: r() }), Je = qe, Ye = L.extend({
172
+ }), We = U.extend({ method: f("resources/list") }), q = Re.extend({ resources: m(He) }), Ge = U.extend({ method: f("resources/templates/list") }), Ke = Re.extend({ resourceTemplates: m(Ue) }), qe = F.extend({ uri: r() }), Je = qe, Ye = I.extend({
173
173
  method: f("resources/read"),
174
174
  params: Je
175
- }), Xe = B.extend({ contents: m(x([ze, K])) }), Ze = z.extend({
175
+ }), Xe = z.extend({ contents: m(x([ze, K])) }), Ze = R.extend({
176
176
  method: f("notifications/resources/list_changed"),
177
- params: R.optional()
178
- }), Qe = qe, $e = L.extend({
177
+ params: L.optional()
178
+ }), Qe = qe, $e = I.extend({
179
179
  method: f("resources/subscribe"),
180
180
  params: Qe
181
- }), et = qe, tt = L.extend({
181
+ }), et = qe, tt = I.extend({
182
182
  method: f("resources/unsubscribe"),
183
183
  params: et
184
184
  }), nt = o({
185
- toolsListChanged: O().optional(),
186
- promptsListChanged: O().optional(),
187
- resourcesListChanged: O().optional(),
185
+ toolsListChanged: D().optional(),
186
+ promptsListChanged: D().optional(),
187
+ resourcesListChanged: D().optional(),
188
188
  resourceSubscriptions: m(r()).optional()
189
- }), J = I.extend({ notifications: nt }), rt = L.extend({
189
+ }), J = F.extend({ notifications: nt }), rt = I.extend({
190
190
  method: f("subscriptions/listen"),
191
191
  params: J
192
- }), it = R.extend({ notifications: nt }), Y = z.extend({
192
+ }), it = L.extend({ notifications: nt }), Y = R.extend({
193
193
  method: f("notifications/subscriptions/acknowledged"),
194
194
  params: it
195
- }), at = i({ [M]: fe }), ot = B.extend({ _meta: at }), st = R.extend({ uri: r() }), ct = z.extend({
195
+ }), at = i({ [j]: pe }), ot = z.extend({ _meta: at }), st = L.extend({ uri: r() }), ct = R.extend({
196
196
  method: f("notifications/resources/updated"),
197
197
  params: st
198
198
  }), lt = o({
199
199
  name: r(),
200
200
  description: a(r()),
201
- required: a(O())
201
+ required: a(D())
202
202
  }), ut = o({
203
- ...V.shape,
204
- ...xe.shape,
203
+ ...Ce.shape,
204
+ ...Se.shape,
205
205
  description: a(r()),
206
206
  arguments: a(m(lt)),
207
207
  _meta: a(i({}))
208
- }), dt = U.extend({ method: f("prompts/list") }), ft = Re.extend({ prompts: m(ut) }), pt = I.extend({
208
+ }), dt = U.extend({ method: f("prompts/list") }), ft = Re.extend({ prompts: m(ut) }), pt = F.extend({
209
209
  name: r(),
210
210
  arguments: S(r(), r()).optional()
211
- }), mt = L.extend({
211
+ }), mt = I.extend({
212
212
  method: f("prompts/get"),
213
213
  params: pt
214
214
  }), ht = o({
@@ -248,56 +248,56 @@ var ve = B.strict(), ye = R.extend({
248
248
  ]), St = o({
249
249
  role: Be,
250
250
  content: xt
251
- }), Ct = B.extend({
251
+ }), Ct = z.extend({
252
252
  description: r().optional(),
253
253
  messages: m(St)
254
- }), wt = z.extend({
254
+ }), wt = R.extend({
255
255
  method: f("notifications/prompts/list_changed"),
256
- params: R.optional()
256
+ params: L.optional()
257
257
  }), Tt = o({
258
258
  title: r().optional(),
259
- readOnlyHint: O().optional(),
260
- destructiveHint: O().optional(),
261
- idempotentHint: O().optional(),
262
- openWorldHint: O().optional()
263
- }), Et = o({ taskSupport: T([
259
+ readOnlyHint: D().optional(),
260
+ destructiveHint: D().optional(),
261
+ idempotentHint: D().optional(),
262
+ openWorldHint: D().optional()
263
+ }), Et = o({ taskSupport: E([
264
264
  "required",
265
265
  "optional",
266
266
  "forbidden"
267
267
  ]).optional() }), Dt = o({
268
- ...V.shape,
269
- ...xe.shape,
268
+ ...Ce.shape,
269
+ ...Se.shape,
270
270
  description: r().optional(),
271
271
  inputSchema: o({
272
272
  type: f("object"),
273
- properties: S(r(), N).optional(),
273
+ properties: S(r(), M).optional(),
274
274
  required: m(r()).optional()
275
275
  }).catchall(c()),
276
276
  outputSchema: i({ $schema: r().optional() }).optional(),
277
277
  annotations: Tt.optional(),
278
278
  execution: Et.optional(),
279
279
  _meta: S(r(), c()).optional()
280
- }), Ot = U.extend({ method: f("tools/list") }), kt = Re.extend({ tools: m(Dt) }), At = B.extend({
280
+ }), Ot = U.extend({ method: f("tools/list") }), kt = Re.extend({ tools: m(Dt) }), At = z.extend({
281
281
  content: m(xt).default([]),
282
282
  structuredContent: c().optional(),
283
- isError: O().optional()
283
+ isError: D().optional()
284
284
  });
285
- At.or(B.extend({ toolResult: c() }));
286
- var jt = de.extend({
285
+ At.or(z.extend({ toolResult: c() }));
286
+ var jt = fe.extend({
287
287
  name: r(),
288
288
  arguments: S(r(), c()).optional()
289
- }), Mt = L.extend({
289
+ }), Mt = I.extend({
290
290
  method: f("tools/call"),
291
291
  params: jt
292
- }), Nt = z.extend({
292
+ }), Nt = R.extend({
293
293
  method: f("notifications/tools/list_changed"),
294
- params: R.optional()
294
+ params: L.optional()
295
295
  });
296
296
  o({
297
- autoRefresh: O().default(!0),
297
+ autoRefresh: D().default(!0),
298
298
  debounceMs: p().int().nonnegative().default(300)
299
299
  });
300
- var Pt = T([
300
+ var Pt = E([
301
301
  "debug",
302
302
  "info",
303
303
  "notice",
@@ -306,14 +306,14 @@ var Pt = T([
306
306
  "critical",
307
307
  "alert",
308
308
  "emergency"
309
- ]), Ft = I.extend({ level: Pt }), It = L.extend({
309
+ ]), Ft = F.extend({ level: Pt }), It = I.extend({
310
310
  method: f("logging/setLevel"),
311
311
  params: Ft
312
- }), Lt = R.extend({
312
+ }), Lt = L.extend({
313
313
  level: Pt,
314
314
  logger: r().optional(),
315
315
  data: c()
316
- }), Rt = z.extend({
316
+ }), Rt = R.extend({
317
317
  method: f("notifications/message"),
318
318
  params: Lt
319
319
  }), zt = o({
@@ -321,7 +321,7 @@ var Pt = T([
321
321
  costPriority: p().min(0).max(1).optional(),
322
322
  speedPriority: p().min(0).max(1).optional(),
323
323
  intelligencePriority: p().min(0).max(1).optional()
324
- }), Bt = o({ mode: T([
324
+ }), Bt = o({ mode: E([
325
325
  "auto",
326
326
  "required",
327
327
  "none"
@@ -330,13 +330,13 @@ var Pt = T([
330
330
  toolUseId: r().describe("The unique identifier for the corresponding tool call."),
331
331
  content: m(xt),
332
332
  structuredContent: c().optional(),
333
- isError: O().optional(),
333
+ isError: D().optional(),
334
334
  _meta: S(r(), c()).optional()
335
- }), Ht = A("type", [
335
+ }), Ht = k("type", [
336
336
  ht,
337
337
  gt,
338
338
  _t
339
- ]), Ut = A("type", [
339
+ ]), Ut = k("type", [
340
340
  ht,
341
341
  gt,
342
342
  _t,
@@ -346,11 +346,11 @@ var Pt = T([
346
346
  role: Be,
347
347
  content: x([Ut, m(Ut)]),
348
348
  _meta: S(r(), c()).optional()
349
- }), Gt = de.extend({
349
+ }), Gt = fe.extend({
350
350
  messages: m(Wt),
351
351
  modelPreferences: zt.optional(),
352
352
  systemPrompt: r().optional(),
353
- includeContext: T([
353
+ includeContext: E([
354
354
  "none",
355
355
  "thisServer",
356
356
  "allServers"
@@ -358,24 +358,24 @@ var Pt = T([
358
358
  temperature: p().optional(),
359
359
  maxTokens: p().int(),
360
360
  stopSequences: m(r()).optional(),
361
- metadata: P.optional(),
361
+ metadata: N.optional(),
362
362
  tools: m(Dt).optional(),
363
363
  toolChoice: Bt.optional()
364
- }), Kt = L.extend({
364
+ }), Kt = I.extend({
365
365
  method: f("sampling/createMessage"),
366
366
  params: Gt
367
- }), qt = B.extend({
367
+ }), qt = z.extend({
368
368
  model: r(),
369
- stopReason: a(T([
369
+ stopReason: a(E([
370
370
  "endTurn",
371
371
  "stopSequence",
372
372
  "maxTokens"
373
373
  ]).or(r())),
374
374
  role: Be,
375
375
  content: Ht
376
- }), Jt = B.extend({
376
+ }), Jt = z.extend({
377
377
  model: r(),
378
- stopReason: a(T([
378
+ stopReason: a(E([
379
379
  "endTurn",
380
380
  "stopSequence",
381
381
  "maxTokens",
@@ -387,14 +387,14 @@ var Pt = T([
387
387
  type: f("boolean"),
388
388
  title: r().optional(),
389
389
  description: r().optional(),
390
- default: O().optional()
390
+ default: D().optional()
391
391
  }), Xt = o({
392
392
  type: f("string"),
393
393
  title: r().optional(),
394
394
  description: r().optional(),
395
395
  minLength: p().optional(),
396
396
  maxLength: p().optional(),
397
- format: T([
397
+ format: E([
398
398
  "email",
399
399
  "uri",
400
400
  "date",
@@ -402,7 +402,7 @@ var Pt = T([
402
402
  ]).optional(),
403
403
  default: r().optional()
404
404
  }), Zt = o({
405
- type: T(["number", "integer"]),
405
+ type: E(["number", "integer"]),
406
406
  title: r().optional(),
407
407
  description: r().optional(),
408
408
  minimum: p().optional(),
@@ -461,7 +461,7 @@ var Pt = T([
461
461
  Yt,
462
462
  Xt,
463
463
  Zt
464
- ]), tn = x([de.extend({
464
+ ]), tn = x([fe.extend({
465
465
  mode: f("form").optional(),
466
466
  message: r(),
467
467
  requestedSchema: o({
@@ -469,19 +469,19 @@ var Pt = T([
469
469
  properties: S(r(), en),
470
470
  required: m(r()).optional()
471
471
  }).catchall(c())
472
- }), de.extend({
472
+ }), fe.extend({
473
473
  mode: f("url"),
474
474
  message: r(),
475
475
  elicitationId: r(),
476
476
  url: r().url()
477
- })]), nn = L.extend({
477
+ })]), nn = I.extend({
478
478
  method: f("elicitation/create"),
479
479
  params: tn
480
- }), rn = R.extend({ elicitationId: r() }), an = z.extend({
480
+ }), rn = L.extend({ elicitationId: r() }), an = R.extend({
481
481
  method: f("notifications/elicitation/complete"),
482
482
  params: rn
483
- }), on = B.extend({
484
- action: T([
483
+ }), on = z.extend({
484
+ action: E([
485
485
  "accept",
486
486
  "decline",
487
487
  "cancel"
@@ -489,7 +489,7 @@ var Pt = T([
489
489
  content: u((e) => e === null ? void 0 : e, S(r(), x([
490
490
  r(),
491
491
  p(),
492
- O(),
492
+ D(),
493
493
  m(r())
494
494
  ])).optional())
495
495
  }), sn = o({
@@ -498,36 +498,36 @@ var Pt = T([
498
498
  }), cn = o({
499
499
  type: f("ref/prompt"),
500
500
  name: r()
501
- }), ln = I.extend({
501
+ }), ln = F.extend({
502
502
  ref: x([cn, sn]),
503
503
  argument: o({
504
504
  name: r(),
505
505
  value: r()
506
506
  }),
507
507
  context: o({ arguments: S(r(), r()).optional() }).optional()
508
- }), un = L.extend({
508
+ }), un = I.extend({
509
509
  method: f("completion/complete"),
510
510
  params: ln
511
- }), dn = B.extend({ completion: i({
511
+ }), dn = z.extend({ completion: i({
512
512
  values: m(r()).max(100),
513
513
  total: a(p().int()),
514
- hasMore: a(O())
514
+ hasMore: a(D())
515
515
  }) }), fn = o({
516
516
  uri: r().startsWith("file://"),
517
517
  name: r().optional(),
518
518
  _meta: S(r(), c()).optional()
519
- }), pn = L.extend({
519
+ }), pn = I.extend({
520
520
  method: f("roots/list"),
521
- params: I.optional()
522
- }), mn = B.extend({ roots: m(fn) }), hn = z.extend({
521
+ params: F.optional()
522
+ }), mn = z.extend({ roots: m(fn) }), hn = R.extend({
523
523
  method: f("notifications/roots/list_changed"),
524
- params: R.optional()
524
+ params: L.optional()
525
525
  });
526
526
  i({
527
527
  ttl: p().optional(),
528
528
  pollInterval: p().optional()
529
529
  });
530
- var gn = T([
530
+ var gn = E([
531
531
  "working",
532
532
  "input_required",
533
533
  "completed",
@@ -542,23 +542,23 @@ var gn = T([
542
542
  pollInterval: a(p()),
543
543
  statusMessage: a(r())
544
544
  });
545
- B.extend({ task: _n });
546
- var vn = R.merge(_n);
547
- z.extend({
545
+ z.extend({ task: _n });
546
+ var vn = L.merge(_n);
547
+ R.extend({
548
548
  method: f("notifications/tasks/status"),
549
549
  params: vn
550
- }), L.extend({
550
+ }), I.extend({
551
551
  method: f("tasks/get"),
552
- params: I.extend({ taskId: r() })
553
- }), B.merge(_n), L.extend({
552
+ params: F.extend({ taskId: r() })
553
+ }), z.merge(_n), I.extend({
554
554
  method: f("tasks/result"),
555
- params: I.extend({ taskId: r() })
556
- }), B.loose(), U.extend({ method: f("tasks/list") }), Re.extend({ tasks: m(_n) }), L.extend({
555
+ params: F.extend({ taskId: r() })
556
+ }), z.loose(), U.extend({ method: f("tasks/list") }), Re.extend({ tasks: m(_n) }), I.extend({
557
557
  method: f("tasks/cancel"),
558
- params: I.extend({ taskId: r() })
559
- }), B.merge(_n), x([
558
+ params: F.extend({ taskId: r() })
559
+ }), z.merge(_n), x([
560
560
  Pe,
561
- Oe,
561
+ ke,
562
562
  Me,
563
563
  un,
564
564
  It,
@@ -573,12 +573,12 @@ z.extend({
573
573
  Mt,
574
574
  Ot
575
575
  ]), x([
576
- be,
576
+ xe,
577
577
  Ie,
578
578
  je,
579
579
  hn
580
580
  ]), x([
581
- ve,
581
+ ye,
582
582
  qt,
583
583
  Jt,
584
584
  on,
@@ -589,7 +589,7 @@ z.extend({
589
589
  nn,
590
590
  pn
591
591
  ]), x([
592
- be,
592
+ xe,
593
593
  Ie,
594
594
  Rt,
595
595
  ct,
@@ -599,8 +599,8 @@ z.extend({
599
599
  Y,
600
600
  an
601
601
  ]), x([
602
- ve,
603
- Ae,
602
+ ye,
603
+ V,
604
604
  Ne,
605
605
  dn,
606
606
  Ct,
@@ -633,10 +633,10 @@ i({
633
633
  resource_documentation: r().optional(),
634
634
  resource_policy_uri: r().url().optional(),
635
635
  resource_tos_uri: r().url().optional(),
636
- tls_client_certificate_bound_access_tokens: O().optional(),
636
+ tls_client_certificate_bound_access_tokens: D().optional(),
637
637
  authorization_details_types_supported: m(r()).optional(),
638
638
  dpop_signing_alg_values_supported: m(r()).optional(),
639
- dpop_bound_access_tokens_required: O().optional()
639
+ dpop_bound_access_tokens_required: D().optional()
640
640
  });
641
641
  var yn = i({
642
642
  issuer: r(),
@@ -657,8 +657,8 @@ var yn = i({
657
657
  introspection_endpoint_auth_methods_supported: m(r()).optional(),
658
658
  introspection_endpoint_auth_signing_alg_values_supported: m(r()).optional(),
659
659
  code_challenge_methods_supported: m(r()).optional(),
660
- client_id_metadata_document_supported: O().optional(),
661
- authorization_response_iss_parameter_supported: O().optional().catch(void 0)
660
+ client_id_metadata_document_supported: D().optional(),
661
+ authorization_response_iss_parameter_supported: D().optional().catch(void 0)
662
662
  });
663
663
  o({
664
664
  ...i({
@@ -691,14 +691,14 @@ o({
691
691
  service_documentation: r().optional(),
692
692
  claims_locales_supported: m(r()).optional(),
693
693
  ui_locales_supported: m(r()).optional(),
694
- claims_parameter_supported: O().optional(),
695
- request_parameter_supported: O().optional(),
696
- request_uri_parameter_supported: O().optional(),
697
- require_request_uri_registration: O().optional(),
694
+ claims_parameter_supported: D().optional(),
695
+ request_parameter_supported: D().optional(),
696
+ request_uri_parameter_supported: D().optional(),
697
+ require_request_uri_registration: D().optional(),
698
698
  op_policy_uri: X.optional(),
699
699
  op_tos_uri: X.optional(),
700
- client_id_metadata_document_supported: O().optional(),
701
- authorization_response_iss_parameter_supported: O().optional().catch(void 0)
700
+ client_id_metadata_document_supported: D().optional(),
701
+ authorization_response_iss_parameter_supported: D().optional().catch(void 0)
702
702
  }).shape,
703
703
  ...yn.pick({ code_challenge_methods_supported: !0 }).shape
704
704
  }), o({
@@ -868,7 +868,7 @@ var Cn = class {
868
868
  ]).describe("CSS variable keys available to MCP apps for theming.").describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."), x([r(), y()]).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation.")).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."), On = o({
869
869
  method: f("ui/open-link"),
870
870
  params: o({ url: r().describe("URL to open in the host's browser") })
871
- }), kn = o({ isError: O().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), An = o({ isError: O().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), jn = o({ isError: O().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), Mn = o({
871
+ }), kn = o({ isError: D().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), An = o({ isError: D().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), jn = o({ isError: D().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), Mn = o({
872
872
  method: f("ui/notifications/sandbox-proxy-ready"),
873
873
  params: o({})
874
874
  }), Nn = o({
@@ -920,8 +920,8 @@ var Rn = S(r(), c()), zn = o({
920
920
  experimental: o({}).optional().describe("Experimental features (structure TBD)."),
921
921
  openLinks: o({}).optional().describe("Host supports opening external URLs."),
922
922
  downloadFile: o({}).optional().describe("Host supports file downloads via ui/download-file."),
923
- serverTools: o({ listChanged: O().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."),
924
- serverResources: o({ listChanged: O().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
923
+ serverTools: o({ listChanged: D().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."),
924
+ serverResources: o({ listChanged: D().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
925
925
  logging: o({}).optional().describe("Host accepts log messages."),
926
926
  sandbox: o({
927
927
  permissions: Pn.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
@@ -932,7 +932,7 @@ var Rn = S(r(), c()), zn = o({
932
932
  sampling: o({ tools: o({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.") }).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")
933
933
  }), Hn = o({
934
934
  experimental: o({}).optional().describe("Experimental features (structure TBD)."),
935
- tools: o({ listChanged: O().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
935
+ tools: o({ listChanged: D().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
936
936
  availableDisplayModes: m(En).optional().describe("Display modes the app supports.")
937
937
  }), Un = o({
938
938
  method: f("ui/notifications/initialized"),
@@ -942,7 +942,7 @@ o({
942
942
  csp: Nn.optional().describe("Content Security Policy configuration for UI resources."),
943
943
  permissions: Pn.optional().describe("Sandbox permissions requested by the UI resource."),
944
944
  domain: r().optional().describe("Dedicated origin for view sandbox.\n\nUseful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.\n\n**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:\n- Hash-based subdomains (e.g., `{hash}.claudemcpcontent.com`)\n- URL-derived subdomains (e.g., `www-example-com.oaiusercontent.com`)\n\nIf omitted, host uses default sandbox origin (typically per-conversation)."),
945
- prefersBorder: O().optional().describe("Visual boundary preference - true if view prefers a visible border.\n\nBoolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.\n\n- `true`: request visible border + background\n- `false`: request no visible border + background\n- omitted: host decides border")
945
+ prefersBorder: D().optional().describe("Visual boundary preference - true if view prefers a visible border.\n\nBoolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.\n\n- `true`: request visible border + background\n- `false`: request no visible border + background\n- omitted: host decides border")
946
946
  });
947
947
  var Wn = o({
948
948
  method: f("ui/request-display-mode"),
@@ -951,8 +951,8 @@ var Wn = o({
951
951
  o({
952
952
  resourceUri: r().optional(),
953
953
  visibility: m(Kn).optional().describe("Who can access this tool. Default: [\"model\", \"app\"]\n- \"model\": Tool visible to and callable by the agent\n- \"app\": Tool callable by the app from this server only"),
954
- csp: k().optional(),
955
- permissions: k().optional()
954
+ csp: O().optional(),
955
+ permissions: O().optional()
956
956
  }), o({ mimeTypes: m(r()).optional().describe("Array of supported MIME types for UI resources.\nMust include `\"text/html;profile=mcp-app\"` for MCP Apps support.") });
957
957
  var qn = o({
958
958
  method: f("ui/download-file"),
@@ -978,7 +978,7 @@ o({
978
978
  });
979
979
  var Yn = o({
980
980
  toolInfo: o({
981
- id: fe.optional().describe("JSON-RPC id of the tools/call request."),
981
+ id: pe.optional().describe("JSON-RPC id of the tools/call request."),
982
982
  tool: Dt.describe("Tool definition including name, inputSchema, etc.")
983
983
  }).optional().describe("Metadata of the tool call that instantiated this App."),
984
984
  theme: Tn.optional().describe("Current color theme preference."),
@@ -995,8 +995,8 @@ var Yn = o({
995
995
  f("mobile")
996
996
  ]).optional().describe("Platform type for responsive design decisions."),
997
997
  deviceCapabilities: o({
998
- touch: O().optional().describe("Whether the device supports touch input."),
999
- hover: O().optional().describe("Whether the device supports hover interactions.")
998
+ touch: D().optional().describe("Whether the device supports touch input."),
999
+ hover: D().optional().describe("Whether the device supports hover interactions.")
1000
1000
  }).optional().describe("Device input capabilities."),
1001
1001
  safeAreaInsets: o({
1002
1002
  top: p().describe("Top safe area inset in pixels."),
@@ -1018,13 +1018,13 @@ var Xn = o({
1018
1018
  }), Zn = o({
1019
1019
  method: f("ui/initialize"),
1020
1020
  params: o({
1021
- appInfo: Se.describe("App identification (name and version)."),
1021
+ appInfo: B.describe("App identification (name and version)."),
1022
1022
  appCapabilities: Hn.describe("Features and capabilities this app provides."),
1023
1023
  protocolVersion: r().describe("Protocol version this app supports.")
1024
1024
  })
1025
1025
  }), Qn = o({
1026
1026
  protocolVersion: r().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
1027
- hostInfo: Se.describe("Host application identification and version."),
1027
+ hostInfo: B.describe("Host application identification and version."),
1028
1028
  hostCapabilities: Vn.describe("Features and capabilities provided by the host."),
1029
1029
  hostContext: Yn.describe("Rich context about the host environment.")
1030
1030
  }).passthrough(), $n = class {
@@ -1037,7 +1037,7 @@ var Xn = o({
1037
1037
  console.debug("Ignoring message from unknown source", e);
1038
1038
  return;
1039
1039
  }
1040
- let n = _e.safeParse(e.data);
1040
+ let n = ve.safeParse(e.data);
1041
1041
  n.success ? (console.debug("Parsed message", n.data), this.onmessage?.(n.data)) : e.data?.jsonrpc === "2.0" ? (console.error("Failed to parse message", n.error.message, e), this.onerror?.(Error("Invalid JSON-RPC message received: " + n.error.message))) : console.debug("Ignoring non-JSON-RPC message", n.error.message, e);
1042
1042
  };
1043
1043
  }
@@ -1219,7 +1219,7 @@ var nr = [wn], rr = class extends ie {
1219
1219
  set onupdatemodelcontext(e) {
1220
1220
  this.warnIfRequestHandlerReplaced("onupdatemodelcontext", this._onupdatemodelcontext, e), this._onupdatemodelcontext = e, this.setRequestHandler("ui/update-model-context", {
1221
1221
  params: Xn.shape.params,
1222
- result: ve
1222
+ result: ye
1223
1223
  }, async (e, t) => {
1224
1224
  if (!this._onupdatemodelcontext) throw Error("No onupdatemodelcontext handler set");
1225
1225
  return this._onupdatemodelcontext(e, t);
@@ -1645,7 +1645,7 @@ function Nr(e) {
1645
1645
  var Pr = class {
1646
1646
  getValidator(e) {
1647
1647
  let t = Nr(e);
1648
- return (t === void 0 ? new re() : new re({ draft: t })).getValidator(e);
1648
+ return (t === void 0 ? new T() : new T({ draft: t })).getValidator(e);
1649
1649
  }
1650
1650
  };
1651
1651
  mr();
@@ -1944,7 +1944,7 @@ var Lr = { "~standard": {
1944
1944
  };
1945
1945
  function zr(e, t = 0) {
1946
1946
  if (!e || t > 5) return !1;
1947
- if (e instanceof E || e instanceof C && e.status === 401) return !0;
1947
+ if (e instanceof re || e instanceof C && e.status === 401) return !0;
1948
1948
  if (e instanceof Error) {
1949
1949
  if (e.cause && zr(e.cause, t + 1)) return !0;
1950
1950
  let n = e instanceof _ ? e.data : void 0;
@@ -2135,7 +2135,7 @@ var Vr = class extends Rr {
2135
2135
  a = this.opts.wrapTransport(a, e);
2136
2136
  }
2137
2137
  let o = this.buildClientOptions();
2138
- Z.debug("Creating Client with capabilities:", JSON.stringify(o.capabilities, null, 2)), this.client = new D(this.clientInfo, o), this.setupRootsHandler(), this.setupSamplingHandler(), this.setupElicitationHandler(), Z.debug("Roots/sampling/elicitation handlers registered before connect");
2138
+ Z.debug("Creating Client with capabilities:", JSON.stringify(o.capabilities, null, 2)), this.client = new ae(this.clientInfo, o), this.setupRootsHandler(), this.setupSamplingHandler(), this.setupElicitationHandler(), Z.debug("Roots/sampling/elicitation handlers registered before connect");
2139
2139
  try {
2140
2140
  let e;
2141
2141
  if (await Promise.race([this.client.connect(a), new Promise((t, n) => {
@@ -2198,7 +2198,7 @@ var Vr = class extends Rr {
2198
2198
  }
2199
2199
  await super.cleanupResources();
2200
2200
  }
2201
- }, Hr = "2.0.0-beta.2";
2201
+ }, Hr = "2.0.0-beta.3";
2202
2202
  function Ur() {
2203
2203
  return Hr;
2204
2204
  }
@@ -3100,7 +3100,7 @@ var Pi = class e {
3100
3100
  }, Fi = 5 * 6e4;
3101
3101
  function Ii(e, t = 0) {
3102
3102
  if (!e || t > 5) return !1;
3103
- if (e instanceof E) return !0;
3103
+ if (e instanceof re) return !0;
3104
3104
  if (e instanceof Error) {
3105
3105
  if (e.code === 401 || e.name === "UnauthorizedError") return !0;
3106
3106
  let n = e.message ?? "";
@@ -3577,7 +3577,7 @@ function la(e, t) {
3577
3577
  return n;
3578
3578
  }
3579
3579
  function ua(e) {
3580
- let t = (0, j.useCallback)(async (t, n, r) => {
3580
+ let t = (0, A.useCallback)(async (t, n, r) => {
3581
3581
  let i = la(e, `call tool "${t}"`);
3582
3582
  e.addLog("info", `Calling tool: ${t}`, n);
3583
3583
  let a = Date.now();
@@ -3596,12 +3596,12 @@ function ua(e) {
3596
3596
  executionTimeMs: Date.now() - a
3597
3597
  }).catch(() => {}), n;
3598
3598
  }
3599
- }, [e.addLog]), n = (0, j.useCallback)(async () => {
3599
+ }, [e.addLog]), n = (0, A.useCallback)(async () => {
3600
3600
  let t = la(e, "list resources");
3601
3601
  e.addLog("info", "Listing resources");
3602
3602
  let n = await t.listAllResources();
3603
3603
  e.setResources(n.resources || []);
3604
- }, [e.addLog]), r = (0, j.useCallback)(async (t) => {
3604
+ }, [e.addLog]), r = (0, A.useCallback)(async (t) => {
3605
3605
  let n = la(e, "read resource");
3606
3606
  e.addLog("info", `Reading resource: ${t}`);
3607
3607
  try {
@@ -3617,32 +3617,32 @@ function ua(e) {
3617
3617
  errorType: e instanceof Error ? e.name : "UnknownError"
3618
3618
  }).catch(() => {}), e;
3619
3619
  }
3620
- }, [e.addLog]), i = (0, j.useCallback)(async () => {
3620
+ }, [e.addLog]), i = (0, A.useCallback)(async () => {
3621
3621
  let t = la(e, "list prompts");
3622
3622
  e.addLog("info", "Listing prompts");
3623
3623
  let n = await t.listPrompts();
3624
3624
  e.setPrompts(n.prompts || []);
3625
- }, [e.addLog]), a = (0, j.useCallback)(async () => {
3625
+ }, [e.addLog]), a = (0, A.useCallback)(async () => {
3626
3626
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3627
3627
  e.setTools(await e.connectionRef.current.listTools() || []);
3628
3628
  } catch (t) {
3629
3629
  e.addLog("error", "Failed to refresh tools:", t);
3630
3630
  }
3631
- }, [e.addLog]), o = (0, j.useCallback)(async () => {
3631
+ }, [e.addLog]), o = (0, A.useCallback)(async () => {
3632
3632
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3633
3633
  let t = await e.connectionRef.current.listAllResources();
3634
3634
  e.setResources(t.resources || []);
3635
3635
  } catch (t) {
3636
3636
  e.addLog("warn", "Failed to refresh resources:", t);
3637
3637
  }
3638
- }, [e.addLog]), s = (0, j.useCallback)(async () => {
3638
+ }, [e.addLog]), s = (0, A.useCallback)(async () => {
3639
3639
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3640
3640
  let t = await e.connectionRef.current.listPrompts();
3641
3641
  e.setPrompts(t.prompts || []);
3642
3642
  } catch (t) {
3643
3643
  e.addLog("warn", "Failed to refresh prompts:", t);
3644
3644
  }
3645
- }, [e.addLog]), c = (0, j.useCallback)(async () => {
3645
+ }, [e.addLog]), c = (0, A.useCallback)(async () => {
3646
3646
  let t = await la(e, "refresh resource templates").listResourceTemplates();
3647
3647
  e.isMounted() && e.setResourceTemplates(t.resourceTemplates || []);
3648
3648
  }, [e.addLog]);
@@ -3655,7 +3655,7 @@ function ua(e) {
3655
3655
  refreshResources: o,
3656
3656
  refreshPrompts: s,
3657
3657
  refreshResourceTemplates: c,
3658
- refreshAll: (0, j.useCallback)(() => Promise.all([
3658
+ refreshAll: (0, A.useCallback)(() => Promise.all([
3659
3659
  a(),
3660
3660
  o(),
3661
3661
  c(),
@@ -3666,26 +3666,26 @@ function ua(e) {
3666
3666
  c,
3667
3667
  s
3668
3668
  ]),
3669
- getPrompt: (0, j.useCallback)(async (t, n) => la(e, "get prompt").getPrompt(t, n || {}), [e.addLog]),
3670
- complete: (0, j.useCallback)(async (t) => la(e, "request completion").complete(t), [e.addLog])
3669
+ getPrompt: (0, A.useCallback)(async (t, n) => la(e, "get prompt").getPrompt(t, n || {}), [e.addLog]),
3670
+ complete: (0, A.useCallback)(async (t) => la(e, "request completion").complete(t), [e.addLog])
3671
3671
  };
3672
3672
  }
3673
3673
  var da = 3e3, fa = 5e3;
3674
3674
  function pa(e) {
3675
- let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, re = "http", T = w?.clientId?.trim() || void 0, E = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, D = (0, j.useMemo)(() => T ? { client_id: T } : void 0, [T]), O = (0, j.useMemo)(() => {
3675
+ let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, T = "http", E = w?.clientId?.trim() || void 0, re = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, ae = (0, A.useMemo)(() => E ? { client_id: E } : void 0, [E]), D = (0, A.useMemo)(() => {
3676
3676
  let e = `useMcp:${t || "no-url"}`, n = pr.get(e);
3677
3677
  return u && (n.level = u), n;
3678
- }, [t, u]), k = o ?? {}, ae = (0, j.useMemo)(() => Jr(y), [y]), A = C, oe = ne, M = (0, j.useMemo)(() => ({
3678
+ }, [t, u]), O = o ?? {}, oe = (0, A.useMemo)(() => Jr(y), [y]), k = C, se = ne, j = (0, A.useMemo)(() => ({
3679
3679
  name: "mcp-use",
3680
3680
  title: "mcp-use",
3681
3681
  version: Ur(),
3682
3682
  description: "mcp-use is a complete TypeScript framework for building and using MCP",
3683
3683
  icons: [{ src: "https://mcp-use.com/logo.png" }],
3684
3684
  websiteUrl: "https://mcp-use.com"
3685
- }), []), N = (0, j.useMemo)(() => e.clientInfo ? {
3686
- ...M,
3685
+ }), []), M = (0, A.useMemo)(() => e.clientInfo ? {
3686
+ ...j,
3687
3687
  ...e.clientInfo
3688
- } : M, [e.clientInfo, M]), P = (0, j.useMemo)(() => ia(N), [N]), se = (0, j.useMemo)(() => {
3688
+ } : j, [e.clientInfo, j]), N = (0, A.useMemo)(() => ia(M), [M]), ce = (0, A.useMemo)(() => {
3689
3689
  if (!l) return {
3690
3690
  enabled: !1,
3691
3691
  proxyAddress: void 0
@@ -3702,7 +3702,7 @@ function pa(e) {
3702
3702
  enabled: l.enabled !== !1 && !!e,
3703
3703
  proxyAddress: e
3704
3704
  };
3705
- }, [l, s]), F = (0, j.useMemo)(() => f === !1 ? {
3705
+ }, [l, s]), P = (0, A.useMemo)(() => f === !1 ? {
3706
3706
  enabled: !1,
3707
3707
  initialDelay: 0,
3708
3708
  healthCheckInterval: !1,
@@ -3722,66 +3722,66 @@ function pa(e) {
3722
3722
  initialDelay: f.initialDelay ?? da,
3723
3723
  healthCheckInterval: f.healthCheckInterval ?? 1e4,
3724
3724
  healthCheckTimeout: f.healthCheckTimeout ?? 3e4
3725
- }, [f]), [ce, le] = (0, j.useState)(void 0);
3726
- (0, j.useEffect)(() => {
3727
- le(void 0);
3725
+ }, [f]), [le, ue] = (0, A.useState)(void 0);
3726
+ (0, A.useEffect)(() => {
3727
+ ue(void 0);
3728
3728
  }, [t, s]);
3729
- let ue = (0, j.useMemo)(() => {
3730
- if (!ce?.proxyAddress) return s;
3729
+ let de = (0, A.useMemo)(() => {
3730
+ if (!le?.proxyAddress) return s;
3731
3731
  let e = s?.headers ?? {};
3732
3732
  return {
3733
- ...ce,
3733
+ ...le,
3734
3734
  headers: {
3735
3735
  ...e,
3736
- ...ce.headers ?? {}
3736
+ ...le.headers ?? {}
3737
3737
  }
3738
3738
  };
3739
- }, [ce, s]), I = ue?.proxyAddress, de = ue?.headers ?? {}, L = (0, j.useMemo)(() => t || "", [t]), R = (0, j.useMemo)(() => ({
3740
- ...de,
3741
- ...k
3742
- }), [de, k]), [z, B] = (0, j.useState)("discovering"), [fe, pe] = (0, j.useState)([]), [me, he] = (0, j.useState)([]), [ge, _e] = (0, j.useState)([]), [ve, ye] = (0, j.useState)([]), [be, xe] = (0, j.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [V, Se] = (0, j.useState)(), [Ce, we] = (0, j.useState)(void 0), [Te, Ee] = (0, j.useState)(void 0), [De, Oe] = (0, j.useState)(), [ke, Ae] = (0, j.useState)({}), [je, Me] = (0, j.useState)(void 0), [Ne, Pe] = (0, j.useState)([]), [Fe, H] = (0, j.useState)(void 0), [Ie, Le] = (0, j.useState)(void 0), U = (0, j.useRef)(null), Re = (0, j.useRef)(null), W = (0, j.useRef)(a ?? null), ze = (0, j.useRef)(null), G = (0, j.useRef)(!1), K = (0, j.useRef)(!0), Be = (0, j.useRef)(0), Ve = (0, j.useRef)(0), He = (0, j.useRef)(null), Ue = (0, j.useRef)(!1), We = (0, j.useRef)(!1), q = (0, j.useRef)(z), Ge = (0, j.useRef)(f), Ke = (0, j.useRef)(null), qe = (0, j.useRef)(null), Je = (0, j.useRef)(null), Ye = (0, j.useRef)(A), Xe = (0, j.useRef)(oe), Ze = (0, j.useRef)(A !== void 0), Qe = (0, j.useRef)(oe !== void 0), $e = (0, j.useRef)(S);
3743
- A !== void 0 && (Ye.current = A), oe !== void 0 && (Xe.current = oe), Ze.current = A !== void 0, Qe.current = oe !== void 0, $e.current = S;
3744
- let et = (0, j.useCallback)(async (e) => Ye.current(e), []), tt = (0, j.useCallback)(async (e) => Xe.current(e), []), nt = (0, j.useCallback)((e) => {
3739
+ }, [le, s]), F = de?.proxyAddress, fe = de?.headers ?? {}, I = (0, A.useMemo)(() => t || "", [t]), L = (0, A.useMemo)(() => ({
3740
+ ...fe,
3741
+ ...O
3742
+ }), [fe, O]), [R, z] = (0, A.useState)("discovering"), [pe, me] = (0, A.useState)([]), [he, ge] = (0, A.useState)([]), [_e, ve] = (0, A.useState)([]), [ye, be] = (0, A.useState)([]), [xe, Se] = (0, A.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [Ce, B] = (0, A.useState)(), [we, Te] = (0, A.useState)(void 0), [Ee, De] = (0, A.useState)(void 0), [Oe, ke] = (0, A.useState)(), [Ae, V] = (0, A.useState)({}), [je, Me] = (0, A.useState)(void 0), [Ne, Pe] = (0, A.useState)([]), [Fe, H] = (0, A.useState)(void 0), [Ie, Le] = (0, A.useState)(void 0), U = (0, A.useRef)(null), Re = (0, A.useRef)(null), W = (0, A.useRef)(a ?? null), ze = (0, A.useRef)(null), G = (0, A.useRef)(!1), K = (0, A.useRef)(!0), Be = (0, A.useRef)(0), Ve = (0, A.useRef)(0), He = (0, A.useRef)(null), Ue = (0, A.useRef)(!1), We = (0, A.useRef)(!1), q = (0, A.useRef)(R), Ge = (0, A.useRef)(f), Ke = (0, A.useRef)(null), qe = (0, A.useRef)(null), Je = (0, A.useRef)(null), Ye = (0, A.useRef)(k), Xe = (0, A.useRef)(se), Ze = (0, A.useRef)(k !== void 0), Qe = (0, A.useRef)(se !== void 0), $e = (0, A.useRef)(S);
3743
+ k !== void 0 && (Ye.current = k), se !== void 0 && (Xe.current = se), Ze.current = k !== void 0, Qe.current = se !== void 0, $e.current = S;
3744
+ let et = (0, A.useCallback)(async (e) => Ye.current(e), []), tt = (0, A.useCallback)(async (e) => Xe.current(e), []), nt = (0, A.useCallback)((e) => {
3745
3745
  $e.current?.(e);
3746
3746
  }, []);
3747
- (0, j.useEffect)(() => {
3748
- q.current = z, Ge.current = f;
3749
- }, [z, f]), (0, j.useEffect)(() => {
3747
+ (0, A.useEffect)(() => {
3748
+ q.current = R, Ge.current = f;
3749
+ }, [R, f]), (0, A.useEffect)(() => {
3750
3750
  W.current = a ?? null;
3751
3751
  }, [a]);
3752
- let J = (0, j.useCallback)((e, t, ...n) => {
3752
+ let J = (0, A.useCallback)((e, t, ...n) => {
3753
3753
  let r = n.length > 0 ? `${t} ${n.map((e) => JSON.stringify(e)).join(" ")}` : t, i = `[useMcp] ${r}`;
3754
3754
  switch (e) {
3755
3755
  case "error":
3756
- O.error(i);
3756
+ D.error(i);
3757
3757
  break;
3758
3758
  case "warn":
3759
- O.warn(i);
3759
+ D.warn(i);
3760
3760
  break;
3761
3761
  case "info":
3762
- O.info(i);
3762
+ D.info(i);
3763
3763
  break;
3764
3764
  case "debug":
3765
- O.debug(i);
3765
+ D.debug(i);
3766
3766
  break;
3767
- default: O.info(i);
3767
+ default: D.info(i);
3768
3768
  }
3769
3769
  K.current && Pe((t) => [...t.slice(-100), {
3770
3770
  level: e,
3771
3771
  message: r,
3772
3772
  timestamp: Date.now()
3773
3773
  }]);
3774
- }, [O]), rt = ua({
3774
+ }, [D]), rt = ua({
3775
3775
  stateRef: q,
3776
3776
  connectionRef: Re,
3777
3777
  hasClient: () => U.current !== null,
3778
3778
  isMounted: () => K.current,
3779
- setTools: pe,
3780
- setResources: he,
3781
- setResourceTemplates: _e,
3782
- setPrompts: ye,
3779
+ setTools: me,
3780
+ setResources: ge,
3781
+ setResourceTemplates: ve,
3782
+ setPrompts: be,
3783
3783
  addLog: J
3784
- }), it = (0, j.useCallback)(async (e = !1) => {
3784
+ }), it = (0, A.useCallback)(async (e = !1) => {
3785
3785
  e || J("info", "Disconnecting..."), G.current = !1, He.current && clearTimeout(He.current), He.current = null;
3786
3786
  let t = Ve.current, n = U.current;
3787
3787
  if (n) try {
@@ -3791,21 +3791,21 @@ function pa(e) {
3791
3791
  e || J("warn", "Error closing connection:", t);
3792
3792
  }
3793
3793
  let r = Ve.current !== t;
3794
- U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (B("discovering"), pe([]), he([]), _e([]), ye([]), Me(void 0), H(void 0), Le(void 0), xe(void 0), Se(void 0), we(void 0), Ee(void 0), Oe(void 0), Ae({}));
3795
- }, [J]), Y = (0, j.useCallback)((e, n) => {
3794
+ U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (z("discovering"), me([]), ge([]), ve([]), be([]), Me(void 0), H(void 0), Le(void 0), Se(void 0), B(void 0), Te(void 0), De(void 0), ke(void 0), V({}));
3795
+ }, [J]), Y = (0, A.useCallback)((e, n) => {
3796
3796
  J("error", e, n ?? "");
3797
- let r = n && "code" in n ? n.code : void 0, i = se.enabled && !ue?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
- if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), U.current = null, a || (W.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), le({ proxyAddress: se.proxyAddress }), K.current && B("discovering"), setTimeout(() => {
3797
+ let r = n && "code" in n ? n.code : void 0, i = ce.enabled && !de?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
+ if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), U.current = null, a || (W.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), ue({ proxyAddress: ce.proxyAddress }), K.current && z("discovering"), setTimeout(() => {
3799
3799
  K.current && qe.current?.();
3800
3800
  }, 1e3), !0;
3801
3801
  if (K.current) {
3802
- J("info", "Setting state to FAILED:", e), B("failed"), Me(e);
3802
+ J("info", "Setting state to FAILED:", e), z("failed"), Me(e);
3803
3803
  let t = W.current?.getLastAttemptedAuthUrl?.();
3804
3804
  t && (H(t), J("info", "Manual authentication URL may be available.", t));
3805
3805
  }
3806
3806
  return G.current = !1, t && Pi.getInstance().trackUseMcpConnection({
3807
3807
  url: t,
3808
- transportType: re,
3808
+ transportType: T,
3809
3809
  success: !1,
3810
3810
  errorType: n?.name || "UnknownError",
3811
3811
  hasOAuth: !!W.current,
@@ -3815,11 +3815,11 @@ function pa(e) {
3815
3815
  }, [
3816
3816
  J,
3817
3817
  t,
3818
- re,
3819
- se,
3820
- ue,
3818
+ T,
3819
+ ce,
3820
+ de,
3821
3821
  a
3822
- ]), at = (0, j.useCallback)(async () => {
3822
+ ]), at = (0, A.useCallback)(async () => {
3823
3823
  if (!n || !t) {
3824
3824
  J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag.");
3825
3825
  return;
@@ -3832,23 +3832,23 @@ function pa(e) {
3832
3832
  J("debug", "Connect called after unmount, aborting.");
3833
3833
  return;
3834
3834
  }
3835
- if (G.current = !0, Ve.current += 1, Be.current += 1, Me(void 0), H(void 0), Ke.current = null, B("discovering"), pe([]), he([]), _e([]), ye([]), xe(void 0), Se(void 0), we(void 0), Ee(void 0), Oe(void 0), Ae({}), J("info", `Connecting attempt #${Be.current} to ${t}...`), !W.current) {
3835
+ if (G.current = !0, Ve.current += 1, Be.current += 1, Me(void 0), H(void 0), Ke.current = null, z("discovering"), me([]), ge([]), ve([]), be([]), Se(void 0), B(void 0), Te(void 0), De(void 0), ke(void 0), V({}), J("info", `Connecting attempt #${Be.current} to ${t}...`), !W.current) {
3836
3836
  let { provider: e, oauthProxyUrl: t } = sa({
3837
- effectiveOAuthUrl: L,
3837
+ effectiveOAuthUrl: I,
3838
3838
  storageKeyPrefix: i,
3839
- oauthClientConfig: P,
3839
+ oauthClientConfig: N,
3840
3840
  callbackUrl: r,
3841
3841
  preventAutoAuth: m,
3842
3842
  useRedirectFlow: h,
3843
- gatewayUrl: I,
3843
+ gatewayUrl: F,
3844
3844
  oauthProxyUrl: c,
3845
3845
  onPopupWindow: g,
3846
3846
  proxyOAuthRequests: !0,
3847
- staticClientInfo: D,
3848
- clientMetadataUrl: E,
3847
+ staticClientInfo: ae,
3848
+ clientMetadataUrl: re,
3849
3849
  scope: ie
3850
3850
  });
3851
- W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
3851
+ W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
3852
3852
  }
3853
3853
  U.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (U.current = new Ki(), J("debug", "BrowserMCPClient initialized in connect."));
3854
3854
  let e = async (n) => {
@@ -3858,16 +3858,16 @@ function pa(e) {
3858
3858
  let e = ea, r = {
3859
3859
  url: t,
3860
3860
  timeout: _,
3861
- clientInfo: N,
3861
+ clientInfo: M,
3862
3862
  ...(() => {
3863
3863
  let e = W.current?.getProxyFetch?.(te) ?? te;
3864
3864
  return e ? { fetch: e } : {};
3865
3865
  })(),
3866
- ...ae && { clientOptions: ae },
3866
+ ...oe && { clientOptions: oe },
3867
3867
  ...x !== void 0 && { protocolNegotiation: x },
3868
3868
  ...p ? { reconnectionOptions: p } : f === !1 ? { reconnectionOptions: { maxRetries: 0 } } : {}
3869
3869
  };
3870
- if (I && (r.gatewayUrl = I, J("debug", `Using proxy gateway: ${I} for target: ${t}`)), R && Object.keys(R).length > 0 && (r.headers = R), !U.current) {
3870
+ if (F && (r.gatewayUrl = F, J("debug", `Using proxy gateway: ${F} for target: ${t}`)), L && Object.keys(L).length > 0 && (r.headers = L), !U.current) {
3871
3871
  if (!K.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
3872
3872
  let e = /* @__PURE__ */ Error("Client not initialized - this is a bug in the connection flow");
3873
3873
  throw J("error", "Client ref is null in tryConnectWithTransport but component is still mounted"), e;
@@ -3884,10 +3884,10 @@ function pa(e) {
3884
3884
  });
3885
3885
  let i = await U.current.connect(e);
3886
3886
  if (Re.current = i, !K.current) return J("debug", "Connection aborted after connection creation - component unmounted"), "failed";
3887
- J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), F.enabled && F.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3888
- gatewayUrl: I,
3887
+ J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), P.enabled && P.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3888
+ gatewayUrl: F,
3889
3889
  url: t,
3890
- allHeaders: R,
3890
+ allHeaders: L,
3891
3891
  getAuthHeaders: async () => {
3892
3892
  try {
3893
3893
  let e = await W.current?.tokens?.();
@@ -3901,12 +3901,12 @@ function pa(e) {
3901
3901
  isMountedRef: K,
3902
3902
  stateRef: q,
3903
3903
  autoReconnectRef: Ge,
3904
- setState: B,
3904
+ setState: z,
3905
3905
  addLog: J,
3906
3906
  connect: at,
3907
- defaultReconnectDelay: F.initialDelay,
3908
- healthCheckIntervalMs: F.healthCheckInterval,
3909
- healthCheckTimeoutMs: F.healthCheckTimeout
3907
+ defaultReconnectDelay: P.initialDelay,
3908
+ healthCheckIntervalMs: P.healthCheckInterval,
3909
+ healthCheckTimeoutMs: P.healthCheckTimeout
3910
3910
  })), Pi.getInstance().trackUseMcpConnection({
3911
3911
  url: t,
3912
3912
  transportType: n,
@@ -3914,28 +3914,28 @@ function pa(e) {
3914
3914
  hasOAuth: !!W.current,
3915
3915
  hasSampling: Ze.current,
3916
3916
  hasElicitation: Qe.current
3917
- }).catch(() => {}), pe(i.tools || []);
3917
+ }).catch(() => {}), me(i.tools || []);
3918
3918
  let [a, o, s] = await Promise.all([
3919
3919
  i.listAllResources(),
3920
3920
  i.listPrompts(),
3921
3921
  i.supports("resources") ? i.listResourceTemplates() : Promise.resolve({ resourceTemplates: [] })
3922
3922
  ]);
3923
3923
  if (!K.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
3924
- he(a.resources || []), ye(o.prompts || []), _e(s.resourceTemplates || []);
3924
+ ge(a.resources || []), be(o.prompts || []), ve(s.resourceTemplates || []);
3925
3925
  let { server: c, capabilities: l, protocolEra: u, protocolVersion: d, instructions: m, extensions: h } = i.info;
3926
- if (K.current && (we(u), Ee(d), Oe(m), Ae(h)), c) {
3926
+ if (K.current && (Te(u), De(d), ke(m), V(h)), c) {
3927
3927
  if (J("debug", "Server info:", c), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3928
- xe(c), ze.current = na({
3928
+ Se(c), ze.current = na({
3929
3929
  serverInfo: c,
3930
3930
  url: t,
3931
3931
  isMounted: () => K.current,
3932
- setServerInfo: xe,
3932
+ setServerInfo: Se,
3933
3933
  addLog: J
3934
3934
  });
3935
3935
  }
3936
3936
  if (l) {
3937
3937
  if (J("debug", "Server capabilities:", l), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3938
- Se(l);
3938
+ B(l);
3939
3939
  }
3940
3940
  if (W.current) {
3941
3941
  let e = await W.current.tokens?.();
@@ -3965,18 +3965,18 @@ function pa(e) {
3965
3965
  });
3966
3966
  }
3967
3967
  }
3968
- return Ke.current = n, B("ready"), "success";
3968
+ return Ke.current = n, z("ready"), "success";
3969
3969
  } catch (r) {
3970
3970
  let i = r, a = i?.message || String(r), o = W.current?.getLastAttemptedAuthUrl?.();
3971
- if (o && W.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), K.current && (B("pending_auth"), H(o)), G.current = !1, "auth_redirect";
3971
+ if (o && W.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), K.current && (z("pending_auth"), H(o)), G.current = !1, "auth_redirect";
3972
3972
  let s = aa(r), c = Ii(r);
3973
- if (s && k && Object.keys(k).length > 0) return Y("Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct."), "failed";
3974
- if (s && (!k || Object.keys(k).length === 0)) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3973
+ if (s && O && Object.keys(O).length > 0) return Y("Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct."), "failed";
3974
+ if (s && (!O || Object.keys(O).length === 0)) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3975
3975
  if (c) {
3976
3976
  if (s) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3977
3977
  if (W.current) if (J("info", "Authentication required. OAuth provider available."), m) {
3978
3978
  if (J("info", "Waiting for user to initiate authentication flow..."), K.current) {
3979
- B("pending_auth");
3979
+ z("pending_auth");
3980
3980
  let e = W.current?.getLastAttemptedAuthUrl?.();
3981
3981
  e && (H(e), J("info", "Retrieved stored auth URL for manual authentication"));
3982
3982
  }
@@ -4001,7 +4001,7 @@ function pa(e) {
4001
4001
  return Y(`Automatic OAuth authentication failed: ${e instanceof Error ? e.message : String(e)}`, e instanceof Error ? e : Error(String(e))), "failed";
4002
4002
  }
4003
4003
  }
4004
- return k && Object.keys(k).length > 0 ? (Y("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."), "failed") : (Y("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed");
4004
+ return O && Object.keys(O).length > 0 ? (Y("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."), "failed") : (Y("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed");
4005
4005
  }
4006
4006
  return Y(a, i instanceof Error ? i : Error(String(i))) ? "auth_redirect" : "failed";
4007
4007
  }
@@ -4014,37 +4014,37 @@ function pa(e) {
4014
4014
  t,
4015
4015
  i,
4016
4016
  r,
4017
- P.name,
4018
- P.version,
4019
- P.uri,
4020
- P.logo_uri,
4021
- D,
4022
- E,
4023
- ie,
4024
- k,
4017
+ N.name,
4018
+ N.version,
4019
+ N.uri,
4020
+ N.logo_uri,
4021
+ ae,
4025
4022
  re,
4023
+ ie,
4024
+ O,
4025
+ T,
4026
4026
  m,
4027
4027
  h,
4028
4028
  g,
4029
4029
  n,
4030
4030
  _,
4031
- N,
4032
- ae,
4031
+ M,
4032
+ oe,
4033
4033
  x,
4034
- I,
4034
+ F,
4035
4035
  c,
4036
- R,
4037
4036
  L,
4037
+ I,
4038
4038
  et,
4039
4039
  tt,
4040
4040
  nt
4041
4041
  ]);
4042
- (0, j.useEffect)(() => {
4042
+ (0, A.useEffect)(() => {
4043
4043
  qe.current = at, Je.current = Y;
4044
4044
  }, [at, Y]);
4045
- let ot = (0, j.useCallback)(() => {
4045
+ let ot = (0, A.useCallback)(() => {
4046
4046
  q.current === "failed" ? (J("info", "Retry requested..."), qe.current?.()) : J("warn", `Retry called but state is not 'failed' (state: ${q.current}). Ignoring.`);
4047
- }, [J]), st = (0, j.useCallback)(async () => {
4047
+ }, [J]), st = (0, A.useCallback)(async () => {
4048
4048
  J("info", "Manual authentication requested...");
4049
4049
  let e = q.current;
4050
4050
  if (e === "failed") J("info", "Attempting to reconnect and authenticate via retry..."), ot();
@@ -4060,15 +4060,15 @@ function pa(e) {
4060
4060
  }), qe.current?.();
4061
4061
  return;
4062
4062
  }
4063
- J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), B("authenticating");
4063
+ J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), z("authenticating");
4064
4064
  let e = null, n = null, { provider: o, oauthProxyUrl: s } = sa({
4065
- effectiveOAuthUrl: L,
4065
+ effectiveOAuthUrl: I,
4066
4066
  storageKeyPrefix: i,
4067
- oauthClientConfig: P,
4067
+ oauthClientConfig: N,
4068
4068
  callbackUrl: r,
4069
4069
  preventAutoAuth: !1,
4070
4070
  useRedirectFlow: h,
4071
- gatewayUrl: I,
4071
+ gatewayUrl: F,
4072
4072
  oauthProxyUrl: c,
4073
4073
  onPopupWindow: (t, r, i) => {
4074
4074
  e = i;
@@ -4078,8 +4078,8 @@ function pa(e) {
4078
4078
  g?.(t, r, i);
4079
4079
  },
4080
4080
  proxyOAuthRequests: !0,
4081
- staticClientInfo: D,
4082
- clientMetadataUrl: E,
4081
+ staticClientInfo: ae,
4082
+ clientMetadataUrl: re,
4083
4083
  scope: ie
4084
4084
  });
4085
4085
  s && J("info", "Scoped OAuth proxy fetch enabled for manual auth"), W.current = o, J("info", "Triggering fresh OAuth authorization...");
@@ -4119,10 +4119,10 @@ function pa(e) {
4119
4119
  J("info", "Authentication succeeded; reconnecting to MCP server..."), G.current = !1, qe.current?.();
4120
4120
  break;
4121
4121
  case "cancelled":
4122
- J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), B("pending_auth");
4122
+ J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), z("pending_auth");
4123
4123
  break;
4124
4124
  case "timeout":
4125
- J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."), B("pending_auth");
4125
+ J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."), z("pending_auth");
4126
4126
  break;
4127
4127
  case "error":
4128
4128
  Y(`Authentication failed: ${p.error}`);
@@ -4131,7 +4131,7 @@ function pa(e) {
4131
4131
  }
4132
4132
  } catch (e) {
4133
4133
  if (!K.current) return;
4134
- B("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
4134
+ z("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
4135
4135
  }
4136
4136
  } else if (e === "authenticating") {
4137
4137
  J("warn", "Already attempting authentication. Check for blocked popups or wait for timeout.");
@@ -4147,23 +4147,23 @@ function pa(e) {
4147
4147
  h,
4148
4148
  g,
4149
4149
  i,
4150
- P.name,
4151
- P.uri,
4152
- P.logo_uri,
4153
- D,
4154
- E,
4150
+ N.name,
4151
+ N.uri,
4152
+ N.logo_uri,
4153
+ ae,
4154
+ re,
4155
4155
  ie,
4156
4156
  r,
4157
- N,
4157
+ M,
4158
4158
  a
4159
- ]), ct = (0, j.useCallback)(() => {
4159
+ ]), ct = (0, A.useCallback)(() => {
4160
4160
  W.current?.clearStorage ? (J("info", `Cleared ${W.current.clearStorage()} item(s) from localStorage for ${t}.`), H(void 0), it()) : J("warn", "Auth provider not initialized, cannot clear storage.");
4161
4161
  }, [
4162
4162
  t,
4163
4163
  J,
4164
4164
  it
4165
4165
  ]);
4166
- (0, j.useEffect)(() => {
4166
+ (0, A.useEffect)(() => {
4167
4167
  if (typeof window > "u") return;
4168
4168
  let e = (e, t) => {
4169
4169
  if (We.current) {
@@ -4206,28 +4206,28 @@ function pa(e) {
4206
4206
  }
4207
4207
  He.current && clearTimeout(He.current);
4208
4208
  };
4209
- }, [J]), (0, j.useEffect)(() => {
4210
- if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), B("discovering"), () => {
4209
+ }, [J]), (0, A.useEffect)(() => {
4210
+ if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), z("discovering"), () => {
4211
4211
  K.current = !1;
4212
4212
  };
4213
4213
  if (J("debug", "useMcp mounted, initiating connection."), Be.current = 0, a) W.current = a, J("debug", "Using externally provided authProvider");
4214
- else if (!W.current || W.current.serverUrl !== L) {
4214
+ else if (!W.current || W.current.serverUrl !== I) {
4215
4215
  let { provider: e, oauthProxyUrl: t } = sa({
4216
- effectiveOAuthUrl: L,
4216
+ effectiveOAuthUrl: I,
4217
4217
  storageKeyPrefix: i,
4218
- oauthClientConfig: P,
4218
+ oauthClientConfig: N,
4219
4219
  callbackUrl: r,
4220
4220
  preventAutoAuth: m,
4221
4221
  useRedirectFlow: h,
4222
- gatewayUrl: I,
4222
+ gatewayUrl: F,
4223
4223
  oauthProxyUrl: c,
4224
4224
  onPopupWindow: g,
4225
4225
  proxyOAuthRequests: !0,
4226
- staticClientInfo: D,
4227
- clientMetadataUrl: E,
4226
+ staticClientInfo: ae,
4227
+ clientMetadataUrl: re,
4228
4228
  scope: ie
4229
4229
  });
4230
- W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
4230
+ W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
4231
4231
  }
4232
4232
  return at(), () => {
4233
4233
  K.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
@@ -4237,25 +4237,25 @@ function pa(e) {
4237
4237
  n,
4238
4238
  i,
4239
4239
  r,
4240
- P.name,
4241
- P.version,
4242
- P.uri,
4243
- P.logo_uri,
4244
- D,
4245
- E,
4240
+ N.name,
4241
+ N.version,
4242
+ N.uri,
4243
+ N.logo_uri,
4244
+ ae,
4245
+ re,
4246
4246
  ie,
4247
4247
  h,
4248
- N,
4249
- L,
4248
+ M,
4249
+ I,
4250
4250
  s,
4251
4251
  a
4252
4252
  ]);
4253
- let lt = (0, j.useRef)(ot), ut = (0, j.useRef)(J);
4254
- (0, j.useEffect)(() => {
4253
+ let lt = (0, A.useRef)(ot), ut = (0, A.useRef)(J);
4254
+ (0, A.useEffect)(() => {
4255
4255
  lt.current = ot, ut.current = J;
4256
- }, [ot, J]), (0, j.useEffect)(() => {
4256
+ }, [ot, J]), (0, A.useEffect)(() => {
4257
4257
  let e = null;
4258
- if (z === "failed" && d && Be.current > 0) {
4258
+ if (R === "failed" && d && Be.current > 0) {
4259
4259
  if (!Ue.current) {
4260
4260
  Ue.current = !0;
4261
4261
  let t = typeof d == "number" ? d : fa;
@@ -4263,25 +4263,25 @@ function pa(e) {
4263
4263
  Ue.current = !1, K.current && q.current === "failed" && lt.current();
4264
4264
  }, t);
4265
4265
  }
4266
- } else z !== "failed" && (Ue.current = !1);
4266
+ } else R !== "failed" && (Ue.current = !1);
4267
4267
  return () => {
4268
4268
  e && (clearTimeout(e), Ue.current = !1);
4269
4269
  };
4270
- }, [z, d]);
4271
- let dt = (0, j.useCallback)(async () => q.current === "ready" ? be?.icon ? be.icon : ze.current ? (J("debug", "Waiting for icon to finish loading..."), await ze.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [be, J]);
4270
+ }, [R, d]);
4271
+ let dt = (0, A.useCallback)(async () => q.current === "ready" ? xe?.icon ? xe.icon : ze.current ? (J("debug", "Waiting for icon to finish loading..."), await ze.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [xe, J]);
4272
4272
  return {
4273
- state: z,
4274
- name: be?.name || t || "",
4275
- tools: fe,
4276
- resources: me,
4277
- resourceTemplates: ge,
4278
- prompts: ve,
4279
- serverInfo: be,
4280
- capabilities: V,
4281
- protocolEra: Ce,
4282
- protocolVersion: Te,
4283
- instructions: De,
4284
- extensions: ke,
4273
+ state: R,
4274
+ name: xe?.name || t || "",
4275
+ tools: pe,
4276
+ resources: he,
4277
+ resourceTemplates: _e,
4278
+ prompts: ye,
4279
+ serverInfo: xe,
4280
+ capabilities: Ce,
4281
+ protocolEra: we,
4282
+ protocolVersion: Ee,
4283
+ instructions: Oe,
4284
+ extensions: Ae,
4285
4285
  error: je,
4286
4286
  log: Ne,
4287
4287
  authUrl: Fe,
@@ -4459,14 +4459,14 @@ function Ea(e) {
4459
4459
  }
4460
4460
  var Da = 500, Oa = 5 * 6e4;
4461
4461
  function ka(e) {
4462
- let [t, n] = (0, j.useState)([]), [r, i] = (0, j.useState)([]), [a, o] = (0, j.useState)([]), s = (0, j.useRef)(0), c = (0, j.useRef)(0), l = (0, j.useRef)(/* @__PURE__ */ new Map()), u = (0, j.useRef)(/* @__PURE__ */ new Map()), d = (0, j.useCallback)((e) => {
4462
+ let [t, n] = (0, A.useState)([]), [r, i] = (0, A.useState)([]), [a, o] = (0, A.useState)([]), s = (0, A.useRef)(0), c = (0, A.useRef)(0), l = (0, A.useRef)(/* @__PURE__ */ new Map()), u = (0, A.useRef)(/* @__PURE__ */ new Map()), d = (0, A.useCallback)((e) => {
4463
4463
  for (let t of l.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
4464
4464
  l.current.clear();
4465
4465
  for (let t of u.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
4466
4466
  u.current.clear(), i([]), o([]);
4467
4467
  }, []);
4468
- (0, j.useEffect)(() => () => d("MCP server connection was removed"), [d]);
4469
- let f = (0, j.useCallback)((t) => {
4468
+ (0, A.useEffect)(() => () => d("MCP server connection was removed"), [d]);
4469
+ let f = (0, A.useCallback)((t) => {
4470
4470
  let r = {
4471
4471
  id: globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`,
4472
4472
  method: t.method,
@@ -4475,13 +4475,13 @@ function ka(e) {
4475
4475
  read: !1
4476
4476
  };
4477
4477
  n((e) => [r, ...e].slice(0, Da)), e.onNotificationReceived?.(r);
4478
- }, [e.onNotificationReceived]), p = (0, j.useCallback)((e, t) => {
4478
+ }, [e.onNotificationReceived]), p = (0, A.useCallback)((e, t) => {
4479
4479
  let n = l.current.get(e);
4480
4480
  n && (clearTimeout(n.timeout), l.current.delete(e), i((t) => t.filter((t) => t.id !== e)), n.resolve(t));
4481
- }, []), m = (0, j.useCallback)((e, t) => {
4481
+ }, []), m = (0, A.useCallback)((e, t) => {
4482
4482
  let n = l.current.get(e);
4483
4483
  n && (clearTimeout(n.timeout), l.current.delete(e), i((t) => t.filter((t) => t.id !== e)), n.reject(Error(t ?? "User rejected sampling request")));
4484
- }, []), h = (0, j.useCallback)((t) => new Promise((n, r) => {
4484
+ }, []), h = (0, A.useCallback)((t) => new Promise((n, r) => {
4485
4485
  let a = `sampling-${s.current++}`, o = {
4486
4486
  id: a,
4487
4487
  request: {
@@ -4500,13 +4500,13 @@ function ka(e) {
4500
4500
  p,
4501
4501
  e,
4502
4502
  m
4503
- ]), g = (0, j.useCallback)((e, t) => {
4503
+ ]), g = (0, A.useCallback)((e, t) => {
4504
4504
  let n = u.current.get(e);
4505
4505
  n && (clearTimeout(n.timeout), u.current.delete(e), o((t) => t.filter((t) => t.id !== e)), n.resolve(t));
4506
- }, []), _ = (0, j.useCallback)((e, t) => {
4506
+ }, []), _ = (0, A.useCallback)((e, t) => {
4507
4507
  let n = u.current.get(e);
4508
4508
  n && (clearTimeout(n.timeout), u.current.delete(e), o((t) => t.filter((t) => t.id !== e)), n.reject(Error(t ?? "User rejected elicitation request")));
4509
- }, []), v = (0, j.useCallback)((t) => new Promise((n, r) => {
4509
+ }, []), v = (0, A.useCallback)((t) => new Promise((n, r) => {
4510
4510
  let i = `elicitation-${c.current++}`, a = {
4511
4511
  id: i,
4512
4512
  request: t,
@@ -4522,15 +4522,15 @@ function ka(e) {
4522
4522
  g,
4523
4523
  e,
4524
4524
  _
4525
- ]), ee = (0, j.useCallback)((e) => {
4525
+ ]), ee = (0, A.useCallback)((e) => {
4526
4526
  n((t) => t.map((t) => t.id === e ? {
4527
4527
  ...t,
4528
4528
  read: !0
4529
4529
  } : t));
4530
- }, []), te = (0, j.useCallback)(() => n((e) => e.map((e) => ({
4530
+ }, []), te = (0, A.useCallback)(() => n((e) => e.map((e) => ({
4531
4531
  ...e,
4532
4532
  read: !0
4533
- }))), []), y = (0, j.useCallback)(() => n([]), []);
4533
+ }))), []), y = (0, A.useCallback)(() => n([]), []);
4534
4534
  return {
4535
4535
  notifications: t,
4536
4536
  pendingSamplingRequests: r,
@@ -4549,7 +4549,7 @@ function ka(e) {
4549
4549
  rejectAll: d
4550
4550
  };
4551
4551
  }
4552
- var Q = pr.get("McpClientProvider"), Aa = (0, j.createContext)(null);
4552
+ var Q = pr.get("McpClientProvider"), Aa = (0, A.createContext)(null);
4553
4553
  function $(e, t) {
4554
4554
  return JSON.stringify(e) === JSON.stringify(t);
4555
4555
  }
@@ -4557,7 +4557,7 @@ function ja(e, t) {
4557
4557
  return e.id === t.id && $(Ta(e), Ta(t)) && e.name === t.name && e.state === t.state && e.error === t.error && e.authUrl === t.authUrl && $(e.authTokens, t.authTokens) && e.protocolEra === t.protocolEra && e.protocolVersion === t.protocolVersion && $(e.serverInfo, t.serverInfo) && $(e.capabilities, t.capabilities) && e.instructions === t.instructions && $(e.extensions, t.extensions) && $(e.tools, t.tools) && $(e.resources, t.resources) && $(e.resourceTemplates, t.resourceTemplates) && $(e.prompts, t.prompts) && $(e.notifications, t.notifications) && e.unreadNotificationCount === t.unreadNotificationCount && $(e.pendingSamplingRequests, t.pendingSamplingRequests) && $(e.pendingElicitationRequests, t.pendingElicitationRequests) && e.client === t.client;
4558
4558
  }
4559
4559
  function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r, defaultProxyConfig: i, defaultAutoProxyFallback: a, clientInfo: o, cachedMetadata: s, onUpdate: c, onUpdateConfig: l, onUpdateDisplayName: u, onReconnect: d, rpcWrapTransport: f, onGlobalSamplingRequest: p, onGlobalElicitationRequest: m }) {
4560
- let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0, j.useMemo)(() => {
4560
+ let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0, A.useMemo)(() => {
4561
4561
  let { displayName: c, onSamplingRequest: l, onElicitationRequest: u, onNotificationReceived: d, wrapTransport: f, ...p } = t;
4562
4562
  return {
4563
4563
  ...p,
@@ -4580,7 +4580,7 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4580
4580
  a,
4581
4581
  o,
4582
4582
  s
4583
- ]), y = (0, j.useMemo)(() => {
4583
+ ]), y = (0, A.useMemo)(() => {
4584
4584
  if (!(!f && !ee)) return (t) => {
4585
4585
  let n = t;
4586
4586
  return f && (n = f(n, e)), ee && (n = ee(n, e)), n;
@@ -4604,10 +4604,10 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4604
4604
  onElicitation: b.onElicitation,
4605
4605
  wrapTransport: y
4606
4606
  });
4607
- (0, j.useEffect)(() => {
4607
+ (0, A.useEffect)(() => {
4608
4608
  x.state !== "ready" && b.rejectAll("MCP server connection is no longer active");
4609
4609
  }, [x.state, b.rejectAll]);
4610
- let S = (0, j.useCallback)((t) => l(e, t), [e, l]), C = (0, j.useCallback)((n) => {
4610
+ let S = (0, A.useCallback)((t) => l(e, t), [e, l]), C = (0, A.useCallback)((n) => {
4611
4611
  let r = t.proxyConfig?.proxyAddress?.trim();
4612
4612
  return t.connectionMode === "proxy" && r ? l(e, {
4613
4613
  proxyConfig: {
@@ -4622,10 +4622,10 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4622
4622
  t.connectionMode,
4623
4623
  t.proxyConfig,
4624
4624
  l
4625
- ]), ne = (0, j.useCallback)((t) => u(e, t), [e, u]), w = (0, j.useCallback)(() => d(e), [e, d]), re = (0, j.useRef)(c), T = (0, j.useRef)(null);
4626
- return (0, j.useEffect)(() => {
4627
- re.current = c;
4628
- }, [c]), (0, j.useEffect)(() => {
4625
+ ]), ne = (0, A.useCallback)((t) => u(e, t), [e, u]), w = (0, A.useCallback)(() => d(e), [e, d]), T = (0, A.useRef)(c), E = (0, A.useRef)(null);
4626
+ return (0, A.useEffect)(() => {
4627
+ T.current = c;
4628
+ }, [c]), (0, A.useEffect)(() => {
4629
4629
  let n = {
4630
4630
  ...Ea(t),
4631
4631
  ...x,
@@ -4646,8 +4646,8 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4646
4646
  setHeaders: C,
4647
4647
  setDisplayName: ne,
4648
4648
  reconnect: w
4649
- }, r = T.current;
4650
- !r || !ja(r, n) ? (T.current = n, re.current(n)) : Q.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`);
4649
+ }, r = E.current;
4650
+ !r || !ja(r, n) ? (E.current = n, T.current(n)) : Q.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`);
4651
4651
  }, [
4652
4652
  e,
4653
4653
  h,
@@ -4675,23 +4675,23 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4675
4675
  ]), null;
4676
4676
  }
4677
4677
  function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r, defaultProxyConfig: i, defaultAutoProxyFallback: a = !1, defaultServerConfig: o, clientInfo: s, storageProvider: c, enableRpcLogging: l = !1, onServerAdded: u, onServerRemoved: d, onServerStateChange: f, onSamplingRequest: p, onElicitationRequest: m }) {
4678
- let [h, g] = (0, j.useState)([]), [_, v] = (0, j.useState)([]), [ee, te] = (0, j.useState)({}), [y, b] = (0, j.useState)(!1), x = (0, j.useRef)(!1), S = (0, j.useRef)([]);
4679
- (0, j.useEffect)(() => {
4678
+ let [h, g] = (0, A.useState)([]), [_, v] = (0, A.useState)([]), [ee, te] = (0, A.useState)({}), [y, b] = (0, A.useState)(!1), x = (0, A.useRef)(!1), S = (0, A.useRef)([]);
4679
+ (0, A.useEffect)(() => {
4680
4680
  S.current = _;
4681
4681
  }, [_]);
4682
- let C = (0, j.useRef)({}), [ne, w] = (0, j.useState)(void 0), [re, T] = (0, j.useState)(!1);
4683
- (0, j.useEffect)(() => {
4682
+ let C = (0, A.useRef)({}), [ne, w] = (0, A.useState)(void 0), [T, E] = (0, A.useState)(!1);
4683
+ (0, A.useEffect)(() => {
4684
4684
  if (!l || typeof window > "u") {
4685
- w(void 0), T(!0);
4685
+ w(void 0), E(!0);
4686
4686
  return;
4687
4687
  }
4688
4688
  Promise.resolve().then(() => (wr(), hr)).then((e) => {
4689
- Q.debug("[McpClientProvider] RPC logger loaded"), w(() => e.wrapTransportForLogging), T(!0);
4689
+ Q.debug("[McpClientProvider] RPC logger loaded"), w(() => e.wrapTransportForLogging), E(!0);
4690
4690
  }).catch((e) => {
4691
- Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), T(!0);
4691
+ Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), E(!0);
4692
4692
  });
4693
- }, [l]), (0, j.useEffect)(() => {
4694
- if (!re) {
4693
+ }, [l]), (0, A.useEffect)(() => {
4694
+ if (!T) {
4695
4695
  Q.debug("[McpClientProvider] Waiting for RPC logging to be ready before loading servers");
4696
4696
  return;
4697
4697
  }
@@ -4733,8 +4733,8 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4733
4733
  }, [
4734
4734
  c,
4735
4735
  t,
4736
- re
4737
- ]), (0, j.useEffect)(() => {
4736
+ T
4737
+ ]), (0, A.useEffect)(() => {
4738
4738
  !c || !y || (async () => {
4739
4739
  try {
4740
4740
  let e = h.reduce((e, t) => (e[t.id] = Ea(t.options), e), {});
@@ -4748,7 +4748,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4748
4748
  c,
4749
4749
  y
4750
4750
  ]);
4751
- let E = (0, j.useCallback)((e) => {
4751
+ let re = (0, A.useCallback)((e) => {
4752
4752
  Q.debug(`[McpClientProvider] handleServerUpdate called for server ${e.id}`, {
4753
4753
  toolCount: e.tools.length,
4754
4754
  state: e.state
@@ -4786,12 +4786,12 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4786
4786
  u,
4787
4787
  f,
4788
4788
  c
4789
- ]), ie = (0, j.useCallback)((e, t) => {
4789
+ ]), ie = (0, A.useCallback)((e, t) => {
4790
4790
  g((n) => n.find((t) => t.id === e) ? n : (Q.debug("[McpClientProvider] Adding new server to configs:", e), [...n, {
4791
4791
  id: e,
4792
4792
  options: t
4793
4793
  }]));
4794
- }, []), D = (0, j.useCallback)(async (e, t) => {
4794
+ }, []), ae = (0, A.useCallback)(async (e, t) => {
4795
4795
  let n = S.current.find((t) => t.id === e);
4796
4796
  if (v((t) => t.filter((t) => t.id !== e)), g((t) => t.filter((t) => t.id !== e)), te((t) => {
4797
4797
  let { [e]: n, ...r } = t;
@@ -4801,7 +4801,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4801
4801
  t(e);
4802
4802
  }
4803
4803
  d?.(e);
4804
- }, [l, d]), O = (0, j.useCallback)(async (e, t) => {
4804
+ }, [l, d]), D = (0, A.useCallback)(async (e, t) => {
4805
4805
  let n = h.find((t) => t.id === e);
4806
4806
  if (!n) {
4807
4807
  Q.warn(`[McpClientProvider] Cannot update server "${e}" - not found`);
@@ -4818,7 +4818,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4818
4818
  ...t,
4819
4819
  [e]: (t[e] ?? 0) + 1
4820
4820
  })));
4821
- }, [h]), k = (0, j.useCallback)(async (e) => {
4821
+ }, [h]), O = (0, A.useCallback)(async (e) => {
4822
4822
  if (!h.find((t) => t.id === e)) {
4823
4823
  Q.warn(`[McpClientProvider] Cannot reconnect server "${e}" - not found`);
4824
4824
  return;
@@ -4827,7 +4827,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4827
4827
  ...t,
4828
4828
  [e]: (t[e] ?? 0) + 1
4829
4829
  }));
4830
- }, [h]), ae = (0, j.useCallback)(async (e, t) => new Promise((n) => {
4830
+ }, [h]), oe = (0, A.useCallback)(async (e, t) => new Promise((n) => {
4831
4831
  let r = h.find((t) => t.id === e);
4832
4832
  if (!r) {
4833
4833
  Q.warn(`[McpClientProvider] Cannot update server metadata for "${e}" - not found`), n();
@@ -4847,33 +4847,33 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4847
4847
  } : t);
4848
4848
  return setTimeout(() => n(), 0), r;
4849
4849
  });
4850
- }), [h]), A = (0, j.useCallback)((e) => _.find((t) => t.id === e), [_]), oe = (0, j.useMemo)(() => ({
4850
+ }), [h]), k = (0, A.useCallback)((e) => _.find((t) => t.id === e), [_]), se = (0, A.useMemo)(() => ({
4851
4851
  servers: _,
4852
4852
  addServer: ie,
4853
- removeServer: D,
4854
- updateServerMetadata: ae,
4855
- updateServer: O,
4856
- getServer: A,
4853
+ removeServer: ae,
4854
+ updateServerMetadata: oe,
4855
+ updateServer: D,
4856
+ getServer: k,
4857
4857
  storageLoaded: y
4858
4858
  }), [
4859
4859
  _,
4860
4860
  ie,
4861
- D,
4862
4861
  ae,
4863
- O,
4864
- A,
4862
+ oe,
4863
+ D,
4864
+ k,
4865
4865
  y
4866
- ]), { capabilities: M, ...N } = s || {}, P = (0, j.useMemo)(() => Object.keys(N).length ? N : void 0, [s]), se = (0, j.useMemo)(() => h.map((e) => {
4866
+ ]), { capabilities: j, ...M } = s || {}, N = (0, A.useMemo)(() => Object.keys(M).length ? M : void 0, [s]), ce = (0, A.useMemo)(() => h.map((e) => {
4867
4867
  let t = o ? {
4868
4868
  ...o,
4869
4869
  ...e.options
4870
4870
  } : e.options;
4871
- return M && (t = {
4871
+ return j && (t = {
4872
4872
  ...t,
4873
4873
  clientOptions: {
4874
4874
  ...t.clientOptions,
4875
4875
  capabilities: {
4876
- ...M,
4876
+ ...j,
4877
4877
  ...t.clientOptions?.capabilities
4878
4878
  }
4879
4879
  }
@@ -4883,10 +4883,10 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4883
4883
  };
4884
4884
  }), [
4885
4885
  h,
4886
- M,
4886
+ j,
4887
4887
  o
4888
- ]), F = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
- return /* @__PURE__ */ j.createElement(Aa.Provider, { value: oe }, e, !F && se.map((e) => /* @__PURE__ */ j.createElement(Ma, {
4888
+ ]), P = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
+ return /* @__PURE__ */ A.createElement(Aa.Provider, { value: se }, e, !P && ce.map((e) => /* @__PURE__ */ A.createElement(Ma, {
4890
4890
  key: `${e.id}-v${ee[e.id] ?? 0}`,
4891
4891
  id: e.id,
4892
4892
  options: e.options,
@@ -4894,19 +4894,19 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4894
4894
  defaultOAuthProxyUrl: r,
4895
4895
  defaultProxyConfig: i,
4896
4896
  defaultAutoProxyFallback: a,
4897
- clientInfo: P,
4897
+ clientInfo: N,
4898
4898
  cachedMetadata: C.current[e.id],
4899
- onUpdate: E,
4900
- onUpdateConfig: O,
4901
- onUpdateDisplayName: (e, t) => ae(e, { name: t }),
4902
- onReconnect: k,
4899
+ onUpdate: re,
4900
+ onUpdateConfig: D,
4901
+ onUpdateDisplayName: (e, t) => oe(e, { name: t }),
4902
+ onReconnect: O,
4903
4903
  rpcWrapTransport: ne,
4904
4904
  onGlobalSamplingRequest: p,
4905
4905
  onGlobalElicitationRequest: m
4906
4906
  })));
4907
4907
  }
4908
4908
  function Pa() {
4909
- let e = (0, j.useContext)(Aa);
4909
+ let e = (0, A.useContext)(Aa);
4910
4910
  if (!e) throw Error("useMcpClient must be used within a McpClientProvider");
4911
4911
  return e;
4912
4912
  }
@@ -5036,7 +5036,7 @@ var Wa = "fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-co
5036
5036
  "flex flex-col"
5037
5037
  ].join(" "), Ka = "data-mcp-widget-fullscreen", qa = "data-mcp-widget-display-mode";
5038
5038
  function Ja(e) {
5039
- (0, j.useEffect)(() => {
5039
+ (0, A.useEffect)(() => {
5040
5040
  if (!(typeof document > "u")) {
5041
5041
  if (e === "pip" || e === "fullscreen") return document.documentElement.setAttribute(qa, e), e === "fullscreen" ? document.documentElement.setAttribute(Ka, "") : document.documentElement.removeAttribute(Ka), () => {
5042
5042
  document.documentElement.removeAttribute(qa), document.documentElement.removeAttribute(Ka);
@@ -5048,7 +5048,7 @@ function Ja(e) {
5048
5048
  function Ya({ displayMode: e, setDisplayMode: t }) {
5049
5049
  let n = e === "fullscreen", r = e === "pip";
5050
5050
  return Ja(e), {
5051
- handleDisplayModeChange: (0, j.useCallback)((e) => t(e), [t]),
5051
+ handleDisplayModeChange: (0, A.useCallback)((e) => t(e), [t]),
5052
5052
  fullscreenShellClassName: n ? Wa : void 0,
5053
5053
  pipShellClassName: r ? Ga : void 0,
5054
5054
  isFullscreen: n,
@@ -5103,62 +5103,64 @@ function oo(e, t) {
5103
5103
  structuredContent: n
5104
5104
  } : e ?? null;
5105
5105
  }
5106
- function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, className: re, testId: T = "mcp-app-frame", invoking: E, invoked: ie }) {
5107
- let D = (0, j.useRef)(null), O = (0, j.useRef)(null), k = (0, j.useRef)(null), ae = (0, j.useRef)(t.kind === "live" ? t.connection : null), [A, oe] = (0, j.useState)(null), [M, N] = (0, j.useState)(null), [P, se] = (0, j.useState)(null), [F, ce] = (0, j.useState)(0), [le, ue] = (0, j.useState)(!0), [I, de] = (0, j.useState)(Xa.DEFAULT_HEIGHT), [L, R] = (0, j.useState)("inline"), z = p ?? L, B = (0, j.useRef)(u);
5108
- B.current = u;
5109
- let fe = (0, j.useRef)(_);
5110
- fe.current = _;
5111
- let pe = (0, j.useRef)(i);
5112
- pe.current = i;
5113
- let me = (0, j.useRef)(a);
5114
- me.current = a;
5115
- let he = (0, j.useRef)(s);
5116
- he.current = s;
5117
- let ge = (0, j.useRef)(S);
5118
- ge.current = S;
5119
- let _e = (0, j.useRef)(v);
5120
- _e.current = v;
5121
- let ve = (0, j.useRef)(ee);
5122
- ve.current = ee;
5123
- let ye = (0, j.useRef)(b);
5124
- ye.current = b;
5125
- let be = (0, j.useRef)(x);
5126
- be.current = x;
5127
- let xe = (0, j.useRef)(te);
5128
- xe.current = te;
5129
- let V = (0, j.useRef)(y);
5130
- V.current = y;
5131
- let Se = (0, j.useRef)(n);
5132
- Se.current = n;
5133
- let Ce = (0, j.useRef)(f);
5134
- Ce.current = f;
5135
- let we = (0, j.useRef)(w);
5136
- we.current = w;
5137
- let Te = (0, j.useCallback)((e) => {
5138
- let t = Se.current;
5106
+ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, className: T, testId: E = "mcp-app-frame", invoking: re, invoked: ie }) {
5107
+ let ae = (0, A.useRef)(null), D = (0, A.useRef)(null), O = (0, A.useRef)(null), oe = (0, A.useRef)(t.kind === "live" ? t.connection : null), [k, se] = (0, A.useState)(null), [j, M] = (0, A.useState)(null), [N, ce] = (0, A.useState)(null), [P, le] = (0, A.useState)(0), [ue, de] = (0, A.useState)(!0), [F, fe] = (0, A.useState)(Xa.DEFAULT_HEIGHT), [I, L] = (0, A.useState)("inline"), R = p ?? I, z = (0, A.useRef)(u);
5108
+ z.current = u;
5109
+ let pe = (0, A.useRef)(_);
5110
+ pe.current = _;
5111
+ let me = (0, A.useRef)(i);
5112
+ me.current = i;
5113
+ let he = (0, A.useRef)(o);
5114
+ he.current = o;
5115
+ let ge = (0, A.useRef)(a);
5116
+ ge.current = a;
5117
+ let _e = (0, A.useRef)(s);
5118
+ _e.current = s;
5119
+ let ve = (0, A.useRef)(S);
5120
+ ve.current = S;
5121
+ let ye = (0, A.useRef)(v);
5122
+ ye.current = v;
5123
+ let be = (0, A.useRef)(ee);
5124
+ be.current = ee;
5125
+ let xe = (0, A.useRef)(b);
5126
+ xe.current = b;
5127
+ let Se = (0, A.useRef)(x);
5128
+ Se.current = x;
5129
+ let Ce = (0, A.useRef)(te);
5130
+ Ce.current = te;
5131
+ let B = (0, A.useRef)(y);
5132
+ B.current = y;
5133
+ let we = (0, A.useRef)(n);
5134
+ we.current = n;
5135
+ let Te = (0, A.useRef)(f);
5136
+ Te.current = f;
5137
+ let Ee = (0, A.useRef)(w);
5138
+ Ee.current = w;
5139
+ let De = (0, A.useCallback)((e) => {
5140
+ let t = we.current;
5139
5141
  return t ? typeof t == "function" ? t(e) : t : Va({
5140
- cspMode: Ce.current,
5142
+ cspMode: Te.current,
5141
5143
  permissions: e.permissions,
5142
5144
  widgetCsp: e.declaredCsp
5143
5145
  });
5144
- }, []), { handleDisplayModeChange: Ee, fullscreenShellClassName: De, pipShellClassName: Oe, isFullscreen: ke, isPip: Ae } = Ya({
5145
- containerRef: k,
5146
- displayMode: z,
5147
- setDisplayMode: (0, j.useCallback)((e) => {
5148
- m ? m(e) : R(e);
5146
+ }, []), { handleDisplayModeChange: Oe, fullscreenShellClassName: ke, pipShellClassName: Ae, isFullscreen: V, isPip: je } = Ya({
5147
+ containerRef: O,
5148
+ displayMode: R,
5149
+ setDisplayMode: (0, A.useCallback)((e) => {
5150
+ m ? m(e) : L(e);
5149
5151
  }, [m])
5150
- }), je = (0, j.useRef)(Ee);
5151
- je.current = Ee;
5152
- let Me = (0, j.useRef)(z);
5153
- Me.current = z;
5154
- let Ne = t.kind === "live" ? t.resourceUri : void 0, Pe = t.kind === "preloaded" ? t.html : void 0;
5155
- t.kind === "live" && (ae.current = t.connection), (0, j.useEffect)(() => {
5152
+ }), Me = (0, A.useRef)(Oe);
5153
+ Me.current = Oe;
5154
+ let Ne = (0, A.useRef)(R);
5155
+ Ne.current = R;
5156
+ let Pe = t.kind === "live" ? t.resourceUri : void 0, Fe = t.kind === "preloaded" ? t.html : void 0;
5157
+ t.kind === "live" && (oe.current = t.connection), (0, A.useEffect)(() => {
5156
5158
  let e = !1;
5157
- V.current?.({ status: "resolving" });
5159
+ B.current?.({ status: "resolving" });
5158
5160
  let n = (e) => {
5159
- oe(e), V.current?.({ status: "sandbox-loading" });
5160
- let t = Te(e);
5161
- N((e) => e?.href === t.href ? e : t), ge.current?.(e);
5161
+ se(e), B.current?.({ status: "sandbox-loading" });
5162
+ let t = De(e);
5163
+ M((e) => e?.href === t.href ? e : t), ve.current?.(e);
5162
5164
  };
5163
5165
  if (t.kind === "preloaded") {
5164
5166
  n({
@@ -5174,7 +5176,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5174
5176
  return;
5175
5177
  }
5176
5178
  let { connection: r, resourceUri: i } = t;
5177
- return ae.current = r, (async () => {
5179
+ return oe.current = r, (async () => {
5178
5180
  try {
5179
5181
  let t = await r.readResource(i);
5180
5182
  if (e) return;
@@ -5186,7 +5188,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5186
5188
  });
5187
5189
  if (!o.mimeTypeValid) {
5188
5190
  let e = o.mimeTypeWarning || "Invalid MIME type - SEP-1865 requires \"text/html;profile=mcp-app\"";
5189
- se(e), V.current?.({
5191
+ ce(e), B.current?.({
5190
5192
  status: "error",
5191
5193
  error: e
5192
5194
  });
@@ -5195,7 +5197,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5195
5197
  n(o);
5196
5198
  } catch (t) {
5197
5199
  if (e) return;
5198
- se(t instanceof Error ? t.message : "Failed to prepare view"), V.current?.({
5200
+ ce(t instanceof Error ? t.message : "Failed to prepare view"), B.current?.({
5199
5201
  status: "error",
5200
5202
  error: t instanceof Error ? t.message : "Failed to prepare view"
5201
5203
  });
@@ -5205,30 +5207,30 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5205
5207
  };
5206
5208
  }, [
5207
5209
  t.kind,
5208
- Ne,
5209
5210
  Pe,
5211
+ Fe,
5210
5212
  f,
5211
- Te
5212
- ]), (0, j.useEffect)(() => {
5213
- let e = M;
5213
+ De
5214
+ ]), (0, A.useEffect)(() => {
5215
+ let e = j;
5214
5216
  return () => {
5215
5217
  e?.protocol === "blob:" && URL.revokeObjectURL(e.href);
5216
5218
  };
5217
- }, [M]);
5218
- let Fe = M?.protocol === "blob:", H = !M || Fe ? null : (() => {
5219
+ }, [j]);
5220
+ let H = j?.protocol === "blob:", Ie = !j || H ? null : (() => {
5219
5221
  try {
5220
- return M.origin;
5222
+ return j.origin;
5221
5223
  } catch {
5222
5224
  return null;
5223
5225
  }
5224
5226
  })();
5225
- (0, j.useEffect)(() => {
5226
- if (!H && !Fe) return;
5227
+ (0, A.useEffect)(() => {
5228
+ if (!Ie && !H) return;
5227
5229
  let e = (e) => {
5228
- let t = D.current;
5229
- if (t?.contentWindow && e.source === t.contentWindow && !(!Fe && e.origin !== H && H !== "*")) {
5230
+ let t = ae.current;
5231
+ if (t?.contentWindow && e.source === t.contentWindow && !(!H && e.origin !== Ie && Ie !== "*")) {
5230
5232
  if (e.data?.type === "mcp-apps:csp-violation") {
5231
- be.current?.({
5233
+ Se.current?.({
5232
5234
  directive: e.data.directive,
5233
5235
  effectiveDirective: e.data.effectiveDirective,
5234
5236
  blockedUri: e.data.blockedUri,
@@ -5240,33 +5242,33 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5240
5242
  });
5241
5243
  return;
5242
5244
  }
5243
- e.data?.type === "iframe-console-log" && ve.current && ve.current({
5245
+ e.data?.type === "iframe-console-log" && be.current && be.current({
5244
5246
  level: e.data.level ?? "log",
5245
5247
  data: e.data.args
5246
5248
  });
5247
5249
  }
5248
5250
  };
5249
5251
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
5250
- }, [H, Fe]), (0, j.useEffect)(() => {
5251
- if (!A || !M) return;
5252
- let t = D.current;
5252
+ }, [Ie, H]), (0, A.useEffect)(() => {
5253
+ if (!k || !j) return;
5254
+ let t = ae.current;
5253
5255
  if (!t) return;
5254
5256
  let n = !1, r = null;
5255
5257
  return (async () => {
5256
5258
  try {
5257
- V.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5258
- let i = tr(A.permissions);
5259
+ B.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5260
+ let i = tr(k.permissions);
5259
5261
  i && t.setAttribute("allow", i);
5260
5262
  let a = io(t);
5261
- if (t.src = M.href, await a, n) return;
5263
+ if (t.src = j.href, await a, n) return;
5262
5264
  r = new rr(null, l, {
5263
5265
  ...d ?? ro,
5264
5266
  sandbox: {
5265
- csp: f === "permissive" ? void 0 : A.csp,
5266
- permissions: A.permissions
5267
+ csp: f === "permissive" ? void 0 : k.csp,
5268
+ permissions: k.permissions
5267
5269
  }
5268
- }, { hostContext: B.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && fe.current && fe.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5269
- let n = ae.current;
5270
+ }, { hostContext: z.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && pe.current && pe.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5271
+ let n = oe.current;
5270
5272
  if (!n) throw Error("Server connection not available");
5271
5273
  try {
5272
5274
  return await n.callTool(e, t || {}, {
@@ -5277,47 +5279,51 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5277
5279
  throw r?.sendToolCancelled({ reason: e instanceof Error ? e.message : String(e) }), e;
5278
5280
  }
5279
5281
  }), r.onreadresource = (async ({ uri: e }) => {
5280
- let t = ae.current;
5282
+ let t = oe.current;
5281
5283
  if (!t) throw Error("Server connection not available");
5282
5284
  return await t.readResource(e);
5283
5285
  }), r.onlistresources = (async () => {
5284
- let e = ae.current;
5286
+ let e = oe.current;
5285
5287
  if (!e) throw Error("Server connection not available");
5286
5288
  return { resources: [...e.resources ?? []] };
5287
5289
  }), r.onrequestdisplaymode = async ({ mode: e }) => {
5288
- let t = e ?? "inline", n = (B.current?.availableDisplayModes ?? [
5290
+ let t = e ?? "inline", n = (z.current?.availableDisplayModes ?? [
5289
5291
  "inline",
5290
5292
  "pip",
5291
5293
  "fullscreen"
5292
- ]).includes(t) ? t : Me.current;
5293
- return await je.current(n), { mode: n };
5294
- }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (_e.current?.({
5294
+ ]).includes(t) ? t : Ne.current;
5295
+ return await Me.current(n), { mode: n };
5296
+ }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (ye.current?.({
5295
5297
  content: e,
5296
5298
  structuredContent: t
5297
- }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (ve.current?.({
5299
+ }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (be.current?.({
5298
5300
  level: e,
5299
5301
  data: t
5300
5302
  }), {}), r.onsizechange = async ({ height: e }) => {
5301
- Me.current === "inline" && e !== void 0 && de(e);
5303
+ Ne.current === "inline" && e !== void 0 && fe(e);
5302
5304
  };
5303
5305
  let o = ao(r), s = new $n(t.contentWindow, t.contentWindow);
5304
5306
  if (C && (s = C(s, e)), await r.connect(s), n || (await r.sendSandboxResourceReady({
5305
- html: we.current ? Ra(A.html) : A.html,
5306
- csp: A.csp,
5307
- permissions: A.permissions
5307
+ html: Ee.current ? Ra(k.html) : k.html,
5308
+ csp: k.csp,
5309
+ permissions: k.permissions
5308
5310
  }), await o, n)) return;
5309
- O.current = r, ce((e) => e + 1), V.current?.({ status: "initialized" });
5310
- let c = {
5311
- ...pe.current,
5312
- ...Ia(he.current)
5313
- };
5314
- r.sendToolInput({ arguments: c });
5315
- let u = oo(me.current, he.current);
5316
- u && r.sendToolResult(u), V.current?.({ status: "ready" });
5311
+ D.current = r, le((e) => e + 1), B.current?.({ status: "initialized" });
5312
+ let c = he.current;
5313
+ if (c) r.sendToolInputPartial({ arguments: c });
5314
+ else {
5315
+ let e = {
5316
+ ...me.current,
5317
+ ...Ia(_e.current)
5318
+ };
5319
+ r.sendToolInput({ arguments: e });
5320
+ }
5321
+ let u = oo(ge.current, _e.current);
5322
+ u && r.sendToolResult(u), B.current?.({ status: "ready" });
5317
5323
  } catch (e) {
5318
5324
  if (!n) {
5319
5325
  let t = e instanceof Error ? e.message : "Failed to connect view";
5320
- se(t), ye.current?.(t), V.current?.({
5326
+ ce(t), xe.current?.(t), B.current?.({
5321
5327
  status: "error",
5322
5328
  error: t
5323
5329
  });
@@ -5326,17 +5332,17 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5326
5332
  })(), () => {
5327
5333
  n = !0;
5328
5334
  let e = r;
5329
- O.current = null, e && (V.current?.({ status: "tearing-down" }), (async () => {
5335
+ D.current = null, e && (B.current?.({ status: "tearing-down" }), (async () => {
5330
5336
  try {
5331
5337
  await Promise.race([e.teardownResource({}), new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("teardown timeout")), 2e3))]);
5332
5338
  } catch {} finally {
5333
- e.close().catch(() => {}), V.current?.({ status: "closed" });
5339
+ e.close().catch(() => {}), B.current?.({ status: "closed" });
5334
5340
  }
5335
5341
  })());
5336
5342
  };
5337
5343
  }, [
5338
- A,
5339
- M,
5344
+ k,
5345
+ j,
5340
5346
  l,
5341
5347
  d,
5342
5348
  f,
@@ -5344,82 +5350,83 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5344
5350
  C,
5345
5351
  ne,
5346
5352
  w
5347
- ]), (0, j.useEffect)(() => {
5348
- let e = O.current;
5349
- !e || F === 0 || !u || e.setHostContext(u);
5350
- }, [u, F]), (0, j.useEffect)(() => {
5351
- let e = O.current;
5352
- !e || F === 0 || !o || e.sendToolInputPartial({ arguments: o });
5353
- }, [F, o]), (0, j.useEffect)(() => {
5354
- let e = O.current;
5355
- if (!e || F === 0) return;
5353
+ ]), (0, A.useEffect)(() => {
5354
+ let e = D.current;
5355
+ !e || P === 0 || !u || e.setHostContext(u);
5356
+ }, [u, P]), (0, A.useEffect)(() => {
5357
+ let e = D.current;
5358
+ !e || P === 0 || !o || e.sendToolInputPartial({ arguments: o });
5359
+ }, [P, o]), (0, A.useEffect)(() => {
5360
+ let e = D.current;
5361
+ if (!e || P === 0 || o) return;
5356
5362
  let t = {
5357
5363
  ...i,
5358
5364
  ...Ia(s)
5359
5365
  };
5360
5366
  e.sendToolInput({ arguments: t });
5361
5367
  }, [
5362
- F,
5368
+ P,
5363
5369
  i,
5370
+ o,
5364
5371
  s
5365
- ]), (0, j.useEffect)(() => {
5366
- let e = O.current;
5367
- if (!e || F === 0) return;
5372
+ ]), (0, A.useEffect)(() => {
5373
+ let e = D.current;
5374
+ if (!e || P === 0) return;
5368
5375
  let t = oo(a, s);
5369
5376
  t && e.sendToolResult(t);
5370
5377
  }, [
5371
- F,
5378
+ P,
5372
5379
  a,
5373
5380
  s
5374
- ]), (0, j.useEffect)(() => {
5375
- let e = O.current;
5376
- !e || F === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
5377
- }, [c, F]);
5378
- let Ie = (0, j.useRef)(!1);
5379
- if ((0, j.useEffect)(() => {
5380
- Ie.current || F === 0 || (Ie.current = !0, xe.current?.());
5381
- }, [F]), (0, j.useEffect)(() => {
5382
- if (F === 0 || !le) return;
5383
- let e = setTimeout(() => ue(!1), 300);
5381
+ ]), (0, A.useEffect)(() => {
5382
+ let e = D.current;
5383
+ !e || P === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
5384
+ }, [c, P]);
5385
+ let Le = (0, A.useRef)(!1);
5386
+ if ((0, A.useEffect)(() => {
5387
+ Le.current || P === 0 || (Le.current = !0, Ce.current?.());
5388
+ }, [P]), (0, A.useEffect)(() => {
5389
+ if (P === 0 || !ue) return;
5390
+ let e = setTimeout(() => de(!1), 300);
5384
5391
  return () => clearTimeout(e);
5385
- }, [F, le]), P) return /* @__PURE__ */ j.createElement("div", { className: re }, /* @__PURE__ */ j.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ j.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", P)));
5386
- if (!A) return /* @__PURE__ */ j.createElement("div", { className: re }, /* @__PURE__ */ j.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ j.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5387
- let Le = De ?? Oe ?? "flex group flex-1 items-center justify-center", U = {
5388
- height: ke || Ae ? "100%" : `${I}px`,
5392
+ }, [P, ue]), N) return /* @__PURE__ */ A.createElement("div", { className: T }, /* @__PURE__ */ A.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ A.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", N)));
5393
+ if (!k) return /* @__PURE__ */ A.createElement("div", { className: T }, /* @__PURE__ */ A.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5394
+ let U = ke ?? Ae ?? "flex group flex-1 items-center justify-center", Re = {
5395
+ height: V || je ? "100%" : `${F}px`,
5389
5396
  width: "100%",
5390
- maxWidth: z === "inline" ? `${h}px` : "100%",
5391
- transition: ke || Ae ? void 0 : "height 300ms ease-out"
5392
- }, Re = /* @__PURE__ */ j.createElement("div", {
5393
- ref: k,
5394
- className: Le,
5395
- style: Ae ? {
5397
+ maxWidth: R === "inline" ? `${h}px` : "100%",
5398
+ transition: V || je ? void 0 : "height 300ms ease-out"
5399
+ }, W = /* @__PURE__ */ A.createElement("div", {
5400
+ ref: O,
5401
+ className: U,
5402
+ style: je ? {
5396
5403
  height: Xa.DEFAULT_HEIGHT,
5397
5404
  maxWidth: Xa.PIP_MAX_WIDTH,
5398
5405
  zIndex: 100
5399
- } : ke ? { zIndex: 100 } : void 0
5400
- }, (ke || Ae) && /* @__PURE__ */ j.createElement("button", {
5406
+ } : V ? { zIndex: 100 } : void 0
5407
+ }, (V || je) && /* @__PURE__ */ A.createElement("button", {
5401
5408
  type: "button",
5402
- "data-testid": ke ? "debugger-exit-fullscreen-button" : "debugger-exit-pip-button",
5403
- "aria-label": ke ? "Exit fullscreen" : "Exit picture-in-picture",
5409
+ "data-testid": V ? "debugger-exit-fullscreen-button" : "debugger-exit-pip-button",
5410
+ "aria-label": V ? "Exit fullscreen" : "Exit picture-in-picture",
5404
5411
  className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
5405
5412
  style: { zIndex: 110 },
5406
- onClick: () => void Ee("inline")
5407
- }, "×"), /* @__PURE__ */ j.createElement("div", { className: ke || Ae ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, le && /* @__PURE__ */ j.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ j.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !Ae && !ke && (E || ie) && /* @__PURE__ */ j.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, E && !a ? E : ie), /* @__PURE__ */ j.createElement("div", {
5408
- "data-testid": T,
5413
+ onClick: () => void Oe("inline")
5414
+ }, "×"), /* @__PURE__ */ A.createElement("div", { className: V || je ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, ue && /* @__PURE__ */ A.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !je && !V && (re || ie) && /* @__PURE__ */ A.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, re && !a ? re : ie), /* @__PURE__ */ A.createElement("div", {
5415
+ "data-testid": E,
5409
5416
  "data-mcp-app-tool": r,
5410
- className: z === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5411
- style: U
5412
- }, /* @__PURE__ */ j.createElement("iframe", {
5413
- ref: D,
5417
+ className: R === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5418
+ style: Re
5419
+ }, /* @__PURE__ */ A.createElement("iframe", {
5420
+ ref: ae,
5414
5421
  title: `MCP App: ${r}`,
5415
5422
  className: "w-full h-full border-0 bg-transparent",
5416
- style: { border: A.prefersBorder && z !== "fullscreen" ? void 0 : "none" }
5423
+ style: { border: k.prefersBorder && R !== "fullscreen" ? void 0 : "none" }
5417
5424
  }))));
5418
- return /* @__PURE__ */ j.createElement("div", { className: re }, Re);
5425
+ return /* @__PURE__ */ A.createElement("div", { className: T }, W);
5419
5426
  }
5420
5427
  function co(e, t) {
5421
5428
  return !(e.viewId !== t.viewId || e.source !== t.source || e.sandboxUrl !== t.sandboxUrl || e.displayMode !== t.displayMode || e.cancelled !== t.cancelled || e.toolInput !== t.toolInput || e.toolOutput !== t.toolOutput || e.partialToolInput !== t.partialToolInput || e.customProps !== t.customProps || e.hostContext !== t.hostContext || e.hostCapabilities !== t.hostCapabilities || e.cspMode !== t.cspMode || e.mockOpenAiFileApis !== t.mockOpenAiFileApis || e.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
5422
5429
  }
5423
- var lo = (0, j.memo)(so, co);
5430
+ var lo = (0, A.memo)(so, co);
5424
5431
  //#endregion
5425
5432
  export { _r as a, Qa as c, Pa as d, yr as i, Sa as l, Na as n, Za as o, lo as r, $a as s, Fa as t, vr as u };