@lovable.dev/mcp-js 3.2.2 → 3.3.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.
- package/README.md +19 -1
- package/dist/{authorize-DUEaDXjU.d.ts → authorize-BV62MDan.d.ts} +1 -1
- package/dist/{authorize-bDiUiJco.d.cts → authorize-CoaAw6wg.d.cts} +1 -1
- package/dist/{base-CLO7XsxC.d.ts → base-Cx0spfMk.d.ts} +1 -1
- package/dist/{base-D2d7lJY5.d.cts → base-CzWe8AD1.d.cts} +1 -1
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/{cors-NkrVgCH-.cjs → cors-3HjrsmEW.cjs} +1 -1
- package/dist/{cors-Bgfa7_s1.js → cors-CNNmKKIg.js} +1 -1
- package/dist/{errors-CLfxIB-l.cjs → errors-C97I7VOC.cjs} +23 -1
- package/dist/{errors-CljrUVby.js → errors-CIpFAb6i.js} +23 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{io-BCqgMODc.cjs → io-CaBSlPwS.cjs} +1 -1
- package/dist/{io-CKX89yXp.js → io-CahnhUhA.js} +1 -1
- package/dist/{io-CFyHLyvs.d.ts → io-D7cpdBJO.d.ts} +1 -1
- package/dist/{io-DfUvQ-SV.d.cts → io-DC-Y6R61.d.cts} +1 -1
- package/dist/{mcp-Dml0oUFG.js → mcp-DC8AoD18.js} +32 -12
- package/dist/{mcp-CdFFC4U3.cjs → mcp-DlWLIwX9.cjs} +31 -11
- package/dist/{package-dsaGuWL2.cjs → package-B488glmj.cjs} +1 -1
- package/dist/{package-00F1cYGw.js → package-CukfP_vq.js} +1 -1
- package/dist/protocols/mcp/index.cjs +1 -1
- package/dist/protocols/mcp/index.d.cts +3 -3
- package/dist/protocols/mcp/index.d.ts +3 -3
- package/dist/protocols/mcp/index.js +1 -1
- package/dist/protocols/oauth-metadata.cjs +1 -1
- package/dist/protocols/oauth-metadata.d.cts +3 -3
- package/dist/protocols/oauth-metadata.d.ts +3 -3
- package/dist/protocols/oauth-metadata.js +1 -1
- package/dist/stacks/supabase/index.cjs +2 -2
- package/dist/stacks/supabase/index.d.cts +1 -1
- package/dist/stacks/supabase/index.d.ts +1 -1
- package/dist/stacks/supabase/index.js +2 -2
- package/dist/stacks/supabase/vite.cjs +1 -1
- package/dist/stacks/supabase/vite.d.cts +1 -1
- package/dist/stacks/supabase/vite.d.ts +1 -1
- package/dist/stacks/supabase/vite.js +1 -1
- package/dist/stacks/tanstack/index.cjs +2 -2
- package/dist/stacks/tanstack/index.d.cts +2 -2
- package/dist/stacks/tanstack/index.d.ts +2 -2
- package/dist/stacks/tanstack/index.js +2 -2
- package/dist/stacks/tanstack/vite.d.cts +1 -1
- package/dist/stacks/tanstack/vite.d.ts +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/{types-CAFCH0yK.d.cts → types-z7T5bBIU.d.cts} +13 -3
- package/dist/{types-CAFCH0yK.d.ts → types-z7T5bBIU.d.ts} +13 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -46,6 +46,10 @@ Manifest extraction allows **512 tools** in the evaluated `defineMcp({ tools })`
|
|
|
46
46
|
|
|
47
47
|
`inputSchema` is closed: a `tools/call` carrying an argument key the schema does not declare fails in-band (`isError: true`, naming the key) instead of silently dropping it, and `tools/list` advertises `additionalProperties: false`. Set `strict: false` on a tool to accept and drop unknown keys instead.
|
|
48
48
|
|
|
49
|
+
MCP POST bodies default to **1 MiB** and tool arguments to **10,000 combined object members and array elements**. Larger bodies receive HTTP `413`; arguments over the element limit return a tool error before the handler runs. These defaults apply to both protocol eras, including Skills and app-context requests.
|
|
50
|
+
|
|
51
|
+
For tools that need larger inputs, set `limits` in `defineMcp`, for example `limits: { maxRequestBodySize: 4 * 1024 * 1024, maxToolInputElements: 50_000 }`. `maxRequestBodySize` is measured in bytes. Each override must be a positive safe integer; zero, fractional values, `NaN` and `Infinity` are rejected when the server is declared. Omitted fields keep their defaults. Hosting-provider limits still apply.
|
|
52
|
+
|
|
49
53
|
## Task workflows as skills
|
|
50
54
|
|
|
51
55
|
**Experimental:** Skills support follows the developing [MCP Skills extension](https://modelcontextprotocol.io/extensions/skills). Client support varies, and the integration may change as the specification evolves.
|
|
@@ -66,7 +70,7 @@ import refunds from "./skills/refunds?allowHidden=templates/.prettierrc&allowHid
|
|
|
66
70
|
|
|
67
71
|
Repeat `allowHidden` for each exact, case-sensitive file path relative to the skill directory. Directory-wide grants, globs, traversal paths, duplicate entries and entries that do not name an existing file are rejected. A hidden directory is traversed only for listed descendants; every file beneath it needs its own entry. An empty hidden directory fails too. Allowed files still pass the text-only and symlink checks. Combine `allowHidden` with `path` in either order, keeping `skill` last; percent-encode reserved characters in values (for example `%26` for `&` and `%25` for `%`).
|
|
68
72
|
|
|
69
|
-
Use dedicated publication directories without credentials or private documents. The allowlist prevents accidental hidden-file publication, not secrets in ordinary or explicitly approved files. Files use the same server-level OAuth and origin policy as tools;
|
|
73
|
+
Use dedicated publication directories without credentials or private documents. The allowlist prevents accidental hidden-file publication, not secrets in ordinary or explicitly approved files. Files use the same server-level OAuth and origin policy as tools. Tool visibility does not control Skill visibility; use a conditional Skill registration when callers need different procedures.
|
|
70
74
|
|
|
71
75
|
By default, `./skills/refunds?skill` publishes `skill://refunds/SKILL.md` and its supporting files. Use root-relative file references such as `references/rules.md` inside a skill. Reference a different skill with its complete URI; the host resolves it through `skills/get` and its skill-loading path. Reading `SKILL.md` as an ordinary resource does not activate it.
|
|
72
76
|
|
|
@@ -88,6 +92,20 @@ The server advertises the [Skills extension](https://modelcontextprotocol.io/ext
|
|
|
88
92
|
|
|
89
93
|
Fallback is reference text, not installation, execution or a permission grant. It preserves source text rather than summarizing it or rewriting links. A capable client that omits the declaration can receive both representations, even if its native skill loader is disabled. Host context limits still apply: the SDK does not truncate instructions or guarantee that a host will retain them. Build output lists published file sizes; the standard recommends at most 512 files and 16 MiB per skill, and fallback instructions should be substantially smaller for practical model context. Omit `skills` to retain existing tools-only behavior.
|
|
90
94
|
|
|
95
|
+
### Caller-specific skills
|
|
96
|
+
|
|
97
|
+
With SDK 3.3.0, mix unconditional imports with conditional registrations:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
skills: [memberGuide, { skill: adminGuide, enabled: ({ appContext }) => appContext.isAdmin }],
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use `defineMcp<AppContext>` and an authenticated `createAppContext`, as in [caller-dependent tool catalogs](#caller-dependent-tool-catalogs). Derive permissions from verified `auth`, not client metadata. `enabled` receives only `{ appContext }` and must be a pure synchronous boolean predicate. The SDK creates context once per protocol request that builds a server, shared with tools, including discovery, resource reads and static tool calls when conditional Skills are configured. A context or predicate failure fails the request with a redacted 500; asynchronous and non-boolean predicates are rejected. Unconditional-only servers retain their existing context-loading behavior.
|
|
104
|
+
|
|
105
|
+
Disabled registrations are absent from `skills/list` and unavailable through `skills/get`. Resources and fallback contain exactly the union of enabled bundles. Each enabled registration grants its entire recursive directory: an enabled parent still publishes a disabled child's files, including its `SKILL.md`, without registering that child as a Skill. Disabling a registration does not revoke copies independently published by another registration, another URI, or authored `instructions`. Keep restricted content outside directories granted to other callers. A reference requiring `skills/get` for a disabled registration cannot activate it, even if its text remains readable through a parent.
|
|
106
|
+
|
|
107
|
+
This selects static authored content; it does not generate personalized Skill text. Keep handler/service/RLS authorization independent. ChatGPT currently imports submission-time snapshots: do not rely on these predicates for per-user ChatGPT delivery or submit admin-only content assuming it will be filtered for later users.
|
|
108
|
+
|
|
91
109
|
## What the plugin emits
|
|
92
110
|
|
|
93
111
|
| URL | File | Purpose |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as McpProtocolEra } from "./types-z7T5bBIU.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" | "auth_token_expired" | "auth_token_invalid" | "auth_insufficient_scope" | "auth_unexpected_error" | "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 {
|
|
1
|
+
import { N as McpProtocolEra } from "./types-z7T5bBIU.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" | "auth_token_expired" | "auth_token_invalid" | "auth_insufficient_scope" | "auth_unexpected_error" | "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
|
|
@@ -7,7 +7,7 @@ import("zod/v3").catch((err) => {
|
|
|
7
7
|
}).then(() => import("vite").catch((err) => {
|
|
8
8
|
const message = err instanceof Error ? err.message : String(err);
|
|
9
9
|
throw new Error(`@lovable.dev/mcp-js requires vite >=5.0.0 <9.0.0 for manifest extraction. Install a compatible Vite version in the project (for example, npm install -D vite@^7) and include dev dependencies when running this command. Underlying error: ${message}`);
|
|
10
|
-
})).then(() => Promise.resolve().then(() => require("../io-
|
|
10
|
+
})).then(() => Promise.resolve().then(() => require("../io-CaBSlPwS.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
|
|
11
11
|
console.error(err instanceof Error ? err.message : String(err));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
|
@@ -7,7 +7,7 @@ import("zod/v3").catch((err) => {
|
|
|
7
7
|
}).then(() => import("vite").catch((err) => {
|
|
8
8
|
const message = err instanceof Error ? err.message : String(err);
|
|
9
9
|
throw new Error(`@lovable.dev/mcp-js requires vite >=5.0.0 <9.0.0 for manifest extraction. Install a compatible Vite version in the project (for example, npm install -D vite@^7) and include dev dependencies when running this command. Underlying error: ${message}`);
|
|
10
|
-
})).then(() => import("../io-
|
|
10
|
+
})).then(() => import("../io-CahnhUhA.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
|
|
11
11
|
console.error(err instanceof Error ? err.message : String(err));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-B488glmj.cjs");
|
|
3
3
|
require("./metadata-path-zd7NSNoa.cjs");
|
|
4
4
|
let jose = require("jose");
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import { t as version } from "./package-CukfP_vq.js";
|
|
3
3
|
import "./metadata-path-CAkNcfyY.js";
|
|
4
4
|
import { createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -16,6 +16,14 @@ function assertAppContextConfiguration(mcp) {
|
|
|
16
16
|
if (mcp.createAppContext && !mcp.auth) throw new Error(`@lovable.dev/mcp-js: createAppContext requires auth`);
|
|
17
17
|
if (!mcp.createAppContext && mcp.tools.some((tool) => tool.enabled || toolRequiresAppContext(tool))) throw new Error(`@lovable.dev/mcp-js: app-context or conditional tools require createAppContext`);
|
|
18
18
|
}
|
|
19
|
+
function assertLimits(limits) {
|
|
20
|
+
if (limits === void 0) return;
|
|
21
|
+
if (limits === null || typeof limits !== "object" || Array.isArray(limits)) throw new TypeError("@lovable.dev/mcp-js: limits must be an object");
|
|
22
|
+
for (const name of ["maxRequestBodySize", "maxToolInputElements"]) {
|
|
23
|
+
const value = limits[name];
|
|
24
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value <= 0)) throw new TypeError(`@lovable.dev/mcp-js: limits.${name} must be a positive safe integer`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
function assertNonEmptyString(label, value) {
|
|
20
28
|
if (value.trim() === "") throw new Error(`@lovable.dev/mcp-js: ${label} must not be empty`);
|
|
21
29
|
if (value !== value.trim()) throw new Error(`@lovable.dev/mcp-js: ${label} must not have leading or trailing whitespace`);
|
|
@@ -141,13 +149,27 @@ function defineMcp(def) {
|
|
|
141
149
|
assertAppContextConfiguration(def);
|
|
142
150
|
if (def.auth) assertOAuthConfig(def.auth);
|
|
143
151
|
assertAllowedOrigins(def.allowedOrigins);
|
|
152
|
+
assertLimits(def.limits);
|
|
144
153
|
assertToolSchemas(def);
|
|
145
154
|
require_logger.resolveMetricsConfig(def.metrics);
|
|
146
155
|
freezeAuth(def.auth);
|
|
156
|
+
if (def.limits) Object.freeze(def.limits);
|
|
147
157
|
if (Array.isArray(def.allowedOrigins)) Object.freeze(def.allowedOrigins);
|
|
148
158
|
Object.freeze(def.tools);
|
|
149
159
|
for (const tool of def.tools) Object.freeze(tool);
|
|
150
|
-
if (def.skills !== void 0)
|
|
160
|
+
if (def.skills !== void 0) {
|
|
161
|
+
if (!Array.isArray(def.skills)) throw new TypeError("@lovable.dev/mcp-js: skills must be an array of ?skill imports");
|
|
162
|
+
require_format.validateSkills(def.skills.map((entry) => {
|
|
163
|
+
if (entry && "skill" in entry) {
|
|
164
|
+
if (typeof entry.enabled !== "function") throw new TypeError("@lovable.dev/mcp-js: conditional skills require an enabled predicate");
|
|
165
|
+
if (!def.createAppContext) throw new Error("@lovable.dev/mcp-js: conditional skills require createAppContext");
|
|
166
|
+
Object.freeze(entry);
|
|
167
|
+
return entry.skill;
|
|
168
|
+
}
|
|
169
|
+
return entry;
|
|
170
|
+
}));
|
|
171
|
+
Object.freeze(def.skills);
|
|
172
|
+
}
|
|
151
173
|
return def;
|
|
152
174
|
}
|
|
153
175
|
//#endregion
|
|
@@ -16,6 +16,14 @@ function assertAppContextConfiguration(mcp) {
|
|
|
16
16
|
if (mcp.createAppContext && !mcp.auth) throw new Error(`@lovable.dev/mcp-js: createAppContext requires auth`);
|
|
17
17
|
if (!mcp.createAppContext && mcp.tools.some((tool) => tool.enabled || toolRequiresAppContext(tool))) throw new Error(`@lovable.dev/mcp-js: app-context or conditional tools require createAppContext`);
|
|
18
18
|
}
|
|
19
|
+
function assertLimits(limits) {
|
|
20
|
+
if (limits === void 0) return;
|
|
21
|
+
if (limits === null || typeof limits !== "object" || Array.isArray(limits)) throw new TypeError("@lovable.dev/mcp-js: limits must be an object");
|
|
22
|
+
for (const name of ["maxRequestBodySize", "maxToolInputElements"]) {
|
|
23
|
+
const value = limits[name];
|
|
24
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value <= 0)) throw new TypeError(`@lovable.dev/mcp-js: limits.${name} must be a positive safe integer`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
function assertNonEmptyString(label, value) {
|
|
20
28
|
if (value.trim() === "") throw new Error(`@lovable.dev/mcp-js: ${label} must not be empty`);
|
|
21
29
|
if (value !== value.trim()) throw new Error(`@lovable.dev/mcp-js: ${label} must not have leading or trailing whitespace`);
|
|
@@ -141,13 +149,27 @@ function defineMcp(def) {
|
|
|
141
149
|
assertAppContextConfiguration(def);
|
|
142
150
|
if (def.auth) assertOAuthConfig(def.auth);
|
|
143
151
|
assertAllowedOrigins(def.allowedOrigins);
|
|
152
|
+
assertLimits(def.limits);
|
|
144
153
|
assertToolSchemas(def);
|
|
145
154
|
resolveMetricsConfig(def.metrics);
|
|
146
155
|
freezeAuth(def.auth);
|
|
156
|
+
if (def.limits) Object.freeze(def.limits);
|
|
147
157
|
if (Array.isArray(def.allowedOrigins)) Object.freeze(def.allowedOrigins);
|
|
148
158
|
Object.freeze(def.tools);
|
|
149
159
|
for (const tool of def.tools) Object.freeze(tool);
|
|
150
|
-
if (def.skills !== void 0)
|
|
160
|
+
if (def.skills !== void 0) {
|
|
161
|
+
if (!Array.isArray(def.skills)) throw new TypeError("@lovable.dev/mcp-js: skills must be an array of ?skill imports");
|
|
162
|
+
validateSkills(def.skills.map((entry) => {
|
|
163
|
+
if (entry && "skill" in entry) {
|
|
164
|
+
if (typeof entry.enabled !== "function") throw new TypeError("@lovable.dev/mcp-js: conditional skills require an enabled predicate");
|
|
165
|
+
if (!def.createAppContext) throw new Error("@lovable.dev/mcp-js: conditional skills require createAppContext");
|
|
166
|
+
Object.freeze(entry);
|
|
167
|
+
return entry.skill;
|
|
168
|
+
}
|
|
169
|
+
return entry;
|
|
170
|
+
}));
|
|
171
|
+
Object.freeze(def.skills);
|
|
172
|
+
}
|
|
151
173
|
return def;
|
|
152
174
|
}
|
|
153
175
|
//#endregion
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_errors = require("./errors-
|
|
3
|
+
const require_errors = require("./errors-C97I7VOC.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
|
|
1
|
+
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-z7T5bBIU.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
|
|
@@ -76,4 +76,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
|
|
|
76
76
|
*/
|
|
77
77
|
declare function setLogLevel(level: LogLevel): LogLevel;
|
|
78
78
|
//#endregion
|
|
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 Skill, 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 ConditionalSkill, 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 Skill, 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
|
|
1
|
+
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-z7T5bBIU.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
|
|
@@ -76,4 +76,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
|
|
|
76
76
|
*/
|
|
77
77
|
declare function setLogLevel(level: LogLevel): LogLevel;
|
|
78
78
|
//#endregion
|
|
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 Skill, 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 ConditionalSkill, 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 Skill, 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
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-
|
|
2
|
+
import { a as ToolContext, i as AuthContext, o as defineMcp, s as defineTool, t as ToolError } from "./errors-CIpFAb6i.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,5 +1,5 @@
|
|
|
1
1
|
const require_schema = require("./schema-DNMsvJwE.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-B488glmj.cjs");
|
|
3
3
|
const require_hooks = require("./hooks-xQl3EkDa.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as jsonSchemaFromDefinition } from "./schema-JK_1KkOa.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-CukfP_vq.js";
|
|
3
3
|
import { a as isFileMissing, i as readSupabaseProjectRef, r as skillImportVitePlugin } from "./hooks-BOdDe251.js";
|
|
4
4
|
import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as log, r as describeError } from "./logger-CpLgYbCG.js";
|
|
2
2
|
import { n as schemaFromDefinition, t as jsonSchemaFromDefinition } from "./schema-JK_1KkOa.js";
|
|
3
|
-
import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-
|
|
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-
|
|
3
|
+
import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-CIpFAb6i.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-CNNmKKIg.js";
|
|
5
5
|
import { t as finalizeToolResult } from "./tool-result-DcNioyiI.js";
|
|
6
6
|
import { safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
7
|
-
import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, ProtocolError, ProtocolErrorCode, createMcpHandler } from "@modelcontextprotocol/server";
|
|
7
|
+
import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, ProtocolError, ProtocolErrorCode, createMcpHandler, readRequestBody } from "@modelcontextprotocol/server";
|
|
8
8
|
//#region src/core/content.ts
|
|
9
9
|
/** Join the text of a result's `type: "text"` blocks into one string, dropping
|
|
10
10
|
* binary/resource blocks. Used to surface a `tool_error` message in the local
|
|
@@ -74,6 +74,7 @@ function prepareSkills(serverName, importedSkills) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function composeInstructions(authored, prepared, declared) {
|
|
77
|
+
if (prepared.skills.length === 0) return authored;
|
|
77
78
|
const addition = declared ? prepared.indexText : prepared.fallbackText;
|
|
78
79
|
return authored.length > 0 ? `${authored}\n\n${addition}` : addition;
|
|
79
80
|
}
|
|
@@ -143,9 +144,11 @@ async function withAppContextError(run) {
|
|
|
143
144
|
throw new AppContextError(cause);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
async function classifyRequest(request) {
|
|
147
|
+
async function classifyRequest(request, maxRequestBodySize) {
|
|
147
148
|
try {
|
|
148
|
-
const
|
|
149
|
+
const body = await readRequestBody(request.clone(), maxRequestBodySize);
|
|
150
|
+
if (body.tooLarge) return { operations: NO_OPERATIONS };
|
|
151
|
+
const parsedBody = JSON.parse(body.text);
|
|
149
152
|
const calledTools = /* @__PURE__ */ new Set();
|
|
150
153
|
return {
|
|
151
154
|
operations: {
|
|
@@ -388,19 +391,33 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
388
391
|
const calledTools = operations ? mcp.tools.filter((tool) => operations.calledTools.has(tool.name)) : mcp.tools;
|
|
389
392
|
const selectedTools = !operations || operations.listTools ? mcp.tools : calledTools;
|
|
390
393
|
const hasConditionalTools = mcp.tools.some((tool) => tool.enabled !== void 0);
|
|
391
|
-
const needsAppContext = operations?.listTools === true && hasConditionalTools || calledTools.some((tool) => tool.enabled !== void 0 || toolRequiresAppContext(tool));
|
|
394
|
+
const needsAppContext = skills !== void 0 && skills.prepared === void 0 || operations?.listTools === true && hasConditionalTools || calledTools.some((tool) => tool.enabled !== void 0 || toolRequiresAppContext(tool));
|
|
392
395
|
const { createAppContext } = mcp;
|
|
393
396
|
const appContext = needsAppContext && createAppContext ? await withAppContextError(() => createAppContext({
|
|
394
397
|
auth: new AuthContext(auth),
|
|
395
398
|
signal
|
|
396
399
|
})) : void 0;
|
|
397
400
|
const visibilityContext = Object.freeze({ appContext });
|
|
401
|
+
let preparedSkills = skills?.prepared;
|
|
402
|
+
if (skills && !preparedSkills) {
|
|
403
|
+
const enabledSkills = await withAppContextError(() => mcp.skills.flatMap((entry) => {
|
|
404
|
+
if (!("skill" in entry)) return [entry];
|
|
405
|
+
const enabled = entry.enabled(visibilityContext);
|
|
406
|
+
if (typeof enabled !== "boolean") {
|
|
407
|
+
Promise.resolve(enabled).catch(() => {});
|
|
408
|
+
throw new TypeError("@lovable.dev/mcp-js: skill enabled must return a boolean synchronously");
|
|
409
|
+
}
|
|
410
|
+
return enabled ? [entry.skill] : [];
|
|
411
|
+
}));
|
|
412
|
+
preparedSkills = prepareSkills(mcp.name, enabledSkills);
|
|
413
|
+
}
|
|
398
414
|
const server = new McpServer({
|
|
399
415
|
name: mcp.name,
|
|
400
416
|
version: mcp.version,
|
|
401
417
|
title: mcp.title
|
|
402
418
|
}, {
|
|
403
|
-
|
|
419
|
+
maxToolInputElements: mcp.limits?.maxToolInputElements ?? 1e4,
|
|
420
|
+
instructions: preparedSkills ? composeInstructions(mcp.instructions, preparedSkills, skills.declared) : mcp.instructions,
|
|
404
421
|
capabilities: skills ? {
|
|
405
422
|
tools: { listChanged: false },
|
|
406
423
|
resources: {
|
|
@@ -424,7 +441,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
424
441
|
} : {}
|
|
425
442
|
}
|
|
426
443
|
});
|
|
427
|
-
if (
|
|
444
|
+
if (preparedSkills) registerSkills(server, preparedSkills, era);
|
|
428
445
|
for (const tool of selectedTools) {
|
|
429
446
|
if (tool.enabled) {
|
|
430
447
|
const { enabled } = tool;
|
|
@@ -458,7 +475,9 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
458
475
|
*/
|
|
459
476
|
function createMcpProtocolHandler(mcp, options = {}) {
|
|
460
477
|
const authorizer = createRequestAuthorizer(mcp, options);
|
|
461
|
-
const
|
|
478
|
+
const maxRequestBodySize = mcp.limits?.maxRequestBodySize ?? 1024 * 1024;
|
|
479
|
+
const hasSkills = mcp.skills !== void 0 && mcp.skills.length > 0;
|
|
480
|
+
const preparedSkills = mcp.skills?.length && mcp.skills.every((entry) => !("skill" in entry)) ? prepareSkills(mcp.name, mcp.skills) : void 0;
|
|
462
481
|
const handle = async (request, authResult, recorder) => {
|
|
463
482
|
let protocolError;
|
|
464
483
|
const reportTransportError = async (error) => {
|
|
@@ -476,14 +495,15 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
476
495
|
});
|
|
477
496
|
};
|
|
478
497
|
try {
|
|
479
|
-
const classified = mcp.createAppContext ||
|
|
498
|
+
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request, maxRequestBodySize) : void 0;
|
|
480
499
|
const operations = mcp.createAppContext ? classified?.operations : void 0;
|
|
481
|
-
const skills =
|
|
500
|
+
const skills = hasSkills ? {
|
|
482
501
|
prepared: preparedSkills,
|
|
483
|
-
|
|
502
|
+
declared: declaresSkillsSupport(classified?.parsedBody)
|
|
484
503
|
} : void 0;
|
|
485
504
|
const response = await createMcpHandler(({ era, requestInfo }) => buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills), {
|
|
486
505
|
legacy: "stateless",
|
|
506
|
+
maxRequestBodySize,
|
|
487
507
|
maxSubscriptions: 0,
|
|
488
508
|
onerror: (error) => {
|
|
489
509
|
protocolError = error;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_schema = require("./schema-DNMsvJwE.cjs");
|
|
2
2
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_errors = require("./errors-
|
|
4
|
-
const require_cors = require("./cors-
|
|
3
|
+
const require_errors = require("./errors-C97I7VOC.cjs");
|
|
4
|
+
const require_cors = require("./cors-3HjrsmEW.cjs");
|
|
5
5
|
const require_tool_result = require("./tool-result-rU-PpNNi.cjs");
|
|
6
6
|
let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
|
|
7
7
|
let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
|
|
@@ -74,6 +74,7 @@ function prepareSkills(serverName, importedSkills) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function composeInstructions(authored, prepared, declared) {
|
|
77
|
+
if (prepared.skills.length === 0) return authored;
|
|
77
78
|
const addition = declared ? prepared.indexText : prepared.fallbackText;
|
|
78
79
|
return authored.length > 0 ? `${authored}\n\n${addition}` : addition;
|
|
79
80
|
}
|
|
@@ -143,9 +144,11 @@ async function withAppContextError(run) {
|
|
|
143
144
|
throw new AppContextError(cause);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
async function classifyRequest(request) {
|
|
147
|
+
async function classifyRequest(request, maxRequestBodySize) {
|
|
147
148
|
try {
|
|
148
|
-
const
|
|
149
|
+
const body = await (0, _modelcontextprotocol_server.readRequestBody)(request.clone(), maxRequestBodySize);
|
|
150
|
+
if (body.tooLarge) return { operations: NO_OPERATIONS };
|
|
151
|
+
const parsedBody = JSON.parse(body.text);
|
|
149
152
|
const calledTools = /* @__PURE__ */ new Set();
|
|
150
153
|
return {
|
|
151
154
|
operations: {
|
|
@@ -388,19 +391,33 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
388
391
|
const calledTools = operations ? mcp.tools.filter((tool) => operations.calledTools.has(tool.name)) : mcp.tools;
|
|
389
392
|
const selectedTools = !operations || operations.listTools ? mcp.tools : calledTools;
|
|
390
393
|
const hasConditionalTools = mcp.tools.some((tool) => tool.enabled !== void 0);
|
|
391
|
-
const needsAppContext = operations?.listTools === true && hasConditionalTools || calledTools.some((tool) => tool.enabled !== void 0 || require_errors.toolRequiresAppContext(tool));
|
|
394
|
+
const needsAppContext = skills !== void 0 && skills.prepared === void 0 || operations?.listTools === true && hasConditionalTools || calledTools.some((tool) => tool.enabled !== void 0 || require_errors.toolRequiresAppContext(tool));
|
|
392
395
|
const { createAppContext } = mcp;
|
|
393
396
|
const appContext = needsAppContext && createAppContext ? await withAppContextError(() => createAppContext({
|
|
394
397
|
auth: new require_errors.AuthContext(auth),
|
|
395
398
|
signal
|
|
396
399
|
})) : void 0;
|
|
397
400
|
const visibilityContext = Object.freeze({ appContext });
|
|
401
|
+
let preparedSkills = skills?.prepared;
|
|
402
|
+
if (skills && !preparedSkills) {
|
|
403
|
+
const enabledSkills = await withAppContextError(() => mcp.skills.flatMap((entry) => {
|
|
404
|
+
if (!("skill" in entry)) return [entry];
|
|
405
|
+
const enabled = entry.enabled(visibilityContext);
|
|
406
|
+
if (typeof enabled !== "boolean") {
|
|
407
|
+
Promise.resolve(enabled).catch(() => {});
|
|
408
|
+
throw new TypeError("@lovable.dev/mcp-js: skill enabled must return a boolean synchronously");
|
|
409
|
+
}
|
|
410
|
+
return enabled ? [entry.skill] : [];
|
|
411
|
+
}));
|
|
412
|
+
preparedSkills = prepareSkills(mcp.name, enabledSkills);
|
|
413
|
+
}
|
|
398
414
|
const server = new _modelcontextprotocol_server.McpServer({
|
|
399
415
|
name: mcp.name,
|
|
400
416
|
version: mcp.version,
|
|
401
417
|
title: mcp.title
|
|
402
418
|
}, {
|
|
403
|
-
|
|
419
|
+
maxToolInputElements: mcp.limits?.maxToolInputElements ?? 1e4,
|
|
420
|
+
instructions: preparedSkills ? composeInstructions(mcp.instructions, preparedSkills, skills.declared) : mcp.instructions,
|
|
404
421
|
capabilities: skills ? {
|
|
405
422
|
tools: { listChanged: false },
|
|
406
423
|
resources: {
|
|
@@ -424,7 +441,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
424
441
|
} : {}
|
|
425
442
|
}
|
|
426
443
|
});
|
|
427
|
-
if (
|
|
444
|
+
if (preparedSkills) registerSkills(server, preparedSkills, era);
|
|
428
445
|
for (const tool of selectedTools) {
|
|
429
446
|
if (tool.enabled) {
|
|
430
447
|
const { enabled } = tool;
|
|
@@ -458,7 +475,9 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
458
475
|
*/
|
|
459
476
|
function createMcpProtocolHandler(mcp, options = {}) {
|
|
460
477
|
const authorizer = require_cors.createRequestAuthorizer(mcp, options);
|
|
461
|
-
const
|
|
478
|
+
const maxRequestBodySize = mcp.limits?.maxRequestBodySize ?? 1024 * 1024;
|
|
479
|
+
const hasSkills = mcp.skills !== void 0 && mcp.skills.length > 0;
|
|
480
|
+
const preparedSkills = mcp.skills?.length && mcp.skills.every((entry) => !("skill" in entry)) ? prepareSkills(mcp.name, mcp.skills) : void 0;
|
|
462
481
|
const handle = async (request, authResult, recorder) => {
|
|
463
482
|
let protocolError;
|
|
464
483
|
const reportTransportError = async (error) => {
|
|
@@ -476,14 +495,15 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
476
495
|
});
|
|
477
496
|
};
|
|
478
497
|
try {
|
|
479
|
-
const classified = mcp.createAppContext ||
|
|
498
|
+
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request, maxRequestBodySize) : void 0;
|
|
480
499
|
const operations = mcp.createAppContext ? classified?.operations : void 0;
|
|
481
|
-
const skills =
|
|
500
|
+
const skills = hasSkills ? {
|
|
482
501
|
prepared: preparedSkills,
|
|
483
|
-
|
|
502
|
+
declared: declaresSkillsSupport(classified?.parsedBody)
|
|
484
503
|
} : void 0;
|
|
485
504
|
const response = await (0, _modelcontextprotocol_server.createMcpHandler)(({ era, requestInfo }) => buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills), {
|
|
486
505
|
legacy: "stateless",
|
|
506
|
+
maxRequestBodySize,
|
|
487
507
|
maxSubscriptions: 0,
|
|
488
508
|
onerror: (error) => {
|
|
489
509
|
protocolError = error;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-CzWe8AD1.cjs";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CoaAw6wg.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 {
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-Cx0spfMk.js";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BV62MDan.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-
|
|
1
|
+
import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.js";
|
|
2
2
|
export { createMcpProtocolHandler };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("../logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_cors = require("../cors-
|
|
3
|
+
const require_cors = require("../cors-3HjrsmEW.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 {
|
|
2
|
-
import { t as MetricsRecorder } from "../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../types-z7T5bBIU.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../base-CzWe8AD1.cjs";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-CoaAw6wg.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 {
|
|
2
|
-
import { t as MetricsRecorder } from "../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../types-z7T5bBIU.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../base-Cx0spfMk.js";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-BV62MDan.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
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-
|
|
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-CNNmKKIg.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
2
|
const require_logger = require("../../logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_cors = require("../../cors-
|
|
3
|
+
const require_cors = require("../../cors-3HjrsmEW.cjs");
|
|
4
4
|
const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
|
|
5
|
-
const require_mcp = require("../../mcp-
|
|
5
|
+
const require_mcp = require("../../mcp-DlWLIwX9.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 {
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.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 {
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.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
1
|
import { s as trimTrailingSlash } from "../../logger-CpLgYbCG.js";
|
|
2
|
-
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-
|
|
2
|
+
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-CNNmKKIg.js";
|
|
3
3
|
import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
|
|
4
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
4
|
+
import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.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-
|
|
5
|
+
const require_package = require("../../package-B488glmj.cjs");
|
|
6
6
|
const require_hooks = require("../../hooks-xQl3EkDa.cjs");
|
|
7
7
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "../../package-
|
|
1
|
+
import { t as version } from "../../package-CukfP_vq.js";
|
|
2
2
|
import { a as isFileMissing, i as readSupabaseProjectRef, n as skillImportEsbuildPlugin, t as isSkillImportInput } from "../../hooks-BOdDe251.js";
|
|
3
3
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
4
4
|
import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cors = require("../../cors-
|
|
3
|
-
const require_mcp = require("../../mcp-
|
|
2
|
+
const require_cors = require("../../cors-3HjrsmEW.cjs");
|
|
3
|
+
const require_mcp = require("../../mcp-DlWLIwX9.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 {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.cjs";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CoaAw6wg.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 {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.js";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BV62MDan.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-
|
|
2
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
1
|
+
import { c as createRecorderForRuntime } from "../../cors-CNNmKKIg.js";
|
|
2
|
+
import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.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
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ZodOutputSchema } from "../types-z7T5bBIU.cjs";
|
|
2
2
|
import { n as McpCheckError, t as Diagnostic } from "../diagnostic-DRKjgCsW.cjs";
|
|
3
3
|
//#region src/testing/result.d.ts
|
|
4
4
|
interface ToolResultExpectation {
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as ZodOutputSchema } from "../types-z7T5bBIU.js";
|
|
2
2
|
import { n as McpCheckError, t as Diagnostic } from "../diagnostic-DRKjgCsW.js";
|
|
3
3
|
//#region src/testing/result.d.ts
|
|
4
4
|
interface ToolResultExpectation {
|
|
@@ -328,6 +328,11 @@ interface CreateAppContextInput {
|
|
|
328
328
|
interface ToolVisibilityContext<TAppContext> {
|
|
329
329
|
readonly appContext: TAppContext;
|
|
330
330
|
}
|
|
331
|
+
/** Publishes a static skill bundle only when the caller's app context permits it. */
|
|
332
|
+
interface ConditionalSkill<TAppContext> {
|
|
333
|
+
readonly skill: Skill;
|
|
334
|
+
readonly enabled: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
|
|
335
|
+
}
|
|
331
336
|
interface ToolDefinitionBase<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
|
|
332
337
|
readonly name: string;
|
|
333
338
|
/** Human-readable display name shown to the user in MCP clients. Required. */
|
|
@@ -393,6 +398,10 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
393
398
|
readonly auth?: McpAuthConfig;
|
|
394
399
|
/** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
|
|
395
400
|
readonly allowedOrigins?: McpAllowedOrigins;
|
|
401
|
+
readonly limits?: {
|
|
402
|
+
readonly maxRequestBodySize?: number;
|
|
403
|
+
readonly maxToolInputElements?: number;
|
|
404
|
+
};
|
|
396
405
|
/**
|
|
397
406
|
* Server-level prose the LLM reads as context for all tools on this server.
|
|
398
407
|
* Required for the same reason `ToolDefinition.description` is — optional
|
|
@@ -401,7 +410,7 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
401
410
|
*/
|
|
402
411
|
readonly instructions: string;
|
|
403
412
|
readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
|
|
404
|
-
readonly skills?: readonly Skill[];
|
|
413
|
+
readonly skills?: readonly (Skill | ConditionalSkill<TAppContext>)[];
|
|
405
414
|
/**
|
|
406
415
|
* Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
|
|
407
416
|
* `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
|
|
@@ -410,10 +419,11 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
410
419
|
readonly metrics?: MetricsConfig;
|
|
411
420
|
} & AppContextConfiguration<TAppContext>;
|
|
412
421
|
declare const McpDefinitionBrand: unique symbol;
|
|
413
|
-
type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools"> & {
|
|
422
|
+
type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools" | "skills"> & {
|
|
414
423
|
readonly createAppContext?: (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
|
|
415
424
|
readonly tools: readonly AnyToolDefinition[];
|
|
425
|
+
readonly skills?: readonly (Skill | ConditionalSkill<never>)[];
|
|
416
426
|
readonly [McpDefinitionBrand]: never;
|
|
417
427
|
};
|
|
418
428
|
//#endregion
|
|
419
|
-
export {
|
|
429
|
+
export { MetricsOptions as A, ToolHandlerResult as C, ZodSchema as D, ZodRawShape$1 as E, ToolContext as F, JwtClaims as I, McpAuthConfig as L, McpClientInfo as M, McpProtocolEra as N, Skill as O, ProgressUpdate as P, ToolDefinition as S, ZodOutputSchema as T, ResourceLink as _, ContentAnnotations as a, ToolAnnotations as b, EmbeddedBlobResource as c, ImageContent as d, JsonValue as f, McpDefinitionInput as g, McpDefinition as h, ConditionalSkill as i, AuthContext as j, MetricsConfig as k, EmbeddedResource as l, McpAllowedOrigins as m, AppContextToolDefinitionInput as n, ContentBlock as o, JsonValueInput as p, AudioContent as r, CreateAppContextInput as s, AppContextToolDefinition as t, EmbeddedTextResource as u, ResourceLinkIcon as v, ToolVisibilityContext as w, ToolContent as x, TextContent as y };
|
|
@@ -328,6 +328,11 @@ interface CreateAppContextInput {
|
|
|
328
328
|
interface ToolVisibilityContext<TAppContext> {
|
|
329
329
|
readonly appContext: TAppContext;
|
|
330
330
|
}
|
|
331
|
+
/** Publishes a static skill bundle only when the caller's app context permits it. */
|
|
332
|
+
interface ConditionalSkill<TAppContext> {
|
|
333
|
+
readonly skill: Skill;
|
|
334
|
+
readonly enabled: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
|
|
335
|
+
}
|
|
331
336
|
interface ToolDefinitionBase<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
|
|
332
337
|
readonly name: string;
|
|
333
338
|
/** Human-readable display name shown to the user in MCP clients. Required. */
|
|
@@ -393,6 +398,10 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
393
398
|
readonly auth?: McpAuthConfig;
|
|
394
399
|
/** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
|
|
395
400
|
readonly allowedOrigins?: McpAllowedOrigins;
|
|
401
|
+
readonly limits?: {
|
|
402
|
+
readonly maxRequestBodySize?: number;
|
|
403
|
+
readonly maxToolInputElements?: number;
|
|
404
|
+
};
|
|
396
405
|
/**
|
|
397
406
|
* Server-level prose the LLM reads as context for all tools on this server.
|
|
398
407
|
* Required for the same reason `ToolDefinition.description` is — optional
|
|
@@ -401,7 +410,7 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
401
410
|
*/
|
|
402
411
|
readonly instructions: string;
|
|
403
412
|
readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
|
|
404
|
-
readonly skills?: readonly Skill[];
|
|
413
|
+
readonly skills?: readonly (Skill | ConditionalSkill<TAppContext>)[];
|
|
405
414
|
/**
|
|
406
415
|
* Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
|
|
407
416
|
* `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
|
|
@@ -410,10 +419,11 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
410
419
|
readonly metrics?: MetricsConfig;
|
|
411
420
|
} & AppContextConfiguration<TAppContext>;
|
|
412
421
|
declare const McpDefinitionBrand: unique symbol;
|
|
413
|
-
type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools"> & {
|
|
422
|
+
type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools" | "skills"> & {
|
|
414
423
|
readonly createAppContext?: (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
|
|
415
424
|
readonly tools: readonly AnyToolDefinition[];
|
|
425
|
+
readonly skills?: readonly (Skill | ConditionalSkill<never>)[];
|
|
416
426
|
readonly [McpDefinitionBrand]: never;
|
|
417
427
|
};
|
|
418
428
|
//#endregion
|
|
419
|
-
export {
|
|
429
|
+
export { MetricsOptions as A, ToolHandlerResult as C, ZodSchema as D, ZodRawShape$1 as E, ToolContext as F, JwtClaims as I, McpAuthConfig as L, McpClientInfo as M, McpProtocolEra as N, Skill as O, ProgressUpdate as P, ToolDefinition as S, ZodOutputSchema as T, ResourceLink as _, ContentAnnotations as a, ToolAnnotations as b, EmbeddedBlobResource as c, ImageContent as d, JsonValue as f, McpDefinitionInput as g, McpDefinition as h, ConditionalSkill as i, AuthContext as j, MetricsConfig as k, EmbeddedResource as l, McpAllowedOrigins as m, AppContextToolDefinitionInput as n, ContentBlock as o, JsonValueInput as p, AudioContent as r, CreateAppContextInput as s, AppContextToolDefinition as t, EmbeddedTextResource as u, ResourceLinkIcon as v, ToolVisibilityContext as w, ToolContent as x, TextContent as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -139,10 +139,10 @@
|
|
|
139
139
|
],
|
|
140
140
|
"license": "MIT",
|
|
141
141
|
"dependencies": {
|
|
142
|
-
"@modelcontextprotocol/client": "2.3.
|
|
142
|
+
"@modelcontextprotocol/client": "2.3.1",
|
|
143
143
|
"@modelcontextprotocol/core": "2.3.0",
|
|
144
|
-
"@modelcontextprotocol/server": "2.
|
|
145
|
-
"@modelcontextprotocol/sdk": "1.
|
|
144
|
+
"@modelcontextprotocol/server": "~2.3.1",
|
|
145
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
146
146
|
"esbuild": "^0.27.0",
|
|
147
147
|
"jose": "^6.2.2",
|
|
148
148
|
"js-yaml": "^4.3.2"
|