@outfitter/mcp 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -29
- package/dist/actions.d.ts +3 -3
- package/dist/actions.js +25 -4
- package/dist/core-tools.d.ts +3 -3
- package/dist/core-tools.js +140 -6
- package/dist/index.d.ts +7 -952
- package/dist/index.js +7 -959
- package/dist/logging.d.ts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.js +2 -2
- package/dist/shared/@outfitter/{mcp-jk0ka9hw.d.ts → mcp-7kcw2814.d.ts} +4 -4
- package/dist/shared/@outfitter/{mcp-nmp5wf0w.js → mcp-b502y16n.js} +1 -1
- package/dist/shared/@outfitter/{mcp-a0cgfsnw.d.ts → mcp-d8vs6vry.d.ts} +1 -1
- package/dist/shared/@outfitter/{mcp-h2twz77x.d.ts → mcp-gqjg15f5.d.ts} +166 -196
- package/dist/shared/@outfitter/mcp-hw5wz4gb.js +1 -0
- package/dist/shared/@outfitter/{mcp-2vqyt1fj.d.ts → mcp-knq080yt.d.ts} +1 -1
- package/dist/shared/@outfitter/{mcp-dwd800vf.d.ts → mcp-s6afm4ff.d.ts} +14 -14
- package/dist/transport.d.ts +3 -3
- package/dist/transport.js +161 -5
- package/dist/types.d.ts +2 -2
- package/package.json +31 -30
- package/dist/shared/@outfitter/mcp-ktapzh9d.js +0 -28
- package/dist/shared/@outfitter/mcp-mzky3ck8.js +0 -165
- package/dist/shared/@outfitter/mcp-zv3ej45k.js +0 -143
- package/dist/shared/@outfitter/mcp-zy7b487d.js +0 -5
package/dist/logging.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { McpLogLevel, mapLogLevelToMcp, shouldEmitLog } from "./shared/@outfitter/mcp-cqpyer9m";
|
|
1
|
+
import { McpLogLevel, mapLogLevelToMcp, shouldEmitLog } from "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
2
2
|
export { shouldEmitLog, mapLogLevelToMcp, McpLogLevel };
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JsonSchema, zodToJsonSchema } from "./shared/@outfitter/mcp-83zvbna8";
|
|
1
|
+
import { JsonSchema, zodToJsonSchema } from "./shared/@outfitter/mcp-83zvbna8.js";
|
|
2
2
|
export { zodToJsonSchema, JsonSchema };
|
package/dist/schema.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./shared/@outfitter/mcp-
|
|
2
|
-
import "./shared/@outfitter/mcp-
|
|
3
|
-
import "./shared/@outfitter/mcp-cqpyer9m";
|
|
1
|
+
import { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./shared/@outfitter/mcp-knq080yt.js";
|
|
2
|
+
import "./shared/@outfitter/mcp-gqjg15f5.js";
|
|
3
|
+
import "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
4
4
|
export { defineTool, defineResourceTemplate, defineResource, definePrompt, createMcpServer };
|
package/dist/server.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
defineResource,
|
|
6
6
|
defineResourceTemplate,
|
|
7
7
|
defineTool
|
|
8
|
-
} from "./shared/@outfitter/mcp-
|
|
8
|
+
} from "./shared/@outfitter/mcp-b502y16n.js";
|
|
9
9
|
import"./shared/@outfitter/mcp-fjtxsa0x.js";
|
|
10
10
|
import"./shared/@outfitter/mcp-9m5hs2z0.js";
|
|
11
|
-
import"./shared/@outfitter/mcp-
|
|
11
|
+
import"./shared/@outfitter/mcp-hw5wz4gb.js";
|
|
12
12
|
export {
|
|
13
13
|
defineTool,
|
|
14
14
|
defineResourceTemplate,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { McpServer } from "./mcp-
|
|
2
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio";
|
|
4
|
-
import { CallToolResult } from "@modelcontextprotocol/sdk/types";
|
|
1
|
+
import { McpServer } from "./mcp-gqjg15f5.js";
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
type McpToolResponse = CallToolResult;
|
|
6
6
|
/**
|
|
7
7
|
* Wrap a handler success value into an MCP CallToolResult.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolDefinition } from "./mcp-
|
|
1
|
+
import { ToolDefinition } from "./mcp-gqjg15f5.js";
|
|
2
2
|
import { ActionRegistry, ActionSurface, AnyActionSpec } from "@outfitter/contracts";
|
|
3
3
|
interface BuildMcpToolsOptions {
|
|
4
4
|
readonly includeSurfaces?: readonly ActionSurface[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpLogLevel } from "./mcp-cqpyer9m";
|
|
1
|
+
import { McpLogLevel } from "./mcp-cqpyer9m.js";
|
|
2
2
|
import { Handler, HandlerContext, Logger, OutfitterError, Result, TaggedErrorClass } from "@outfitter/contracts";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Result as Result2 } from "@outfitter/contracts";
|
|
@@ -18,21 +18,6 @@ import { TaggedError } from "@outfitter/contracts";
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
interface McpServerOptions {
|
|
21
|
-
/**
|
|
22
|
-
* Server name, used in MCP protocol handshake.
|
|
23
|
-
* Should be a short, descriptive identifier.
|
|
24
|
-
*/
|
|
25
|
-
name: string;
|
|
26
|
-
/**
|
|
27
|
-
* Server version (semver format recommended).
|
|
28
|
-
* Sent to clients during initialization.
|
|
29
|
-
*/
|
|
30
|
-
version: string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional logger instance for server logging.
|
|
33
|
-
* If not provided, the server uses the Outfitter logger factory defaults.
|
|
34
|
-
*/
|
|
35
|
-
logger?: Logger;
|
|
36
21
|
/**
|
|
37
22
|
* Default MCP log level for client-facing log forwarding.
|
|
38
23
|
*
|
|
@@ -46,6 +31,21 @@ interface McpServerOptions {
|
|
|
46
31
|
* The MCP client can always override via `logging/setLevel`.
|
|
47
32
|
*/
|
|
48
33
|
defaultLogLevel?: McpLogLevel | null;
|
|
34
|
+
/**
|
|
35
|
+
* Optional logger instance for server logging.
|
|
36
|
+
* If not provided, the server uses the Outfitter logger factory defaults.
|
|
37
|
+
*/
|
|
38
|
+
logger?: Logger;
|
|
39
|
+
/**
|
|
40
|
+
* Server name, used in MCP protocol handshake.
|
|
41
|
+
* Should be a short, descriptive identifier.
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* Server version (semver format recommended).
|
|
46
|
+
* Sent to clients during initialization.
|
|
47
|
+
*/
|
|
48
|
+
version: string;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Behavioral hints for MCP tools.
|
|
@@ -56,14 +56,14 @@ interface McpServerOptions {
|
|
|
56
56
|
* @see https://spec.modelcontextprotocol.io/specification/2025-03-26/server/tools/#annotations
|
|
57
57
|
*/
|
|
58
58
|
interface ToolAnnotations {
|
|
59
|
-
/** When true, the tool does not modify any state. */
|
|
60
|
-
readOnlyHint?: boolean;
|
|
61
59
|
/** When true, the tool may perform destructive operations (e.g., deleting data). */
|
|
62
60
|
destructiveHint?: boolean;
|
|
63
61
|
/** When true, calling the tool multiple times with the same input has the same effect. */
|
|
64
62
|
idempotentHint?: boolean;
|
|
65
63
|
/** When true, the tool may interact with external systems beyond the server. */
|
|
66
64
|
openWorldHint?: boolean;
|
|
65
|
+
/** When true, the tool does not modify any state. */
|
|
66
|
+
readOnlyHint?: boolean;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Common annotation presets for MCP tools.
|
|
@@ -80,41 +80,11 @@ interface ToolAnnotations {
|
|
|
80
80
|
* limitation; presets + spread cover most edge cases.
|
|
81
81
|
*/
|
|
82
82
|
declare const TOOL_ANNOTATIONS: {
|
|
83
|
-
|
|
84
|
-
readonly
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
readonly openWorldHint: false;
|
|
89
|
-
};
|
|
90
|
-
/** Creates or updates state, not destructive. */
|
|
91
|
-
readonly write: {
|
|
92
|
-
readonly readOnlyHint: false;
|
|
93
|
-
readonly destructiveHint: false;
|
|
94
|
-
readonly idempotentHint: false;
|
|
95
|
-
readonly openWorldHint: false;
|
|
96
|
-
};
|
|
97
|
-
/** Idempotent write (PUT-like). */
|
|
98
|
-
readonly writeIdempotent: {
|
|
99
|
-
readonly readOnlyHint: false;
|
|
100
|
-
readonly destructiveHint: false;
|
|
101
|
-
readonly idempotentHint: true;
|
|
102
|
-
readonly openWorldHint: false;
|
|
103
|
-
};
|
|
104
|
-
/** Deletes or permanently modifies data. */
|
|
105
|
-
readonly destructive: {
|
|
106
|
-
readonly readOnlyHint: false;
|
|
107
|
-
readonly destructiveHint: true;
|
|
108
|
-
readonly idempotentHint: true;
|
|
109
|
-
readonly openWorldHint: false;
|
|
110
|
-
};
|
|
111
|
-
/** Interacts with external systems (APIs, network). */
|
|
112
|
-
readonly openWorld: {
|
|
113
|
-
readonly readOnlyHint: false;
|
|
114
|
-
readonly destructiveHint: false;
|
|
115
|
-
readonly idempotentHint: false;
|
|
116
|
-
readonly openWorldHint: true;
|
|
117
|
-
};
|
|
83
|
+
readonly destructive: ToolAnnotations;
|
|
84
|
+
readonly openWorld: ToolAnnotations;
|
|
85
|
+
readonly readOnly: ToolAnnotations;
|
|
86
|
+
readonly write: ToolAnnotations;
|
|
87
|
+
readonly writeIdempotent: ToolAnnotations;
|
|
118
88
|
};
|
|
119
89
|
/**
|
|
120
90
|
* Definition of an MCP tool that can be invoked by clients.
|
|
@@ -158,51 +128,51 @@ interface ToolDefinition<
|
|
|
158
128
|
TError extends OutfitterError = OutfitterError
|
|
159
129
|
> {
|
|
160
130
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
131
|
+
* Optional behavioral annotations for the tool.
|
|
132
|
+
* Helps clients understand tool behavior without invoking it.
|
|
163
133
|
*/
|
|
164
|
-
|
|
134
|
+
annotations?: ToolAnnotations;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the tool should be deferred for tool search.
|
|
137
|
+
* Defaults to true for domain tools; core tools set this to false.
|
|
138
|
+
*/
|
|
139
|
+
deferLoading?: boolean;
|
|
165
140
|
/**
|
|
166
141
|
* Human-readable description of what the tool does.
|
|
167
142
|
* Shown to clients and used by LLMs to understand tool capabilities.
|
|
168
143
|
*/
|
|
169
144
|
description: string;
|
|
170
145
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
146
|
+
* Handler function that processes the tool invocation.
|
|
147
|
+
* Receives validated input and HandlerContext, returns Result.
|
|
173
148
|
*/
|
|
174
|
-
|
|
149
|
+
handler: Handler<TInput, TOutput, TError>;
|
|
175
150
|
/**
|
|
176
151
|
* Zod schema for validating and parsing input.
|
|
177
152
|
* The schema defines the expected input structure.
|
|
178
153
|
*/
|
|
179
154
|
inputSchema: z.ZodType<TInput>;
|
|
180
155
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*/
|
|
184
|
-
annotations?: ToolAnnotations;
|
|
185
|
-
/**
|
|
186
|
-
* Handler function that processes the tool invocation.
|
|
187
|
-
* Receives validated input and HandlerContext, returns Result.
|
|
156
|
+
* Unique tool name (kebab-case recommended).
|
|
157
|
+
* Used by clients to invoke the tool.
|
|
188
158
|
*/
|
|
189
|
-
|
|
159
|
+
name: string;
|
|
190
160
|
}
|
|
191
161
|
/**
|
|
192
162
|
* Serialized tool information for MCP protocol.
|
|
193
163
|
* This is the format sent to clients during tool listing.
|
|
194
164
|
*/
|
|
195
165
|
interface SerializedTool {
|
|
196
|
-
/**
|
|
197
|
-
|
|
166
|
+
/** Behavioral annotations for the tool */
|
|
167
|
+
annotations?: ToolAnnotations;
|
|
168
|
+
/** MCP tool-search hint: whether tool is deferred */
|
|
169
|
+
defer_loading?: boolean;
|
|
198
170
|
/** Tool description */
|
|
199
171
|
description: string;
|
|
200
172
|
/** JSON Schema representation of the input schema */
|
|
201
173
|
inputSchema: Record<string, unknown>;
|
|
202
|
-
/**
|
|
203
|
-
|
|
204
|
-
/** Behavioral annotations for the tool */
|
|
205
|
-
annotations?: ToolAnnotations;
|
|
174
|
+
/** Tool name */
|
|
175
|
+
name: string;
|
|
206
176
|
}
|
|
207
177
|
/**
|
|
208
178
|
* Annotations for content items (resource content, prompt messages).
|
|
@@ -226,27 +196,27 @@ interface ContentAnnotations {
|
|
|
226
196
|
* Text content returned from a resource read.
|
|
227
197
|
*/
|
|
228
198
|
interface TextResourceContent {
|
|
229
|
-
/** Resource URI */
|
|
230
|
-
uri: string;
|
|
231
|
-
/** Text content */
|
|
232
|
-
text: string;
|
|
233
|
-
/** Optional MIME type */
|
|
234
|
-
mimeType?: string;
|
|
235
199
|
/** Optional content annotations */
|
|
236
200
|
annotations?: ContentAnnotations;
|
|
201
|
+
/** Optional MIME type */
|
|
202
|
+
mimeType?: string;
|
|
203
|
+
/** Text content */
|
|
204
|
+
text: string;
|
|
205
|
+
/** Resource URI */
|
|
206
|
+
uri: string;
|
|
237
207
|
}
|
|
238
208
|
/**
|
|
239
209
|
* Binary (base64-encoded) content returned from a resource read.
|
|
240
210
|
*/
|
|
241
211
|
interface BlobResourceContent {
|
|
242
|
-
/**
|
|
243
|
-
|
|
212
|
+
/** Optional content annotations */
|
|
213
|
+
annotations?: ContentAnnotations;
|
|
244
214
|
/** Base64-encoded binary content */
|
|
245
215
|
blob: string;
|
|
246
216
|
/** Optional MIME type */
|
|
247
217
|
mimeType?: string;
|
|
248
|
-
/**
|
|
249
|
-
|
|
218
|
+
/** Resource URI */
|
|
219
|
+
uri: string;
|
|
250
220
|
}
|
|
251
221
|
/**
|
|
252
222
|
* Content returned from reading a resource.
|
|
@@ -281,31 +251,31 @@ type ResourceReadHandler = (uri: string, ctx: HandlerContext) => Promise<Result<
|
|
|
281
251
|
* ```
|
|
282
252
|
*/
|
|
283
253
|
interface ResourceDefinition {
|
|
284
|
-
/**
|
|
285
|
-
* Unique resource URI.
|
|
286
|
-
* Must be a valid URI (file://, https://, custom://, etc.).
|
|
287
|
-
*/
|
|
288
|
-
uri: string;
|
|
289
|
-
/**
|
|
290
|
-
* Human-readable resource name.
|
|
291
|
-
* Displayed to users in resource listings.
|
|
292
|
-
*/
|
|
293
|
-
name: string;
|
|
294
254
|
/**
|
|
295
255
|
* Optional description of the resource.
|
|
296
256
|
* Provides additional context about the resource contents.
|
|
297
257
|
*/
|
|
298
258
|
description?: string;
|
|
299
259
|
/**
|
|
260
|
+
* Optional handler for reading the resource content.
|
|
261
|
+
* If not provided, the resource is metadata-only.
|
|
262
|
+
*/
|
|
263
|
+
handler?: ResourceReadHandler;
|
|
264
|
+
/**
|
|
300
265
|
* Optional MIME type of the resource content.
|
|
301
266
|
* Helps clients understand how to process the resource.
|
|
302
267
|
*/
|
|
303
268
|
mimeType?: string;
|
|
304
269
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
270
|
+
* Human-readable resource name.
|
|
271
|
+
* Displayed to users in resource listings.
|
|
307
272
|
*/
|
|
308
|
-
|
|
273
|
+
name: string;
|
|
274
|
+
/**
|
|
275
|
+
* Unique resource URI.
|
|
276
|
+
* Must be a valid URI (file://, https://, custom://, etc.).
|
|
277
|
+
*/
|
|
278
|
+
uri: string;
|
|
309
279
|
}
|
|
310
280
|
/**
|
|
311
281
|
* Handler for reading a resource template's content.
|
|
@@ -334,29 +304,29 @@ type ResourceTemplateReadHandler = (uri: string, variables: Record<string, strin
|
|
|
334
304
|
* ```
|
|
335
305
|
*/
|
|
336
306
|
interface ResourceTemplateDefinition {
|
|
337
|
-
/** URI template with `{param}` placeholders (RFC 6570 Level 1). */
|
|
338
|
-
uriTemplate: string;
|
|
339
|
-
/** Human-readable name for the template. */
|
|
340
|
-
name: string;
|
|
341
|
-
/** Optional description. */
|
|
342
|
-
description?: string;
|
|
343
|
-
/** Optional MIME type. */
|
|
344
|
-
mimeType?: string;
|
|
345
307
|
/** Optional completion handlers keyed by parameter name. */
|
|
346
308
|
complete?: Record<string, CompletionHandler>;
|
|
309
|
+
/** Optional description. */
|
|
310
|
+
description?: string;
|
|
347
311
|
/** Handler for reading matched resources. */
|
|
348
312
|
handler: ResourceTemplateReadHandler;
|
|
313
|
+
/** Optional MIME type. */
|
|
314
|
+
mimeType?: string;
|
|
315
|
+
/** Human-readable name for the template. */
|
|
316
|
+
name: string;
|
|
317
|
+
/** URI template with `{param}` placeholders (RFC 6570 Level 1). */
|
|
318
|
+
uriTemplate: string;
|
|
349
319
|
}
|
|
350
320
|
/**
|
|
351
321
|
* Result of a completion request.
|
|
352
322
|
*/
|
|
353
323
|
interface CompletionResult {
|
|
354
|
-
/** Completion values */
|
|
355
|
-
values: string[];
|
|
356
|
-
/** Total number of available values (for pagination) */
|
|
357
|
-
total?: number;
|
|
358
324
|
/** Whether there are more values */
|
|
359
325
|
hasMore?: boolean;
|
|
326
|
+
/** Total number of available values (for pagination) */
|
|
327
|
+
total?: number;
|
|
328
|
+
/** Completion values */
|
|
329
|
+
values: string[];
|
|
360
330
|
}
|
|
361
331
|
/**
|
|
362
332
|
* Handler for generating completions.
|
|
@@ -376,43 +346,43 @@ type CompletionRef = {
|
|
|
376
346
|
* Argument definition for a prompt.
|
|
377
347
|
*/
|
|
378
348
|
interface PromptArgument {
|
|
379
|
-
/**
|
|
380
|
-
|
|
349
|
+
/** Optional completion handler for this argument */
|
|
350
|
+
complete?: CompletionHandler;
|
|
381
351
|
/** Human-readable description */
|
|
382
352
|
description?: string;
|
|
353
|
+
/** Argument name */
|
|
354
|
+
name: string;
|
|
383
355
|
/** Whether this argument is required */
|
|
384
356
|
required?: boolean;
|
|
385
|
-
/** Optional completion handler for this argument */
|
|
386
|
-
complete?: CompletionHandler;
|
|
387
357
|
}
|
|
388
358
|
/**
|
|
389
359
|
* Content block within a prompt message.
|
|
390
360
|
*/
|
|
391
361
|
interface PromptMessageContent {
|
|
392
|
-
/** Content type */
|
|
393
|
-
type: "text";
|
|
394
|
-
/** Text content */
|
|
395
|
-
text: string;
|
|
396
362
|
/** Optional content annotations */
|
|
397
363
|
annotations?: ContentAnnotations;
|
|
364
|
+
/** Text content */
|
|
365
|
+
text: string;
|
|
366
|
+
/** Content type */
|
|
367
|
+
type: "text";
|
|
398
368
|
}
|
|
399
369
|
/**
|
|
400
370
|
* A message in a prompt response.
|
|
401
371
|
*/
|
|
402
372
|
interface PromptMessage {
|
|
403
|
-
/** Message role */
|
|
404
|
-
role: "user" | "assistant";
|
|
405
373
|
/** Message content */
|
|
406
374
|
content: PromptMessageContent;
|
|
375
|
+
/** Message role */
|
|
376
|
+
role: "user" | "assistant";
|
|
407
377
|
}
|
|
408
378
|
/**
|
|
409
379
|
* Result returned from getting a prompt.
|
|
410
380
|
*/
|
|
411
381
|
interface PromptResult {
|
|
412
|
-
/** Prompt messages */
|
|
413
|
-
messages: PromptMessage[];
|
|
414
382
|
/** Optional description override */
|
|
415
383
|
description?: string;
|
|
384
|
+
/** Prompt messages */
|
|
385
|
+
messages: PromptMessage[];
|
|
416
386
|
}
|
|
417
387
|
/**
|
|
418
388
|
* Handler for generating prompt messages.
|
|
@@ -438,14 +408,14 @@ type PromptHandler = (args: Record<string, string | undefined>) => Promise<Resul
|
|
|
438
408
|
* ```
|
|
439
409
|
*/
|
|
440
410
|
interface PromptDefinition {
|
|
441
|
-
/** Unique prompt name */
|
|
442
|
-
name: string;
|
|
443
|
-
/** Human-readable description */
|
|
444
|
-
description?: string;
|
|
445
411
|
/** Prompt arguments */
|
|
446
412
|
arguments: PromptArgument[];
|
|
413
|
+
/** Human-readable description */
|
|
414
|
+
description?: string;
|
|
447
415
|
/** Handler to generate messages */
|
|
448
416
|
handler: PromptHandler;
|
|
417
|
+
/** Unique prompt name */
|
|
418
|
+
name: string;
|
|
449
419
|
}
|
|
450
420
|
declare const McpErrorBase: TaggedErrorClass<"McpError", {
|
|
451
421
|
message: string;
|
|
@@ -483,12 +453,12 @@ declare class McpError extends McpErrorBase {
|
|
|
483
453
|
* Options for invoking a tool.
|
|
484
454
|
*/
|
|
485
455
|
interface InvokeToolOptions {
|
|
486
|
-
/** Abort signal for cancellation */
|
|
487
|
-
signal?: AbortSignal;
|
|
488
|
-
/** Custom request ID (auto-generated if not provided) */
|
|
489
|
-
requestId?: string;
|
|
490
456
|
/** Progress token from client for tracking progress */
|
|
491
457
|
progressToken?: string | number;
|
|
458
|
+
/** Custom request ID (auto-generated if not provided) */
|
|
459
|
+
requestId?: string;
|
|
460
|
+
/** Abort signal for cancellation */
|
|
461
|
+
signal?: AbortSignal;
|
|
492
462
|
}
|
|
493
463
|
/**
|
|
494
464
|
* MCP Server instance.
|
|
@@ -510,44 +480,12 @@ interface InvokeToolOptions {
|
|
|
510
480
|
* ```
|
|
511
481
|
*/
|
|
512
482
|
interface McpServer {
|
|
513
|
-
/** Server name */
|
|
514
|
-
readonly name: string;
|
|
515
|
-
/** Server version */
|
|
516
|
-
readonly version: string;
|
|
517
|
-
/**
|
|
518
|
-
* Register a tool with the server.
|
|
519
|
-
* @param tool - Tool definition to register
|
|
520
|
-
*/
|
|
521
|
-
registerTool<
|
|
522
|
-
TInput,
|
|
523
|
-
TOutput,
|
|
524
|
-
TError extends OutfitterError
|
|
525
|
-
>(tool: ToolDefinition<TInput, TOutput, TError>): void;
|
|
526
|
-
/**
|
|
527
|
-
* Register a resource with the server.
|
|
528
|
-
* @param resource - Resource definition to register
|
|
529
|
-
*/
|
|
530
|
-
registerResource(resource: ResourceDefinition): void;
|
|
531
|
-
/**
|
|
532
|
-
* Get all registered tools.
|
|
533
|
-
* @returns Array of serialized tool information
|
|
534
|
-
*/
|
|
535
|
-
getTools(): SerializedTool[];
|
|
536
|
-
/**
|
|
537
|
-
* Register a resource template with the server.
|
|
538
|
-
* @param template - Resource template definition to register
|
|
539
|
-
*/
|
|
540
|
-
registerResourceTemplate(template: ResourceTemplateDefinition): void;
|
|
541
|
-
/**
|
|
542
|
-
* Get all registered resources.
|
|
543
|
-
* @returns Array of resource definitions
|
|
544
|
-
*/
|
|
545
|
-
getResources(): ResourceDefinition[];
|
|
546
483
|
/**
|
|
547
|
-
*
|
|
548
|
-
*
|
|
484
|
+
* Bind the SDK server instance for notifications.
|
|
485
|
+
* Called internally by the transport layer.
|
|
486
|
+
* @param sdkServer - The MCP SDK Server instance
|
|
549
487
|
*/
|
|
550
|
-
|
|
488
|
+
bindSdkServer?(sdkServer: any): void;
|
|
551
489
|
/**
|
|
552
490
|
* Complete an argument value.
|
|
553
491
|
* @param ref - Reference to the prompt or resource template
|
|
@@ -557,10 +495,12 @@ interface McpServer {
|
|
|
557
495
|
*/
|
|
558
496
|
complete(ref: CompletionRef, argumentName: string, value: string): Promise<Result<CompletionResult, InstanceType<typeof McpError>>>;
|
|
559
497
|
/**
|
|
560
|
-
*
|
|
561
|
-
* @param
|
|
498
|
+
* Get a specific prompt's messages.
|
|
499
|
+
* @param name - Prompt name
|
|
500
|
+
* @param args - Prompt arguments
|
|
501
|
+
* @returns Result with prompt result or McpError
|
|
562
502
|
*/
|
|
563
|
-
|
|
503
|
+
getPrompt(name: string, args: Record<string, string | undefined>): Promise<Result<PromptResult, InstanceType<typeof McpError>>>;
|
|
564
504
|
/**
|
|
565
505
|
* Get all registered prompts.
|
|
566
506
|
* @returns Array of prompt definitions (without handlers)
|
|
@@ -571,18 +511,20 @@ interface McpServer {
|
|
|
571
511
|
arguments: PromptArgument[];
|
|
572
512
|
}>;
|
|
573
513
|
/**
|
|
574
|
-
* Get
|
|
575
|
-
* @
|
|
576
|
-
* @param args - Prompt arguments
|
|
577
|
-
* @returns Result with prompt result or McpError
|
|
514
|
+
* Get all registered resources.
|
|
515
|
+
* @returns Array of resource definitions
|
|
578
516
|
*/
|
|
579
|
-
|
|
517
|
+
getResources(): ResourceDefinition[];
|
|
580
518
|
/**
|
|
581
|
-
*
|
|
582
|
-
* @
|
|
583
|
-
* @returns Result with resource content or McpError
|
|
519
|
+
* Get all registered resource templates.
|
|
520
|
+
* @returns Array of resource template definitions
|
|
584
521
|
*/
|
|
585
|
-
|
|
522
|
+
getResourceTemplates(): ResourceTemplateDefinition[];
|
|
523
|
+
/**
|
|
524
|
+
* Get all registered tools.
|
|
525
|
+
* @returns Array of serialized tool information
|
|
526
|
+
*/
|
|
527
|
+
getTools(): SerializedTool[];
|
|
586
528
|
/**
|
|
587
529
|
* Invoke a tool by name.
|
|
588
530
|
* @param name - Tool name
|
|
@@ -591,16 +533,16 @@ interface McpServer {
|
|
|
591
533
|
* @returns Result with tool output or McpError
|
|
592
534
|
*/
|
|
593
535
|
invokeTool<T = unknown>(name: string, input: unknown, options?: InvokeToolOptions): Promise<Result<T, InstanceType<typeof McpError>>>;
|
|
536
|
+
/** Server name */
|
|
537
|
+
readonly name: string;
|
|
594
538
|
/**
|
|
595
|
-
*
|
|
596
|
-
* @param uri - Resource URI to subscribe to
|
|
539
|
+
* Notify connected clients that the prompt list has changed.
|
|
597
540
|
*/
|
|
598
|
-
|
|
541
|
+
notifyPromptsChanged(): void;
|
|
599
542
|
/**
|
|
600
|
-
*
|
|
601
|
-
* @param uri - Resource URI to unsubscribe from
|
|
543
|
+
* Notify connected clients that the resource list has changed.
|
|
602
544
|
*/
|
|
603
|
-
|
|
545
|
+
notifyResourcesChanged(): void;
|
|
604
546
|
/**
|
|
605
547
|
* Notify connected clients that a specific resource has been updated.
|
|
606
548
|
* Only emits for subscribed URIs.
|
|
@@ -612,19 +554,35 @@ interface McpServer {
|
|
|
612
554
|
*/
|
|
613
555
|
notifyToolsChanged(): void;
|
|
614
556
|
/**
|
|
615
|
-
*
|
|
557
|
+
* Read a resource by URI.
|
|
558
|
+
* @param uri - Resource URI
|
|
559
|
+
* @returns Result with resource content or McpError
|
|
616
560
|
*/
|
|
617
|
-
|
|
561
|
+
readResource(uri: string): Promise<Result<ResourceContent[], InstanceType<typeof McpError>>>;
|
|
618
562
|
/**
|
|
619
|
-
*
|
|
563
|
+
* Register a prompt with the server.
|
|
564
|
+
* @param prompt - Prompt definition to register
|
|
620
565
|
*/
|
|
621
|
-
|
|
566
|
+
registerPrompt(prompt: PromptDefinition): void;
|
|
622
567
|
/**
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
* @param level - MCP log level string
|
|
568
|
+
* Register a resource with the server.
|
|
569
|
+
* @param resource - Resource definition to register
|
|
626
570
|
*/
|
|
627
|
-
|
|
571
|
+
registerResource(resource: ResourceDefinition): void;
|
|
572
|
+
/**
|
|
573
|
+
* Register a resource template with the server.
|
|
574
|
+
* @param template - Resource template definition to register
|
|
575
|
+
*/
|
|
576
|
+
registerResourceTemplate(template: ResourceTemplateDefinition): void;
|
|
577
|
+
/**
|
|
578
|
+
* Register a tool with the server.
|
|
579
|
+
* @param tool - Tool definition to register
|
|
580
|
+
*/
|
|
581
|
+
registerTool<
|
|
582
|
+
TInput,
|
|
583
|
+
TOutput,
|
|
584
|
+
TError extends OutfitterError
|
|
585
|
+
>(tool: ToolDefinition<TInput, TOutput, TError>): void;
|
|
628
586
|
/**
|
|
629
587
|
* Send a log message to connected clients.
|
|
630
588
|
* Filters by the client-requested log level threshold.
|
|
@@ -636,11 +594,11 @@ interface McpServer {
|
|
|
636
594
|
*/
|
|
637
595
|
sendLogMessage(level: McpLogLevel, data: unknown, loggerName?: string): void;
|
|
638
596
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* @param
|
|
597
|
+
* Set the client-requested log level.
|
|
598
|
+
* Only log messages at or above this level will be forwarded.
|
|
599
|
+
* @param level - MCP log level string
|
|
642
600
|
*/
|
|
643
|
-
|
|
601
|
+
setLogLevel?(level: string): void;
|
|
644
602
|
/**
|
|
645
603
|
* Start the MCP server.
|
|
646
604
|
* Begins listening for client connections.
|
|
@@ -651,6 +609,18 @@ interface McpServer {
|
|
|
651
609
|
* Closes all connections and cleans up resources.
|
|
652
610
|
*/
|
|
653
611
|
stop(): Promise<void>;
|
|
612
|
+
/**
|
|
613
|
+
* Subscribe to updates for a resource URI.
|
|
614
|
+
* @param uri - Resource URI to subscribe to
|
|
615
|
+
*/
|
|
616
|
+
subscribe(uri: string): void;
|
|
617
|
+
/**
|
|
618
|
+
* Unsubscribe from updates for a resource URI.
|
|
619
|
+
* @param uri - Resource URI to unsubscribe from
|
|
620
|
+
*/
|
|
621
|
+
unsubscribe(uri: string): void;
|
|
622
|
+
/** Server version */
|
|
623
|
+
readonly version: string;
|
|
654
624
|
}
|
|
655
625
|
/**
|
|
656
626
|
* Reporter for sending progress updates to clients.
|
|
@@ -669,10 +639,10 @@ interface ProgressReporter {
|
|
|
669
639
|
* Includes MCP-specific information in addition to standard HandlerContext.
|
|
670
640
|
*/
|
|
671
641
|
interface McpHandlerContext extends HandlerContext {
|
|
672
|
-
/** The name of the tool being invoked */
|
|
673
|
-
toolName?: string;
|
|
674
642
|
/** Progress reporter, present when client provides a progressToken */
|
|
675
643
|
progress?: ProgressReporter;
|
|
644
|
+
/** The name of the tool being invoked */
|
|
645
|
+
toolName?: string;
|
|
676
646
|
}
|
|
677
647
|
/**
|
|
678
648
|
* Adapt a handler with a domain error type for use with MCP tools.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { zodToJsonSchema } from "@outfitter/contracts/schema";
|