@lovable.dev/mcp-js 0.20.0 → 0.20.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
1
  type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_config_error";
2
2
  /** One recorded MCP call. Carries no arguments or response payloads — only the
3
- * tool name, the JSON-RPC method, the result class, timing, and byte sizes. */
3
+ * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
4
+ * `errorText` is the sole exception: it is logged locally for debugging and
5
+ * deliberately never included in the OTLP payload (see `emit` / `buildLogsPayload`). */
4
6
  interface InvocationRecord {
5
7
  /** Tool name for `tools/call`; `null` for list/initialize, transport faults, and auth-config failures. */
6
8
  tool: string | null;
@@ -10,6 +12,9 @@ interface InvocationRecord {
10
12
  durationMs: number;
11
13
  reqBytes?: number;
12
14
  resBytes?: number;
15
+ /** The `tool_error` message (text content of an `isError` result). Local log
16
+ * only — never sent to the collector, so it stays on-box for the operator. */
17
+ errorText?: string;
13
18
  }
14
19
  /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
15
20
  * single OTLP POST, awaited so it lands before the request ends. */
@@ -0,0 +1,11 @@
1
+ // src/core/content.ts
2
+ function extractTextContent(content) {
3
+ if (!content)
4
+ return void 0;
5
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("\n").trim();
6
+ return text.length > 0 ? text : void 0;
7
+ }
8
+
9
+ export {
10
+ extractTextContent
11
+ };
@@ -6,7 +6,7 @@ import {
6
6
  headResponse,
7
7
  methodNotAllowed,
8
8
  withCors
9
- } from "./chunk-EPEEEI3C.js";
9
+ } from "./chunk-XIGO7RW6.js";
10
10
 
11
11
  // src/protocols/rest/list-tools.ts
12
12
  import { objectFromShape } from "@modelcontextprotocol/sdk/server/zod-compat.js";
@@ -7,7 +7,7 @@ import {
7
7
  oauthConfigurationErrorResponse,
8
8
  resolveProtectedResource,
9
9
  withCors
10
- } from "./chunk-EPEEEI3C.js";
10
+ } from "./chunk-XIGO7RW6.js";
11
11
  import {
12
12
  describeError,
13
13
  log
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.20.0";
2
+ var version = "0.20.1-rc.1";
3
3
 
4
4
  export {
5
5
  version
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-6DXGZZA4.js";
14
14
  import {
15
15
  version
16
- } from "./chunk-FTTVLHNN.js";
16
+ } from "./chunk-QWVSMQJF.js";
17
17
 
18
18
  // src/core/http.ts
19
19
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -156,7 +156,8 @@ var BaseMetricRecorder = class {
156
156
  method: ev.method,
157
157
  outcome: ev.outcome,
158
158
  durationMs: ev.durationMs,
159
- stack: this.stack
159
+ stack: this.stack,
160
+ ...ev.errorText !== void 0 && { errorText: ev.errorText }
160
161
  });
161
162
  if (!this.config.enabled)
162
163
  return;
@@ -1,3 +1,6 @@
1
+ import {
2
+ extractTextContent
3
+ } from "./chunk-6QFZYYUV.js";
1
4
  import {
2
5
  ToolContext
3
6
  } from "./chunk-MA5H6PSF.js";
@@ -7,7 +10,7 @@ import {
7
10
  createRequestAuthorizer,
8
11
  nowMs,
9
12
  withCors
10
- } from "./chunk-EPEEEI3C.js";
13
+ } from "./chunk-XIGO7RW6.js";
11
14
  import {
12
15
  describeError,
13
16
  log
@@ -45,7 +48,8 @@ function adaptToolToSdkCallback(tool, auth, recorder) {
45
48
  tool: tool.name,
46
49
  method: "tools/call",
47
50
  outcome: result.isError ? "tool_error" : "ok",
48
- durationMs: nowMs() - start
51
+ durationMs: nowMs() - start,
52
+ errorText: result.isError ? extractTextContent(result.content) : void 0
49
53
  });
50
54
  return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
51
55
  };
@@ -1,3 +1,6 @@
1
+ import {
2
+ extractTextContent
3
+ } from "./chunk-6QFZYYUV.js";
1
4
  import {
2
5
  ToolContext
3
6
  } from "./chunk-MA5H6PSF.js";
@@ -10,7 +13,7 @@ import {
10
13
  methodNotAllowed,
11
14
  nowMs,
12
15
  withCors
13
- } from "./chunk-EPEEEI3C.js";
16
+ } from "./chunk-XIGO7RW6.js";
14
17
 
15
18
  // src/protocols/rest/invoke-tool.ts
16
19
  import { getParseErrorMessage, objectFromShape, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
@@ -113,7 +116,8 @@ function createInvokeToolHandler(mcp, options = {}) {
113
116
  tool: tool.name,
114
117
  method: "tools/call",
115
118
  outcome: result.isError ? "tool_error" : "ok",
116
- durationMs: nowMs() - start
119
+ durationMs: nowMs() - start,
120
+ errorText: result.isError ? extractTextContent(result.content) : void 0
117
121
  });
118
122
  return Response.json({
119
123
  content: result.content ?? [],
@@ -13,7 +13,7 @@ function isFileMissing(err) {
13
13
  }
14
14
 
15
15
  // package.json
16
- var version = "0.20.0";
16
+ var version = "0.20.1-rc.1";
17
17
 
18
18
  // src/protocols/rest/list-tools.ts
19
19
  var import_zod_compat = require("@modelcontextprotocol/sdk/server/zod-compat.js");
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  buildMcpListing
4
- } from "../chunk-7JJEPFSO.js";
5
- import "../chunk-EPEEEI3C.js";
4
+ } from "../chunk-ICCGSB2E.js";
5
+ import "../chunk-XIGO7RW6.js";
6
6
  import "../chunk-H37EB22A.js";
7
7
  import "../chunk-6DXGZZA4.js";
8
8
  import {
@@ -10,7 +10,7 @@ import {
10
10
  } from "../chunk-Y3ZFPEQH.js";
11
11
  import {
12
12
  version
13
- } from "../chunk-FTTVLHNN.js";
13
+ } from "../chunk-QWVSMQJF.js";
14
14
 
15
15
  // src/manifest/io.ts
16
16
  import { randomUUID } from "crypto";
@@ -604,6 +604,14 @@ var ToolContext = class {
604
604
  }
605
605
  };
606
606
 
607
+ // src/core/content.ts
608
+ function extractTextContent(content) {
609
+ if (!content)
610
+ return void 0;
611
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("\n").trim();
612
+ return text.length > 0 ? text : void 0;
613
+ }
614
+
607
615
  // src/core/cors.ts
608
616
  var EXPOSE_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
609
617
  var ALLOW_HEADERS = "Authorization, Content-Type, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID";
@@ -654,7 +662,8 @@ function adaptToolToSdkCallback(tool, auth, recorder) {
654
662
  tool: tool.name,
655
663
  method: "tools/call",
656
664
  outcome: result.isError ? "tool_error" : "ok",
657
- durationMs: nowMs() - start
665
+ durationMs: nowMs() - start,
666
+ errorText: result.isError ? extractTextContent(result.content) : void 0
658
667
  });
659
668
  return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
660
669
  };
@@ -1,6 +1,6 @@
1
1
  import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
2
2
  import { d as McpDefinition } from '../../types-CPkhCRxc.js';
3
- import { M as MetricsRecorder } from '../../base-C9rhAHZ0.js';
3
+ import { M as MetricsRecorder } from '../../base-CFy5vZ5Z.js';
4
4
  import 'zod';
5
5
 
6
6
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
2
2
  import { d as McpDefinition } from '../../types-CPkhCRxc.js';
3
- import { M as MetricsRecorder } from '../../base-C9rhAHZ0.js';
3
+ import { M as MetricsRecorder } from '../../base-CFy5vZ5Z.js';
4
4
  import 'zod';
5
5
 
6
6
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  createMcpProtocolHandler
3
- } from "../../chunk-WW7NRRCJ.js";
3
+ } from "../../chunk-YQFF4OCL.js";
4
+ import "../../chunk-6QFZYYUV.js";
4
5
  import "../../chunk-MA5H6PSF.js";
5
- import "../../chunk-EPEEEI3C.js";
6
+ import "../../chunk-XIGO7RW6.js";
6
7
  import "../../chunk-H37EB22A.js";
7
8
  import "../../chunk-6DXGZZA4.js";
8
- import "../../chunk-FTTVLHNN.js";
9
+ import "../../chunk-QWVSMQJF.js";
9
10
  export {
10
11
  createMcpProtocolHandler
11
12
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createOAuthProtectedResourceMetadataHandler
3
- } from "../chunk-DUNDNXK5.js";
4
- import "../chunk-EPEEEI3C.js";
3
+ } from "../chunk-PKYNTB7X.js";
4
+ import "../chunk-XIGO7RW6.js";
5
5
  import "../chunk-H37EB22A.js";
6
6
  import "../chunk-6DXGZZA4.js";
7
- import "../chunk-FTTVLHNN.js";
7
+ import "../chunk-QWVSMQJF.js";
8
8
  export {
9
9
  createOAuthProtectedResourceMetadataHandler
10
10
  };
@@ -687,6 +687,14 @@ var ToolContext = class {
687
687
  }
688
688
  };
689
689
 
690
+ // src/core/content.ts
691
+ function extractTextContent(content) {
692
+ if (!content)
693
+ return void 0;
694
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("\n").trim();
695
+ return text.length > 0 ? text : void 0;
696
+ }
697
+
690
698
  // src/protocols/rest/invoke-tool.ts
691
699
  var MAX_REFLECTED_TOOL_NAME = 256;
692
700
  function safeReflectName(name) {
@@ -787,7 +795,8 @@ function createInvokeToolHandler(mcp, options = {}) {
787
795
  tool: tool.name,
788
796
  method: "tools/call",
789
797
  outcome: result.isError ? "tool_error" : "ok",
790
- durationMs: nowMs() - start
798
+ durationMs: nowMs() - start,
799
+ errorText: result.isError ? extractTextContent(result.content) : void 0
791
800
  });
792
801
  return Response.json({
793
802
  content: result.content ?? [],
@@ -1,6 +1,6 @@
1
1
  import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
2
2
  import { d as McpDefinition } from '../../types-CPkhCRxc.js';
3
- import { M as MetricsRecorder } from '../../base-C9rhAHZ0.js';
3
+ import { M as MetricsRecorder } from '../../base-CFy5vZ5Z.js';
4
4
  import 'zod';
5
5
 
6
6
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
2
2
  import { d as McpDefinition } from '../../types-CPkhCRxc.js';
3
- import { M as MetricsRecorder } from '../../base-C9rhAHZ0.js';
3
+ import { M as MetricsRecorder } from '../../base-CFy5vZ5Z.js';
4
4
  import 'zod';
5
5
 
6
6
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  createInvokeToolHandler
3
- } from "../../chunk-WKIXRW46.js";
3
+ } from "../../chunk-YQMS7A7Z.js";
4
4
  import {
5
5
  createListToolsHandler
6
- } from "../../chunk-7JJEPFSO.js";
6
+ } from "../../chunk-ICCGSB2E.js";
7
+ import "../../chunk-6QFZYYUV.js";
7
8
  import "../../chunk-MA5H6PSF.js";
8
- import "../../chunk-EPEEEI3C.js";
9
+ import "../../chunk-XIGO7RW6.js";
9
10
  import "../../chunk-H37EB22A.js";
10
11
  import "../../chunk-6DXGZZA4.js";
11
- import "../../chunk-FTTVLHNN.js";
12
+ import "../../chunk-QWVSMQJF.js";
12
13
  export {
13
14
  createInvokeToolHandler,
14
15
  createListToolsHandler
@@ -174,7 +174,7 @@ function describeError(err) {
174
174
  }
175
175
 
176
176
  // package.json
177
- var version = "0.20.0";
177
+ var version = "0.20.1-rc.1";
178
178
 
179
179
  // src/metrics/otlp.ts
180
180
  var SCOPE_NAME = "@lovable.dev/mcp-js";
@@ -281,7 +281,8 @@ var BaseMetricRecorder = class {
281
281
  method: ev.method,
282
282
  outcome: ev.outcome,
283
283
  durationMs: ev.durationMs,
284
- stack: this.stack
284
+ stack: this.stack,
285
+ ...ev.errorText !== void 0 && { errorText: ev.errorText }
285
286
  });
286
287
  if (!this.config.enabled)
287
288
  return;
@@ -877,6 +878,14 @@ var ToolContext = class {
877
878
  }
878
879
  };
879
880
 
881
+ // src/core/content.ts
882
+ function extractTextContent(content) {
883
+ if (!content)
884
+ return void 0;
885
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("\n").trim();
886
+ return text.length > 0 ? text : void 0;
887
+ }
888
+
880
889
  // src/core/cors.ts
881
890
  var EXPOSE_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
882
891
  var ALLOW_HEADERS = "Authorization, Content-Type, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID";
@@ -927,7 +936,8 @@ function adaptToolToSdkCallback(tool, auth, recorder) {
927
936
  tool: tool.name,
928
937
  method: "tools/call",
929
938
  outcome: result.isError ? "tool_error" : "ok",
930
- durationMs: nowMs() - start
939
+ durationMs: nowMs() - start,
940
+ errorText: result.isError ? extractTextContent(result.content) : void 0
931
941
  });
932
942
  return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
933
943
  };
@@ -1183,7 +1193,8 @@ function createInvokeToolHandler(mcp, options = {}) {
1183
1193
  tool: tool.name,
1184
1194
  method: "tools/call",
1185
1195
  outcome: result.isError ? "tool_error" : "ok",
1186
- durationMs: nowMs() - start
1196
+ durationMs: nowMs() - start,
1197
+ errorText: result.isError ? extractTextContent(result.content) : void 0
1187
1198
  });
1188
1199
  return Response.json({
1189
1200
  content: result.content ?? [],
@@ -3,21 +3,22 @@ import {
3
3
  } from "../../chunk-UQK5UO6C.js";
4
4
  import {
5
5
  createMcpProtocolHandler
6
- } from "../../chunk-WW7NRRCJ.js";
6
+ } from "../../chunk-YQFF4OCL.js";
7
7
  import {
8
8
  createOAuthProtectedResourceMetadataHandler
9
- } from "../../chunk-DUNDNXK5.js";
9
+ } from "../../chunk-PKYNTB7X.js";
10
10
  import {
11
11
  createInvokeToolHandler
12
- } from "../../chunk-WKIXRW46.js";
12
+ } from "../../chunk-YQMS7A7Z.js";
13
13
  import {
14
14
  createListToolsHandler
15
- } from "../../chunk-7JJEPFSO.js";
15
+ } from "../../chunk-ICCGSB2E.js";
16
+ import "../../chunk-6QFZYYUV.js";
16
17
  import "../../chunk-MA5H6PSF.js";
17
18
  import {
18
19
  assertResourcePathShape,
19
20
  createRecorderForRuntime
20
- } from "../../chunk-EPEEEI3C.js";
21
+ } from "../../chunk-XIGO7RW6.js";
21
22
  import {
22
23
  trimTrailingSlash
23
24
  } from "../../chunk-H37EB22A.js";
@@ -28,7 +29,7 @@ import {
28
29
  FUNCTIONS_MOUNT_PREFIX,
29
30
  assertFunctionName
30
31
  } from "../../chunk-XQWJN6DC.js";
31
- import "../../chunk-FTTVLHNN.js";
32
+ import "../../chunk-QWVSMQJF.js";
32
33
 
33
34
  // src/stacks/supabase/handler.ts
34
35
  function deriveResourcePath(options) {
@@ -33,7 +33,7 @@ var import_node_fs = require("fs");
33
33
  var import_node_path = require("path");
34
34
 
35
35
  // package.json
36
- var version = "0.20.0";
36
+ var version = "0.20.1-rc.1";
37
37
 
38
38
  // src/core/fs-errors.ts
39
39
  function isFileMissing(err) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../chunk-XQWJN6DC.js";
8
8
  import {
9
9
  version
10
- } from "../../chunk-FTTVLHNN.js";
10
+ } from "../../chunk-QWVSMQJF.js";
11
11
 
12
12
  // src/stacks/supabase/vite.ts
13
13
  import { resolve as resolve2, sep as sep2 } from "path";
@@ -129,7 +129,7 @@ function describeError(err) {
129
129
  }
130
130
 
131
131
  // package.json
132
- var version = "0.20.0";
132
+ var version = "0.20.1-rc.1";
133
133
 
134
134
  // src/metrics/otlp.ts
135
135
  var SCOPE_NAME = "@lovable.dev/mcp-js";
@@ -236,7 +236,8 @@ var BaseMetricRecorder = class {
236
236
  method: ev.method,
237
237
  outcome: ev.outcome,
238
238
  durationMs: ev.durationMs,
239
- stack: this.stack
239
+ stack: this.stack,
240
+ ...ev.errorText !== void 0 && { errorText: ev.errorText }
240
241
  });
241
242
  if (!this.config.enabled)
242
243
  return;
@@ -880,6 +881,14 @@ var ToolContext = class {
880
881
  }
881
882
  };
882
883
 
884
+ // src/core/content.ts
885
+ function extractTextContent(content) {
886
+ if (!content)
887
+ return void 0;
888
+ const text = content.filter((block) => block.type === "text").map((block) => block.text).join("\n").trim();
889
+ return text.length > 0 ? text : void 0;
890
+ }
891
+
883
892
  // src/core/cors.ts
884
893
  var EXPOSE_HEADERS = "WWW-Authenticate, Mcp-Session-Id, Mcp-Protocol-Version";
885
894
  var ALLOW_HEADERS = "Authorization, Content-Type, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID";
@@ -930,7 +939,8 @@ function adaptToolToSdkCallback(tool, auth, recorder) {
930
939
  tool: tool.name,
931
940
  method: "tools/call",
932
941
  outcome: result.isError ? "tool_error" : "ok",
933
- durationMs: nowMs() - start
942
+ durationMs: nowMs() - start,
943
+ errorText: result.isError ? extractTextContent(result.content) : void 0
934
944
  });
935
945
  return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
936
946
  };
@@ -1186,7 +1196,8 @@ function createInvokeToolHandler(mcp, options = {}) {
1186
1196
  tool: tool.name,
1187
1197
  method: "tools/call",
1188
1198
  outcome: result.isError ? "tool_error" : "ok",
1189
- durationMs: nowMs() - start
1199
+ durationMs: nowMs() - start,
1200
+ errorText: result.isError ? extractTextContent(result.content) : void 0
1190
1201
  });
1191
1202
  return Response.json({
1192
1203
  content: result.content ?? [],
@@ -3,23 +3,24 @@ import {
3
3
  } from "../../chunk-UQK5UO6C.js";
4
4
  import {
5
5
  createMcpProtocolHandler
6
- } from "../../chunk-WW7NRRCJ.js";
6
+ } from "../../chunk-YQFF4OCL.js";
7
7
  import {
8
8
  createOAuthProtectedResourceMetadataHandler
9
- } from "../../chunk-DUNDNXK5.js";
9
+ } from "../../chunk-PKYNTB7X.js";
10
10
  import {
11
11
  createInvokeToolHandler
12
- } from "../../chunk-WKIXRW46.js";
12
+ } from "../../chunk-YQMS7A7Z.js";
13
13
  import {
14
14
  createListToolsHandler
15
- } from "../../chunk-7JJEPFSO.js";
15
+ } from "../../chunk-ICCGSB2E.js";
16
+ import "../../chunk-6QFZYYUV.js";
16
17
  import "../../chunk-MA5H6PSF.js";
17
18
  import {
18
19
  createRecorderForRuntime
19
- } from "../../chunk-EPEEEI3C.js";
20
+ } from "../../chunk-XIGO7RW6.js";
20
21
  import "../../chunk-H37EB22A.js";
21
22
  import "../../chunk-6DXGZZA4.js";
22
- import "../../chunk-FTTVLHNN.js";
23
+ import "../../chunk-QWVSMQJF.js";
23
24
 
24
25
  // src/stacks/tanstack/handlers.ts
25
26
  var STACK = "tanstack";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.20.0",
3
+ "version": "0.20.1-rc.1",
4
4
  "description": "Author MCP servers for Lovable apps. Declare tools with defineTool, register them in defineMcp, and a framework adapter (TanStack or Supabase Edge Functions) emits the route(s) at build time.",
5
5
  "type": "module",
6
6
  "repository": {