@frontmcp/sdk 1.10.9-rc.2 → 1.10.9-rc.4

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 (44) hide show
  1. package/auth/auth-ui/auth-ui.render.d.ts.map +1 -1
  2. package/browser/auth/auth-ui/auth-ui.render.mjs +1 -4
  3. package/browser/builtin/config/providers/config-loader.mjs +1 -1
  4. package/browser/direct/direct-client.mjs +3 -6
  5. package/browser/esm-loader/semver.utils.mjs +9 -7
  6. package/browser/index.cjs +624 -594
  7. package/browser/skill/sep-2640/sep-2640.builders.mjs +1 -1
  8. package/browser/skill/skill-md-parser.mjs +1 -1
  9. package/browser/third-party/js-yaml.mjs +6 -0
  10. package/browser/third-party/semver.mjs +17 -0
  11. package/browser/third-party/uipack-render.mjs +6 -0
  12. package/browser/transport/adapters/transport.sse.adapter.mjs +17 -5
  13. package/browser/transport/in-memory-server.mjs +7 -15
  14. package/browser/transport/transport.registry.mjs +21 -17
  15. package/browser/transport/web-standard-mcp.mjs +1 -15
  16. package/builtin/config/providers/config-loader.d.ts.map +1 -1
  17. package/esm/index.mjs +17 -17
  18. package/esm-loader/semver.utils.d.ts.map +1 -1
  19. package/index.js +18 -18
  20. package/package.json +25 -10
  21. package/third-party/js-yaml.d.ts +2 -0
  22. package/third-party/js-yaml.d.ts.map +1 -0
  23. package/third-party/js-yaml.js +1 -0
  24. package/third-party/lazy-js-yaml.d.ts +2 -0
  25. package/third-party/lazy-js-yaml.d.ts.map +1 -0
  26. package/third-party/lazy-js-yaml.js +1 -0
  27. package/third-party/lazy-semver.d.ts +2 -0
  28. package/third-party/lazy-semver.d.ts.map +1 -0
  29. package/third-party/lazy-semver.js +1 -0
  30. package/third-party/lazy-uipack-render.d.ts +2 -0
  31. package/third-party/lazy-uipack-render.d.ts.map +1 -0
  32. package/third-party/lazy-uipack-render.js +1 -0
  33. package/third-party/semver.d.ts +8 -0
  34. package/third-party/semver.d.ts.map +1 -0
  35. package/third-party/semver.js +1 -0
  36. package/third-party/uipack-render.d.ts +2 -0
  37. package/third-party/uipack-render.d.ts.map +1 -0
  38. package/third-party/uipack-render.js +1 -0
  39. package/transport/adapters/transport.sse.adapter.d.ts +2 -1
  40. package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
  41. package/transport/in-memory-server.d.ts.map +1 -1
  42. package/transport/transport.registry.d.ts +3 -0
  43. package/transport/transport.registry.d.ts.map +1 -1
  44. package/transport/web-standard-mcp.d.ts.map +1 -1
@@ -1,5 +1,5 @@
1
1
  // libs/sdk/src/skill/sep-2640/sep-2640.builders.ts
2
- import * as yaml from "js-yaml";
2
+ import * as yaml from "../../third-party/js-yaml.mjs";
3
3
  import { SKILL_INDEX_SCHEMA_URI } from "./sep-2640.constants.mjs";
4
4
  import { buildSkillUri } from "./sep-2640.uri.mjs";
5
5
  function buildSkillMdIndexEntry(input) {
@@ -1,6 +1,6 @@
1
1
  // libs/sdk/src/skill/skill-md-parser.ts
2
- import * as yaml from "js-yaml";
3
2
  import { readFile } from "@frontmcp/utils";
3
+ import * as yaml from "../third-party/js-yaml.mjs";
4
4
  function parseSkillMdFrontmatter(content) {
5
5
  const trimmed = content.trimStart();
6
6
  if (!trimmed.startsWith("---")) {
@@ -0,0 +1,6 @@
1
+ // libs/sdk/src/third-party/js-yaml.ts
2
+ import { dump, load } from "js-yaml";
3
+ export {
4
+ dump,
5
+ load
6
+ };
@@ -0,0 +1,17 @@
1
+ // libs/sdk/src/third-party/semver.ts
2
+ import { default as default2 } from "semver/functions/compare.js";
3
+ import { default as default3 } from "semver/functions/gt.js";
4
+ import { default as default4 } from "semver/functions/rcompare.js";
5
+ import { default as default5 } from "semver/functions/satisfies.js";
6
+ import { default as default6 } from "semver/functions/valid.js";
7
+ import { default as default7 } from "semver/ranges/max-satisfying.js";
8
+ import { default as default8 } from "semver/ranges/valid.js";
9
+ export {
10
+ default2 as compare,
11
+ default3 as gt,
12
+ default7 as maxSatisfying,
13
+ default4 as rcompare,
14
+ default5 as satisfies,
15
+ default6 as valid,
16
+ default8 as validRange
17
+ };
@@ -0,0 +1,6 @@
1
+ // libs/sdk/src/third-party/uipack-render.ts
2
+ import { createResolverWithOverrides, renderComponent } from "@frontmcp/uipack";
3
+ export {
4
+ createResolverWithOverrides,
5
+ renderComponent
6
+ };
@@ -1,10 +1,19 @@
1
1
  // libs/sdk/src/transport/adapters/transport.sse.adapter.ts
2
2
  import { toJSONSchema } from "@frontmcp/lazy-zod";
3
3
  import { DEFAULT_ELICIT_TTL } from "../../elicitation/elicitation.types.mjs";
4
- import { ElicitationTimeoutError, InvalidInputError } from "../../errors/index.mjs";
4
+ import { ElicitationTimeoutError, InternalMcpError, InvalidInputError } from "../../errors/index.mjs";
5
5
  import { rpcRequest } from "../transport.error.mjs";
6
- import { RecreateableSSEServerTransport } from "./sse-transport.mjs";
7
6
  import { LocalTransportAdapter } from "./transport.local.adapter.mjs";
7
+ var RecreateableTransport;
8
+ async function loadSseTransport() {
9
+ RecreateableTransport ??= (await import("./sse-transport.mjs")).RecreateableSSEServerTransport;
10
+ }
11
+ function sseTransportClass() {
12
+ if (!RecreateableTransport) {
13
+ throw new InternalMcpError("The SSE transport was used before loadSseTransport() loaded it");
14
+ }
15
+ return RecreateableTransport;
16
+ }
8
17
  var TransportSSEAdapter = class extends LocalTransportAdapter {
9
18
  sessionId;
10
19
  /**
@@ -19,7 +28,8 @@ var TransportSSEAdapter = class extends LocalTransportAdapter {
19
28
  createTransport(sessionId, res) {
20
29
  this.sessionId = sessionId;
21
30
  this.logger.info(`new transport session: ${sessionId.slice(0, 40)}`);
22
- const transport = new RecreateableSSEServerTransport(`${this.scope.fullPath}/message`, res, {
31
+ const SseTransport = sseTransportClass();
32
+ const transport = new SseTransport(`${this.scope.fullPath}/message`, res, {
23
33
  sessionId
24
34
  });
25
35
  this.configureTransportHandlers(transport);
@@ -36,7 +46,8 @@ var TransportSSEAdapter = class extends LocalTransportAdapter {
36
46
  createTransportFromSession(sessionId, res, lastEventId) {
37
47
  this.sessionId = sessionId;
38
48
  this.logger.info(`recreating transport session: ${sessionId.slice(0, 40)}, lastEventId: ${lastEventId ?? "none"}`);
39
- const transport = new RecreateableSSEServerTransport(`${this.scope.fullPath}/message`, res, {
49
+ const SseTransport = sseTransportClass();
50
+ const transport = new SseTransport(`${this.scope.fullPath}/message`, res, {
40
51
  sessionId,
41
52
  initialEventId: lastEventId
42
53
  });
@@ -163,5 +174,6 @@ var TransportSSEAdapter = class extends LocalTransportAdapter {
163
174
  }
164
175
  };
165
176
  export {
166
- TransportSSEAdapter
177
+ TransportSSEAdapter,
178
+ loadSseTransport
167
179
  };
@@ -1,26 +1,18 @@
1
- var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
2
- const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
3
- // __frontmcpCreateRequire
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
-
11
1
  // libs/sdk/src/transport/in-memory-server.ts
12
2
  import { toJSONSchema } from "@frontmcp/lazy-zod";
3
+ import {
4
+ ElicitResultSchema,
5
+ ErrorCode,
6
+ InMemoryTransport,
7
+ McpError,
8
+ McpServer
9
+ } from "@frontmcp/protocol";
13
10
  import { randomUUID, runRequestExclusive } from "@frontmcp/utils";
14
11
  import { ELICITATION_META_KEY } from "../elicitation/elicitation-meta.mjs";
15
12
  import { ElicitationTimeoutError } from "../errors/index.mjs";
16
13
  import { composeCallerInstructions } from "../skill/skill-instructions.helper.mjs";
17
- import { importWithRequireFallback } from "../utils/dynamic-import.utils.mjs";
18
14
  import { buildScopedServerOptions } from "./build-scoped-server-options.mjs";
19
15
  async function createInMemoryServer(scope, options) {
20
- const { ElicitResultSchema, ErrorCode, InMemoryTransport, McpError, McpServer } = await importWithRequireFallback(
21
- () => import("@frontmcp/protocol"),
22
- () => __require("@frontmcp/protocol")
23
- );
24
16
  const { createMcpHandlers } = await import("./mcp-handlers/index.mjs");
25
17
  const sessionId = options?.sessionId ?? `in-memory:${randomUUID()}`;
26
18
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
@@ -4,6 +4,7 @@ import { createSessionStore } from "../auth/session/session-store.factory.mjs";
4
4
  import { isDeploymentSessionId } from "../auth/session/utils/session-id.utils.mjs";
5
5
  import { sessionIdPresentedBy } from "../common/utils/auth-info.utils.mjs";
6
6
  import { InvalidTransportSessionError, SessionClaimConflictError } from "../errors/transport.errors.mjs";
7
+ import { loadSseTransport } from "./adapters/transport.sse.adapter.mjs";
7
8
  import { loadStreamableHttpTransport } from "./adapters/transport.streamable-http.adapter.mjs";
8
9
  import HandleMcp20260728Flow from "./flows/handle.mcp-20260728.flow.mjs";
9
10
  import HandleSseFlow from "./flows/handle.sse.flow.mjs";
@@ -72,10 +73,12 @@ var TransportService = class {
72
73
  * Key: JSON-encoded {t: type, h: tokenHash, s: sessionId}, Value: Promise that resolves when creation completes
73
74
  */
74
75
  creationMutex = /* @__PURE__ */ new Map();
75
- // The Streamable HTTP transport class loads with the first session that uses it, so stdio and SSE servers never load it.
76
+ // Each transport class loads with the first session that uses it, so a stdio server loads neither.
76
77
  async newLocalTransporter(key, res, onDispose) {
77
78
  if (key.type === "streamable-http" || key.type === "stateless-http") {
78
79
  await loadStreamableHttpTransport();
80
+ } else if (key.type === "sse") {
81
+ await loadSseTransport();
79
82
  }
80
83
  return new LocalTransporter(this.scope, key, res, onDispose);
81
84
  }
@@ -850,30 +853,31 @@ var TransportService = class {
850
853
  * All anonymous requests share the same transport instance.
851
854
  */
852
855
  async getOrCreateAnonymousStatelessTransport(type, res) {
853
- const key = this.keyOf(type, "__anonymous__", STATELESS_SESSION_ID);
854
- const existing = this.lookupLocal(key);
855
- if (existing) return existing;
856
- const transporter = await this.newLocalTransporter(key, res, () => {
857
- this.evictLocal(key);
858
- if (this.distributed && this.bus) {
859
- this.bus.revoke(key).catch(() => void 0);
860
- }
861
- });
862
- await transporter.ready();
863
- this.insertLocal(key, transporter);
864
- if (this.distributed && this.bus) {
865
- await this.bus.advertise(key);
866
- }
867
- return transporter;
856
+ return this.getOrCreateStatelessTransport(this.keyOf(type, "__anonymous__", STATELESS_SESSION_ID), res);
868
857
  }
869
858
  /**
870
859
  * Get or create a singleton transport for authenticated stateless requests.
871
860
  * Each unique token gets its own singleton transport.
872
861
  */
873
862
  async getOrCreateAuthenticatedStatelessTransport(type, token, res) {
874
- const key = this.keyOf(type, token, STATELESS_SESSION_ID);
863
+ return this.getOrCreateStatelessTransport(this.keyOf(type, token, STATELESS_SESSION_ID), res);
864
+ }
865
+ /** Concurrent first requests share one creation, so a second transport never replaces the first and gets evicted with it. */
866
+ async getOrCreateStatelessTransport(key, res) {
875
867
  const existing = this.lookupLocal(key);
876
868
  if (existing) return existing;
869
+ const mutexKey = JSON.stringify({ t: key.type, h: key.tokenHash, s: key.sessionId });
870
+ const pendingCreation = this.creationMutex.get(mutexKey);
871
+ if (pendingCreation) return pendingCreation;
872
+ const creationPromise = this.doCreateStatelessTransport(key, res);
873
+ this.creationMutex.set(mutexKey, creationPromise);
874
+ try {
875
+ return await creationPromise;
876
+ } finally {
877
+ this.creationMutex.delete(mutexKey);
878
+ }
879
+ }
880
+ async doCreateStatelessTransport(key, res) {
877
881
  const transporter = await this.newLocalTransporter(key, res, () => {
878
882
  this.evictLocal(key);
879
883
  if (this.distributed && this.bus) {
@@ -1,24 +1,10 @@
1
- var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
2
- const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
3
- // __frontmcpCreateRequire
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
-
11
1
  // libs/sdk/src/transport/web-standard-mcp.ts
2
+ import { McpServer, WebStandardStreamableHTTPServerTransport } from "@frontmcp/protocol";
12
3
  import { randomUUID } from "@frontmcp/utils";
13
4
  import { composeCallerInstructions } from "../skill/skill-instructions.helper.mjs";
14
- import { importWithRequireFallback } from "../utils/dynamic-import.utils.mjs";
15
5
  import { mcpTransportBodyLimit } from "./body-limit.mjs";
16
6
  import { buildScopedServerOptions } from "./build-scoped-server-options.mjs";
17
7
  async function wireServer(scope, serverOptions, sessionId, sessionIdGenerator, enableJsonResponse) {
18
- const { McpServer, WebStandardStreamableHTTPServerTransport } = await importWithRequireFallback(
19
- () => import("@frontmcp/protocol"),
20
- () => __require("@frontmcp/protocol")
21
- );
22
8
  const { createMcpHandlers } = await import("./mcp-handlers/index.mjs");
23
9
  const mcpServer = new McpServer(scope.metadata.info, serverOptions);
24
10
  const composeInstructions = (caller) => composeCallerInstructions(scope, { ctx: caller, skillUriHints: true });
@@ -1 +1 @@
1
- {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../src/builtin/config/providers/config-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAUzD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yGAAyG;IACzG,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,CAAC,CAAC,CAiDZ;AA8DD;;;;;;;;GAQG;AACH,iBAAS,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2B5G;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../src/builtin/config/providers/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAK5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAUzD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yGAAyG;IACzG,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,CAAC,CAAC,CAiDZ;AA8DD;;;;;;;;GAQG;AACH,iBAAS,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2B5G;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}