@aigne/afs-mcp 1.11.0-beta.10
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.md +26 -0
- package/README.md +297 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/index.cjs +1895 -0
- package/dist/index.d.cts +498 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +498 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1894 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kinds.cjs +181 -0
- package/dist/kinds.mjs +182 -0
- package/dist/kinds.mjs.map +1 -0
- package/package.json +58 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSReadResult, AFSSearchResult, AFSStatResult, ProviderManifest, RouteContext } from "@aigne/afs";
|
|
2
|
+
import { AFSBaseProvider } from "@aigne/afs/provider";
|
|
3
|
+
import { Prompt, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Parsed resource URI
|
|
9
|
+
*/
|
|
10
|
+
interface ParsedResourceUri {
|
|
11
|
+
scheme: string;
|
|
12
|
+
path: string;
|
|
13
|
+
query?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration options for AFSMCP
|
|
17
|
+
*/
|
|
18
|
+
interface AFSMCPOptions {
|
|
19
|
+
/** Module name (used as mount path segment) */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** Module description */
|
|
22
|
+
description?: string;
|
|
23
|
+
/** Transport type */
|
|
24
|
+
transport: "stdio" | "http" | "sse";
|
|
25
|
+
/** Command to execute (for stdio transport) */
|
|
26
|
+
command?: string;
|
|
27
|
+
/** Command arguments (for stdio transport) */
|
|
28
|
+
args?: string[];
|
|
29
|
+
/** Environment variables (for stdio transport) */
|
|
30
|
+
env?: Record<string, string>;
|
|
31
|
+
/** Server URL (for http/sse transport) */
|
|
32
|
+
url?: string;
|
|
33
|
+
/** HTTP headers (for http/sse transport) */
|
|
34
|
+
headers?: Record<string, string>;
|
|
35
|
+
/** Connection timeout in milliseconds */
|
|
36
|
+
timeout?: number;
|
|
37
|
+
/** Maximum reconnection attempts */
|
|
38
|
+
maxReconnects?: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* AFS Module for MCP Server integration
|
|
42
|
+
*/
|
|
43
|
+
declare class AFSMCP extends AFSBaseProvider {
|
|
44
|
+
readonly options: AFSMCPOptions & {
|
|
45
|
+
cwd?: string;
|
|
46
|
+
uri?: string;
|
|
47
|
+
};
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly description?: string;
|
|
50
|
+
readonly accessMode: "readwrite";
|
|
51
|
+
/**
|
|
52
|
+
* Get the Zod schema for options validation
|
|
53
|
+
*/
|
|
54
|
+
static schema(): z.ZodType<{
|
|
55
|
+
name: string | undefined;
|
|
56
|
+
description: string | undefined;
|
|
57
|
+
transport: "stdio" | "http" | "sse";
|
|
58
|
+
command: string | undefined;
|
|
59
|
+
args: string[] | undefined;
|
|
60
|
+
env: Record<string, string> | undefined;
|
|
61
|
+
url: string | undefined;
|
|
62
|
+
headers: Record<string, string> | undefined;
|
|
63
|
+
timeout: number | undefined;
|
|
64
|
+
maxReconnects: number | undefined;
|
|
65
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
66
|
+
name: string | undefined;
|
|
67
|
+
description: string | undefined;
|
|
68
|
+
transport: "stdio" | "http" | "sse";
|
|
69
|
+
command: string | undefined;
|
|
70
|
+
args: string[] | undefined;
|
|
71
|
+
env: Record<string, string> | undefined;
|
|
72
|
+
url: string | undefined;
|
|
73
|
+
headers: Record<string, string> | undefined;
|
|
74
|
+
timeout: number | undefined;
|
|
75
|
+
maxReconnects: number | undefined;
|
|
76
|
+
}, unknown>>;
|
|
77
|
+
static manifest(): ProviderManifest[];
|
|
78
|
+
/**
|
|
79
|
+
* Load module from configuration file
|
|
80
|
+
*/
|
|
81
|
+
static load({
|
|
82
|
+
basePath,
|
|
83
|
+
config
|
|
84
|
+
}?: AFSModuleLoadParams): Promise<AFSMCP>;
|
|
85
|
+
/**
|
|
86
|
+
* Parse a resource URI into its components
|
|
87
|
+
*
|
|
88
|
+
* Examples:
|
|
89
|
+
* - "file:///path/to/file.txt" -> { scheme: "file", path: "/path/to/file.txt" }
|
|
90
|
+
* - "sqlite://posts" -> { scheme: "sqlite", path: "/posts" }
|
|
91
|
+
* - "github://repos/owner/repo" -> { scheme: "github", path: "/repos/owner/repo" }
|
|
92
|
+
*/
|
|
93
|
+
static parseResourceUri(uri: string): ParsedResourceUri;
|
|
94
|
+
/**
|
|
95
|
+
* Parse a URI template and extract variable names
|
|
96
|
+
*
|
|
97
|
+
* Examples:
|
|
98
|
+
* - "sqlite://posts/{id}" -> ["id"]
|
|
99
|
+
* - "github://repos/{owner}/{repo}/issues/{number}" -> ["owner", "repo", "number"]
|
|
100
|
+
*/
|
|
101
|
+
static parseUriTemplate(template: string): string[];
|
|
102
|
+
/**
|
|
103
|
+
* Match a path against a URI template and extract parameters
|
|
104
|
+
*
|
|
105
|
+
* Examples:
|
|
106
|
+
* - matchPathToTemplate("/posts/123", "sqlite://posts/{id}") -> { id: "123" }
|
|
107
|
+
* - matchPathToTemplate("/repos/arcblock/afs/issues/42", "github://repos/{owner}/{repo}/issues/{number}")
|
|
108
|
+
* -> { owner: "arcblock", repo: "afs", number: "42" }
|
|
109
|
+
*
|
|
110
|
+
* Returns null if path doesn't match the template
|
|
111
|
+
*/
|
|
112
|
+
static matchPathToTemplate(path: string, uriTemplate: string): Record<string, string> | null;
|
|
113
|
+
/**
|
|
114
|
+
* Build a complete URI from a template and parameters
|
|
115
|
+
*/
|
|
116
|
+
static buildUriFromTemplate(template: string, params: Record<string, string>): string;
|
|
117
|
+
private client;
|
|
118
|
+
private transport;
|
|
119
|
+
private _tools;
|
|
120
|
+
private _prompts;
|
|
121
|
+
private _resources;
|
|
122
|
+
private _resourceTemplates;
|
|
123
|
+
private _resourcePathMap;
|
|
124
|
+
private _isConnected;
|
|
125
|
+
constructor(options: AFSMCPOptions & {
|
|
126
|
+
cwd?: string;
|
|
127
|
+
uri?: string;
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* List root directory children.
|
|
131
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
132
|
+
*/
|
|
133
|
+
listRootHandler(_ctx: RouteContext): Promise<AFSListResult>;
|
|
134
|
+
/**
|
|
135
|
+
* Read root directory entry
|
|
136
|
+
*/
|
|
137
|
+
readRootHandler(_ctx: RouteContext): Promise<AFSEntry>;
|
|
138
|
+
/**
|
|
139
|
+
* Read root metadata
|
|
140
|
+
*/
|
|
141
|
+
readRootMeta(_ctx: RouteContext): Promise<AFSEntry>;
|
|
142
|
+
/**
|
|
143
|
+
* Read capabilities manifest
|
|
144
|
+
*
|
|
145
|
+
* Returns all MCP tools as ToolDefinition objects.
|
|
146
|
+
* MCP has no node-level actions, so actions is always empty.
|
|
147
|
+
*/
|
|
148
|
+
readCapabilities(_ctx: RouteContext): Promise<AFSEntry>;
|
|
149
|
+
/**
|
|
150
|
+
* Stat root directory
|
|
151
|
+
*/
|
|
152
|
+
statRootHandler(_ctx: RouteContext): Promise<AFSStatResult>;
|
|
153
|
+
/**
|
|
154
|
+
* Read WORLD.md file
|
|
155
|
+
*/
|
|
156
|
+
readWorldMdHandler(_ctx: RouteContext): Promise<AFSEntry>;
|
|
157
|
+
/**
|
|
158
|
+
* List WORLD.md - files have no children
|
|
159
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
160
|
+
*/
|
|
161
|
+
listWorldMdHandler(_ctx: RouteContext): Promise<AFSListResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Read WORLD.md metadata
|
|
164
|
+
*/
|
|
165
|
+
readWorldMdMeta(_ctx: RouteContext): Promise<AFSEntry>;
|
|
166
|
+
/**
|
|
167
|
+
* Read /tools directory entry
|
|
168
|
+
*/
|
|
169
|
+
readToolsDir(_ctx: RouteContext): Promise<AFSEntry>;
|
|
170
|
+
/**
|
|
171
|
+
* Read /tools metadata
|
|
172
|
+
*/
|
|
173
|
+
readToolsMeta(_ctx: RouteContext): Promise<AFSEntry>;
|
|
174
|
+
/**
|
|
175
|
+
* Read /prompts directory entry
|
|
176
|
+
*/
|
|
177
|
+
readPromptsDir(_ctx: RouteContext): Promise<AFSEntry>;
|
|
178
|
+
/**
|
|
179
|
+
* Read /prompts metadata
|
|
180
|
+
*/
|
|
181
|
+
readPromptsMeta(_ctx: RouteContext): Promise<AFSEntry>;
|
|
182
|
+
/**
|
|
183
|
+
* Read /resources directory entry
|
|
184
|
+
*/
|
|
185
|
+
readResourcesDir(_ctx: RouteContext): Promise<AFSEntry>;
|
|
186
|
+
/**
|
|
187
|
+
* Read /resources metadata
|
|
188
|
+
*/
|
|
189
|
+
readResourcesMeta(_ctx: RouteContext): Promise<AFSEntry>;
|
|
190
|
+
/**
|
|
191
|
+
* Calculate immediate children count for /resources directory
|
|
192
|
+
*/
|
|
193
|
+
private getResourcesImmediateChildrenCount;
|
|
194
|
+
/**
|
|
195
|
+
* Stat WORLD.md file
|
|
196
|
+
*/
|
|
197
|
+
statWorldMdHandler(_ctx: RouteContext): Promise<AFSStatResult>;
|
|
198
|
+
/**
|
|
199
|
+
* Stat /tools directory
|
|
200
|
+
*/
|
|
201
|
+
statToolsHandler(_ctx: RouteContext): Promise<AFSStatResult>;
|
|
202
|
+
/**
|
|
203
|
+
* Stat /prompts directory
|
|
204
|
+
*/
|
|
205
|
+
statPromptsHandler(_ctx: RouteContext): Promise<AFSStatResult>;
|
|
206
|
+
/**
|
|
207
|
+
* Stat /resources directory
|
|
208
|
+
*/
|
|
209
|
+
statResourcesHandler(_ctx: RouteContext): Promise<AFSStatResult>;
|
|
210
|
+
/**
|
|
211
|
+
* Stat specific tool
|
|
212
|
+
*/
|
|
213
|
+
statToolHandler(ctx: RouteContext<{
|
|
214
|
+
name: string;
|
|
215
|
+
}>): Promise<AFSStatResult>;
|
|
216
|
+
/**
|
|
217
|
+
* Stat specific prompt
|
|
218
|
+
*/
|
|
219
|
+
statPromptHandler(ctx: RouteContext<{
|
|
220
|
+
name: string;
|
|
221
|
+
}>): Promise<AFSStatResult>;
|
|
222
|
+
/**
|
|
223
|
+
* Stat resource paths (wildcard handler under /resources)
|
|
224
|
+
*/
|
|
225
|
+
statResourceHandler(ctx: RouteContext<{
|
|
226
|
+
path: string;
|
|
227
|
+
}>): Promise<AFSStatResult>;
|
|
228
|
+
get isConnected(): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Get cached tools
|
|
231
|
+
*/
|
|
232
|
+
get tools(): Tool[];
|
|
233
|
+
/**
|
|
234
|
+
* Get cached prompts
|
|
235
|
+
*/
|
|
236
|
+
get prompts(): Prompt[];
|
|
237
|
+
/**
|
|
238
|
+
* Get cached resources
|
|
239
|
+
*/
|
|
240
|
+
get resources(): Resource[];
|
|
241
|
+
/**
|
|
242
|
+
* Get cached resource templates
|
|
243
|
+
*/
|
|
244
|
+
get resourceTemplates(): ResourceTemplate[];
|
|
245
|
+
/** Promise for in-progress connection */
|
|
246
|
+
private _connectPromise;
|
|
247
|
+
/**
|
|
248
|
+
* Ensure connection is established (lazy connect)
|
|
249
|
+
*/
|
|
250
|
+
ensureConnected(): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Connect to the MCP server
|
|
253
|
+
*/
|
|
254
|
+
connect(): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Disconnect from the MCP server
|
|
257
|
+
*/
|
|
258
|
+
disconnect(): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Create transport based on configuration
|
|
261
|
+
*/
|
|
262
|
+
private createTransport;
|
|
263
|
+
/**
|
|
264
|
+
* Refresh cached capabilities from the server
|
|
265
|
+
*/
|
|
266
|
+
private refreshCapabilities;
|
|
267
|
+
/**
|
|
268
|
+
* Build the resource path mapping from cached resources
|
|
269
|
+
*/
|
|
270
|
+
private buildResourcePathMap;
|
|
271
|
+
/**
|
|
272
|
+
* Convert a resource URI to an AFS path
|
|
273
|
+
*
|
|
274
|
+
* Examples:
|
|
275
|
+
* - "file:///path/to/file.txt" -> "/path/to/file.txt"
|
|
276
|
+
* - "sqlite://posts" -> "/posts"
|
|
277
|
+
* - "github://repos" -> "/repos"
|
|
278
|
+
*/
|
|
279
|
+
resourceUriToPath(uri: string): string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Get the base path from a URI template (path before first variable)
|
|
282
|
+
*
|
|
283
|
+
* Examples:
|
|
284
|
+
* - "sqlite://posts/{id}" -> "/posts"
|
|
285
|
+
* - "github://repos/{owner}/{repo}" -> "/repos"
|
|
286
|
+
*/
|
|
287
|
+
private getTemplateBasePath;
|
|
288
|
+
/**
|
|
289
|
+
* Check if a resource path is a template base path (has dynamic children).
|
|
290
|
+
*/
|
|
291
|
+
private isTemplateBasePath;
|
|
292
|
+
/**
|
|
293
|
+
* Get immediate child segments under a resource parent path,
|
|
294
|
+
* scanning both static resources and template base paths.
|
|
295
|
+
*/
|
|
296
|
+
private getImmediateResourceChildren;
|
|
297
|
+
/**
|
|
298
|
+
* Find a resource or template that matches a given path
|
|
299
|
+
*/
|
|
300
|
+
private findResourceForPath;
|
|
301
|
+
/**
|
|
302
|
+
* Convert a Tool to an AFSEntry (Meta Spec compliant)
|
|
303
|
+
*/
|
|
304
|
+
private toolToEntry;
|
|
305
|
+
/**
|
|
306
|
+
* Convert a Prompt to an AFSEntry (Meta Spec compliant)
|
|
307
|
+
* Note: inputSchema is NOT included in prompt entry meta.
|
|
308
|
+
* For prompts with arguments, use the action system (/.actions/get) to execute.
|
|
309
|
+
*/
|
|
310
|
+
private promptToEntry;
|
|
311
|
+
/**
|
|
312
|
+
* Convert prompt arguments to JSON Schema (for action inputSchema)
|
|
313
|
+
*/
|
|
314
|
+
private promptArgsToSchema;
|
|
315
|
+
/**
|
|
316
|
+
* Extract text content from MCP prompt messages
|
|
317
|
+
*/
|
|
318
|
+
private extractTextFromMessages;
|
|
319
|
+
/**
|
|
320
|
+
* Convert a Resource to an AFSEntry (Meta Spec compliant)
|
|
321
|
+
*/
|
|
322
|
+
private resourceToEntry;
|
|
323
|
+
/**
|
|
324
|
+
* Convert a ResourceTemplate to an AFSEntry (Meta Spec compliant)
|
|
325
|
+
*/
|
|
326
|
+
private resourceTemplateToEntry;
|
|
327
|
+
/**
|
|
328
|
+
* List tools.
|
|
329
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
330
|
+
*/
|
|
331
|
+
listToolsHandler(_ctx: RouteContext): Promise<AFSListResult>;
|
|
332
|
+
/**
|
|
333
|
+
* List prompts.
|
|
334
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
335
|
+
*/
|
|
336
|
+
listPromptsHandler(_ctx: RouteContext): Promise<AFSListResult>;
|
|
337
|
+
/**
|
|
338
|
+
* List specific tool - tools are leaf nodes with no children
|
|
339
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
340
|
+
*/
|
|
341
|
+
listToolHandler(ctx: RouteContext<{
|
|
342
|
+
name: string;
|
|
343
|
+
}>): Promise<AFSListResult>;
|
|
344
|
+
/**
|
|
345
|
+
* List specific prompt - prompts are leaf nodes with no children
|
|
346
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
347
|
+
*/
|
|
348
|
+
listPromptHandler(ctx: RouteContext<{
|
|
349
|
+
name: string;
|
|
350
|
+
}>): Promise<AFSListResult>;
|
|
351
|
+
/**
|
|
352
|
+
* List resources directory.
|
|
353
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
354
|
+
*/
|
|
355
|
+
listResourcesHandler(_ctx: RouteContext): Promise<AFSListResult>;
|
|
356
|
+
/**
|
|
357
|
+
* List resource paths (wildcard handler under /resources)
|
|
358
|
+
* Note: list() returns only children, never the path itself (per new semantics)
|
|
359
|
+
*/
|
|
360
|
+
listResourceHandler(ctx: RouteContext<{
|
|
361
|
+
path: string;
|
|
362
|
+
}>): Promise<AFSListResult>;
|
|
363
|
+
/**
|
|
364
|
+
* Read metadata for tools (dynamic entries not in static tree).
|
|
365
|
+
* Static entries metadata is handled by AFSBaseProvider.
|
|
366
|
+
*/
|
|
367
|
+
readToolMeta(ctx: RouteContext<{
|
|
368
|
+
name: string;
|
|
369
|
+
}>): Promise<AFSEntry>;
|
|
370
|
+
/**
|
|
371
|
+
* Read metadata for prompts (dynamic entries not in static tree).
|
|
372
|
+
*/
|
|
373
|
+
readPromptMeta(ctx: RouteContext<{
|
|
374
|
+
name: string;
|
|
375
|
+
}>): Promise<AFSEntry>;
|
|
376
|
+
/**
|
|
377
|
+
* Read metadata for resources (dynamic entries not in static tree).
|
|
378
|
+
* Handles both actual resources and synthesized intermediate directories.
|
|
379
|
+
*/
|
|
380
|
+
readResourceMeta(ctx: RouteContext<{
|
|
381
|
+
path: string;
|
|
382
|
+
}>): Promise<AFSEntry>;
|
|
383
|
+
/**
|
|
384
|
+
* Read tool
|
|
385
|
+
*/
|
|
386
|
+
readToolHandler(ctx: RouteContext<{
|
|
387
|
+
name: string;
|
|
388
|
+
}>): Promise<AFSEntry>;
|
|
389
|
+
/**
|
|
390
|
+
* Read prompt
|
|
391
|
+
*
|
|
392
|
+
* Behavior:
|
|
393
|
+
* - Prompts with NO arguments: returns content directly
|
|
394
|
+
* - Prompts with ONLY optional arguments: returns content (empty params)
|
|
395
|
+
* - Prompts with REQUIRED arguments: returns metadata only (use /.actions/get to execute)
|
|
396
|
+
*/
|
|
397
|
+
readPromptHandler(ctx: RouteContext<{
|
|
398
|
+
name: string;
|
|
399
|
+
}>): Promise<AFSEntry>;
|
|
400
|
+
/**
|
|
401
|
+
* List actions for a prompt
|
|
402
|
+
*
|
|
403
|
+
* Only prompts with arguments expose a "get" action.
|
|
404
|
+
*/
|
|
405
|
+
listPromptActions(ctx: RouteContext<{
|
|
406
|
+
name: string;
|
|
407
|
+
}>): Promise<{
|
|
408
|
+
data: AFSEntry[];
|
|
409
|
+
}>;
|
|
410
|
+
/**
|
|
411
|
+
* Execute prompt "get" action
|
|
412
|
+
*
|
|
413
|
+
* Fetches prompt content with provided arguments.
|
|
414
|
+
*/
|
|
415
|
+
execPromptGetHandler(ctx: RouteContext<{
|
|
416
|
+
name: string;
|
|
417
|
+
}>, params: Record<string, unknown>): Promise<AFSExecResult>;
|
|
418
|
+
/**
|
|
419
|
+
* List actions for a resource template
|
|
420
|
+
*
|
|
421
|
+
* Only resource templates expose a "get" action.
|
|
422
|
+
* Static resources do not have actions.
|
|
423
|
+
*/
|
|
424
|
+
listResourceActions(ctx: RouteContext<{
|
|
425
|
+
path: string;
|
|
426
|
+
}>): Promise<{
|
|
427
|
+
data: AFSEntry[];
|
|
428
|
+
}>;
|
|
429
|
+
/**
|
|
430
|
+
* Execute resource template "get" action
|
|
431
|
+
*
|
|
432
|
+
* Fetches resource content with provided template parameters.
|
|
433
|
+
*/
|
|
434
|
+
execResourceGetHandler(ctx: RouteContext<{
|
|
435
|
+
path: string;
|
|
436
|
+
}>, params: Record<string, unknown>): Promise<AFSExecResult>;
|
|
437
|
+
/**
|
|
438
|
+
* Read resource (wildcard handler under /resources)
|
|
439
|
+
*/
|
|
440
|
+
readResourceHandler(ctx: RouteContext<{
|
|
441
|
+
path: string;
|
|
442
|
+
}>): Promise<AFSEntry>;
|
|
443
|
+
/**
|
|
444
|
+
* Read a resource by its URI (internal helper)
|
|
445
|
+
*/
|
|
446
|
+
private readResourceByUri;
|
|
447
|
+
/**
|
|
448
|
+
* Read a prompt with arguments, returning the prompt content
|
|
449
|
+
*
|
|
450
|
+
* This is a specialized method that calls the MCP getPrompt API
|
|
451
|
+
* to get the actual prompt content with substituted arguments.
|
|
452
|
+
*/
|
|
453
|
+
readPrompt(path: string, args: Record<string, string>): Promise<AFSReadResult>;
|
|
454
|
+
/**
|
|
455
|
+
* Generate WORLD.md content describing this MCP server's capabilities
|
|
456
|
+
*/
|
|
457
|
+
generateWorldMd(): string;
|
|
458
|
+
/**
|
|
459
|
+
* Explain root → server name, tools/prompts/resources counts
|
|
460
|
+
*/
|
|
461
|
+
explainRoot(_ctx: RouteContext): Promise<AFSExplainResult>;
|
|
462
|
+
/**
|
|
463
|
+
* Explain a specific tool → name, description, inputSchema
|
|
464
|
+
*/
|
|
465
|
+
explainTool(ctx: RouteContext<{
|
|
466
|
+
name: string;
|
|
467
|
+
}>): Promise<AFSExplainResult>;
|
|
468
|
+
/**
|
|
469
|
+
* Explain a specific prompt → name, description, arguments
|
|
470
|
+
*/
|
|
471
|
+
explainPrompt(ctx: RouteContext<{
|
|
472
|
+
name: string;
|
|
473
|
+
}>): Promise<AFSExplainResult>;
|
|
474
|
+
/**
|
|
475
|
+
* Explain a specific resource → name, URI, description
|
|
476
|
+
*/
|
|
477
|
+
explainResource(ctx: RouteContext<{
|
|
478
|
+
path: string;
|
|
479
|
+
}>): Promise<AFSExplainResult>;
|
|
480
|
+
/**
|
|
481
|
+
* Search tools, prompts, and resources by name or description
|
|
482
|
+
*/
|
|
483
|
+
searchHandler(_ctx: RouteContext<{
|
|
484
|
+
path?: string;
|
|
485
|
+
}>, query: string, options?: {
|
|
486
|
+
limit?: number;
|
|
487
|
+
caseSensitive?: boolean;
|
|
488
|
+
}): Promise<AFSSearchResult>;
|
|
489
|
+
/**
|
|
490
|
+
* Execute a tool
|
|
491
|
+
*/
|
|
492
|
+
execToolHandler(ctx: RouteContext<{
|
|
493
|
+
name: string;
|
|
494
|
+
}>, args: Record<string, any>): Promise<AFSExecResult>;
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
export { AFSMCP, AFSMCP as default, AFSMCPOptions, ParsedResourceUri };
|
|
498
|
+
//# sourceMapp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