@siglo/query 0.0.0-stage → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -2
- package/dist/cursor.d.ts +16 -0
- package/dist/cursor.d.ts.map +1 -0
- package/dist/cursor.js +52 -0
- package/dist/cursor.js.map +1 -0
- package/dist/engine.d.ts +27 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +225 -0
- package/dist/engine.js.map +1 -0
- package/dist/graphql/backing.d.ts +4 -0
- package/dist/graphql/backing.d.ts.map +1 -0
- package/dist/graphql/backing.js +6 -0
- package/dist/graphql/backing.js.map +1 -0
- package/dist/graphql/projection.d.ts +15 -0
- package/dist/graphql/projection.d.ts.map +1 -0
- package/dist/graphql/projection.js +69 -0
- package/dist/graphql/projection.js.map +1 -0
- package/dist/graphql/resolvers.d.ts +89 -0
- package/dist/graphql/resolvers.d.ts.map +1 -0
- package/dist/graphql/resolvers.js +190 -0
- package/dist/graphql/resolvers.js.map +1 -0
- package/dist/graphql/scalars.d.ts +5 -0
- package/dist/graphql/scalars.d.ts.map +1 -0
- package/dist/graphql/scalars.js +91 -0
- package/dist/graphql/scalars.js.map +1 -0
- package/dist/graphql/schema.d.ts +6 -0
- package/dist/graphql/schema.d.ts.map +1 -0
- package/dist/graphql/schema.js +254 -0
- package/dist/graphql/schema.js.map +1 -0
- package/dist/graphql/subscriptions.d.ts +44 -0
- package/dist/graphql/subscriptions.d.ts.map +1 -0
- package/dist/graphql/subscriptions.js +271 -0
- package/dist/graphql/subscriptions.js.map +1 -0
- package/dist/graphql/transport.d.ts +40 -0
- package/dist/graphql/transport.d.ts.map +1 -0
- package/dist/graphql/transport.js +234 -0
- package/dist/graphql/transport.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/express.d.ts +30 -0
- package/dist/integrations/express.d.ts.map +1 -0
- package/dist/integrations/express.js +157 -0
- package/dist/integrations/express.js.map +1 -0
- package/dist/integrations/fastify.d.ts +33 -0
- package/dist/integrations/fastify.d.ts.map +1 -0
- package/dist/integrations/fastify.js +116 -0
- package/dist/integrations/fastify.js.map +1 -0
- package/dist/integrations/hono.d.ts +27 -0
- package/dist/integrations/hono.d.ts.map +1 -0
- package/dist/integrations/hono.js +131 -0
- package/dist/integrations/hono.js.map +1 -0
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +20 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +21 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/prompts.d.ts +25 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +102 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/resources.d.ts +25 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +111 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/server.d.ts +108 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +238 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +212 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +318 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/memory.d.ts +33 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +78 -0
- package/dist/memory.js.map +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +89 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fastify.js","sourceRoot":"","sources":["../../src/integrations/fastify.ts"],"names":[],"mappings":";;AAqEA,gDAuF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T,OAAO,EAAE,YAAY;oBACrB,aAAa;oBACb,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;iBACnD,CAAC,CAAC;gBACH,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC;gBACzB,OAAO,IAAA,qCAAyB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAA,iBAAO,EAAC;gBACzB,MAAM;gBACN,MAAM,EAAE,KAAK;gBACb,cAAc,EAAE,SAAS;gBACzB,YAAY;gBACZ,aAAa;aAChB,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACzD,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,OAAO,KAAK;iBACP,MAAM,CAAC,GAAG,CAAC;iBACX,IAAI,CAAC,iCAAiC,CAAC;iBACvC,IAAI,CAAC;gBACF,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,IAAA,sBAAe,EAAC,GAAG,CAAC,IAAI,gBAAgB,EAAE,CAAC;aAClE,CAAC,CAAC;QACX,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type GraphQLSchema } from 'graphql';
|
|
2
|
+
import type { WorkflowQueryEngine } from '../engine';
|
|
3
|
+
import type { WorkflowGraphQLContext } from '../graphql/resolvers';
|
|
4
|
+
export interface QueryHonoContextLike {
|
|
5
|
+
req: {
|
|
6
|
+
method?: string;
|
|
7
|
+
query(name: string): string | undefined;
|
|
8
|
+
header?(name: string): string | undefined;
|
|
9
|
+
json(): Promise<unknown>;
|
|
10
|
+
};
|
|
11
|
+
json(data: unknown, status?: number): Response | Promise<Response>;
|
|
12
|
+
}
|
|
13
|
+
export interface HonoQueryOptions {
|
|
14
|
+
engine: WorkflowQueryEngine;
|
|
15
|
+
schema?: GraphQLSchema;
|
|
16
|
+
namespace?: string | ((c: QueryHonoContextLike) => Promise<string | undefined> | string | undefined);
|
|
17
|
+
context?: (c: QueryHonoContextLike) => Promise<WorkflowGraphQLContext> | WorkflowGraphQLContext;
|
|
18
|
+
keepAliveIntervalMs?: number;
|
|
19
|
+
allowHeaderNamespace?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Hono route handler / middleware for executing Siglo GraphQL queries,
|
|
23
|
+
* mutations, and Server-Sent Events (SSE) subscriptions over Web Standard Request/Response.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createHonoQueryHandler(options: HonoQueryOptions): (c: QueryHonoContextLike, next?: () => Promise<void>) => Promise<Response | void>;
|
|
26
|
+
export declare const honoQueryMiddleware: typeof createHonoQueryHandler;
|
|
27
|
+
//# sourceMappingURL=hono.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.d.ts","sourceRoot":"","sources":["../../src/integrations/hono.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE;QACD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;QACxC,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;QAC1C,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;KAC5B,CAAC;IACF,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;IACrG,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;IAChG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AA8BD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,gBAAgB,OAI3C,oBAAoB,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,KAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyF/F;AAED,eAAO,MAAM,mBAAmB,+BAAyB,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.honoQueryMiddleware = void 0;
|
|
4
|
+
exports.createHonoQueryHandler = createHonoQueryHandler;
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const core_1 = require("@siglo/core");
|
|
7
|
+
const schema_1 = require("../graphql/schema");
|
|
8
|
+
const transport_1 = require("../graphql/transport");
|
|
9
|
+
function parseMaybeObjectJson(val) {
|
|
10
|
+
if (typeof val === 'string') {
|
|
11
|
+
try {
|
|
12
|
+
const parsed = JSON.parse(val);
|
|
13
|
+
return (0, core_1.isPlainObject)(parsed) ? parsed : undefined;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return (0, core_1.isPlainObject)(val) ? val : undefined;
|
|
20
|
+
}
|
|
21
|
+
function isSubscriptionOperation(query, operationName) {
|
|
22
|
+
try {
|
|
23
|
+
const doc = (0, graphql_1.parse)(query);
|
|
24
|
+
for (const def of doc.definitions) {
|
|
25
|
+
if (def.kind === graphql_1.Kind.OPERATION_DEFINITION && def.operation === 'subscription') {
|
|
26
|
+
if (!operationName || def.name?.value === operationName) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// syntax error handled by executor/stream
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a Hono route handler / middleware for executing Siglo GraphQL queries,
|
|
39
|
+
* mutations, and Server-Sent Events (SSE) subscriptions over Web Standard Request/Response.
|
|
40
|
+
*/
|
|
41
|
+
function createHonoQueryHandler(options) {
|
|
42
|
+
const { engine } = options;
|
|
43
|
+
const schema = options.schema ?? (0, schema_1.createWorkflowGraphQLSchema)(engine);
|
|
44
|
+
return async (c, next) => {
|
|
45
|
+
try {
|
|
46
|
+
const method = c.req?.method || 'POST';
|
|
47
|
+
if (method === 'OPTIONS') {
|
|
48
|
+
return new Response(null, {
|
|
49
|
+
status: 204,
|
|
50
|
+
headers: { Allow: 'GET, POST, OPTIONS' },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
let query;
|
|
54
|
+
let variables;
|
|
55
|
+
let operationName;
|
|
56
|
+
if (method === 'GET') {
|
|
57
|
+
query = c.req.query('query');
|
|
58
|
+
variables = parseMaybeObjectJson(c.req.query('variables'));
|
|
59
|
+
operationName = c.req.query('operationName');
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
let rawBody = {};
|
|
63
|
+
try {
|
|
64
|
+
rawBody = await c.req.json();
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
rawBody = {};
|
|
68
|
+
}
|
|
69
|
+
const body = (0, core_1.isPlainObject)(rawBody) ? rawBody : {};
|
|
70
|
+
const rawQuery = body.query ?? c.req.query?.('query');
|
|
71
|
+
query = typeof rawQuery === 'string' && rawQuery.length > 0 ? rawQuery : undefined;
|
|
72
|
+
variables = parseMaybeObjectJson(body.variables ?? c.req.query?.('variables'));
|
|
73
|
+
const rawOp = body.operationName ?? c.req.query?.('operationName');
|
|
74
|
+
operationName = typeof rawOp === 'string' && rawOp.length > 0 ? rawOp : undefined;
|
|
75
|
+
}
|
|
76
|
+
if (!query) {
|
|
77
|
+
if (typeof next === 'function') {
|
|
78
|
+
return next();
|
|
79
|
+
}
|
|
80
|
+
return c.json({ errors: [{ message: 'GraphQL query is required' }] }, 400);
|
|
81
|
+
}
|
|
82
|
+
let authenticatedNamespace;
|
|
83
|
+
if (typeof options.namespace === 'function') {
|
|
84
|
+
authenticatedNamespace = await options.namespace(c);
|
|
85
|
+
}
|
|
86
|
+
else if (typeof options.namespace === 'string') {
|
|
87
|
+
authenticatedNamespace = options.namespace;
|
|
88
|
+
}
|
|
89
|
+
else if (options.allowHeaderNamespace && c.req?.header) {
|
|
90
|
+
authenticatedNamespace = c.req.header('x-namespace');
|
|
91
|
+
}
|
|
92
|
+
const userContext = options.context ? await options.context(c) : {};
|
|
93
|
+
const contextValue = {
|
|
94
|
+
...userContext,
|
|
95
|
+
namespace: userContext.namespace ?? authenticatedNamespace,
|
|
96
|
+
engine,
|
|
97
|
+
subscriptionManager: engine.getSubscriptionManager(),
|
|
98
|
+
};
|
|
99
|
+
const accept = c.req?.header?.('accept') || '';
|
|
100
|
+
const wantsSSE = accept.includes('text/event-stream') || isSubscriptionOperation(query, operationName);
|
|
101
|
+
if (wantsSSE) {
|
|
102
|
+
const stream = (0, transport_1.createWorkflowSSEStream)({
|
|
103
|
+
schema,
|
|
104
|
+
query,
|
|
105
|
+
variables,
|
|
106
|
+
context: contextValue,
|
|
107
|
+
operationName,
|
|
108
|
+
keepAliveIntervalMs: options.keepAliveIntervalMs,
|
|
109
|
+
});
|
|
110
|
+
return (0, transport_1.createWorkflowSSEResponse)(stream);
|
|
111
|
+
}
|
|
112
|
+
const result = await (0, graphql_1.graphql)({
|
|
113
|
+
schema,
|
|
114
|
+
source: query,
|
|
115
|
+
variableValues: variables,
|
|
116
|
+
contextValue,
|
|
117
|
+
operationName,
|
|
118
|
+
});
|
|
119
|
+
const status = result.errors && !result.data ? 400 : 200;
|
|
120
|
+
return c.json(result, status);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
if (typeof next === 'function') {
|
|
124
|
+
return next();
|
|
125
|
+
}
|
|
126
|
+
return c.json({ errors: [{ message: (0, core_1.getErrorMessage)(err) || 'Internal error' }] }, 500);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
exports.honoQueryMiddleware = createHonoQueryHandler;
|
|
131
|
+
//# sourceMappingURL=hono.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hono.js","sourceRoot":"","sources":["../../src/integrations/hono.ts"],"names":[],"mappings":";;;AA0DA,wDA6FC;AAvJD,qCAAmE;AACnE,sCAA6D;AAE7D,8CAAgE;AAEhE,oDAA0F;AAqB1F,SAAS,oBAAoB,CAAC,GAAY;IACtC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC;YACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO,IAAA,oBAAa,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CA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c,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./express"), exports);
|
|
18
|
+
__exportStar(require("./fastify"), exports);
|
|
19
|
+
__exportStar(require("./hono"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,yCAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./server"), exports);
|
|
18
|
+
__exportStar(require("./tools"), exports);
|
|
19
|
+
__exportStar(require("./resources"), exports);
|
|
20
|
+
__exportStar(require("./prompts"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,4CAA0B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { WorkflowQueryEngine } from '../engine';
|
|
2
|
+
import { type McpTenantScopeOptions } from './tools';
|
|
3
|
+
export declare const WORKFLOW_MCP_PROMPTS: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
arguments: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
}[];
|
|
12
|
+
export interface McpPromptContext extends McpTenantScopeOptions {
|
|
13
|
+
engine: WorkflowQueryEngine;
|
|
14
|
+
}
|
|
15
|
+
export declare function getMcpPrompt(name: string, args: Record<string, string> | undefined, ctx: McpPromptContext): Promise<{
|
|
16
|
+
description: string;
|
|
17
|
+
messages: Array<{
|
|
18
|
+
role: 'user' | 'assistant';
|
|
19
|
+
content: {
|
|
20
|
+
type: 'text';
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAA6C,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhG,eAAO,MAAM,oBAAoB;;;;;;;;GAuBhC,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC3D,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AAED,wBAAsB,YAAY,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACxC,GAAG,EAAE,gBAAgB,GACtB,OAAO,CAAC;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAC3B,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,CAAC,CAAC;CACN,CAAC,CA6ED"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_MCP_PROMPTS = void 0;
|
|
4
|
+
exports.getMcpPrompt = getMcpPrompt;
|
|
5
|
+
const tools_1 = require("./tools");
|
|
6
|
+
exports.WORKFLOW_MCP_PROMPTS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'diagnose_failure',
|
|
9
|
+
description: 'Diagnose why a workflow execution failed, inspect step history and error diagnostics, and recommend remediation steps.',
|
|
10
|
+
arguments: [
|
|
11
|
+
{
|
|
12
|
+
name: 'stackId',
|
|
13
|
+
description: 'The workflow execution stackId to diagnose.',
|
|
14
|
+
required: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'workflowId',
|
|
18
|
+
description: 'Optional workflowId to search for recent failed executions.',
|
|
19
|
+
required: false,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'namespace',
|
|
23
|
+
description: 'Tenant partition namespace.',
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
async function getMcpPrompt(name, args, ctx) {
|
|
30
|
+
if (name !== 'diagnose_failure') {
|
|
31
|
+
throw new Error(`Unknown MCP prompt: '${name}'`);
|
|
32
|
+
}
|
|
33
|
+
const namespace = (0, tools_1.resolveMcpNamespace)(args?.namespace, ctx);
|
|
34
|
+
const stackId = args?.stackId?.trim();
|
|
35
|
+
const workflowId = args?.workflowId?.trim();
|
|
36
|
+
if (stackId) {
|
|
37
|
+
const execution = await ctx.engine.findById(stackId, {
|
|
38
|
+
namespace,
|
|
39
|
+
includeContext: true,
|
|
40
|
+
redact: true,
|
|
41
|
+
});
|
|
42
|
+
if (!execution) {
|
|
43
|
+
return {
|
|
44
|
+
description: `Diagnose workflow failure for stack '${stackId}' in namespace '${namespace}'`,
|
|
45
|
+
messages: [
|
|
46
|
+
{
|
|
47
|
+
role: 'user',
|
|
48
|
+
content: {
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: [
|
|
51
|
+
`Workflow execution '${stackId}' was not found in namespace '${namespace}'.`,
|
|
52
|
+
`Use the 'search_workflows' tool with { "namespace": "${namespace}", "status": "FAILED"${workflowId ? `, "workflowId": "${workflowId}"` : ''} } to locate the failed workflow, then call 'inspect_workflow' to analyze its step history and error diagnostics.`,
|
|
53
|
+
].join('\n\n'),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const snapshot = (0, tools_1.formatWorkflowDetail)(execution, true);
|
|
60
|
+
return {
|
|
61
|
+
description: `Root-cause failure diagnosis for workflow '${stackId}'`,
|
|
62
|
+
messages: [
|
|
63
|
+
{
|
|
64
|
+
role: 'user',
|
|
65
|
+
content: {
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: [
|
|
68
|
+
`Diagnose the failure for Siglo workflow execution '${stackId}' in namespace '${namespace}'.`,
|
|
69
|
+
`Here is the redacted workflow execution snapshot:`,
|
|
70
|
+
'```json',
|
|
71
|
+
JSON.stringify(snapshot, null, 2),
|
|
72
|
+
'```',
|
|
73
|
+
`Please provide:`,
|
|
74
|
+
`1. **Failing Step & Root Cause**: Identify which step failed and the specific exception or error reason.`,
|
|
75
|
+
`2. **Execution Context State**: Summarize the relevant state accumulated prior to the failure.`,
|
|
76
|
+
`3. **Saga & Compensation Status**: Note whether any compensations ran or require operator attention.`,
|
|
77
|
+
`4. **Remediation Plan**: Recommend concrete recovery or retry actions.`,
|
|
78
|
+
].join('\n'),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
description: `Diagnose recent workflow failures in namespace '${namespace}'`,
|
|
86
|
+
messages: [
|
|
87
|
+
{
|
|
88
|
+
role: 'user',
|
|
89
|
+
content: {
|
|
90
|
+
type: 'text',
|
|
91
|
+
text: [
|
|
92
|
+
`Diagnose recent workflow failures in namespace '${namespace}'${workflowId ? ` for workflowId '${workflowId}'` : ''}.`,
|
|
93
|
+
`Step 1: Call 'search_workflows' with { "namespace": "${namespace}", "status": "FAILED"${workflowId ? `, "workflowId": "${workflowId}"` : ''} }.`,
|
|
94
|
+
`Step 2: For the failed execution(s), call 'inspect_workflow' with { "stackId": "<stackId>", "namespace": "${namespace}", "includeSteps": true }.`,
|
|
95
|
+
`Step 3: Report the failing step, error cause, compensation status, and recommended remediation.`,
|
|
96
|
+
].join('\n'),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/mcp/prompts.ts"],"names":[],"mappings":";;;AAgCA,oCAuFC;AAtHD,mCAAgG;AAEnF,QAAA,oBAAoB,GAAG;IAChC;QACI,IAAI,EAAE,kBAAkB;QACxB,WAAW,EACP,wHAAwH;QAC5H,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,6CAA6C;gBAC1D,QAAQ,EAAE,KAAK;aAClB;YACD;gBACI,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,6DAA6D;gBAC1E,QAAQ,EAAE,KAAK;aAClB;YACD;gBACI,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,6BAA6B;gBAC1C,QAAQ,EAAE,KAAK;aAClB;SACJ;KACJ;CACJ,CAAC;AAMK,KAAK,UAAU,YAAY,CAC9B,IAAY,EACZ,IAAwC,EACxC,GAAqB;IAQrB,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,2BAAmB,EAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,IAAI,EAAE,UAA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mDAAmD,SAAS,GAAG;QAC5E,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACF,mDAAmD,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,oBAAoB,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;wBACtH,wDAAwD,SAAS,wBAAwB,UAAU,CAAC,CAAC,CAAC,oBAAoB,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK;wBACjJ,6GAA6G,SAAS,4BAA4B;wBAClJ,iGAAiG;qBACpG,CAAC,IAAI,CAAC,IAAI,CAAC;iBACf;aACJ;SACJ;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { WorkflowQueryEngine } from '../engine';
|
|
2
|
+
import { type McpTenantScopeOptions } from './tools';
|
|
3
|
+
export declare const WORKFLOW_MCP_RESOURCES: {
|
|
4
|
+
uri: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const WORKFLOW_MCP_RESOURCE_TEMPLATES: {
|
|
10
|
+
uriTemplate: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
}[];
|
|
15
|
+
export interface McpResourceContext extends McpTenantScopeOptions {
|
|
16
|
+
engine: WorkflowQueryEngine;
|
|
17
|
+
}
|
|
18
|
+
export declare function readMcpResource(uri: string, ctx: McpResourceContext): Promise<{
|
|
19
|
+
contents: Array<{
|
|
20
|
+
uri: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
text: string;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/mcp/resources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAoE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEvH,eAAO,MAAM,sBAAsB;;;;;GAalC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;GAO3C,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC7D,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AAED,wBAAsB,eAAe,CACjC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,kBAAkB,GACxB,OAAO,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAgG/E"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WORKFLOW_MCP_RESOURCE_TEMPLATES = exports.WORKFLOW_MCP_RESOURCES = void 0;
|
|
4
|
+
exports.readMcpResource = readMcpResource;
|
|
5
|
+
const schema_1 = require("../graphql/schema");
|
|
6
|
+
const tools_1 = require("./tools");
|
|
7
|
+
exports.WORKFLOW_MCP_RESOURCES = [
|
|
8
|
+
{
|
|
9
|
+
uri: 'siglo://workflows/active',
|
|
10
|
+
name: 'Active Workflows',
|
|
11
|
+
description: 'Live list of currently executing (RUNNING) or waiting (WAITING) workflows.',
|
|
12
|
+
mimeType: 'application/json',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
uri: 'siglo://schema/graphql',
|
|
16
|
+
name: 'Siglo Workflow GraphQL Schema',
|
|
17
|
+
description: 'The full GraphQL SDL contract, allowing AI assistants to construct valid queries.',
|
|
18
|
+
mimeType: 'text/plain',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
exports.WORKFLOW_MCP_RESOURCE_TEMPLATES = [
|
|
22
|
+
{
|
|
23
|
+
uriTemplate: 'siglo://workflows/{stackId}',
|
|
24
|
+
name: 'Workflow Execution Snapshot',
|
|
25
|
+
description: 'Real-time status, step breakdown, and redacted context snapshot of a specific workflow.',
|
|
26
|
+
mimeType: 'application/json',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
async function readMcpResource(uri, ctx) {
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = new URL(uri);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new Error(`Invalid MCP resource URI: '${uri}'`);
|
|
36
|
+
}
|
|
37
|
+
if (parsed.protocol !== 'siglo:') {
|
|
38
|
+
throw new Error(`Unsupported MCP resource protocol: '${parsed.protocol}'`);
|
|
39
|
+
}
|
|
40
|
+
const host = parsed.hostname;
|
|
41
|
+
const pathname = parsed.pathname.replace(/^\/+/, '');
|
|
42
|
+
const queryNamespaceParam = parsed.searchParams.get('namespace') ?? undefined;
|
|
43
|
+
if (host === 'schema' && pathname === 'graphql') {
|
|
44
|
+
return {
|
|
45
|
+
contents: [
|
|
46
|
+
{
|
|
47
|
+
uri,
|
|
48
|
+
mimeType: 'text/plain',
|
|
49
|
+
text: schema_1.WORKFLOW_SCHEMA_SDL.trim(),
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (host === 'workflows') {
|
|
55
|
+
const namespace = (0, tools_1.resolveMcpNamespace)(queryNamespaceParam, ctx);
|
|
56
|
+
if (pathname === 'active') {
|
|
57
|
+
const limitParam = parsed.searchParams.get('limit');
|
|
58
|
+
const limit = limitParam ? Number(limitParam) : 25;
|
|
59
|
+
const [runningPage, waitingPage] = await Promise.all([
|
|
60
|
+
ctx.engine.findMany({
|
|
61
|
+
filter: { namespace, status: 'running' },
|
|
62
|
+
pagination: { limit },
|
|
63
|
+
select: { includeContext: false },
|
|
64
|
+
}),
|
|
65
|
+
ctx.engine.findMany({
|
|
66
|
+
filter: { namespace, status: 'waiting' },
|
|
67
|
+
pagination: { limit },
|
|
68
|
+
select: { includeContext: false },
|
|
69
|
+
}),
|
|
70
|
+
]);
|
|
71
|
+
const combined = [...runningPage.items, ...waitingPage.items].sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
72
|
+
const payload = {
|
|
73
|
+
namespace,
|
|
74
|
+
activeCount: runningPage.totalCount + waitingPage.totalCount,
|
|
75
|
+
workflows: combined.slice(0, limit).map(tools_1.formatWorkflowSummary),
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
contents: [
|
|
79
|
+
{
|
|
80
|
+
uri,
|
|
81
|
+
mimeType: 'application/json',
|
|
82
|
+
text: JSON.stringify(payload, null, 2),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const stackId = decodeURIComponent(pathname);
|
|
88
|
+
if (!stackId || stackId.includes('/')) {
|
|
89
|
+
throw new Error(`Unknown MCP workflow resource URI: '${uri}'`);
|
|
90
|
+
}
|
|
91
|
+
const execution = await ctx.engine.findById(stackId, {
|
|
92
|
+
namespace,
|
|
93
|
+
includeContext: true,
|
|
94
|
+
redact: true,
|
|
95
|
+
});
|
|
96
|
+
if (!execution) {
|
|
97
|
+
throw new Error(`Workflow '${stackId}' not found in namespace '${namespace}'`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
contents: [
|
|
101
|
+
{
|
|
102
|
+
uri,
|
|
103
|
+
mimeType: 'application/json',
|
|
104
|
+
text: JSON.stringify((0, tools_1.formatWorkflowDetail)(execution, true), null, 2),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
throw new Error(`Unknown MCP resource URI: '${uri}'`);
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type IncomingMessage, type Server as HttpServer, type ServerResponse } from 'node:http';
|
|
2
|
+
import type { Readable, Writable } from 'node:stream';
|
|
3
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
5
|
+
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
6
|
+
import type { GraphQLSchema } from 'graphql';
|
|
7
|
+
import { type WorkflowQueryEngine } from '../engine';
|
|
8
|
+
import type { WorkflowQueryOptions } from '../types';
|
|
9
|
+
import { type McpTenantScopeOptions } from './tools';
|
|
10
|
+
export interface WorkflowMcpSseOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Port to listen on when starting a standalone HTTP SSE server.
|
|
13
|
+
* Defaults to `0` (ephemeral port assigned by OS).
|
|
14
|
+
*/
|
|
15
|
+
port?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Host interface to bind when starting a standalone HTTP SSE server.
|
|
18
|
+
* Defaults to `'127.0.0.1'`.
|
|
19
|
+
*/
|
|
20
|
+
host?: string;
|
|
21
|
+
/**
|
|
22
|
+
* HTTP GET path for establishing the SSE stream. Defaults to `'/sse'`.
|
|
23
|
+
*/
|
|
24
|
+
ssePath?: string;
|
|
25
|
+
/**
|
|
26
|
+
* HTTP POST path for receiving JSON-RPC client messages. Defaults to `'/messages'`.
|
|
27
|
+
*/
|
|
28
|
+
messagePath?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional existing Node.js HTTP server to mount SSE routes onto.
|
|
31
|
+
*/
|
|
32
|
+
httpServer?: HttpServer;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkflowMcpServerOptions extends Partial<WorkflowQueryOptions>, McpTenantScopeOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Pre-configured `WorkflowQueryEngine` instance. If omitted, `storage` must be provided.
|
|
37
|
+
*/
|
|
38
|
+
engine?: WorkflowQueryEngine;
|
|
39
|
+
/**
|
|
40
|
+
* Optional pre-built GraphQL schema for `execute_workflow_query`.
|
|
41
|
+
*/
|
|
42
|
+
schema?: GraphQLSchema;
|
|
43
|
+
/**
|
|
44
|
+
* Transport mode used by `start()`. Defaults to `'stdio'`.
|
|
45
|
+
*/
|
|
46
|
+
transport?: 'stdio' | 'sse';
|
|
47
|
+
/**
|
|
48
|
+
* Server name reported during MCP initialization. Defaults to `'@siglo/query-mcp'`.
|
|
49
|
+
*/
|
|
50
|
+
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Server version reported during MCP initialization. Defaults to `'1.2.8'`.
|
|
53
|
+
*/
|
|
54
|
+
version?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional readable stream for `stdio` transport (defaults to `process.stdin`).
|
|
57
|
+
*/
|
|
58
|
+
stdin?: Readable;
|
|
59
|
+
/**
|
|
60
|
+
* Optional writable stream for `stdio` transport (defaults to `process.stdout`).
|
|
61
|
+
*/
|
|
62
|
+
stdout?: Writable;
|
|
63
|
+
/**
|
|
64
|
+
* Configuration for `sse` transport mode.
|
|
65
|
+
*/
|
|
66
|
+
sse?: WorkflowMcpSseOptions;
|
|
67
|
+
}
|
|
68
|
+
export declare class WorkflowMcpServer {
|
|
69
|
+
readonly engine: WorkflowQueryEngine;
|
|
70
|
+
readonly schema: GraphQLSchema;
|
|
71
|
+
readonly server: Server;
|
|
72
|
+
private readonly options;
|
|
73
|
+
private readonly info;
|
|
74
|
+
private readonly scope;
|
|
75
|
+
private readonly sseSessions;
|
|
76
|
+
private httpServer?;
|
|
77
|
+
private ownsHttpServer;
|
|
78
|
+
private requestListener?;
|
|
79
|
+
constructor(options: WorkflowMcpServerOptions);
|
|
80
|
+
/**
|
|
81
|
+
* Connects the MCP server to an explicit MCP Transport instance
|
|
82
|
+
* (e.g. `InMemoryTransport`, `StdioServerTransport`, or `SSEServerTransport`).
|
|
83
|
+
*/
|
|
84
|
+
connect(transport: Transport): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Starts the MCP server using the configured transport (`'stdio'` or `'sse'`).
|
|
87
|
+
*/
|
|
88
|
+
start(): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Handles an incoming HTTP GET request to establish an MCP SSE session.
|
|
91
|
+
*/
|
|
92
|
+
handleSseConnect(_req: IncomingMessage, res: ServerResponse, messagePath?: string): Promise<SSEServerTransport>;
|
|
93
|
+
/**
|
|
94
|
+
* Handles an incoming HTTP POST message for an active MCP SSE session.
|
|
95
|
+
*/
|
|
96
|
+
handleSseMessage(req: IncomingMessage, res: ServerResponse, parsedBody?: unknown): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the bound HTTP SSE URL when started in standalone `'sse'` mode.
|
|
99
|
+
*/
|
|
100
|
+
getSseUrl(): string | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Stops the MCP server, closes active transports, and releases resources.
|
|
103
|
+
*/
|
|
104
|
+
close(): Promise<void>;
|
|
105
|
+
stop(): Promise<void>;
|
|
106
|
+
}
|
|
107
|
+
export declare function createWorkflowMcpServer(options: WorkflowMcpServerOptions): WorkflowMcpServer;
|
|
108
|
+
//# sourceMappingURL=server.d.ts.map
|