@frontmcp/sdk 1.0.0-beta.7 → 1.0.0-beta.8
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/esm/index.mjs +152 -80
- package/front-mcp/front-mcp.d.ts +2 -2
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.js +152 -80
- package/notification/notification.service.d.ts +5 -1
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +8 -8
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts +50 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
package/esm/index.mjs
CHANGED
|
@@ -7722,8 +7722,9 @@ var init_notification_service = __esm({
|
|
|
7722
7722
|
emergency: 7
|
|
7723
7723
|
};
|
|
7724
7724
|
NotificationService = class _NotificationService {
|
|
7725
|
-
constructor(scope) {
|
|
7725
|
+
constructor(scope, options = {}) {
|
|
7726
7726
|
this.scope = scope;
|
|
7727
|
+
this.options = options;
|
|
7727
7728
|
this.logger = scope.logger.child("NotificationService");
|
|
7728
7729
|
}
|
|
7729
7730
|
logger;
|
|
@@ -7740,6 +7741,9 @@ var init_notification_service = __esm({
|
|
|
7740
7741
|
terminatedSessions = /* @__PURE__ */ new Set();
|
|
7741
7742
|
/** Maximum number of terminated sessions to track before eviction */
|
|
7742
7743
|
static MAX_TERMINATED_SESSIONS = 1e4;
|
|
7744
|
+
get maxTerminatedSessions() {
|
|
7745
|
+
return this.options.maxTerminatedSessions ?? _NotificationService.MAX_TERMINATED_SESSIONS;
|
|
7746
|
+
}
|
|
7743
7747
|
/**
|
|
7744
7748
|
* Initialize the notification service and subscribe to registry changes.
|
|
7745
7749
|
* Called after all registries are ready.
|
|
@@ -7821,7 +7825,7 @@ var init_notification_service = __esm({
|
|
|
7821
7825
|
const wasRegistered = this.unregisterServer(sessionId);
|
|
7822
7826
|
this.scope.providers.cleanupSession(sessionId);
|
|
7823
7827
|
this.logger.verbose(`Cleaned up provider cache for terminated session: ${sessionId.slice(0, 20)}...`);
|
|
7824
|
-
if (this.terminatedSessions.size >=
|
|
7828
|
+
if (this.terminatedSessions.size >= this.maxTerminatedSessions) {
|
|
7825
7829
|
const oldest = this.terminatedSessions.values().next().value;
|
|
7826
7830
|
if (oldest) {
|
|
7827
7831
|
this.terminatedSessions.delete(oldest);
|
|
@@ -27905,6 +27909,16 @@ var init_http_request_flow = __esm({
|
|
|
27905
27909
|
this.respond(httpRespond.notFound("Session not found"));
|
|
27906
27910
|
return;
|
|
27907
27911
|
}
|
|
27912
|
+
const authorization = request[ServerRequestTokens.auth];
|
|
27913
|
+
if (authorization?.token) {
|
|
27914
|
+
const transportService = this.scope.transportService;
|
|
27915
|
+
for (const protocol of ["streamable-http", "sse"]) {
|
|
27916
|
+
try {
|
|
27917
|
+
await transportService.destroyTransporter(protocol, authorization.token, sessionId);
|
|
27918
|
+
} catch {
|
|
27919
|
+
}
|
|
27920
|
+
}
|
|
27921
|
+
}
|
|
27908
27922
|
this.logger.info(`[${this.requestId}] Session terminated: ${sessionId}`);
|
|
27909
27923
|
this.respond(httpRespond.noContent());
|
|
27910
27924
|
} catch (error) {
|
|
@@ -29523,8 +29537,13 @@ var init_transport_local_adapter = __esm({
|
|
|
29523
29537
|
}
|
|
29524
29538
|
ensureAuthInfo(req, transport) {
|
|
29525
29539
|
const { token, user, session } = req[ServerRequestTokens.auth];
|
|
29526
|
-
|
|
29527
|
-
|
|
29540
|
+
if (!session?.id) {
|
|
29541
|
+
throw new Error(
|
|
29542
|
+
"Session ID is required in ensureAuthInfo. This indicates a bug in session propagation \u2014 the session should have been set by the flow."
|
|
29543
|
+
);
|
|
29544
|
+
}
|
|
29545
|
+
const sessionId = session.id;
|
|
29546
|
+
const sessionPayload = session.payload ?? { protocol: "streamable-http" };
|
|
29528
29547
|
if (this.initSessionPayload) {
|
|
29529
29548
|
const init = this.initSessionPayload;
|
|
29530
29549
|
if (init.supportsElicitation !== void 0 && sessionPayload.supportsElicitation === void 0) {
|
|
@@ -31789,6 +31808,79 @@ var init_ext_apps2 = __esm({
|
|
|
31789
31808
|
// libs/sdk/src/transport/flows/handle.streamable-http.flow.ts
|
|
31790
31809
|
import { z as z62 } from "zod";
|
|
31791
31810
|
import { ElicitResultSchema as ElicitResultSchema2, RequestSchema, CallToolResultSchema as CallToolResultSchema3 } from "@frontmcp/protocol";
|
|
31811
|
+
function resolveStreamableHttpSession(params) {
|
|
31812
|
+
const { rawHeader, authorizationSession, createSession } = params;
|
|
31813
|
+
const rawMcpSessionHeader = typeof rawHeader === "string" ? rawHeader : void 0;
|
|
31814
|
+
const mcpSessionHeader = validateMcpSessionHeader(rawMcpSessionHeader);
|
|
31815
|
+
if (rawHeader !== void 0 && !mcpSessionHeader) {
|
|
31816
|
+
return { responded404: true, createdNew: false };
|
|
31817
|
+
}
|
|
31818
|
+
if (mcpSessionHeader) {
|
|
31819
|
+
if (authorizationSession?.id === mcpSessionHeader) {
|
|
31820
|
+
return { session: authorizationSession, createdNew: false, responded404: false };
|
|
31821
|
+
}
|
|
31822
|
+
return { session: { id: mcpSessionHeader }, createdNew: false, responded404: false };
|
|
31823
|
+
}
|
|
31824
|
+
if (authorizationSession) {
|
|
31825
|
+
return { session: authorizationSession, createdNew: false, responded404: false };
|
|
31826
|
+
}
|
|
31827
|
+
return { session: createSession(), createdNew: true, responded404: false };
|
|
31828
|
+
}
|
|
31829
|
+
function classifyStreamableHttpRequest(params) {
|
|
31830
|
+
const { method, body } = params;
|
|
31831
|
+
if (method.toUpperCase() === "GET") {
|
|
31832
|
+
return { requestType: "sseListener" };
|
|
31833
|
+
}
|
|
31834
|
+
const jsonRpcMethod = body?.method;
|
|
31835
|
+
if (jsonRpcMethod === "initialize") {
|
|
31836
|
+
return { requestType: "initialize" };
|
|
31837
|
+
}
|
|
31838
|
+
if (typeof jsonRpcMethod === "string" && jsonRpcMethod.startsWith("ui/")) {
|
|
31839
|
+
return { requestType: "extApps" };
|
|
31840
|
+
}
|
|
31841
|
+
if (ElicitResultSchema2.safeParse(body?.result).success) {
|
|
31842
|
+
return { requestType: "elicitResult" };
|
|
31843
|
+
}
|
|
31844
|
+
if (jsonRpcMethod && RequestSchema.safeParse(body).success) {
|
|
31845
|
+
return { requestType: "message" };
|
|
31846
|
+
}
|
|
31847
|
+
return { error: "Invalid Request" };
|
|
31848
|
+
}
|
|
31849
|
+
function syncStreamableHttpAuthorizationSession(authorization, session) {
|
|
31850
|
+
if (!authorization.session) {
|
|
31851
|
+
authorization.session = session;
|
|
31852
|
+
}
|
|
31853
|
+
}
|
|
31854
|
+
async function lookupStreamableHttpTransport(params) {
|
|
31855
|
+
const { transportService, token, sessionId, response } = params;
|
|
31856
|
+
const inMemoryTransport = await transportService.getTransporter("streamable-http", token, sessionId);
|
|
31857
|
+
if (inMemoryTransport) {
|
|
31858
|
+
return { kind: "transport", source: "memory", transport: inMemoryTransport };
|
|
31859
|
+
}
|
|
31860
|
+
let recreationError;
|
|
31861
|
+
try {
|
|
31862
|
+
const storedSession = await transportService.getStoredSession("streamable-http", token, sessionId);
|
|
31863
|
+
if (storedSession) {
|
|
31864
|
+
const recreatedTransport = await transportService.recreateTransporter(
|
|
31865
|
+
"streamable-http",
|
|
31866
|
+
token,
|
|
31867
|
+
sessionId,
|
|
31868
|
+
storedSession,
|
|
31869
|
+
response
|
|
31870
|
+
);
|
|
31871
|
+
if (recreatedTransport) {
|
|
31872
|
+
return { kind: "transport", source: "redis", transport: recreatedTransport };
|
|
31873
|
+
}
|
|
31874
|
+
}
|
|
31875
|
+
} catch (error) {
|
|
31876
|
+
recreationError = error;
|
|
31877
|
+
}
|
|
31878
|
+
const wasCreated = await transportService.wasSessionCreatedAsync("streamable-http", token, sessionId);
|
|
31879
|
+
if (wasCreated) {
|
|
31880
|
+
return { kind: "session-expired", recreationError };
|
|
31881
|
+
}
|
|
31882
|
+
return { kind: "session-not-initialized", recreationError };
|
|
31883
|
+
}
|
|
31792
31884
|
var plan19, stateSessionSchema, stateSchema18, name20, Stage20, HandleStreamableHttpFlow;
|
|
31793
31885
|
var init_handle_streamable_http_flow = __esm({
|
|
31794
31886
|
"libs/sdk/src/transport/flows/handle.streamable-http.flow.ts"() {
|
|
@@ -31830,60 +31922,53 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31830
31922
|
const authorization = request[ServerRequestTokens.auth];
|
|
31831
31923
|
const { token } = authorization;
|
|
31832
31924
|
const logger = this.scopeLogger.child("handle:streamable-http:parseInput");
|
|
31833
|
-
const
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
|
|
31925
|
+
const sessionResolution = resolveStreamableHttpSession({
|
|
31926
|
+
rawHeader: request.headers?.["mcp-session-id"],
|
|
31927
|
+
authorizationSession: authorization.session,
|
|
31928
|
+
createSession: () => {
|
|
31929
|
+
const query = request.query;
|
|
31930
|
+
const skillsOnlyMode = detectSkillsOnlyMode(query);
|
|
31931
|
+
return createSessionId("streamable-http", token, {
|
|
31932
|
+
userAgent: request.headers?.["user-agent"],
|
|
31933
|
+
platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
|
|
31934
|
+
skillsOnlyMode
|
|
31935
|
+
});
|
|
31936
|
+
}
|
|
31937
|
+
});
|
|
31938
|
+
if (sessionResolution.responded404 || !sessionResolution.session) {
|
|
31837
31939
|
logger.warn("parseInput: invalid mcp-session-id header");
|
|
31838
31940
|
this.respond(httpRespond.sessionNotFound("invalid session id"));
|
|
31839
31941
|
return;
|
|
31840
31942
|
}
|
|
31841
|
-
|
|
31842
|
-
if (mcpSessionHeader) {
|
|
31843
|
-
if (authorization.session?.id === mcpSessionHeader) {
|
|
31844
|
-
session = authorization.session;
|
|
31845
|
-
} else {
|
|
31846
|
-
session = { id: mcpSessionHeader };
|
|
31847
|
-
}
|
|
31848
|
-
} else if (authorization.session) {
|
|
31849
|
-
session = authorization.session;
|
|
31850
|
-
} else {
|
|
31851
|
-
const query = request.query;
|
|
31852
|
-
const skillsOnlyMode = detectSkillsOnlyMode(query);
|
|
31853
|
-
session = createSessionId("streamable-http", token, {
|
|
31854
|
-
userAgent: request.headers?.["user-agent"],
|
|
31855
|
-
platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
|
|
31856
|
-
skillsOnlyMode
|
|
31857
|
-
});
|
|
31858
|
-
}
|
|
31943
|
+
const session = sessionResolution.session;
|
|
31859
31944
|
this.state.set(stateSchema18.parse({ token, session }));
|
|
31860
31945
|
logger.info("parseInput: session resolved", { sessionId: session.id?.slice(0, 20) });
|
|
31861
31946
|
}
|
|
31862
31947
|
async router() {
|
|
31863
31948
|
const { request } = this.rawInput;
|
|
31864
31949
|
const logger = this.scopeLogger.child("handle:streamable-http:router");
|
|
31865
|
-
|
|
31866
|
-
|
|
31867
|
-
|
|
31950
|
+
const classification = classifyStreamableHttpRequest({
|
|
31951
|
+
method: request.method,
|
|
31952
|
+
body: request.body
|
|
31953
|
+
});
|
|
31954
|
+
if ("error" in classification) {
|
|
31955
|
+
logger.warn("router: invalid request, no valid method");
|
|
31956
|
+
this.respond(httpRespond.rpcError("Invalid Request"));
|
|
31868
31957
|
return;
|
|
31869
31958
|
}
|
|
31870
|
-
|
|
31871
|
-
|
|
31872
|
-
|
|
31873
|
-
|
|
31959
|
+
this.state.set("requestType", classification.requestType);
|
|
31960
|
+
if (classification.requestType === "sseListener") {
|
|
31961
|
+
logger.info("router: requestType=sseListener, method=GET");
|
|
31962
|
+
} else if (classification.requestType === "initialize") {
|
|
31874
31963
|
logger.info("router: requestType=initialize, method=POST");
|
|
31875
|
-
} else if (
|
|
31876
|
-
|
|
31964
|
+
} else if (classification.requestType === "extApps") {
|
|
31965
|
+
const method = request.body?.method;
|
|
31877
31966
|
logger.info(`router: requestType=extApps, method=${method}`);
|
|
31878
|
-
} else if (
|
|
31879
|
-
this.state.set("requestType", "elicitResult");
|
|
31967
|
+
} else if (classification.requestType === "elicitResult") {
|
|
31880
31968
|
logger.info("router: requestType=elicitResult, method=POST");
|
|
31881
|
-
} else if (method && RequestSchema.safeParse(request.body).success) {
|
|
31882
|
-
this.state.set("requestType", "message");
|
|
31883
|
-
logger.info(`router: requestType=message, method=${method}`);
|
|
31884
31969
|
} else {
|
|
31885
|
-
|
|
31886
|
-
|
|
31970
|
+
const method = request.body?.method;
|
|
31971
|
+
logger.info(`router: requestType=message, method=${method}`);
|
|
31887
31972
|
}
|
|
31888
31973
|
}
|
|
31889
31974
|
async onInitialize() {
|
|
@@ -31897,6 +31982,8 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31897
31982
|
tokenPrefix: token?.slice(0, 10)
|
|
31898
31983
|
});
|
|
31899
31984
|
try {
|
|
31985
|
+
const authorization = request[ServerRequestTokens.auth];
|
|
31986
|
+
syncStreamableHttpAuthorizationSession(authorization, session);
|
|
31900
31987
|
const transport = await transportService.createTransporter("streamable-http", token, session.id, response);
|
|
31901
31988
|
logger.info("onInitialize: transport created, calling initialize");
|
|
31902
31989
|
await transport.initialize(request, response);
|
|
@@ -31972,44 +32059,21 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31972
32059
|
sessionId: session.id?.slice(0, 20),
|
|
31973
32060
|
hasToken: !!token
|
|
31974
32061
|
});
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31982
|
-
|
|
31983
|
-
|
|
31984
|
-
found: !!storedSession,
|
|
31985
|
-
initialized: storedSession?.initialized
|
|
31986
|
-
});
|
|
31987
|
-
if (storedSession) {
|
|
31988
|
-
logger.verbose("onMessage: recreating transport from stored session", {
|
|
31989
|
-
sessionId: session.id?.slice(0, 20),
|
|
31990
|
-
createdAt: storedSession.createdAt,
|
|
31991
|
-
initialized: storedSession.initialized
|
|
31992
|
-
});
|
|
31993
|
-
transport = await transportService.recreateTransporter(
|
|
31994
|
-
"streamable-http",
|
|
31995
|
-
token,
|
|
31996
|
-
session.id,
|
|
31997
|
-
storedSession,
|
|
31998
|
-
response
|
|
31999
|
-
);
|
|
32000
|
-
logger.verbose("onMessage: transport recreated successfully");
|
|
32001
|
-
}
|
|
32002
|
-
} catch (error) {
|
|
32062
|
+
const transportLookup = await lookupStreamableHttpTransport({
|
|
32063
|
+
transportService,
|
|
32064
|
+
token,
|
|
32065
|
+
sessionId: session.id,
|
|
32066
|
+
response
|
|
32067
|
+
});
|
|
32068
|
+
if (transportLookup.kind !== "transport") {
|
|
32069
|
+
const body = request.body;
|
|
32070
|
+
if (transportLookup.recreationError) {
|
|
32003
32071
|
logger.warn("Failed to recreate transport from stored session", {
|
|
32004
32072
|
sessionId: session.id?.slice(0, 20),
|
|
32005
|
-
error:
|
|
32073
|
+
error: transportLookup.recreationError instanceof Error ? transportLookup.recreationError.message : String(transportLookup.recreationError)
|
|
32006
32074
|
});
|
|
32007
32075
|
}
|
|
32008
|
-
|
|
32009
|
-
if (!transport) {
|
|
32010
|
-
const wasCreated = await transportService.wasSessionCreatedAsync("streamable-http", token, session.id);
|
|
32011
|
-
const body = request.body;
|
|
32012
|
-
if (wasCreated) {
|
|
32076
|
+
if (transportLookup.kind === "session-expired") {
|
|
32013
32077
|
logger.info("Session expired - client should re-initialize", {
|
|
32014
32078
|
sessionId: session.id?.slice(0, 20),
|
|
32015
32079
|
tokenHash: token.slice(0, 8),
|
|
@@ -32031,6 +32095,8 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
32031
32095
|
}
|
|
32032
32096
|
return;
|
|
32033
32097
|
}
|
|
32098
|
+
const transport = transportLookup.transport;
|
|
32099
|
+
logger.verbose("onMessage: transport resolved", { source: transportLookup.source });
|
|
32034
32100
|
try {
|
|
32035
32101
|
await transport.handleRequest(request, response);
|
|
32036
32102
|
this.handled();
|
|
@@ -42583,7 +42649,13 @@ var init_front_mcp = __esm({
|
|
|
42583
42649
|
return this.scopes.getScopes();
|
|
42584
42650
|
}
|
|
42585
42651
|
static async bootstrap(options) {
|
|
42586
|
-
const
|
|
42652
|
+
const parsedConfig = frontMcpMetadataSchema.parse(options);
|
|
42653
|
+
const daemonSocket = process.env["FRONTMCP_DAEMON_SOCKET"];
|
|
42654
|
+
if (daemonSocket) {
|
|
42655
|
+
await _FrontMcpInstance2.runUnixSocket({ ...parsedConfig, socketPath: daemonSocket });
|
|
42656
|
+
return;
|
|
42657
|
+
}
|
|
42658
|
+
const frontMcp = new _FrontMcpInstance2(parsedConfig);
|
|
42587
42659
|
await frontMcp.ready;
|
|
42588
42660
|
await frontMcp.start();
|
|
42589
42661
|
frontMcp.log?.info("FrontMCP bootstrap complete");
|
|
@@ -43651,7 +43723,7 @@ var init_front_mcp_interface = __esm({
|
|
|
43651
43723
|
|
|
43652
43724
|
// libs/sdk/src/common/interfaces/server.interface.ts
|
|
43653
43725
|
import { IncomingMessage, HttpServerResponse } from "@frontmcp/protocol";
|
|
43654
|
-
var ServerRequest11,
|
|
43726
|
+
var ServerRequest11, ServerResponse4, FrontMcpServer;
|
|
43655
43727
|
var init_server_interface = __esm({
|
|
43656
43728
|
"libs/sdk/src/common/interfaces/server.interface.ts"() {
|
|
43657
43729
|
"use strict";
|
|
@@ -43661,7 +43733,7 @@ var init_server_interface = __esm({
|
|
|
43661
43733
|
body;
|
|
43662
43734
|
authSession;
|
|
43663
43735
|
};
|
|
43664
|
-
|
|
43736
|
+
ServerResponse4 = class extends HttpServerResponse {
|
|
43665
43737
|
};
|
|
43666
43738
|
FrontMcpServer = class {
|
|
43667
43739
|
};
|
|
@@ -46864,7 +46936,7 @@ export {
|
|
|
46864
46936
|
ServerNotFoundError,
|
|
46865
46937
|
ServerRequest11 as ServerRequest,
|
|
46866
46938
|
ServerRequestTokens,
|
|
46867
|
-
|
|
46939
|
+
ServerResponse4 as ServerResponse,
|
|
46868
46940
|
ServerlessHandlerNotInitializedError,
|
|
46869
46941
|
SessionHookStage,
|
|
46870
46942
|
SessionIdEmptyError,
|
package/front-mcp/front-mcp.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class FrontMcpInstance implements FrontMcpInterface {
|
|
|
20
20
|
* Useful for graph visualization and introspection.
|
|
21
21
|
*/
|
|
22
22
|
getScopes(): ScopeEntry[];
|
|
23
|
-
static bootstrap(options: FrontMcpConfigType): Promise<void>;
|
|
23
|
+
static bootstrap(options: FrontMcpConfigInput | FrontMcpConfigType): Promise<void>;
|
|
24
24
|
/**
|
|
25
25
|
* Creates and initializes a FrontMCP instance without starting the HTTP server.
|
|
26
26
|
* Returns the underlying HTTP handler for serverless deployments (Vercel, Lambda).
|
|
@@ -135,7 +135,7 @@ export declare class FrontMcpInstance implements FrontMcpInterface {
|
|
|
135
135
|
* await handle.close();
|
|
136
136
|
* ```
|
|
137
137
|
*/
|
|
138
|
-
static runUnixSocket(options: FrontMcpConfigInput & {
|
|
138
|
+
static runUnixSocket(options: (FrontMcpConfigInput | FrontMcpConfigType) & {
|
|
139
139
|
socketPath: string;
|
|
140
140
|
sqlite?: SqliteOptionsInput;
|
|
141
141
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-mcp.d.ts","sourceRoot":"","sources":["../../src/front-mcp/front-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAGjB,UAAU,EAGX,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,GAAG,CAAC,CAAiB;gBAEjB,MAAM,EAAE,kBAAkB;IAKhC,UAAU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IASzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;WACiB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAqBxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH;;;;;;;;;;;;;;;;;;;;;OAqBG;WACiB,aAAa,CAC/B,OAAO,EAAE,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,GAAG;QACpD,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,kBAAkB,CAAC;KAC7B,GACA,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;WAmDtB,QAAQ,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyG1E"}
|
package/index.js
CHANGED
|
@@ -7688,8 +7688,9 @@ var init_notification_service = __esm({
|
|
|
7688
7688
|
emergency: 7
|
|
7689
7689
|
};
|
|
7690
7690
|
NotificationService = class _NotificationService {
|
|
7691
|
-
constructor(scope) {
|
|
7691
|
+
constructor(scope, options = {}) {
|
|
7692
7692
|
this.scope = scope;
|
|
7693
|
+
this.options = options;
|
|
7693
7694
|
this.logger = scope.logger.child("NotificationService");
|
|
7694
7695
|
}
|
|
7695
7696
|
logger;
|
|
@@ -7706,6 +7707,9 @@ var init_notification_service = __esm({
|
|
|
7706
7707
|
terminatedSessions = /* @__PURE__ */ new Set();
|
|
7707
7708
|
/** Maximum number of terminated sessions to track before eviction */
|
|
7708
7709
|
static MAX_TERMINATED_SESSIONS = 1e4;
|
|
7710
|
+
get maxTerminatedSessions() {
|
|
7711
|
+
return this.options.maxTerminatedSessions ?? _NotificationService.MAX_TERMINATED_SESSIONS;
|
|
7712
|
+
}
|
|
7709
7713
|
/**
|
|
7710
7714
|
* Initialize the notification service and subscribe to registry changes.
|
|
7711
7715
|
* Called after all registries are ready.
|
|
@@ -7787,7 +7791,7 @@ var init_notification_service = __esm({
|
|
|
7787
7791
|
const wasRegistered = this.unregisterServer(sessionId);
|
|
7788
7792
|
this.scope.providers.cleanupSession(sessionId);
|
|
7789
7793
|
this.logger.verbose(`Cleaned up provider cache for terminated session: ${sessionId.slice(0, 20)}...`);
|
|
7790
|
-
if (this.terminatedSessions.size >=
|
|
7794
|
+
if (this.terminatedSessions.size >= this.maxTerminatedSessions) {
|
|
7791
7795
|
const oldest = this.terminatedSessions.values().next().value;
|
|
7792
7796
|
if (oldest) {
|
|
7793
7797
|
this.terminatedSessions.delete(oldest);
|
|
@@ -27845,6 +27849,16 @@ var init_http_request_flow = __esm({
|
|
|
27845
27849
|
this.respond(httpRespond.notFound("Session not found"));
|
|
27846
27850
|
return;
|
|
27847
27851
|
}
|
|
27852
|
+
const authorization = request[ServerRequestTokens.auth];
|
|
27853
|
+
if (authorization?.token) {
|
|
27854
|
+
const transportService = this.scope.transportService;
|
|
27855
|
+
for (const protocol of ["streamable-http", "sse"]) {
|
|
27856
|
+
try {
|
|
27857
|
+
await transportService.destroyTransporter(protocol, authorization.token, sessionId);
|
|
27858
|
+
} catch {
|
|
27859
|
+
}
|
|
27860
|
+
}
|
|
27861
|
+
}
|
|
27848
27862
|
this.logger.info(`[${this.requestId}] Session terminated: ${sessionId}`);
|
|
27849
27863
|
this.respond(httpRespond.noContent());
|
|
27850
27864
|
} catch (error) {
|
|
@@ -29473,8 +29487,13 @@ var init_transport_local_adapter = __esm({
|
|
|
29473
29487
|
}
|
|
29474
29488
|
ensureAuthInfo(req, transport) {
|
|
29475
29489
|
const { token, user, session } = req[ServerRequestTokens.auth];
|
|
29476
|
-
|
|
29477
|
-
|
|
29490
|
+
if (!session?.id) {
|
|
29491
|
+
throw new Error(
|
|
29492
|
+
"Session ID is required in ensureAuthInfo. This indicates a bug in session propagation \u2014 the session should have been set by the flow."
|
|
29493
|
+
);
|
|
29494
|
+
}
|
|
29495
|
+
const sessionId = session.id;
|
|
29496
|
+
const sessionPayload = session.payload ?? { protocol: "streamable-http" };
|
|
29478
29497
|
if (this.initSessionPayload) {
|
|
29479
29498
|
const init = this.initSessionPayload;
|
|
29480
29499
|
if (init.supportsElicitation !== void 0 && sessionPayload.supportsElicitation === void 0) {
|
|
@@ -31730,6 +31749,79 @@ var init_ext_apps2 = __esm({
|
|
|
31730
31749
|
});
|
|
31731
31750
|
|
|
31732
31751
|
// libs/sdk/src/transport/flows/handle.streamable-http.flow.ts
|
|
31752
|
+
function resolveStreamableHttpSession(params) {
|
|
31753
|
+
const { rawHeader, authorizationSession, createSession } = params;
|
|
31754
|
+
const rawMcpSessionHeader = typeof rawHeader === "string" ? rawHeader : void 0;
|
|
31755
|
+
const mcpSessionHeader = validateMcpSessionHeader(rawMcpSessionHeader);
|
|
31756
|
+
if (rawHeader !== void 0 && !mcpSessionHeader) {
|
|
31757
|
+
return { responded404: true, createdNew: false };
|
|
31758
|
+
}
|
|
31759
|
+
if (mcpSessionHeader) {
|
|
31760
|
+
if (authorizationSession?.id === mcpSessionHeader) {
|
|
31761
|
+
return { session: authorizationSession, createdNew: false, responded404: false };
|
|
31762
|
+
}
|
|
31763
|
+
return { session: { id: mcpSessionHeader }, createdNew: false, responded404: false };
|
|
31764
|
+
}
|
|
31765
|
+
if (authorizationSession) {
|
|
31766
|
+
return { session: authorizationSession, createdNew: false, responded404: false };
|
|
31767
|
+
}
|
|
31768
|
+
return { session: createSession(), createdNew: true, responded404: false };
|
|
31769
|
+
}
|
|
31770
|
+
function classifyStreamableHttpRequest(params) {
|
|
31771
|
+
const { method, body } = params;
|
|
31772
|
+
if (method.toUpperCase() === "GET") {
|
|
31773
|
+
return { requestType: "sseListener" };
|
|
31774
|
+
}
|
|
31775
|
+
const jsonRpcMethod = body?.method;
|
|
31776
|
+
if (jsonRpcMethod === "initialize") {
|
|
31777
|
+
return { requestType: "initialize" };
|
|
31778
|
+
}
|
|
31779
|
+
if (typeof jsonRpcMethod === "string" && jsonRpcMethod.startsWith("ui/")) {
|
|
31780
|
+
return { requestType: "extApps" };
|
|
31781
|
+
}
|
|
31782
|
+
if (import_protocol38.ElicitResultSchema.safeParse(body?.result).success) {
|
|
31783
|
+
return { requestType: "elicitResult" };
|
|
31784
|
+
}
|
|
31785
|
+
if (jsonRpcMethod && import_protocol38.RequestSchema.safeParse(body).success) {
|
|
31786
|
+
return { requestType: "message" };
|
|
31787
|
+
}
|
|
31788
|
+
return { error: "Invalid Request" };
|
|
31789
|
+
}
|
|
31790
|
+
function syncStreamableHttpAuthorizationSession(authorization, session) {
|
|
31791
|
+
if (!authorization.session) {
|
|
31792
|
+
authorization.session = session;
|
|
31793
|
+
}
|
|
31794
|
+
}
|
|
31795
|
+
async function lookupStreamableHttpTransport(params) {
|
|
31796
|
+
const { transportService, token, sessionId, response } = params;
|
|
31797
|
+
const inMemoryTransport = await transportService.getTransporter("streamable-http", token, sessionId);
|
|
31798
|
+
if (inMemoryTransport) {
|
|
31799
|
+
return { kind: "transport", source: "memory", transport: inMemoryTransport };
|
|
31800
|
+
}
|
|
31801
|
+
let recreationError;
|
|
31802
|
+
try {
|
|
31803
|
+
const storedSession = await transportService.getStoredSession("streamable-http", token, sessionId);
|
|
31804
|
+
if (storedSession) {
|
|
31805
|
+
const recreatedTransport = await transportService.recreateTransporter(
|
|
31806
|
+
"streamable-http",
|
|
31807
|
+
token,
|
|
31808
|
+
sessionId,
|
|
31809
|
+
storedSession,
|
|
31810
|
+
response
|
|
31811
|
+
);
|
|
31812
|
+
if (recreatedTransport) {
|
|
31813
|
+
return { kind: "transport", source: "redis", transport: recreatedTransport };
|
|
31814
|
+
}
|
|
31815
|
+
}
|
|
31816
|
+
} catch (error) {
|
|
31817
|
+
recreationError = error;
|
|
31818
|
+
}
|
|
31819
|
+
const wasCreated = await transportService.wasSessionCreatedAsync("streamable-http", token, sessionId);
|
|
31820
|
+
if (wasCreated) {
|
|
31821
|
+
return { kind: "session-expired", recreationError };
|
|
31822
|
+
}
|
|
31823
|
+
return { kind: "session-not-initialized", recreationError };
|
|
31824
|
+
}
|
|
31733
31825
|
var import_zod62, import_protocol38, plan19, stateSessionSchema, stateSchema18, name20, Stage20, HandleStreamableHttpFlow;
|
|
31734
31826
|
var init_handle_streamable_http_flow = __esm({
|
|
31735
31827
|
"libs/sdk/src/transport/flows/handle.streamable-http.flow.ts"() {
|
|
@@ -31773,60 +31865,53 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31773
31865
|
const authorization = request[ServerRequestTokens.auth];
|
|
31774
31866
|
const { token } = authorization;
|
|
31775
31867
|
const logger = this.scopeLogger.child("handle:streamable-http:parseInput");
|
|
31776
|
-
const
|
|
31777
|
-
|
|
31778
|
-
|
|
31779
|
-
|
|
31868
|
+
const sessionResolution = resolveStreamableHttpSession({
|
|
31869
|
+
rawHeader: request.headers?.["mcp-session-id"],
|
|
31870
|
+
authorizationSession: authorization.session,
|
|
31871
|
+
createSession: () => {
|
|
31872
|
+
const query = request.query;
|
|
31873
|
+
const skillsOnlyMode = detectSkillsOnlyMode(query);
|
|
31874
|
+
return createSessionId("streamable-http", token, {
|
|
31875
|
+
userAgent: request.headers?.["user-agent"],
|
|
31876
|
+
platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
|
|
31877
|
+
skillsOnlyMode
|
|
31878
|
+
});
|
|
31879
|
+
}
|
|
31880
|
+
});
|
|
31881
|
+
if (sessionResolution.responded404 || !sessionResolution.session) {
|
|
31780
31882
|
logger.warn("parseInput: invalid mcp-session-id header");
|
|
31781
31883
|
this.respond(httpRespond.sessionNotFound("invalid session id"));
|
|
31782
31884
|
return;
|
|
31783
31885
|
}
|
|
31784
|
-
|
|
31785
|
-
if (mcpSessionHeader) {
|
|
31786
|
-
if (authorization.session?.id === mcpSessionHeader) {
|
|
31787
|
-
session = authorization.session;
|
|
31788
|
-
} else {
|
|
31789
|
-
session = { id: mcpSessionHeader };
|
|
31790
|
-
}
|
|
31791
|
-
} else if (authorization.session) {
|
|
31792
|
-
session = authorization.session;
|
|
31793
|
-
} else {
|
|
31794
|
-
const query = request.query;
|
|
31795
|
-
const skillsOnlyMode = detectSkillsOnlyMode(query);
|
|
31796
|
-
session = createSessionId("streamable-http", token, {
|
|
31797
|
-
userAgent: request.headers?.["user-agent"],
|
|
31798
|
-
platformDetectionConfig: this.scope.metadata.transport?.platformDetection,
|
|
31799
|
-
skillsOnlyMode
|
|
31800
|
-
});
|
|
31801
|
-
}
|
|
31886
|
+
const session = sessionResolution.session;
|
|
31802
31887
|
this.state.set(stateSchema18.parse({ token, session }));
|
|
31803
31888
|
logger.info("parseInput: session resolved", { sessionId: session.id?.slice(0, 20) });
|
|
31804
31889
|
}
|
|
31805
31890
|
async router() {
|
|
31806
31891
|
const { request } = this.rawInput;
|
|
31807
31892
|
const logger = this.scopeLogger.child("handle:streamable-http:router");
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
|
|
31893
|
+
const classification = classifyStreamableHttpRequest({
|
|
31894
|
+
method: request.method,
|
|
31895
|
+
body: request.body
|
|
31896
|
+
});
|
|
31897
|
+
if ("error" in classification) {
|
|
31898
|
+
logger.warn("router: invalid request, no valid method");
|
|
31899
|
+
this.respond(httpRespond.rpcError("Invalid Request"));
|
|
31811
31900
|
return;
|
|
31812
31901
|
}
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
|
|
31902
|
+
this.state.set("requestType", classification.requestType);
|
|
31903
|
+
if (classification.requestType === "sseListener") {
|
|
31904
|
+
logger.info("router: requestType=sseListener, method=GET");
|
|
31905
|
+
} else if (classification.requestType === "initialize") {
|
|
31817
31906
|
logger.info("router: requestType=initialize, method=POST");
|
|
31818
|
-
} else if (
|
|
31819
|
-
|
|
31907
|
+
} else if (classification.requestType === "extApps") {
|
|
31908
|
+
const method = request.body?.method;
|
|
31820
31909
|
logger.info(`router: requestType=extApps, method=${method}`);
|
|
31821
|
-
} else if (
|
|
31822
|
-
this.state.set("requestType", "elicitResult");
|
|
31910
|
+
} else if (classification.requestType === "elicitResult") {
|
|
31823
31911
|
logger.info("router: requestType=elicitResult, method=POST");
|
|
31824
|
-
} else if (method && import_protocol38.RequestSchema.safeParse(request.body).success) {
|
|
31825
|
-
this.state.set("requestType", "message");
|
|
31826
|
-
logger.info(`router: requestType=message, method=${method}`);
|
|
31827
31912
|
} else {
|
|
31828
|
-
|
|
31829
|
-
|
|
31913
|
+
const method = request.body?.method;
|
|
31914
|
+
logger.info(`router: requestType=message, method=${method}`);
|
|
31830
31915
|
}
|
|
31831
31916
|
}
|
|
31832
31917
|
async onInitialize() {
|
|
@@ -31840,6 +31925,8 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31840
31925
|
tokenPrefix: token?.slice(0, 10)
|
|
31841
31926
|
});
|
|
31842
31927
|
try {
|
|
31928
|
+
const authorization = request[ServerRequestTokens.auth];
|
|
31929
|
+
syncStreamableHttpAuthorizationSession(authorization, session);
|
|
31843
31930
|
const transport = await transportService.createTransporter("streamable-http", token, session.id, response);
|
|
31844
31931
|
logger.info("onInitialize: transport created, calling initialize");
|
|
31845
31932
|
await transport.initialize(request, response);
|
|
@@ -31915,44 +32002,21 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31915
32002
|
sessionId: session.id?.slice(0, 20),
|
|
31916
32003
|
hasToken: !!token
|
|
31917
32004
|
});
|
|
31918
|
-
|
|
31919
|
-
|
|
31920
|
-
|
|
31921
|
-
|
|
31922
|
-
|
|
31923
|
-
|
|
31924
|
-
|
|
31925
|
-
|
|
31926
|
-
|
|
31927
|
-
found: !!storedSession,
|
|
31928
|
-
initialized: storedSession?.initialized
|
|
31929
|
-
});
|
|
31930
|
-
if (storedSession) {
|
|
31931
|
-
logger.verbose("onMessage: recreating transport from stored session", {
|
|
31932
|
-
sessionId: session.id?.slice(0, 20),
|
|
31933
|
-
createdAt: storedSession.createdAt,
|
|
31934
|
-
initialized: storedSession.initialized
|
|
31935
|
-
});
|
|
31936
|
-
transport = await transportService.recreateTransporter(
|
|
31937
|
-
"streamable-http",
|
|
31938
|
-
token,
|
|
31939
|
-
session.id,
|
|
31940
|
-
storedSession,
|
|
31941
|
-
response
|
|
31942
|
-
);
|
|
31943
|
-
logger.verbose("onMessage: transport recreated successfully");
|
|
31944
|
-
}
|
|
31945
|
-
} catch (error) {
|
|
32005
|
+
const transportLookup = await lookupStreamableHttpTransport({
|
|
32006
|
+
transportService,
|
|
32007
|
+
token,
|
|
32008
|
+
sessionId: session.id,
|
|
32009
|
+
response
|
|
32010
|
+
});
|
|
32011
|
+
if (transportLookup.kind !== "transport") {
|
|
32012
|
+
const body = request.body;
|
|
32013
|
+
if (transportLookup.recreationError) {
|
|
31946
32014
|
logger.warn("Failed to recreate transport from stored session", {
|
|
31947
32015
|
sessionId: session.id?.slice(0, 20),
|
|
31948
|
-
error:
|
|
32016
|
+
error: transportLookup.recreationError instanceof Error ? transportLookup.recreationError.message : String(transportLookup.recreationError)
|
|
31949
32017
|
});
|
|
31950
32018
|
}
|
|
31951
|
-
|
|
31952
|
-
if (!transport) {
|
|
31953
|
-
const wasCreated = await transportService.wasSessionCreatedAsync("streamable-http", token, session.id);
|
|
31954
|
-
const body = request.body;
|
|
31955
|
-
if (wasCreated) {
|
|
32019
|
+
if (transportLookup.kind === "session-expired") {
|
|
31956
32020
|
logger.info("Session expired - client should re-initialize", {
|
|
31957
32021
|
sessionId: session.id?.slice(0, 20),
|
|
31958
32022
|
tokenHash: token.slice(0, 8),
|
|
@@ -31974,6 +32038,8 @@ var init_handle_streamable_http_flow = __esm({
|
|
|
31974
32038
|
}
|
|
31975
32039
|
return;
|
|
31976
32040
|
}
|
|
32041
|
+
const transport = transportLookup.transport;
|
|
32042
|
+
logger.verbose("onMessage: transport resolved", { source: transportLookup.source });
|
|
31977
32043
|
try {
|
|
31978
32044
|
await transport.handleRequest(request, response);
|
|
31979
32045
|
this.handled();
|
|
@@ -42532,7 +42598,13 @@ var init_front_mcp = __esm({
|
|
|
42532
42598
|
return this.scopes.getScopes();
|
|
42533
42599
|
}
|
|
42534
42600
|
static async bootstrap(options) {
|
|
42535
|
-
const
|
|
42601
|
+
const parsedConfig = frontMcpMetadataSchema.parse(options);
|
|
42602
|
+
const daemonSocket = process.env["FRONTMCP_DAEMON_SOCKET"];
|
|
42603
|
+
if (daemonSocket) {
|
|
42604
|
+
await _FrontMcpInstance2.runUnixSocket({ ...parsedConfig, socketPath: daemonSocket });
|
|
42605
|
+
return;
|
|
42606
|
+
}
|
|
42607
|
+
const frontMcp = new _FrontMcpInstance2(parsedConfig);
|
|
42536
42608
|
await frontMcp.ready;
|
|
42537
42609
|
await frontMcp.start();
|
|
42538
42610
|
frontMcp.log?.info("FrontMCP bootstrap complete");
|
|
@@ -43606,7 +43678,7 @@ var init_front_mcp_interface = __esm({
|
|
|
43606
43678
|
});
|
|
43607
43679
|
|
|
43608
43680
|
// libs/sdk/src/common/interfaces/server.interface.ts
|
|
43609
|
-
var import_protocol44, ServerRequest11,
|
|
43681
|
+
var import_protocol44, ServerRequest11, ServerResponse4, FrontMcpServer;
|
|
43610
43682
|
var init_server_interface = __esm({
|
|
43611
43683
|
"libs/sdk/src/common/interfaces/server.interface.ts"() {
|
|
43612
43684
|
"use strict";
|
|
@@ -43617,7 +43689,7 @@ var init_server_interface = __esm({
|
|
|
43617
43689
|
body;
|
|
43618
43690
|
authSession;
|
|
43619
43691
|
};
|
|
43620
|
-
|
|
43692
|
+
ServerResponse4 = class extends import_protocol44.HttpServerResponse {
|
|
43621
43693
|
};
|
|
43622
43694
|
FrontMcpServer = class {
|
|
43623
43695
|
};
|
|
@@ -46614,7 +46686,7 @@ __export(index_exports, {
|
|
|
46614
46686
|
ServerNotFoundError: () => ServerNotFoundError,
|
|
46615
46687
|
ServerRequest: () => ServerRequest11,
|
|
46616
46688
|
ServerRequestTokens: () => ServerRequestTokens,
|
|
46617
|
-
ServerResponse: () =>
|
|
46689
|
+
ServerResponse: () => ServerResponse4,
|
|
46618
46690
|
ServerlessHandlerNotInitializedError: () => ServerlessHandlerNotInitializedError,
|
|
46619
46691
|
SessionHookStage: () => SessionHookStage,
|
|
46620
46692
|
SessionIdEmptyError: () => import_auth11.SessionIdEmptyError,
|
|
@@ -154,6 +154,7 @@ export interface RegisteredServer {
|
|
|
154
154
|
*/
|
|
155
155
|
export declare class NotificationService {
|
|
156
156
|
private readonly scope;
|
|
157
|
+
private readonly options;
|
|
157
158
|
private readonly logger;
|
|
158
159
|
private readonly servers;
|
|
159
160
|
private readonly unsubscribers;
|
|
@@ -168,7 +169,10 @@ export declare class NotificationService {
|
|
|
168
169
|
private readonly terminatedSessions;
|
|
169
170
|
/** Maximum number of terminated sessions to track before eviction */
|
|
170
171
|
private static readonly MAX_TERMINATED_SESSIONS;
|
|
171
|
-
constructor(scope: Scope
|
|
172
|
+
constructor(scope: Scope, options?: {
|
|
173
|
+
maxTerminatedSessions?: number;
|
|
174
|
+
});
|
|
175
|
+
private get maxTerminatedSessions();
|
|
172
176
|
/**
|
|
173
177
|
* Initialize the notification service and subscribe to registry changes.
|
|
174
178
|
* Called after all registries are ready.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.service.d.ts","sourceRoot":"","sources":["../../src/notification/notification.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAClB,KAAK,IAAI,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAE7B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,YAAY,EAAE,IAAI,EAAE,CAAC;AAErB;;GAEG;AACH,YAAY,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,KAAK,CAAC,EAAE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B,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,uBAAuB,GAAG,cAAc,CAkB1G;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CASnE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,sCAAsC,GACtC,kCAAkC,GAClC,oCAAoC,GACpC,iCAAiC,GACjC,uBAAuB,GACvB,wBAAwB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qDAAqD;IACrD,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,uEAAuE;IACvE,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;IACrB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"notification.service.d.ts","sourceRoot":"","sources":["../../src/notification/notification.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAClB,KAAK,IAAI,EACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAE7B,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,YAAY,EAAE,IAAI,EAAE,CAAC;AAErB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AG,SAAS;IAIxD;;;;;;OAMG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc;IAKlD;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAKzC;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAgD3G;;;;;;OAMG;IACH,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAgBhD;;;;;OAKG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,SAAS;IAIrD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB9B,OAAO,CAAC,wBAAwB;CAqBjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/sdk",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
4
4
|
"description": "FrontMCP SDK",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"raw-body": "^3.0.0",
|
|
74
74
|
"content-type": "^1.0.5",
|
|
75
75
|
"@vercel/kv": "^3.0.0",
|
|
76
|
-
"@frontmcp/storage-sqlite": "1.0.0-beta.
|
|
76
|
+
"@frontmcp/storage-sqlite": "1.0.0-beta.8",
|
|
77
77
|
"@enclave-vm/core": "^2.11.1",
|
|
78
78
|
"openai": "^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
79
79
|
"@anthropic-ai/sdk": "^0.30.0 || ^0.78.0"
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@types/cors": "^2.8.17",
|
|
100
|
-
"@frontmcp/utils": "1.0.0-beta.
|
|
101
|
-
"@frontmcp/guard": "1.0.0-beta.
|
|
102
|
-
"@frontmcp/di": "1.0.0-beta.
|
|
103
|
-
"@frontmcp/uipack": "1.0.0-beta.
|
|
104
|
-
"@frontmcp/auth": "1.0.0-beta.
|
|
105
|
-
"@frontmcp/protocol": "1.0.0-beta.
|
|
100
|
+
"@frontmcp/utils": "1.0.0-beta.8",
|
|
101
|
+
"@frontmcp/guard": "1.0.0-beta.8",
|
|
102
|
+
"@frontmcp/di": "1.0.0-beta.8",
|
|
103
|
+
"@frontmcp/uipack": "1.0.0-beta.8",
|
|
104
|
+
"@frontmcp/auth": "1.0.0-beta.8",
|
|
105
|
+
"@frontmcp/protocol": "1.0.0-beta.8",
|
|
106
106
|
"ioredis": "^5.8.0",
|
|
107
107
|
"vectoriadb": "^2.1.3",
|
|
108
108
|
"js-yaml": "^4.1.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.request.flow.d.ts","sourceRoot":"","sources":["../../../src/scope/flows/http.request.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,QAAQ,EACR,UAAU,EAEV,aAAa,
|
|
1
|
+
{"version":3,"file":"http.request.flow.d.ts","sourceRoot":"","sources":["../../../src/scope/flows/http.request.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,QAAQ,EACR,UAAU,EAEV,aAAa,EAWd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,QAAA,MAAM,IAAI;;;;;CA8B2B,CAAC;AAEtC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIjC,CAAC;AAEH,QAAA,MAAM,IAAI,EAAG,cAAuB,CAAC;AAGrC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,cAAc,EAAE,cAAc,CAC5B,eAAe,EACf,OAAO,IAAI,EACX,OAAO,eAAe,EACtB,OAAO,gBAAgB,EACvB,OAAO,sBAAsB,CAC9B,CAAC;KACH;CACF;AAYD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IAChE,MAAM,wCAA8C;IACpD,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,SAAS,CAAM;IAEvB,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU;IActD,YAAY;IAkDZ,YAAY;IA8BZ,kBAAkB;IA+ClB,MAAM;IAkJN,eAAe;IAuBf,SAAS;IAuBT,oBAAoB;IAuBpB,kBAAkB;IAuBlB,mBAAmB;IAuBnB,mBAAmB;IAqDnB,QAAQ;IAcd;;;OAGG;IACH,OAAO,CAAC,QAAQ;CA8CjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.local.adapter.d.ts","sourceRoot":"","sources":["../../../src/transport/adapters/transport.local.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAe,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAqB,SAAS,EAAsB,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,yCAAyC,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,M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AAI,CAAC;IAExF;;;;;;;;OAQG;IACH,QAAQ,CAAC,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAC1C,gBAAgB,EAAE,SAAS,EAC3B,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,CAAC,EAClB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAElE,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,0BAA0B,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAE3F;;;OAGG;IACH,iBAAiB,IAAI,IAAI;IAIzB,aAAa;IAgEb,IAAI,YAAY,IAAI,SAAS,CAE5B;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,aAAa,CAExB;IAEK,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7C;;;OAGG;IACG,IAAI,CAAC,SAAS,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAchD,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,0BAA0B,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"transport.local.adapter.d.ts","sourceRoot":"","sources":["../../../src/transport/adapters/transport.local.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAe,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAqB,SAAS,EAAsB,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,yCAAyC,EAAE,MAAM,6BAA6B,CAAC;AACxF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putSchema, FlowRunOptions, httpOutputSchema, FlowBase } from '../../common';
|
|
1
|
+
import { httpInputSchema, FlowRunOptions, httpOutputSchema, FlowBase, ServerResponse } from '../../common';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import type { StoredSession } from '@frontmcp/auth';
|
|
3
4
|
export declare const plan: {
|
|
4
5
|
readonly pre: ["parseInput", "router"];
|
|
5
6
|
readonly execute: ["onInitialize", "onMessage", "onElicitResult", "onSseListener", "onExtApps"];
|
|
@@ -44,6 +45,54 @@ export declare const stateSchema: z.ZodObject<{
|
|
|
44
45
|
sseListener: "sseListener";
|
|
45
46
|
}>>;
|
|
46
47
|
}, z.core.$strip>;
|
|
48
|
+
type StreamableHttpSession = z.infer<typeof stateSchema>['session'];
|
|
49
|
+
export type StreamableHttpRequestType = NonNullable<z.infer<typeof stateSchema>['requestType']>;
|
|
50
|
+
export declare function resolveStreamableHttpSession(params: {
|
|
51
|
+
rawHeader: unknown;
|
|
52
|
+
authorizationSession?: StreamableHttpSession;
|
|
53
|
+
createSession: () => StreamableHttpSession;
|
|
54
|
+
}): {
|
|
55
|
+
responded404: boolean;
|
|
56
|
+
session?: StreamableHttpSession;
|
|
57
|
+
createdNew: boolean;
|
|
58
|
+
};
|
|
59
|
+
export declare function classifyStreamableHttpRequest(params: {
|
|
60
|
+
method: string;
|
|
61
|
+
body: unknown;
|
|
62
|
+
}): {
|
|
63
|
+
requestType: StreamableHttpRequestType;
|
|
64
|
+
} | {
|
|
65
|
+
error: 'Invalid Request';
|
|
66
|
+
};
|
|
67
|
+
export declare function syncStreamableHttpAuthorizationSession(authorization: {
|
|
68
|
+
session?: StreamableHttpSession;
|
|
69
|
+
}, session: StreamableHttpSession): void;
|
|
70
|
+
export interface StreamableHttpTransport {
|
|
71
|
+
handleRequest(request: unknown, response: unknown): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface StreamableHttpTransportLookupService {
|
|
74
|
+
getTransporter(type: 'streamable-http', token: string, sessionId: string): Promise<StreamableHttpTransport | undefined>;
|
|
75
|
+
getStoredSession(type: 'streamable-http', token: string, sessionId: string): Promise<StoredSession | undefined>;
|
|
76
|
+
recreateTransporter(type: 'streamable-http', token: string, sessionId: string, storedSession: StoredSession, response: ServerResponse): Promise<StreamableHttpTransport | undefined>;
|
|
77
|
+
wasSessionCreatedAsync(type: 'streamable-http', token: string, sessionId: string): Promise<boolean>;
|
|
78
|
+
}
|
|
79
|
+
export type StreamableHttpTransportLookupResult = {
|
|
80
|
+
kind: 'transport';
|
|
81
|
+
source: 'memory' | 'redis';
|
|
82
|
+
transport: StreamableHttpTransport;
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'session-expired';
|
|
85
|
+
recreationError?: unknown;
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'session-not-initialized';
|
|
88
|
+
recreationError?: unknown;
|
|
89
|
+
};
|
|
90
|
+
export declare function lookupStreamableHttpTransport(params: {
|
|
91
|
+
transportService: StreamableHttpTransportLookupService;
|
|
92
|
+
token: string;
|
|
93
|
+
sessionId: string;
|
|
94
|
+
response: ServerResponse;
|
|
95
|
+
}): Promise<StreamableHttpTransportLookupResult>;
|
|
47
96
|
declare const name: "handle:streamable-http";
|
|
48
97
|
declare global {
|
|
49
98
|
interface ExtendFlows {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle.streamable-http.flow.d.ts","sourceRoot":"","sources":["../../../src/transport/flows/handle.streamable-http.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,QAAQ,
|
|
1
|
+
{"version":3,"file":"handle.streamable-http.flow.d.ts","sourceRoot":"","sources":["../../../src/transport/flows/handle.streamable-http.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,gBAAgB,EAEhB,QAAQ,EAIR,cAAc,EAIf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA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