@lovable.dev/mcp-js 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +386 -0
  3. package/dist/authorize-DpTEIFvs.d.ts +9 -0
  4. package/dist/chunk-6DXGZZA4.js +6 -0
  5. package/dist/chunk-DDF63QWG.js +80 -0
  6. package/dist/chunk-GLG5RZGE.js +66 -0
  7. package/dist/chunk-MA5H6PSF.js +46 -0
  8. package/dist/chunk-QA3FWDUV.js +40 -0
  9. package/dist/chunk-VD6CS7Y6.js +144 -0
  10. package/dist/chunk-XEDRJFAR.js +371 -0
  11. package/dist/index.cjs +271 -0
  12. package/dist/index.d.cts +56 -0
  13. package/dist/index.d.ts +56 -0
  14. package/dist/index.js +172 -0
  15. package/dist/protocols/mcp/index.cjs +505 -0
  16. package/dist/protocols/mcp/index.d.cts +14 -0
  17. package/dist/protocols/mcp/index.d.ts +14 -0
  18. package/dist/protocols/mcp/index.js +10 -0
  19. package/dist/protocols/oauth-metadata.cjs +390 -0
  20. package/dist/protocols/oauth-metadata.d.cts +8 -0
  21. package/dist/protocols/oauth-metadata.d.ts +8 -0
  22. package/dist/protocols/oauth-metadata.js +9 -0
  23. package/dist/protocols/rest/index.cjs +599 -0
  24. package/dist/protocols/rest/index.d.cts +11 -0
  25. package/dist/protocols/rest/index.d.ts +11 -0
  26. package/dist/protocols/rest/index.js +12 -0
  27. package/dist/stacks/tanstack/index.cjs +743 -0
  28. package/dist/stacks/tanstack/index.d.cts +38 -0
  29. package/dist/stacks/tanstack/index.d.ts +38 -0
  30. package/dist/stacks/tanstack/index.js +38 -0
  31. package/dist/stacks/tanstack/vite.cjs +291 -0
  32. package/dist/stacks/tanstack/vite.d.cts +64 -0
  33. package/dist/stacks/tanstack/vite.d.ts +64 -0
  34. package/dist/stacks/tanstack/vite.js +263 -0
  35. package/dist/types-zMlr1mOK.d.ts +270 -0
  36. package/package.json +101 -0
@@ -0,0 +1,505 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/protocols/mcp/index.ts
21
+ var mcp_exports = {};
22
+ __export(mcp_exports, {
23
+ createMcpProtocolHandler: () => createMcpProtocolHandler
24
+ });
25
+ module.exports = __toCommonJS(mcp_exports);
26
+
27
+ // src/protocols/mcp/protocol.ts
28
+ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
29
+ var import_webStandardStreamableHttp = require("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js");
30
+
31
+ // src/core/http.ts
32
+ var JSON_HEADERS = { "Content-Type": "application/json" };
33
+
34
+ // src/core/promise.ts
35
+ function cachedPromise(load) {
36
+ let settled = false;
37
+ let value;
38
+ return async () => {
39
+ if (settled)
40
+ return value;
41
+ const loaded = await load();
42
+ settled = true;
43
+ value = loaded;
44
+ return loaded;
45
+ };
46
+ }
47
+
48
+ // src/core/url.ts
49
+ function trimTrailingSlash(value) {
50
+ return value.replace(/\/+$/, "");
51
+ }
52
+ function isLocalHTTPHost(hostname) {
53
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
54
+ }
55
+ function urlSafetyProblem(url) {
56
+ const isAllowedHTTP = url.protocol === "http:" && isLocalHTTPHost(url.hostname);
57
+ if (url.protocol !== "https:" && !isAllowedHTTP) {
58
+ return "must use https://, except localhost development URLs";
59
+ }
60
+ if (url.username || url.password) {
61
+ return "must not include credentials";
62
+ }
63
+ if (url.search || url.hash) {
64
+ return "must not include query or fragment";
65
+ }
66
+ return void 0;
67
+ }
68
+
69
+ // src/core/validation.ts
70
+ function parseSafeUrl(subject, raw, ErrorClass = Error) {
71
+ let url;
72
+ try {
73
+ url = new URL(raw);
74
+ } catch {
75
+ throw new ErrorClass(`${subject} must be an absolute URL`);
76
+ }
77
+ const problem = urlSafetyProblem(url);
78
+ if (problem) {
79
+ throw new ErrorClass(`${subject} ${problem}`);
80
+ }
81
+ return url;
82
+ }
83
+
84
+ // src/auth/discovery.ts
85
+ var OAuthConfigurationError = class extends Error {
86
+ constructor(message) {
87
+ super(message);
88
+ this.name = "OAuthConfigurationError";
89
+ }
90
+ };
91
+ var METADATA_FETCH_TIMEOUT_MS = 5e3;
92
+ function issuerPath(url) {
93
+ const path = trimTrailingSlash(url.pathname);
94
+ return path === "" ? void 0 : path;
95
+ }
96
+ function pathInsertedOAuthMetadataUrls(url, path) {
97
+ return [
98
+ `${url.origin}/.well-known/oauth-authorization-server${path}`,
99
+ `${url.origin}/.well-known/openid-configuration${path}`
100
+ ];
101
+ }
102
+ function oauthMetadataUrlsForIssuer(issuer) {
103
+ const normalizedIssuer = trimTrailingSlash(issuer);
104
+ const url = new URL(normalizedIssuer);
105
+ const path = issuerPath(url);
106
+ if (!path) {
107
+ return [
108
+ `${normalizedIssuer}/.well-known/oauth-authorization-server`,
109
+ `${normalizedIssuer}/.well-known/openid-configuration`
110
+ ];
111
+ }
112
+ return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
113
+ }
114
+ async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
115
+ const errors = [];
116
+ for (const url of metadataUrls) {
117
+ try {
118
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
119
+ } catch (err) {
120
+ errors.push(`${url}: ${err instanceof Error ? err.message : String(err)}`);
121
+ }
122
+ }
123
+ throw new Error(`failed to discover OAuth server metadata (${errors.join("; ")})`);
124
+ }
125
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
126
+ const response = await fetch(url, { signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS), redirect: "error" });
127
+ if (!response.ok) {
128
+ throw new Error(String(response.status));
129
+ }
130
+ const json = await response.json();
131
+ if (typeof json.issuer !== "string") {
132
+ throw new Error("missing issuer");
133
+ }
134
+ parseSafeUrl("discovered issuer", json.issuer);
135
+ if (trimTrailingSlash(json.issuer) !== expectedIssuer) {
136
+ throw new Error("issuer mismatch");
137
+ }
138
+ if (typeof json.jwks_uri !== "string") {
139
+ throw new Error("missing jwks_uri");
140
+ }
141
+ parseSafeUrl("discovered jwks_uri", json.jwks_uri);
142
+ return { issuer: json.issuer, jwks_uri: json.jwks_uri };
143
+ }
144
+ async function fetchIssuerOAuthServerMetadata(issuer) {
145
+ try {
146
+ return await fetchFirstValidOAuthServerMetadata(oauthMetadataUrlsForIssuer(issuer), issuer);
147
+ } catch (err) {
148
+ throw new OAuthConfigurationError(
149
+ `OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`
150
+ );
151
+ }
152
+ }
153
+ function createOAuthDiscoveryResolver(auth) {
154
+ const configuredIssuer = trimTrailingSlash(auth.issuer);
155
+ const oauthServerMetadata = cachedPromise(() => fetchIssuerOAuthServerMetadata(configuredIssuer));
156
+ return {
157
+ resolveIssuer: async () => configuredIssuer,
158
+ resolveJwksUri: async () => auth.jwksUri ?? (await oauthServerMetadata()).jwks_uri
159
+ };
160
+ }
161
+
162
+ // src/auth/metadata-path.ts
163
+ var OAUTH_PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
164
+
165
+ // src/auth/resource.ts
166
+ function resolveProtectedResource(auth, request, options) {
167
+ if (auth.resource)
168
+ return trimTrailingSlash(auth.resource);
169
+ const path = resolveResourcePath(options.resourcePath, request);
170
+ const resourceURL = new URL(path, request.url);
171
+ resourceURL.search = "";
172
+ resourceURL.hash = "";
173
+ return trimTrailingSlash(resourceURL.toString());
174
+ }
175
+ function assertResourcePathShape(resourcePath) {
176
+ if (!resourcePath.startsWith("/") || resourcePath.startsWith("//") || resourcePath.includes("\\") || /(^|\/)\.\.(\/|$)/.test(resourcePath)) {
177
+ throw new Error(
178
+ `@lovable.dev/mcp-js: resourcePath must be an absolute path beginning with "/" without ".." segments or backslashes (got ${JSON.stringify(resourcePath)})`
179
+ );
180
+ }
181
+ }
182
+ function resolveResourcePath(resourcePath, request) {
183
+ if (resourcePath === void 0)
184
+ return new URL(request.url).pathname;
185
+ assertResourcePathShape(resourcePath);
186
+ return resourcePath;
187
+ }
188
+
189
+ // src/auth/verifier.ts
190
+ var import_jose = require("jose");
191
+
192
+ // src/auth/claims.ts
193
+ function readString(value) {
194
+ return typeof value === "string" ? value : void 0;
195
+ }
196
+ function splitScopes(value) {
197
+ if (typeof value === "string")
198
+ return value.split(/\s+/).filter(Boolean);
199
+ if (Array.isArray(value))
200
+ return value.filter((entry) => typeof entry === "string" && entry.length > 0);
201
+ return [];
202
+ }
203
+ function stringClaim(claims, name) {
204
+ return readString(claims[name]);
205
+ }
206
+
207
+ // src/auth/verifier.ts
208
+ var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
209
+ var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
210
+ var OAuthTokenError = class extends Error {
211
+ constructor(status, oauthError, message) {
212
+ super(message);
213
+ this.status = status;
214
+ this.oauthError = oauthError;
215
+ this.name = "OAuthTokenError";
216
+ }
217
+ };
218
+ function resolveAcceptedAudiences(auth, resource) {
219
+ return auth.acceptedAudiences ?? [resource];
220
+ }
221
+ function isJwksFetchFailure(err) {
222
+ if (err instanceof import_jose.errors.JWKSTimeout || err instanceof import_jose.errors.JWKSInvalid)
223
+ return true;
224
+ if (!(err instanceof import_jose.errors.JOSEError))
225
+ return err instanceof Error;
226
+ return err.code === "ERR_JOSE_GENERIC";
227
+ }
228
+ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
229
+ try {
230
+ const { payload } = await (0, import_jose.jwtVerify)(token, keySet, {
231
+ // `issuer` is trimmed of any trailing slash; accept both forms so a token whose
232
+ // `iss` carries the slash the AS publishes still verifies.
233
+ issuer: [issuer, `${issuer}/`],
234
+ audience: [...audience],
235
+ algorithms: auth.algorithms ? [...auth.algorithms] : DEFAULT_JWT_ALGORITHMS,
236
+ requiredClaims: ["sub", "exp"],
237
+ clockTolerance: auth.clockToleranceSeconds ?? DEFAULT_CLOCK_TOLERANCE_SECONDS
238
+ });
239
+ return payload;
240
+ } catch (err) {
241
+ if (isJwksFetchFailure(err)) {
242
+ throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
243
+ }
244
+ throw err;
245
+ }
246
+ }
247
+ function assertNonEmptySubject(claims) {
248
+ const sub = claims["sub"];
249
+ if (typeof sub !== "string" || sub.trim() === "") {
250
+ throw new OAuthTokenError(401, "invalid_token", "token subject claim must be a non-empty string");
251
+ }
252
+ }
253
+ function assertOAuthClientClaim(auth, clientId) {
254
+ if (auth.requireOAuthClientClaim !== false && !clientId) {
255
+ throw new OAuthTokenError(401, "invalid_token", "OAuth client claim is required");
256
+ }
257
+ }
258
+ function makeBearer(token) {
259
+ return Object.defineProperty({}, "token", { value: token, enumerable: false });
260
+ }
261
+ function buildMcpAuthContext(args) {
262
+ const { claims } = args;
263
+ return {
264
+ type: "oauth",
265
+ principal: {
266
+ claims,
267
+ issuer: args.issuer,
268
+ resource: args.resource,
269
+ acceptedAudiences: args.acceptedAudiences,
270
+ scopes: splitScopes(claims.scope),
271
+ sub: stringClaim(claims, "sub"),
272
+ email: stringClaim(claims, "email"),
273
+ clientId: stringClaim(claims, "client_id") ?? stringClaim(claims, "azp")
274
+ },
275
+ bearer: makeBearer(args.token)
276
+ };
277
+ }
278
+ function createOAuthTokenVerifier(auth, discovery) {
279
+ const loadRemoteJwksKeySet = cachedPromise(
280
+ () => discovery.resolveJwksUri().then((jwksURI) => (0, import_jose.createRemoteJWKSet)(new URL(jwksURI)))
281
+ );
282
+ return async (token, request, options) => {
283
+ const resource = resolveProtectedResource(auth, request, options);
284
+ const issuer = await discovery.resolveIssuer();
285
+ const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
286
+ const claims = await verifyJwtClaims(token, await loadRemoteJwksKeySet(), issuer, acceptedAudiences, auth);
287
+ assertNonEmptySubject(claims);
288
+ const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
289
+ assertOAuthClientClaim(auth, context.principal.clientId);
290
+ return context;
291
+ };
292
+ }
293
+
294
+ // src/auth/authorize.ts
295
+ function quoteAuthenticateParam(value) {
296
+ const sanitized = value.replace(/[\u0000-\u001F\u007F]/g, "");
297
+ return `"${sanitized.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
298
+ }
299
+ function resolveProtectedResourceMetadataUrl(auth, request) {
300
+ if (auth.protectedResourceMetadataUrl !== void 0)
301
+ return auth.protectedResourceMetadataUrl;
302
+ const base = auth.resource ?? request.url;
303
+ return new URL(OAUTH_PROTECTED_RESOURCE_METADATA_PATH, base).toString();
304
+ }
305
+ function wwwAuthenticateHeader(auth, request, params = {}) {
306
+ const values = [
307
+ `realm=${quoteAuthenticateParam("mcp")}`,
308
+ `resource_metadata=${quoteAuthenticateParam(resolveProtectedResourceMetadataUrl(auth, request))}`
309
+ ];
310
+ if (auth.requiredScopes && auth.requiredScopes.length > 0) {
311
+ values.push(`scope=${quoteAuthenticateParam(auth.requiredScopes.join(" "))}`);
312
+ }
313
+ if (params.error)
314
+ values.push(`error=${quoteAuthenticateParam(params.error)}`);
315
+ if (params.errorDescription)
316
+ values.push(`error_description=${quoteAuthenticateParam(params.errorDescription)}`);
317
+ return `Bearer ${values.join(", ")}`;
318
+ }
319
+ function challengeResponse(auth, request, status, oauthError, errorDescription) {
320
+ const headers = new Headers(JSON_HEADERS);
321
+ headers.set("WWW-Authenticate", wwwAuthenticateHeader(auth, request, { error: oauthError, errorDescription }));
322
+ headers.set("Cache-Control", "no-store");
323
+ return new Response(JSON.stringify({ error: status === 403 ? "forbidden" : "unauthorized" }), {
324
+ status,
325
+ headers
326
+ });
327
+ }
328
+ function oauthConfigurationErrorResponse() {
329
+ return new Response(JSON.stringify({ error: "oauth configuration error" }), {
330
+ status: 500,
331
+ headers: { ...JSON_HEADERS, "Cache-Control": "no-store" }
332
+ });
333
+ }
334
+ function parseBearerToken(request) {
335
+ const header = request.headers.get("Authorization");
336
+ if (!header)
337
+ return void 0;
338
+ const match = /^Bearer\s+(.+)$/i.exec(header.trim());
339
+ if (!match)
340
+ return void 0;
341
+ const token = match[1].trim();
342
+ if (token === "" || /\s/.test(token))
343
+ return void 0;
344
+ return token;
345
+ }
346
+ function getOAuthRuntime(mcp, options = {}) {
347
+ if (options.resourcePath !== void 0)
348
+ assertResourcePathShape(options.resourcePath);
349
+ const stableOptions = { resourcePath: options.resourcePath };
350
+ const auth = mcp.auth?.type === "oauth" ? mcp.auth : void 0;
351
+ if (!auth)
352
+ return { kind: "unconfigured", options: stableOptions };
353
+ const discovery = createOAuthDiscoveryResolver(auth);
354
+ return {
355
+ kind: "configured",
356
+ auth,
357
+ discovery,
358
+ verify: createOAuthTokenVerifier(auth, discovery),
359
+ options: stableOptions
360
+ };
361
+ }
362
+ function missingRequiredScopes(auth, scopes) {
363
+ const requiredScopes = auth.requiredScopes ?? [];
364
+ if (requiredScopes.length === 0)
365
+ return [];
366
+ const granted = new Set(scopes);
367
+ return requiredScopes.filter((scope) => !granted.has(scope));
368
+ }
369
+ function assertRequiredScopes(auth, context) {
370
+ if (missingRequiredScopes(auth, context.principal.scopes).length > 0) {
371
+ throw new OAuthTokenError(403, "insufficient_scope", "Additional OAuth scope is required");
372
+ }
373
+ }
374
+ function createRequestAuthorizer(mcp, options = {}) {
375
+ const runtime = getOAuthRuntime(mcp, options);
376
+ return {
377
+ async authorize(request) {
378
+ if (runtime.kind === "unconfigured")
379
+ return { ok: true };
380
+ const token = parseBearerToken(request);
381
+ if (!token)
382
+ return { ok: false, response: challengeResponse(runtime.auth, request, 401) };
383
+ try {
384
+ const auth = await runtime.verify(token, request, runtime.options);
385
+ assertRequiredScopes(runtime.auth, auth);
386
+ return { ok: true, auth };
387
+ } catch (err) {
388
+ if (err instanceof OAuthConfigurationError) {
389
+ return { ok: false, response: oauthConfigurationErrorResponse() };
390
+ }
391
+ if (err instanceof OAuthTokenError) {
392
+ return {
393
+ ok: false,
394
+ response: challengeResponse(runtime.auth, request, err.status, err.oauthError, err.message)
395
+ };
396
+ }
397
+ return {
398
+ ok: false,
399
+ response: challengeResponse(runtime.auth, request, 401, "invalid_token", "Invalid access token")
400
+ };
401
+ }
402
+ }
403
+ };
404
+ }
405
+
406
+ // src/auth/context.ts
407
+ var ToolContext = class {
408
+ #auth;
409
+ constructor(auth) {
410
+ this.#auth = auth;
411
+ }
412
+ /** Whether the in-flight tool call carries a verified auth context. */
413
+ isAuthenticated() {
414
+ return this.#auth !== void 0;
415
+ }
416
+ /** The verified bearer token, or `undefined` when unauthenticated. Pass it to downstream APIs; never return or log it. */
417
+ getToken() {
418
+ return this.#auth?.bearer.token;
419
+ }
420
+ /** The verified user id (the token `sub`), or `undefined`. */
421
+ getUserId() {
422
+ return this.#auth?.principal.sub;
423
+ }
424
+ /** The verified user email, or `undefined` when absent. */
425
+ getUserEmail() {
426
+ return this.#auth?.principal.email;
427
+ }
428
+ /** The verified OAuth `client_id`, or `undefined`. */
429
+ getClientId() {
430
+ return this.#auth?.principal.clientId;
431
+ }
432
+ /** The verified OAuth scopes, or `undefined` when unauthenticated. */
433
+ getScopes() {
434
+ return this.#auth?.principal.scopes;
435
+ }
436
+ /** The verified token issuer, or `undefined`. */
437
+ getIssuer() {
438
+ return this.#auth?.principal.issuer;
439
+ }
440
+ /**
441
+ * The full verified JWT claims, or `undefined`. Use this for app/business
442
+ * authorization on issuer-specific claims that have no dedicated accessor.
443
+ */
444
+ getClaims() {
445
+ return this.#auth?.principal.claims;
446
+ }
447
+ };
448
+
449
+ // src/protocols/mcp/protocol.ts
450
+ function adaptToolToSdkCallback(tool, auth) {
451
+ return async (first) => {
452
+ const args = tool.inputSchema ? first ?? {} : {};
453
+ let result;
454
+ try {
455
+ result = await tool.handler(args, new ToolContext(auth));
456
+ } catch {
457
+ return { content: [{ type: "text", text: "tool execution failed" }], isError: true };
458
+ }
459
+ if (result == null) {
460
+ return { content: [{ type: "text", text: `tool "${tool.name}" returned no result` }], isError: true };
461
+ }
462
+ return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
463
+ };
464
+ }
465
+ function createMcpProtocolHandler(mcp, options = {}) {
466
+ const authorizer = createRequestAuthorizer(mcp, options);
467
+ return async (request) => {
468
+ const authResult = await authorizer.authorize(request);
469
+ if (!authResult.ok)
470
+ return authResult.response;
471
+ try {
472
+ const server = new import_mcp.McpServer(
473
+ { name: mcp.name, version: mcp.version, title: mcp.title },
474
+ { instructions: mcp.instructions }
475
+ );
476
+ for (const tool of mcp.tools) {
477
+ server.registerTool(
478
+ tool.name,
479
+ {
480
+ title: tool.title,
481
+ description: tool.description,
482
+ inputSchema: tool.inputSchema,
483
+ outputSchema: tool.outputSchema,
484
+ annotations: tool.annotations
485
+ },
486
+ adaptToolToSdkCallback(tool, authResult.auth)
487
+ );
488
+ }
489
+ const transport = new import_webStandardStreamableHttp.WebStandardStreamableHTTPServerTransport({
490
+ sessionIdGenerator: void 0
491
+ });
492
+ await server.connect(transport);
493
+ return await transport.handleRequest(request);
494
+ } catch {
495
+ return Response.json(
496
+ { jsonrpc: "2.0", id: null, error: { code: -32603, message: "internal error" } },
497
+ { status: 500 }
498
+ );
499
+ }
500
+ };
501
+ }
502
+ // Annotate the CommonJS export names for ESM import in node:
503
+ 0 && (module.exports = {
504
+ createMcpProtocolHandler
505
+ });
@@ -0,0 +1,14 @@
1
+ import { M as McpRuntimeOptions } from '../../authorize-DpTEIFvs.js';
2
+ import { d as McpDefinition } from '../../types-zMlr1mOK.js';
3
+ import 'zod';
4
+
5
+ type McpProtocolHandler = (request: Request) => Promise<Response>;
6
+ /**
7
+ * Build a Web-Standard request handler that serves the MCP protocol over
8
+ * streamable HTTP. A fresh `McpServer` + transport is constructed per
9
+ * request — the transport is stateless, so this is cheap and there is no
10
+ * cross-request state to leak.
11
+ */
12
+ declare function createMcpProtocolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): McpProtocolHandler;
13
+
14
+ export { type McpProtocolHandler, createMcpProtocolHandler };
@@ -0,0 +1,14 @@
1
+ import { M as McpRuntimeOptions } from '../../authorize-DpTEIFvs.js';
2
+ import { d as McpDefinition } from '../../types-zMlr1mOK.js';
3
+ import 'zod';
4
+
5
+ type McpProtocolHandler = (request: Request) => Promise<Response>;
6
+ /**
7
+ * Build a Web-Standard request handler that serves the MCP protocol over
8
+ * streamable HTTP. A fresh `McpServer` + transport is constructed per
9
+ * request — the transport is stateless, so this is cheap and there is no
10
+ * cross-request state to leak.
11
+ */
12
+ declare function createMcpProtocolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): McpProtocolHandler;
13
+
14
+ export { type McpProtocolHandler, createMcpProtocolHandler };
@@ -0,0 +1,10 @@
1
+ import {
2
+ createMcpProtocolHandler
3
+ } from "../../chunk-GLG5RZGE.js";
4
+ import "../../chunk-MA5H6PSF.js";
5
+ import "../../chunk-XEDRJFAR.js";
6
+ import "../../chunk-QA3FWDUV.js";
7
+ import "../../chunk-6DXGZZA4.js";
8
+ export {
9
+ createMcpProtocolHandler
10
+ };