@lovable.dev/mcp-js 2.1.0-rc.0 → 2.2.0-rc.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 (50) hide show
  1. package/README.md +15 -7
  2. package/dist/{authorize-BC4TM__8.d.cts → authorize-BmYO5_-I.d.cts} +1 -1
  3. package/dist/{authorize-DEsM-zTN.d.ts → authorize-d9-8n9u3.d.ts} +1 -1
  4. package/dist/{base-BnlJz6TE.d.ts → base-BAxrhVjq.d.ts} +1 -1
  5. package/dist/{base-4G2k3bMl.d.cts → base-Bmw6Wrb-.d.cts} +1 -1
  6. package/dist/cli/extract-manifest.cjs +1 -1
  7. package/dist/cli/extract-manifest.js +1 -1
  8. package/dist/{cors-D4BjUpgU.js → cors-BfacizN-.js} +2 -2
  9. package/dist/{cors-0ZCwmwyK.cjs → cors-Dm9Yn8E5.cjs} +2 -2
  10. package/dist/{errors-CdrGi5aP.cjs → errors-CpTdzogX.cjs} +1 -2
  11. package/dist/{errors-DTvfh8lb.js → errors-DGcJ8jPK.js} +1 -2
  12. package/dist/index.cjs +2 -2
  13. package/dist/index.d.cts +5 -8
  14. package/dist/index.d.ts +5 -8
  15. package/dist/index.js +2 -2
  16. package/dist/{io-BLZ8jYW6.d.ts → io-7U860POB.d.ts} +1 -1
  17. package/dist/{io-9jGNgPfl.d.cts → io-CL1GeE3D.d.cts} +1 -1
  18. package/dist/{io-BEoJ_gb5.js → io-DD8wjGjd.js} +1 -1
  19. package/dist/{io-Cz81GsrM.cjs → io-DaqblVaG.cjs} +1 -1
  20. package/dist/{logger-CN1q-KNn.cjs → logger-C-Hdu57K.cjs} +5 -1
  21. package/dist/{logger-Ctv5xUSD.js → logger-CpLgYbCG.js} +5 -1
  22. package/dist/{mcp-Q_rjpR99.cjs → mcp-BGsPYWs1.cjs} +3 -3
  23. package/dist/{mcp-CuHyVOZK.js → mcp-DdJJjYYZ.js} +3 -3
  24. package/dist/{package-BAYb-3dX.js → package-cPx-zYIb.js} +1 -1
  25. package/dist/{package-DlouusYQ.cjs → package-hWM0Ru0w.cjs} +1 -1
  26. package/dist/protocols/mcp/index.cjs +1 -1
  27. package/dist/protocols/mcp/index.d.cts +3 -3
  28. package/dist/protocols/mcp/index.d.ts +3 -3
  29. package/dist/protocols/mcp/index.js +1 -1
  30. package/dist/protocols/oauth-metadata.cjs +2 -2
  31. package/dist/protocols/oauth-metadata.d.cts +3 -3
  32. package/dist/protocols/oauth-metadata.d.ts +3 -3
  33. package/dist/protocols/oauth-metadata.js +2 -2
  34. package/dist/stacks/supabase/index.cjs +3 -3
  35. package/dist/stacks/supabase/index.d.cts +1 -1
  36. package/dist/stacks/supabase/index.d.ts +1 -1
  37. package/dist/stacks/supabase/index.js +3 -3
  38. package/dist/stacks/supabase/vite.cjs +1 -1
  39. package/dist/stacks/supabase/vite.d.cts +1 -1
  40. package/dist/stacks/supabase/vite.d.ts +1 -1
  41. package/dist/stacks/supabase/vite.js +1 -1
  42. package/dist/stacks/tanstack/index.cjs +2 -2
  43. package/dist/stacks/tanstack/index.d.cts +2 -2
  44. package/dist/stacks/tanstack/index.d.ts +2 -2
  45. package/dist/stacks/tanstack/index.js +2 -2
  46. package/dist/stacks/tanstack/vite.d.cts +1 -1
  47. package/dist/stacks/tanstack/vite.d.ts +1 -1
  48. package/dist/{types-S6J_QTXw.d.ts → types-BCKyT2wb.d.cts} +17 -4
  49. package/dist/{types-S6J_QTXw.d.cts → types-BCKyT2wb.d.ts} +17 -4
  50. package/package.json +1 -1
package/README.md CHANGED
@@ -216,21 +216,29 @@ The SDK only uses discovery + JWKS. It never calls the authorization or token en
216
216
 
217
217
  Tool handlers receive their input args plus a `ToolContext` as the second
218
218
  argument. The SDK constructs one per request from the verified token and passes
219
- it to the handler; helpers that need the auth take a `ToolContext` parameter, so
220
- the dependency is explicit in their signatures.
219
+ it to the handler. `ToolContext` extends `AuthContext`, which is also what
220
+ `createAppContext` receives as `auth`; helpers that need the auth should take an
221
+ `AuthContext` parameter so both call sites can share them.
221
222
 
222
223
  ```ts
223
- import type { ToolContext } from "@lovable.dev/mcp-js";
224
+ import type { AuthContext } from "@lovable.dev/mcp-js";
225
+
226
+ // Usable from tool handlers (`ctx`) and from `createAppContext` (`auth`).
227
+ function requireUserId(auth: AuthContext): string {
228
+ const userId = auth.getUserId(); // token `sub`, or undefined when unauthenticated
229
+ if (!userId) throw new Error("Authenticated caller required");
230
+ return userId;
231
+ }
224
232
 
225
233
  handler: async ({ title }, ctx) => {
226
- const userId = ctx.getUserId(); // token `sub`, or undefined when unauthenticated
234
+ const userId = requireUserId(ctx);
227
235
  // Apply app/business permissions here using ctx.getClaims() / ctx.getClientId().
228
236
  // For Supabase RLS, pass ctx.getToken() through to Supabase.
229
237
  return { content: [{ type: "text", text: `user=${userId}` }] };
230
238
  };
231
239
  ```
232
240
 
233
- | `ToolContext` method | Returns |
241
+ | `AuthContext` method (inherited by `ToolContext`) | Returns |
234
242
  | --- | --- |
235
243
  | `isAuthenticated()` | `true` when the call carries a verified auth context. |
236
244
  | `getUserId()` | The token `sub` (subject) — the user id. |
@@ -338,11 +346,11 @@ setLogLevel("debug"); // "silent" | "error" | "warn" | "info" | "debug"
338
346
  LOVABLE_MCP_LOG_LEVEL=debug
339
347
  ```
340
348
 
341
- A `500` on an OAuth-protected route is always one of two causes, logged at `error`: an `OAuthConfigurationError` from issuer-metadata discovery or a JWKS *fetch* failure (`oauth.discovery.config_error` / `oauth.jwks.fetch_failed` → `auth.config_error`), or a transport-level fault in the MCP handler (`mcp.transport_error`). Auth outcomes are logged at `info`: a granted request as `oauth.verify.ok`, a request with no parseable bearer as `auth.no_bearer_token`, and a rejected token as `auth.token_rejected` (a `jose` rejection such as an expired token carries the `jose` error name and code; the full reason appears at `debug` as `oauth.verify.rejected`) — so a request rejected for insufficient scope shows both `oauth.verify.ok` and the `auth.token_rejected` that follows it. A sustained flood of `auth.token_rejected` whose `code` is `ERR_JOSE_NOT_SUPPORTED` or `ERR_JOSE_ALG_NOT_ALLOWED` (rather than `ERR_JWT_EXPIRED`) points at server-side key or algorithm configuration, not client error.
349
+ A `500` on an OAuth-protected route is always one of three causes, logged at `error`: an `OAuthConfigurationError` from issuer-metadata discovery or a JWKS *fetch* failure (`oauth.discovery.config_error` / `oauth.jwks.fetch_failed` → `auth.config_error`), a throw from the app's own `createAppContext` or an `enabled` predicate (`mcp.app_context_error`, carrying that error's name and message), or a transport-level fault in the MCP handler (`mcp.transport_error`). Auth outcomes are logged at `info`: a granted request as `oauth.verify.ok`, a request with no parseable bearer as `auth.no_bearer_token`, and a rejected token as `auth.token_rejected` (a `jose` rejection such as an expired token carries the `jose` error name and code; the full reason appears at `debug` as `oauth.verify.rejected`) — so a request rejected for insufficient scope shows both `oauth.verify.ok` and the `auth.token_rejected` that follows it. A sustained flood of `auth.token_rejected` whose `code` is `ERR_JOSE_NOT_SUPPORTED` or `ERR_JOSE_ALG_NOT_ALLOWED` (rather than `ERR_JWT_EXPIRED`) points at server-side key or algorithm configuration, not client error.
342
350
 
343
351
  ## Usage metrics
344
352
 
345
- Each MCP server records per-invocation telemetry — tool name, JSON-RPC method, outcome, latency, request and response sizes when available, and the verified token `sub` for authenticated calls — as **OTLP/HTTP JSON logs**, one awaited POST per record, bounded by a 3-second timeout; a failed or slow POST is logged (`metrics.failed`) and swallowed, never failing the request. Outcomes cover tool results (`ok`, `tool_error`, `handler_error`, `transport_error`), the authorization gate — `auth_challenge` for an unauthenticated request answered with the `401` challenge (so probe traffic produces records), and the `auth_*` discovery/JWKS failure outcomes — and `origin_rejected` for a request refused `403` by the origin policy. Tool-call records also carry the protocol era (`mcp.protocol`: `2026-07-28` or `legacy`); records emitted before protocol classification (auth challenges, transport errors, origin rejections) have no protocol attribute. The bearer token, full claims, tool arguments, and response payloads are never captured. Emission is **on by default** and self-disables at runtime when `LOVABLE_API_KEY` is absent: records are dropped and one `metrics.disabled_no_api_key` warning is logged per process, so a local `vite dev` stays quiet. With `metrics: false` the recorder never runs — on Deno and Cloudflare Workers that also means `LOVABLE_MCP_LOG_LEVEL` is never applied (use `setLogLevel()` instead).
353
+ Each MCP server records per-invocation telemetry — tool name, JSON-RPC method, outcome, latency, request and response sizes when available, and the verified token `sub` for authenticated calls — as **OTLP/HTTP JSON logs**, one awaited POST per record, bounded by a 3-second timeout; a failed or slow POST is logged (`metrics.failed`) and swallowed, never failing the request. Outcomes cover tool results (`ok`, `tool_error`, `handler_error`, `transport_error`), `app_context_error` for a request failed by a throwing `createAppContext` or `enabled`, the authorization gate — `auth_challenge` for an unauthenticated request answered with the `401` challenge (so probe traffic produces records), and the `auth_*` discovery/JWKS failure outcomes — and `origin_rejected` for a request refused `403` by the origin policy. Tool-call records also carry the protocol era (`mcp.protocol`: `2026-07-28` or `legacy`); records emitted before protocol classification (auth challenges, transport errors, origin rejections) have no protocol attribute. The bearer token, full claims, tool arguments, and response payloads are never captured. Emission is **on by default** and self-disables at runtime when `LOVABLE_API_KEY` is absent: records are dropped and one `metrics.disabled_no_api_key` warning is logged per process, so a local `vite dev` stays quiet. With `metrics: false` the recorder never runs — on Deno and Cloudflare Workers that also means `LOVABLE_MCP_LOG_LEVEL` is never applied (use `setLogLevel()` instead).
346
354
 
347
355
  Configure it on the MCP definition:
348
356
 
@@ -1,4 +1,4 @@
1
- import "./types-S6J_QTXw.cjs";
1
+ import "./types-BCKyT2wb.cjs";
2
2
  //#region src/metrics/recorder.d.ts
3
3
  type ScheduleBackground = (task: Promise<unknown>) => void;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import "./types-S6J_QTXw.js";
1
+ import "./types-BCKyT2wb.js";
2
2
  //#region src/metrics/recorder.d.ts
3
3
  type ScheduleBackground = (task: Promise<unknown>) => void;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as McpProtocolEra } from "./types-S6J_QTXw.js";
1
+ import { j as McpProtocolEra } from "./types-BCKyT2wb.js";
2
2
  //#region src/metrics/impl/base.d.ts
3
3
  type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "app_context_error" | "auth_challenge" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
4
4
  /** One recorded MCP call. Carries no arguments or response payloads — only the
@@ -1,4 +1,4 @@
1
- import { A as McpProtocolEra } from "./types-S6J_QTXw.cjs";
1
+ import { j as McpProtocolEra } from "./types-BCKyT2wb.cjs";
2
2
  //#region src/metrics/impl/base.d.ts
3
3
  type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "app_context_error" | "auth_challenge" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
4
4
  /** One recorded MCP call. Carries no arguments or response payloads — only the
@@ -4,7 +4,7 @@ const projectRoot = process.argv[2] ?? process.cwd();
4
4
  import("zod/v3").catch((err) => {
5
5
  const message = err instanceof Error ? err.message : String(err);
6
6
  throw new Error(`@lovable.dev/mcp-js requires zod ^3.25 or ^4.0 to extract MCP schemas. Verify the project's zod dependency and package resolution, then try again. Underlying error: ${message}`);
7
- }).then(() => Promise.resolve().then(() => require("../io-Cz81GsrM.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
7
+ }).then(() => Promise.resolve().then(() => require("../io-DaqblVaG.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
8
8
  console.error(err instanceof Error ? err.message : String(err));
9
9
  process.exit(1);
10
10
  });
@@ -4,7 +4,7 @@ const projectRoot = process.argv[2] ?? process.cwd();
4
4
  import("zod/v3").catch((err) => {
5
5
  const message = err instanceof Error ? err.message : String(err);
6
6
  throw new Error(`@lovable.dev/mcp-js requires zod ^3.25 or ^4.0 to extract MCP schemas. Verify the project's zod dependency and package resolution, then try again. Underlying error: ${message}`);
7
- }).then(() => import("../io-BEoJ_gb5.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
7
+ }).then(() => import("../io-DD8wjGjd.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
8
8
  console.error(err instanceof Error ? err.message : String(err));
9
9
  process.exit(1);
10
10
  });
@@ -1,5 +1,5 @@
1
- import { i as log, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR, u as resolveMetricsConfig } from "./logger-Ctv5xUSD.js";
2
- import { t as version } from "./package-BAYb-3dX.js";
1
+ import { i as log, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR, u as resolveMetricsConfig } from "./logger-CpLgYbCG.js";
2
+ import { t as version } from "./package-cPx-zYIb.js";
3
3
  import "./metadata-path-CAkNcfyY.js";
4
4
  import { createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
5
5
  //#region src/core/http.ts
@@ -1,5 +1,5 @@
1
- const require_logger = require("./logger-CN1q-KNn.cjs");
2
- const require_package = require("./package-DlouusYQ.cjs");
1
+ const require_logger = require("./logger-C-Hdu57K.cjs");
2
+ const require_package = require("./package-hWM0Ru0w.cjs");
3
3
  require("./metadata-path-zd7NSNoa.cjs");
4
4
  let jose = require("jose");
5
5
  //#region src/core/http.ts
@@ -1,4 +1,4 @@
1
- const require_logger = require("./logger-CN1q-KNn.cjs");
1
+ const require_logger = require("./logger-C-Hdu57K.cjs");
2
2
  const require_schema = require("./schema-D3vClxb7.cjs");
3
3
  //#region src/core/define.ts
4
4
  function toolRequiresAppContext(tool) {
@@ -118,7 +118,6 @@ function assertToolSchemas(mcp) {
118
118
  }
119
119
  }
120
120
  }
121
- /** Bind app context once while retaining input/output inference for every tool. */
122
121
  const defineStaticTool = (def) => def;
123
122
  const defineTool = Object.assign(defineStaticTool, { withAppContext: () => (def) => {
124
123
  return {
@@ -1,4 +1,4 @@
1
- import { o as parseSafeUrl, s as trimTrailingSlash, u as resolveMetricsConfig } from "./logger-Ctv5xUSD.js";
1
+ import { o as parseSafeUrl, s as trimTrailingSlash, u as resolveMetricsConfig } from "./logger-CpLgYbCG.js";
2
2
  import { t as jsonSchemaFromDefinition } from "./schema-CW1jKvio.js";
3
3
  //#region src/core/define.ts
4
4
  function toolRequiresAppContext(tool) {
@@ -118,7 +118,6 @@ function assertToolSchemas(mcp) {
118
118
  }
119
119
  }
120
120
  }
121
- /** Bind app context once while retaining input/output inference for every tool. */
122
121
  const defineStaticTool = (def) => def;
123
122
  const defineTool = Object.assign(defineStaticTool, { withAppContext: () => (def) => {
124
123
  return {
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("./logger-CN1q-KNn.cjs");
3
- const require_errors = require("./errors-CdrGi5aP.cjs");
2
+ const require_logger = require("./logger-C-Hdu57K.cjs");
3
+ const require_errors = require("./errors-CpTdzogX.cjs");
4
4
  //#region src/auth/config.ts
5
5
  function frozenArray(value) {
6
6
  return value === void 0 ? void 0 : Object.freeze([...value]);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as McpProtocolEra, C as ZodOutputSchema, D as MetricsOptions, E as MetricsConfig, M as ToolContext, N as JwtClaims, O as AuthContext, P as McpAuthConfig, S as ToolVisibilityContext, T as ZodSchema, _ as TextContent, a as CreateAppContextInput, b as ToolDefinition, c as EmbeddedTextResource, d as JsonValueInput, f as McpAllowedOrigins, g as ResourceLinkIcon, h as ResourceLink, i as ContentBlock, j as ProgressUpdate, k as McpClientInfo, l as ImageContent, m as McpDefinitionInput, n as AudioContent, o as EmbeddedBlobResource, p as McpDefinition, r as ContentAnnotations, s as EmbeddedResource, t as AppContextToolDefinition, u as JsonValue, v as ToolAnnotations, w as ZodRawShape, x as ToolHandlerResult, y as ToolContent } from "./types-S6J_QTXw.cjs";
1
+ import { A as McpClientInfo, C as ToolVisibilityContext, D as MetricsConfig, E as ZodSchema, F as McpAuthConfig, M as ProgressUpdate, N as ToolContext, O as MetricsOptions, P as JwtClaims, S as ToolHandlerResult, T as ZodRawShape, _ as ResourceLinkIcon, a as ContentBlock, b as ToolContent, c as EmbeddedResource, d as JsonValue, f as JsonValueInput, g as ResourceLink, h as McpDefinitionInput, i as ContentAnnotations, j as McpProtocolEra, k as AuthContext, l as EmbeddedTextResource, m as McpDefinition, n as AppContextToolDefinitionInput, o as CreateAppContextInput, p as McpAllowedOrigins, r as AudioContent, s as EmbeddedBlobResource, t as AppContextToolDefinition, u as ImageContent, v as TextContent, w as ZodOutputSchema, x as ToolDefinition, y as ToolAnnotations } from "./types-BCKyT2wb.cjs";
2
2
  //#region src/core/define.d.ts
3
3
  /**
4
4
  * Declare a single MCP tool. Import the result into your MCP definition's
@@ -9,12 +9,9 @@ import { A as McpProtocolEra, C as ZodOutputSchema, D as MetricsOptions, E as Me
9
9
  * and the raw shape is what the JSON-RPC `tools/list` payload exposes.
10
10
  */
11
11
  interface DefineTool {
12
- <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: Omit<ToolDefinition<TInput, TOutput>, "enabled"> & {
13
- readonly enabled?: never;
14
- }): Omit<ToolDefinition<TInput, TOutput>, "enabled"> & {
15
- readonly enabled?: never;
16
- };
17
- withAppContext<TAppContext>(): <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: ToolDefinition<TInput, TOutput, TAppContext>) => AppContextToolDefinition<TInput, TOutput, TAppContext>;
12
+ <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: ToolDefinition<TInput, TOutput>): ToolDefinition<TInput, TOutput>;
13
+ /** Bind app context once while retaining input/output inference for every tool. */
14
+ withAppContext<TAppContext>(): <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: AppContextToolDefinitionInput<TInput, TOutput, TAppContext>) => AppContextToolDefinition<TInput, TOutput, TAppContext>;
18
15
  }
19
16
  declare const defineTool: DefineTool;
20
17
  /**
@@ -79,4 +76,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
79
76
  */
80
77
  declare function setLogLevel(level: LogLevel): LogLevel;
81
78
  //#endregion
82
- export { type AppContextToolDefinition, type AudioContent, AuthContext, type ContentAnnotations, type ContentBlock, type CreateAppContextInput, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ToolVisibilityContext, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
79
+ export { type AppContextToolDefinition, type AppContextToolDefinitionInput, type AudioContent, AuthContext, type ContentAnnotations, type ContentBlock, type CreateAppContextInput, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ToolVisibilityContext, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as McpProtocolEra, C as ZodOutputSchema, D as MetricsOptions, E as MetricsConfig, M as ToolContext, N as JwtClaims, O as AuthContext, P as McpAuthConfig, S as ToolVisibilityContext, T as ZodSchema, _ as TextContent, a as CreateAppContextInput, b as ToolDefinition, c as EmbeddedTextResource, d as JsonValueInput, f as McpAllowedOrigins, g as ResourceLinkIcon, h as ResourceLink, i as ContentBlock, j as ProgressUpdate, k as McpClientInfo, l as ImageContent, m as McpDefinitionInput, n as AudioContent, o as EmbeddedBlobResource, p as McpDefinition, r as ContentAnnotations, s as EmbeddedResource, t as AppContextToolDefinition, u as JsonValue, v as ToolAnnotations, w as ZodRawShape, x as ToolHandlerResult, y as ToolContent } from "./types-S6J_QTXw.js";
1
+ import { A as McpClientInfo, C as ToolVisibilityContext, D as MetricsConfig, E as ZodSchema, F as McpAuthConfig, M as ProgressUpdate, N as ToolContext, O as MetricsOptions, P as JwtClaims, S as ToolHandlerResult, T as ZodRawShape, _ as ResourceLinkIcon, a as ContentBlock, b as ToolContent, c as EmbeddedResource, d as JsonValue, f as JsonValueInput, g as ResourceLink, h as McpDefinitionInput, i as ContentAnnotations, j as McpProtocolEra, k as AuthContext, l as EmbeddedTextResource, m as McpDefinition, n as AppContextToolDefinitionInput, o as CreateAppContextInput, p as McpAllowedOrigins, r as AudioContent, s as EmbeddedBlobResource, t as AppContextToolDefinition, u as ImageContent, v as TextContent, w as ZodOutputSchema, x as ToolDefinition, y as ToolAnnotations } from "./types-BCKyT2wb.js";
2
2
  //#region src/core/define.d.ts
3
3
  /**
4
4
  * Declare a single MCP tool. Import the result into your MCP definition's
@@ -9,12 +9,9 @@ import { A as McpProtocolEra, C as ZodOutputSchema, D as MetricsOptions, E as Me
9
9
  * and the raw shape is what the JSON-RPC `tools/list` payload exposes.
10
10
  */
11
11
  interface DefineTool {
12
- <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: Omit<ToolDefinition<TInput, TOutput>, "enabled"> & {
13
- readonly enabled?: never;
14
- }): Omit<ToolDefinition<TInput, TOutput>, "enabled"> & {
15
- readonly enabled?: never;
16
- };
17
- withAppContext<TAppContext>(): <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: ToolDefinition<TInput, TOutput, TAppContext>) => AppContextToolDefinition<TInput, TOutput, TAppContext>;
12
+ <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: ToolDefinition<TInput, TOutput>): ToolDefinition<TInput, TOutput>;
13
+ /** Bind app context once while retaining input/output inference for every tool. */
14
+ withAppContext<TAppContext>(): <TInput extends ZodRawShape | undefined = undefined, TOutput extends ZodOutputSchema | undefined = undefined>(def: AppContextToolDefinitionInput<TInput, TOutput, TAppContext>) => AppContextToolDefinition<TInput, TOutput, TAppContext>;
18
15
  }
19
16
  declare const defineTool: DefineTool;
20
17
  /**
@@ -79,4 +76,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
79
76
  */
80
77
  declare function setLogLevel(level: LogLevel): LogLevel;
81
78
  //#endregion
82
- export { type AppContextToolDefinition, type AudioContent, AuthContext, type ContentAnnotations, type ContentBlock, type CreateAppContextInput, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ToolVisibilityContext, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
79
+ export { type AppContextToolDefinition, type AppContextToolDefinitionInput, type AudioContent, AuthContext, type ContentAnnotations, type ContentBlock, type CreateAppContextInput, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ToolVisibilityContext, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as setLogLevel } from "./logger-Ctv5xUSD.js";
2
- import { a as ToolContext, i as AuthContext, o as defineMcp, s as defineTool, t as ToolError } from "./errors-DTvfh8lb.js";
1
+ import { a as setLogLevel } from "./logger-CpLgYbCG.js";
2
+ import { a as ToolContext, i as AuthContext, o as defineMcp, s as defineTool, t as ToolError } from "./errors-DGcJ8jPK.js";
3
3
  //#region src/auth/config.ts
4
4
  function frozenArray(value) {
5
5
  return value === void 0 ? void 0 : Object.freeze([...value]);
@@ -1,4 +1,4 @@
1
- import "./types-S6J_QTXw.js";
1
+ import "./types-BCKyT2wb.js";
2
2
  //#region src/manifest/io.d.ts
3
3
  /**
4
4
  * Shape every MCP Vite plugin exposes on its `api` so `runExtract` can read
@@ -1,4 +1,4 @@
1
- import "./types-S6J_QTXw.cjs";
1
+ import "./types-BCKyT2wb.cjs";
2
2
  //#region src/manifest/io.d.ts
3
3
  /**
4
4
  * Shape every MCP Vite plugin exposes on its `api` so `runExtract` can read
@@ -1,5 +1,5 @@
1
1
  import { t as jsonSchemaFromDefinition } from "./schema-CW1jKvio.js";
2
- import { t as version } from "./package-BAYb-3dX.js";
2
+ import { t as version } from "./package-cPx-zYIb.js";
3
3
  import { t as isFileMissing } from "./fs-errors-PA2t1TIp.js";
4
4
  import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { dirname, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
1
  const require_schema = require("./schema-D3vClxb7.cjs");
2
- const require_package = require("./package-DlouusYQ.cjs");
2
+ const require_package = require("./package-hWM0Ru0w.cjs");
3
3
  const require_fs_errors = require("./fs-errors-CWNzOV75.cjs");
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
@@ -139,7 +139,11 @@ function describeError(err) {
139
139
  ...typeof code === "string" ? { code } : {}
140
140
  };
141
141
  }
142
- return { value: String(err) };
142
+ try {
143
+ return { value: String(err) };
144
+ } catch {
145
+ return { value: "[unprintable object]" };
146
+ }
143
147
  }
144
148
  //#endregion
145
149
  Object.defineProperty(exports, "DEFAULT_METRICS_ENDPOINT", {
@@ -139,7 +139,11 @@ function describeError(err) {
139
139
  ...typeof code === "string" ? { code } : {}
140
140
  };
141
141
  }
142
- return { value: String(err) };
142
+ try {
143
+ return { value: String(err) };
144
+ } catch {
145
+ return { value: "[unprintable object]" };
146
+ }
143
147
  }
144
148
  //#endregion
145
149
  export { setLogLevel as a, DEFAULT_METRICS_ENDPOINT as c, log as i, LEGACY_METRICS_ENDPOINT as l, applyLogLevelFromEnv as n, parseSafeUrl as o, describeError as r, trimTrailingSlash as s, LOG_LEVEL_ENV_VAR as t, resolveMetricsConfig as u };
@@ -1,7 +1,7 @@
1
- const require_logger = require("./logger-CN1q-KNn.cjs");
1
+ const require_logger = require("./logger-C-Hdu57K.cjs");
2
2
  const require_schema = require("./schema-D3vClxb7.cjs");
3
- const require_errors = require("./errors-CdrGi5aP.cjs");
4
- const require_cors = require("./cors-0ZCwmwyK.cjs");
3
+ const require_errors = require("./errors-CpTdzogX.cjs");
4
+ const require_cors = require("./cors-Dm9Yn8E5.cjs");
5
5
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
6
6
  let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
7
7
  //#region src/core/content.ts
@@ -1,7 +1,7 @@
1
- import { i as log, r as describeError } from "./logger-Ctv5xUSD.js";
1
+ import { i as log, r as describeError } from "./logger-CpLgYbCG.js";
2
2
  import { n as schemaFromDefinition, t as jsonSchemaFromDefinition } from "./schema-CW1jKvio.js";
3
- import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-DTvfh8lb.js";
4
- import { d as nowMs, i as normalizeHttpMethod, l as emitBeforeResponse, n as createRequestAuthorizer, p as finalizeWireResponse, t as evaluateCors, u as createNoopRecorder } from "./cors-D4BjUpgU.js";
3
+ import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-DGcJ8jPK.js";
4
+ import { d as nowMs, i as normalizeHttpMethod, l as emitBeforeResponse, n as createRequestAuthorizer, p as finalizeWireResponse, t as evaluateCors, u as createNoopRecorder } from "./cors-BfacizN-.js";
5
5
  import { getParseErrorMessage, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
6
6
  import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, createMcpHandler } from "@modelcontextprotocol/server";
7
7
  //#region src/core/content.ts
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "2.1.0-rc.0";
2
+ var version = "2.2.0-rc.0";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.1.0-rc.0";
2
+ var version = "2.2.0-rc.0";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mcp = require("../../mcp-Q_rjpR99.cjs");
2
+ const require_mcp = require("../../mcp-BGsPYWs1.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,6 +1,6 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.cjs";
2
- import { t as MetricsRecorder } from "../../base-4G2k3bMl.cjs";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BC4TM__8.cjs";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.cjs";
2
+ import { t as MetricsRecorder } from "../../base-Bmw6Wrb-.cjs";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BmYO5_-I.cjs";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.js";
2
- import { t as MetricsRecorder } from "../../base-BnlJz6TE.js";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DEsM-zTN.js";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.js";
2
+ import { t as MetricsRecorder } from "../../base-BAxrhVjq.js";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-d9-8n9u3.js";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  /**
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-CuHyVOZK.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-DdJJjYYZ.js";
2
2
  export { createMcpProtocolHandler };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("../logger-CN1q-KNn.cjs");
3
- const require_cors = require("../cors-0ZCwmwyK.cjs");
2
+ const require_logger = require("../logger-C-Hdu57K.cjs");
3
+ const require_cors = require("../cors-Dm9Yn8E5.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -1,6 +1,6 @@
1
- import { p as McpDefinition } from "../types-S6J_QTXw.cjs";
2
- import { t as MetricsRecorder } from "../base-4G2k3bMl.cjs";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-BC4TM__8.cjs";
1
+ import { m as McpDefinition } from "../types-BCKyT2wb.cjs";
2
+ import { t as MetricsRecorder } from "../base-Bmw6Wrb-.cjs";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-BmYO5_-I.cjs";
4
4
  //#region src/protocols/oauth-metadata.d.ts
5
5
  type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,6 +1,6 @@
1
- import { p as McpDefinition } from "../types-S6J_QTXw.js";
2
- import { t as MetricsRecorder } from "../base-BnlJz6TE.js";
3
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-DEsM-zTN.js";
1
+ import { m as McpDefinition } from "../types-BCKyT2wb.js";
2
+ import { t as MetricsRecorder } from "../base-BAxrhVjq.js";
3
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-d9-8n9u3.js";
4
4
  //#region src/protocols/oauth-metadata.d.ts
5
5
  type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
6
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,5 +1,5 @@
1
- import { i as log, r as describeError } from "../logger-Ctv5xUSD.js";
2
- import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-D4BjUpgU.js";
1
+ import { i as log, r as describeError } from "../logger-CpLgYbCG.js";
2
+ import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-BfacizN-.js";
3
3
  //#region src/protocols/oauth-metadata.ts
4
4
  function notFound() {
5
5
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("../../logger-CN1q-KNn.cjs");
3
- const require_cors = require("../../cors-0ZCwmwyK.cjs");
2
+ const require_logger = require("../../logger-C-Hdu57K.cjs");
3
+ const require_cors = require("../../cors-Dm9Yn8E5.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-Q_rjpR99.cjs");
5
+ const require_mcp = require("../../mcp-BGsPYWs1.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
7
  const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
@@ -1,4 +1,4 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.cjs";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.cjs";
2
2
  //#region src/stacks/supabase/handler.d.ts
3
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
4
4
  interface SupabaseHandlerOptions {
@@ -1,4 +1,4 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.js";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.js";
2
2
  //#region src/stacks/supabase/handler.d.ts
3
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
4
4
  interface SupabaseHandlerOptions {
@@ -1,7 +1,7 @@
1
- import { s as trimTrailingSlash } from "../../logger-Ctv5xUSD.js";
2
- import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-D4BjUpgU.js";
1
+ import { s as trimTrailingSlash } from "../../logger-CpLgYbCG.js";
2
+ import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-BfacizN-.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-CuHyVOZK.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-DdJJjYYZ.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
6
  import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
7
7
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_package = require("../../package-DlouusYQ.cjs");
5
+ const require_package = require("../../package-hWM0Ru0w.cjs");
6
6
  const require_fs_errors = require("../../fs-errors-CWNzOV75.cjs");
7
7
  const require_supabase_config = require("../../supabase-config-Dz7dnUv0.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-9jGNgPfl.cjs";
1
+ import { t as McpPluginApi } from "../../io-CL1GeE3D.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-BLZ8jYW6.js";
1
+ import { t as McpPluginApi } from "../../io-7U860POB.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as version } from "../../package-BAYb-3dX.js";
1
+ import { t as version } from "../../package-cPx-zYIb.js";
2
2
  import { t as isFileMissing } from "../../fs-errors-PA2t1TIp.js";
3
3
  import { t as readSupabaseProjectRef } from "../../supabase-config-CakTU8YF.js";
4
4
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-0ZCwmwyK.cjs");
3
- const require_mcp = require("../../mcp-Q_rjpR99.cjs");
2
+ const require_cors = require("../../cors-Dm9Yn8E5.cjs");
3
+ const require_mcp = require("../../mcp-BGsPYWs1.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
5
  const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
6
6
  //#region src/stacks/tanstack/handlers.ts
@@ -1,5 +1,5 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.cjs";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BC4TM__8.cjs";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.cjs";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BmYO5_-I.cjs";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRequest extends Request {
5
5
  waitUntil?: ScheduleBackground;
@@ -1,5 +1,5 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.js";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DEsM-zTN.js";
1
+ import { m as McpDefinition } from "../../types-BCKyT2wb.js";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-d9-8n9u3.js";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRequest extends Request {
5
5
  waitUntil?: ScheduleBackground;
@@ -1,5 +1,5 @@
1
- import { c as createRecorderForRuntime } from "../../cors-D4BjUpgU.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-CuHyVOZK.js";
1
+ import { c as createRecorderForRuntime } from "../../cors-BfacizN-.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-DdJJjYYZ.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
4
  import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
5
5
  //#region src/stacks/tanstack/handlers.ts
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-9jGNgPfl.cjs";
1
+ import { t as McpPluginApi } from "../../io-CL1GeE3D.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-BLZ8jYW6.js";
1
+ import { t as McpPluginApi } from "../../io-7U860POB.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -303,6 +303,11 @@ interface ToolAnnotations {
303
303
  idempotentHint?: boolean;
304
304
  /** Tool interacts with external/unbounded systems (DB, network, third-party APIs). */
305
305
  openWorldHint?: boolean;
306
+ /**
307
+ * Asks the Lovable agent to keep up to 50 KB of this tool's result in context instead of the default 5 KB.
308
+ * Honored for the app's published MCP server; meant for results the agent must read whole.
309
+ */
310
+ largeOutputHint?: boolean;
306
311
  }
307
312
  interface ToolHandlerResult {
308
313
  content?: ToolContent;
@@ -318,7 +323,7 @@ interface CreateAppContextInput {
318
323
  interface ToolVisibilityContext<TAppContext> {
319
324
  readonly appContext: TAppContext;
320
325
  }
321
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = undefined> {
326
+ interface ToolDefinitionBase<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
322
327
  readonly name: string;
323
328
  /** Human-readable display name shown to the user in MCP clients. Required. */
324
329
  readonly title: string;
@@ -327,11 +332,19 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
327
332
  readonly inputSchema?: TInput;
328
333
  readonly outputSchema?: TOutput;
329
334
  readonly annotations?: ToolAnnotations;
335
+ }
336
+ type ToolHandler<TInput extends ZodRawShape$1 | undefined, TAppContext> = TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
337
+ /** A tool that exists for every caller. Its handler receives the plain `ToolContext`. */
338
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> extends ToolDefinitionBase<TInput, TOutput> {
339
+ readonly handler: ToolHandler<TInput, undefined>;
340
+ }
341
+ /** Input to `defineTool.withAppContext<TAppContext>()`. */
342
+ interface AppContextToolDefinitionInput<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinitionBase<TInput, TOutput> {
330
343
  /** Synchronously decide whether this tool exists for the current caller. */
331
344
  readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
332
- readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
345
+ readonly handler: ToolHandler<TInput, TAppContext>;
333
346
  }
334
- interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinition<TInput, TOutput, TAppContext> {
347
+ interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends AppContextToolDefinitionInput<TInput, TOutput, TAppContext> {
335
348
  readonly requiresAppContext: true;
336
349
  }
337
350
  /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
@@ -394,4 +407,4 @@ type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>
394
407
  readonly [McpDefinitionBrand]: never;
395
408
  };
396
409
  //#endregion
397
- export { McpProtocolEra as A, ZodOutputSchema as C, MetricsOptions as D, MetricsConfig as E, ToolContext as M, JwtClaims as N, AuthContext as O, McpAuthConfig as P, ToolVisibilityContext as S, ZodSchema as T, TextContent as _, CreateAppContextInput as a, ToolDefinition as b, EmbeddedTextResource as c, JsonValueInput as d, McpAllowedOrigins as f, ResourceLinkIcon as g, ResourceLink as h, ContentBlock as i, ProgressUpdate as j, McpClientInfo as k, ImageContent as l, McpDefinitionInput as m, AudioContent as n, EmbeddedBlobResource as o, McpDefinition as p, ContentAnnotations as r, EmbeddedResource as s, AppContextToolDefinition as t, JsonValue as u, ToolAnnotations as v, ZodRawShape$1 as w, ToolHandlerResult as x, ToolContent as y };
410
+ export { McpClientInfo as A, ToolVisibilityContext as C, MetricsConfig as D, ZodSchema as E, McpAuthConfig as F, ProgressUpdate as M, ToolContext as N, MetricsOptions as O, JwtClaims as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpProtocolEra as j, AuthContext as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
@@ -303,6 +303,11 @@ interface ToolAnnotations {
303
303
  idempotentHint?: boolean;
304
304
  /** Tool interacts with external/unbounded systems (DB, network, third-party APIs). */
305
305
  openWorldHint?: boolean;
306
+ /**
307
+ * Asks the Lovable agent to keep up to 50 KB of this tool's result in context instead of the default 5 KB.
308
+ * Honored for the app's published MCP server; meant for results the agent must read whole.
309
+ */
310
+ largeOutputHint?: boolean;
306
311
  }
307
312
  interface ToolHandlerResult {
308
313
  content?: ToolContent;
@@ -318,7 +323,7 @@ interface CreateAppContextInput {
318
323
  interface ToolVisibilityContext<TAppContext> {
319
324
  readonly appContext: TAppContext;
320
325
  }
321
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = undefined> {
326
+ interface ToolDefinitionBase<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
322
327
  readonly name: string;
323
328
  /** Human-readable display name shown to the user in MCP clients. Required. */
324
329
  readonly title: string;
@@ -327,11 +332,19 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
327
332
  readonly inputSchema?: TInput;
328
333
  readonly outputSchema?: TOutput;
329
334
  readonly annotations?: ToolAnnotations;
335
+ }
336
+ type ToolHandler<TInput extends ZodRawShape$1 | undefined, TAppContext> = TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
337
+ /** A tool that exists for every caller. Its handler receives the plain `ToolContext`. */
338
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> extends ToolDefinitionBase<TInput, TOutput> {
339
+ readonly handler: ToolHandler<TInput, undefined>;
340
+ }
341
+ /** Input to `defineTool.withAppContext<TAppContext>()`. */
342
+ interface AppContextToolDefinitionInput<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinitionBase<TInput, TOutput> {
330
343
  /** Synchronously decide whether this tool exists for the current caller. */
331
344
  readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
332
- readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
345
+ readonly handler: ToolHandler<TInput, TAppContext>;
333
346
  }
334
- interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinition<TInput, TOutput, TAppContext> {
347
+ interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends AppContextToolDefinitionInput<TInput, TOutput, TAppContext> {
335
348
  readonly requiresAppContext: true;
336
349
  }
337
350
  /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
@@ -394,4 +407,4 @@ type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>
394
407
  readonly [McpDefinitionBrand]: never;
395
408
  };
396
409
  //#endregion
397
- export { McpProtocolEra as A, ZodOutputSchema as C, MetricsOptions as D, MetricsConfig as E, ToolContext as M, JwtClaims as N, AuthContext as O, McpAuthConfig as P, ToolVisibilityContext as S, ZodSchema as T, TextContent as _, CreateAppContextInput as a, ToolDefinition as b, EmbeddedTextResource as c, JsonValueInput as d, McpAllowedOrigins as f, ResourceLinkIcon as g, ResourceLink as h, ContentBlock as i, ProgressUpdate as j, McpClientInfo as k, ImageContent as l, McpDefinitionInput as m, AudioContent as n, EmbeddedBlobResource as o, McpDefinition as p, ContentAnnotations as r, EmbeddedResource as s, AppContextToolDefinition as t, JsonValue as u, ToolAnnotations as v, ZodRawShape$1 as w, ToolHandlerResult as x, ToolContent as y };
410
+ export { McpClientInfo as A, ToolVisibilityContext as C, MetricsConfig as D, ZodSchema as E, McpAuthConfig as F, ProgressUpdate as M, ToolContext as N, MetricsOptions as O, JwtClaims as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpProtocolEra as j, AuthContext as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "2.1.0-rc.0",
3
+ "version": "2.2.0-rc.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },