@walkeros/mcp 3.4.2 → 4.0.0-next-1777463920154
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/dist/index.d.ts +328 -1
- package/dist/index.js +2471 -1516
- package/dist/index.js.map +1 -1
- package/dist/stdio.d.ts +2 -0
- package/dist/stdio.js +2838 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +9 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,329 @@
|
|
|
1
|
+
import { ListFlowsOptions, ListPreviewsOptions, GetPreviewOptions, CreatePreviewOptions, DeletePreviewOptions, DeployOptions, ListDeploymentsOptions, DeviceCodeResult, PollResult, FeedbackOptions } from '@walkeros/cli';
|
|
2
|
+
import { ZodRawShape } from 'zod';
|
|
3
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
export { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { WebStandardStreamableHTTPServerTransportOptions } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
1
6
|
|
|
2
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Transport-agnostic client for network-reach MCP tools. The stdio build
|
|
9
|
+
* plugs in HttpToolClient (talks to the walkerOS app over HTTPS via the
|
|
10
|
+
* CLI's programmatic API). In-process hosts (e.g. the app itself) can plug
|
|
11
|
+
* in a direct client that calls database helpers without HTTP overhead.
|
|
12
|
+
*/
|
|
13
|
+
interface ToolClient {
|
|
14
|
+
listProjects(): Promise<unknown>;
|
|
15
|
+
getProject(options: {
|
|
16
|
+
projectId?: string;
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
createProject(options: {
|
|
19
|
+
name: string;
|
|
20
|
+
}): Promise<unknown>;
|
|
21
|
+
updateProject(options: {
|
|
22
|
+
projectId?: string;
|
|
23
|
+
name: string;
|
|
24
|
+
}): Promise<unknown>;
|
|
25
|
+
deleteProject(options: {
|
|
26
|
+
projectId?: string;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
setDefaultProject(projectId: string): void;
|
|
29
|
+
getDefaultProject(): string | null;
|
|
30
|
+
listAllFlows(options?: {
|
|
31
|
+
sort?: string;
|
|
32
|
+
order?: 'asc' | 'desc';
|
|
33
|
+
includeDeleted?: boolean;
|
|
34
|
+
}): Promise<unknown>;
|
|
35
|
+
listFlows(options: ListFlowsOptions): Promise<unknown>;
|
|
36
|
+
getFlow(options: {
|
|
37
|
+
flowId: string;
|
|
38
|
+
projectId?: string;
|
|
39
|
+
fields?: string[];
|
|
40
|
+
}): Promise<unknown>;
|
|
41
|
+
createFlow(options: {
|
|
42
|
+
name: string;
|
|
43
|
+
content: Record<string, unknown>;
|
|
44
|
+
projectId?: string;
|
|
45
|
+
}): Promise<unknown>;
|
|
46
|
+
updateFlow(options: {
|
|
47
|
+
flowId: string;
|
|
48
|
+
projectId?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
content?: Record<string, unknown>;
|
|
51
|
+
mergePatch?: boolean;
|
|
52
|
+
}): Promise<unknown>;
|
|
53
|
+
deleteFlow(options: {
|
|
54
|
+
flowId: string;
|
|
55
|
+
projectId?: string;
|
|
56
|
+
}): Promise<unknown>;
|
|
57
|
+
duplicateFlow(options: {
|
|
58
|
+
flowId: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
projectId?: string;
|
|
61
|
+
}): Promise<unknown>;
|
|
62
|
+
listPreviews(options: ListPreviewsOptions): Promise<unknown>;
|
|
63
|
+
getPreview(options: GetPreviewOptions): Promise<unknown>;
|
|
64
|
+
createPreview(options: CreatePreviewOptions): Promise<unknown>;
|
|
65
|
+
deletePreview(options: DeletePreviewOptions): Promise<unknown>;
|
|
66
|
+
deploy(options: DeployOptions): Promise<unknown>;
|
|
67
|
+
listDeployments(options: ListDeploymentsOptions): Promise<unknown>;
|
|
68
|
+
getDeploymentBySlug(options: {
|
|
69
|
+
slug: string;
|
|
70
|
+
projectId?: string;
|
|
71
|
+
}): Promise<unknown>;
|
|
72
|
+
deleteDeployment(options: {
|
|
73
|
+
slug: string;
|
|
74
|
+
projectId?: string;
|
|
75
|
+
}): Promise<unknown>;
|
|
76
|
+
requestDeviceCode(): Promise<DeviceCodeResult>;
|
|
77
|
+
pollForToken(deviceCode: string, options?: {
|
|
78
|
+
timeoutMs?: number;
|
|
79
|
+
}): Promise<PollResult>;
|
|
80
|
+
whoami(): Promise<unknown>;
|
|
81
|
+
resolveToken(): {
|
|
82
|
+
token: string;
|
|
83
|
+
source: 'env' | 'config';
|
|
84
|
+
} | null;
|
|
85
|
+
deleteConfig(): boolean;
|
|
86
|
+
submitFeedback(text: string, options?: FeedbackOptions): Promise<void>;
|
|
87
|
+
getFeedbackPreference(): boolean | undefined;
|
|
88
|
+
setFeedbackPreference(anonymous: boolean): void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface ToolAnnotations {
|
|
92
|
+
readOnlyHint: boolean;
|
|
93
|
+
destructiveHint: boolean;
|
|
94
|
+
idempotentHint: boolean;
|
|
95
|
+
openWorldHint: boolean;
|
|
96
|
+
}
|
|
97
|
+
interface ToolDefinition {
|
|
98
|
+
name: string;
|
|
99
|
+
title: string;
|
|
100
|
+
description: string;
|
|
101
|
+
inputSchema: ZodRawShape;
|
|
102
|
+
annotations: ToolAnnotations;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Declarative registry mirroring the inputSchema + annotations of every tool
|
|
106
|
+
* registered in `createWalkerOSMcpServer`. Use this to bridge tools into
|
|
107
|
+
* non-MCP runtimes (e.g., Vercel AI SDK adapters) without booting an
|
|
108
|
+
* `McpServer`. Tool handlers are not included here, they require a
|
|
109
|
+
* `ToolClient`, which the caller provides.
|
|
110
|
+
*/
|
|
111
|
+
declare const TOOL_DEFINITIONS: readonly ToolDefinition[];
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A full tool specification: metadata + executable handler.
|
|
115
|
+
*
|
|
116
|
+
* Produced by each `create<Name>ToolSpec(...)` factory and by the aggregate
|
|
117
|
+
* `createToolHandlers(client)`. Consumers without an `McpServer` (e.g., the
|
|
118
|
+
* walkerOS app's chat route wrapping tools as Vercel AI SDK tools) use this
|
|
119
|
+
* directly; the server factory uses it to call `McpServer.registerTool`.
|
|
120
|
+
*/
|
|
121
|
+
interface ToolSpec {
|
|
122
|
+
name: string;
|
|
123
|
+
title: string;
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: ZodRawShape;
|
|
126
|
+
annotations: ToolAnnotations;
|
|
127
|
+
handler: (input: unknown) => Promise<unknown>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface Logger {
|
|
131
|
+
debug?(message: string, meta?: Record<string, unknown>): void;
|
|
132
|
+
info?(message: string, meta?: Record<string, unknown>): void;
|
|
133
|
+
warn?(message: string, meta?: Record<string, unknown>): void;
|
|
134
|
+
error?(message: string, meta?: Record<string, unknown>): void;
|
|
135
|
+
}
|
|
136
|
+
interface CreateServerOptions {
|
|
137
|
+
client: ToolClient;
|
|
138
|
+
logger?: Logger;
|
|
139
|
+
version?: string;
|
|
140
|
+
catalogBaseUrl?: string;
|
|
141
|
+
}
|
|
142
|
+
declare function createWalkerOSMcpServer(opts: CreateServerOptions): McpServer;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Default ToolClient implementation backed by @walkeros/cli. Every method
|
|
146
|
+
* delegates to the CLI's programmatic API, which in turn talks to the
|
|
147
|
+
* walkerOS app over HTTPS via openapi-fetch. Token resolution and the
|
|
148
|
+
* base URL come from the CLI's config file and environment
|
|
149
|
+
* (WALKEROS_TOKEN, APP_URL), so no constructor args are required.
|
|
150
|
+
*/
|
|
151
|
+
declare class HttpToolClient implements ToolClient {
|
|
152
|
+
listProjects(): Promise<unknown>;
|
|
153
|
+
getProject(options: {
|
|
154
|
+
projectId?: string;
|
|
155
|
+
}): Promise<unknown>;
|
|
156
|
+
createProject(options: {
|
|
157
|
+
name: string;
|
|
158
|
+
}): Promise<unknown>;
|
|
159
|
+
updateProject(options: {
|
|
160
|
+
projectId?: string;
|
|
161
|
+
name: string;
|
|
162
|
+
}): Promise<unknown>;
|
|
163
|
+
deleteProject(options: {
|
|
164
|
+
projectId?: string;
|
|
165
|
+
}): Promise<unknown>;
|
|
166
|
+
setDefaultProject(projectId: string): void;
|
|
167
|
+
getDefaultProject(): string | null;
|
|
168
|
+
listAllFlows(options?: {
|
|
169
|
+
sort?: string;
|
|
170
|
+
order?: 'asc' | 'desc';
|
|
171
|
+
includeDeleted?: boolean;
|
|
172
|
+
}): Promise<unknown>;
|
|
173
|
+
listFlows(options: ListFlowsOptions): Promise<unknown>;
|
|
174
|
+
getFlow(options: {
|
|
175
|
+
flowId: string;
|
|
176
|
+
projectId?: string;
|
|
177
|
+
fields?: string[];
|
|
178
|
+
}): Promise<unknown>;
|
|
179
|
+
createFlow(options: {
|
|
180
|
+
name: string;
|
|
181
|
+
content: Record<string, unknown>;
|
|
182
|
+
projectId?: string;
|
|
183
|
+
}): Promise<unknown>;
|
|
184
|
+
updateFlow(options: {
|
|
185
|
+
flowId: string;
|
|
186
|
+
projectId?: string;
|
|
187
|
+
name?: string;
|
|
188
|
+
content?: Record<string, unknown>;
|
|
189
|
+
mergePatch?: boolean;
|
|
190
|
+
}): Promise<unknown>;
|
|
191
|
+
deleteFlow(options: {
|
|
192
|
+
flowId: string;
|
|
193
|
+
projectId?: string;
|
|
194
|
+
}): Promise<unknown>;
|
|
195
|
+
duplicateFlow(options: {
|
|
196
|
+
flowId: string;
|
|
197
|
+
name?: string;
|
|
198
|
+
projectId?: string;
|
|
199
|
+
}): Promise<unknown>;
|
|
200
|
+
listPreviews(options: ListPreviewsOptions): Promise<unknown>;
|
|
201
|
+
getPreview(options: GetPreviewOptions): Promise<unknown>;
|
|
202
|
+
createPreview(options: CreatePreviewOptions): Promise<unknown>;
|
|
203
|
+
deletePreview(options: DeletePreviewOptions): Promise<unknown>;
|
|
204
|
+
deploy(options: DeployOptions): Promise<unknown>;
|
|
205
|
+
listDeployments(options: ListDeploymentsOptions): Promise<unknown>;
|
|
206
|
+
getDeploymentBySlug(options: {
|
|
207
|
+
slug: string;
|
|
208
|
+
projectId?: string;
|
|
209
|
+
}): Promise<unknown>;
|
|
210
|
+
deleteDeployment(options: {
|
|
211
|
+
slug: string;
|
|
212
|
+
projectId?: string;
|
|
213
|
+
}): Promise<unknown>;
|
|
214
|
+
requestDeviceCode(): Promise<DeviceCodeResult>;
|
|
215
|
+
pollForToken(deviceCode: string, options?: {
|
|
216
|
+
timeoutMs?: number;
|
|
217
|
+
}): Promise<PollResult>;
|
|
218
|
+
whoami(): Promise<unknown>;
|
|
219
|
+
resolveToken(): {
|
|
220
|
+
token: string;
|
|
221
|
+
source: 'env' | 'config';
|
|
222
|
+
} | null;
|
|
223
|
+
deleteConfig(): boolean;
|
|
224
|
+
submitFeedback(text: string, options?: FeedbackOptions): Promise<void>;
|
|
225
|
+
getFeedbackPreference(): boolean | undefined;
|
|
226
|
+
setFeedbackPreference(anonymous: boolean): void;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface CreateStreamableHttpHandlerOptions extends WebStandardStreamableHTTPServerTransportOptions {
|
|
230
|
+
/**
|
|
231
|
+
* Called after a session is initialized. Wraps onsessioninitialized.
|
|
232
|
+
*/
|
|
233
|
+
onSessionInitialized?: (sessionId: string) => void | Promise<void>;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Returns a Fetch-style handler: `(Request) => Promise<Response>`.
|
|
237
|
+
*
|
|
238
|
+
* Single call creates a dedicated transport instance and connects it to the
|
|
239
|
+
* given `McpServer`. The handler holds that transport for its entire
|
|
240
|
+
* lifetime, call `createStreamableHttpHandler` once per app lifecycle, not
|
|
241
|
+
* per request. For multi-session hosting (different users, persistent
|
|
242
|
+
* sessions), instantiate one handler per session keyed by `Mcp-Session-Id`
|
|
243
|
+
* at the Route Handler layer; this factory is the session-agnostic
|
|
244
|
+
* building block.
|
|
245
|
+
*/
|
|
246
|
+
declare function createStreamableHttpHandler(server: McpServer, opts?: CreateStreamableHttpHandlerOptions): (request: Request) => Promise<Response>;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Wraps a user-writable string in `<user_data>…</user_data>` so the chat
|
|
250
|
+
* assistant treats it as data, never as instructions. Inner `</user_data>`
|
|
251
|
+
* sequences are mangled (`</user_data_>`) so a malicious string can't close
|
|
252
|
+
* the envelope early.
|
|
253
|
+
*
|
|
254
|
+
* Idempotent: a string that is already a well-formed envelope with no inner
|
|
255
|
+
* `</user_data>` is returned unchanged.
|
|
256
|
+
*/
|
|
257
|
+
declare function wrapUserData(s: string): string;
|
|
258
|
+
interface RedactOptions {
|
|
259
|
+
/** Return `true` to skip wrapping for a given object key. Only invoked for
|
|
260
|
+
* string values on object entries — not for array elements or scalar
|
|
261
|
+
* roots. Use to keep ids / slugs / dates literal. */
|
|
262
|
+
skip?: (key: string) => boolean;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Recursively walks `value` and returns a deep-copied structure where every
|
|
266
|
+
* string leaf has been passed through `wrapUserData`. Pass `skip` to exclude
|
|
267
|
+
* specific keys (e.g. `id`) from wrapping.
|
|
268
|
+
*/
|
|
269
|
+
declare function redactNestedStrings<T>(value: T, opts?: RedactOptions): T;
|
|
270
|
+
|
|
271
|
+
type SuggestionTile = {
|
|
272
|
+
label: string;
|
|
273
|
+
description?: string;
|
|
274
|
+
prompt: string;
|
|
275
|
+
autoSend?: boolean;
|
|
276
|
+
};
|
|
277
|
+
interface FlowCanvasPayload {
|
|
278
|
+
flowId?: string;
|
|
279
|
+
configName: string;
|
|
280
|
+
platform: 'web' | 'server';
|
|
281
|
+
flowConfig: Record<string, unknown>;
|
|
282
|
+
highlight?: {
|
|
283
|
+
stepAddress: string;
|
|
284
|
+
reason: string;
|
|
285
|
+
};
|
|
286
|
+
suggestions?: SuggestionTile[];
|
|
287
|
+
}
|
|
288
|
+
interface FlowCanvasToolResult extends FlowCanvasPayload {
|
|
289
|
+
kind: 'flow-canvas';
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Tool-result helper that marks a response as renderable as a FlowCanvas.
|
|
293
|
+
* The chat UI inspects `structuredContent.kind === 'flow-canvas'` and mounts
|
|
294
|
+
* a `FlowCanvasBubble` instead of the generic JSON fallback. The `content[0]`
|
|
295
|
+
* text is the same JSON stringified — the LLM sees a self-describing object.
|
|
296
|
+
*/
|
|
297
|
+
declare function flowCanvasResult(payload: FlowCanvasPayload): {
|
|
298
|
+
content: {
|
|
299
|
+
type: "text";
|
|
300
|
+
text: string;
|
|
301
|
+
}[];
|
|
302
|
+
structuredContent: Record<string, unknown> & {
|
|
303
|
+
kind: "flow-canvas";
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
declare function isFlowCanvasResult(v: unknown): v is FlowCanvasToolResult;
|
|
307
|
+
|
|
308
|
+
declare module '@walkeros/core' {
|
|
309
|
+
interface SourceMap {
|
|
310
|
+
mcp: {
|
|
311
|
+
type: 'mcp';
|
|
312
|
+
platform: 'server';
|
|
313
|
+
tool?: string;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Handler-bearing spec for every tool `createWalkerOSMcpServer` registers.
|
|
320
|
+
*
|
|
321
|
+
* Consumers that need to drive the tools WITHOUT an `McpServer` (e.g., the
|
|
322
|
+
* walkerOS app's chat route wrapping them as Vercel AI SDK tools) should call
|
|
323
|
+
* `createToolHandlers(client)` and iterate the returned record. Handlers are
|
|
324
|
+
* closed over `client`, so the caller can bind a single `ToolClient` (such as
|
|
325
|
+
* the zero-hop `ServiceToolClient`) once per session.
|
|
326
|
+
*/
|
|
327
|
+
declare function createToolHandlers(client: ToolClient): Record<string, ToolSpec>;
|
|
328
|
+
|
|
329
|
+
export { type CreateServerOptions, type CreateStreamableHttpHandlerOptions, type FlowCanvasPayload, type FlowCanvasToolResult, HttpToolClient, type Logger, type RedactOptions, type SuggestionTile, TOOL_DEFINITIONS, type ToolAnnotations, type ToolClient, type ToolDefinition, type ToolSpec, createStreamableHttpHandler, createToolHandlers, createWalkerOSMcpServer, flowCanvasResult, isFlowCanvasResult, redactNestedStrings, wrapUserData };
|