@aigne/afs-mcp 1.11.0-beta.7 → 1.11.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +74 -2
- package/dist/index.d.cts +25 -66
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +25 -66
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +74 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -24,9 +24,9 @@ const afsMCPOptionsSchema = (0, _aigne_afs_utils_zod.camelize)(zod.z.object({
|
|
|
24
24
|
]),
|
|
25
25
|
command: (0, _aigne_afs_utils_zod.optionalize)(zod.z.string()),
|
|
26
26
|
args: (0, _aigne_afs_utils_zod.optionalize)(zod.z.array(zod.z.string())),
|
|
27
|
-
env: (0, _aigne_afs_utils_zod.optionalize)(zod.z.record(zod.z.string())),
|
|
27
|
+
env: (0, _aigne_afs_utils_zod.optionalize)(zod.z.record(zod.z.string(), zod.z.string())),
|
|
28
28
|
url: (0, _aigne_afs_utils_zod.optionalize)(zod.z.string()),
|
|
29
|
-
headers: (0, _aigne_afs_utils_zod.optionalize)(zod.z.record(zod.z.string())),
|
|
29
|
+
headers: (0, _aigne_afs_utils_zod.optionalize)(zod.z.record(zod.z.string(), zod.z.string())),
|
|
30
30
|
timeout: (0, _aigne_afs_utils_zod.optionalize)(zod.z.number()),
|
|
31
31
|
maxReconnects: (0, _aigne_afs_utils_zod.optionalize)(zod.z.number())
|
|
32
32
|
}).refine((data) => {
|
|
@@ -47,6 +47,50 @@ var AFSMCP = class AFSMCP extends _aigne_afs_provider.AFSBaseProvider {
|
|
|
47
47
|
static schema() {
|
|
48
48
|
return afsMCPOptionsSchema;
|
|
49
49
|
}
|
|
50
|
+
static manifest() {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
name: "mcp-stdio",
|
|
54
|
+
description: "MCP server via stdio transport",
|
|
55
|
+
uriTemplate: "mcp+stdio://{command+}",
|
|
56
|
+
category: "integration",
|
|
57
|
+
schema: zod.z.object({
|
|
58
|
+
command: zod.z.string(),
|
|
59
|
+
args: zod.z.array(zod.z.string()).optional(),
|
|
60
|
+
env: zod.z.record(zod.z.string(), zod.z.string()).optional()
|
|
61
|
+
}),
|
|
62
|
+
tags: [
|
|
63
|
+
"mcp",
|
|
64
|
+
"stdio",
|
|
65
|
+
"integration"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "mcp-http",
|
|
70
|
+
description: "MCP server via HTTP transport",
|
|
71
|
+
uriTemplate: "mcp+http://{url+}",
|
|
72
|
+
category: "integration",
|
|
73
|
+
schema: zod.z.object({ url: zod.z.string() }),
|
|
74
|
+
tags: [
|
|
75
|
+
"mcp",
|
|
76
|
+
"http",
|
|
77
|
+
"integration"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "mcp-sse",
|
|
82
|
+
description: "MCP server via SSE transport",
|
|
83
|
+
uriTemplate: "mcp+sse://{url+}",
|
|
84
|
+
category: "integration",
|
|
85
|
+
schema: zod.z.object({ url: zod.z.string() }),
|
|
86
|
+
tags: [
|
|
87
|
+
"mcp",
|
|
88
|
+
"sse",
|
|
89
|
+
"integration"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
}
|
|
50
94
|
/**
|
|
51
95
|
* Load module from configuration file
|
|
52
96
|
*/
|
|
@@ -143,6 +187,34 @@ var AFSMCP = class AFSMCP extends _aigne_afs_provider.AFSBaseProvider {
|
|
|
143
187
|
constructor(options) {
|
|
144
188
|
super();
|
|
145
189
|
this.options = options;
|
|
190
|
+
if (!options.transport && options.uri) {
|
|
191
|
+
const uri = options.uri;
|
|
192
|
+
if (uri.startsWith("mcp+stdio://")) {
|
|
193
|
+
options.transport = "stdio";
|
|
194
|
+
if (!options.command) options.command = uri.slice(12).split("?")[0];
|
|
195
|
+
} else if (uri.startsWith("mcp+http://")) {
|
|
196
|
+
options.transport = "http";
|
|
197
|
+
if (!options.url) options.url = uri.replace("mcp+", "");
|
|
198
|
+
} else if (uri.startsWith("mcp+sse://")) {
|
|
199
|
+
options.transport = "sse";
|
|
200
|
+
if (!options.url) options.url = uri.replace("mcp+sse://", "http://");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (typeof options.args === "string") {
|
|
204
|
+
const argsStr = options.args;
|
|
205
|
+
options.args = argsStr.includes(",") ? argsStr.split(",") : [argsStr];
|
|
206
|
+
} else if (Array.isArray(options.args)) options.args = options.args.flatMap((a) => a.includes(",") ? a.split(",") : [a]);
|
|
207
|
+
if (options.env && !Array.isArray(options.env) && typeof options.env === "string") {
|
|
208
|
+
const [key, ...rest] = options.env.split("=");
|
|
209
|
+
options.env = key ? { [key]: rest.join("=") } : {};
|
|
210
|
+
} else if (Array.isArray(options.env)) {
|
|
211
|
+
const envRecord = {};
|
|
212
|
+
for (const entry of options.env) {
|
|
213
|
+
const [key, ...rest] = entry.split("=");
|
|
214
|
+
if (key) envRecord[key] = rest.join("=");
|
|
215
|
+
}
|
|
216
|
+
options.env = envRecord;
|
|
217
|
+
}
|
|
146
218
|
(0, _aigne_afs_utils_zod.zodParse)(afsMCPOptionsSchema, options);
|
|
147
219
|
this.name = options.name || "mcp";
|
|
148
220
|
this.description = options.description;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSReadResult, AFSSearchResult, AFSStatResult, RouteContext } from "@aigne/afs";
|
|
1
|
+
import { AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSReadResult, AFSSearchResult, AFSStatResult, ProviderManifest, RouteContext } from "@aigne/afs";
|
|
2
2
|
import { AFSBaseProvider } from "@aigne/afs/provider";
|
|
3
3
|
import { Prompt, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -43,6 +43,7 @@ interface AFSMCPOptions {
|
|
|
43
43
|
declare class AFSMCP extends AFSBaseProvider {
|
|
44
44
|
readonly options: AFSMCPOptions & {
|
|
45
45
|
cwd?: string;
|
|
46
|
+
uri?: string;
|
|
46
47
|
};
|
|
47
48
|
readonly name: string;
|
|
48
49
|
readonly description?: string;
|
|
@@ -50,73 +51,30 @@ declare class AFSMCP extends AFSBaseProvider {
|
|
|
50
51
|
/**
|
|
51
52
|
* Get the Zod schema for options validation
|
|
52
53
|
*/
|
|
53
|
-
static schema(): z.
|
|
54
|
-
name:
|
|
55
|
-
description:
|
|
56
|
-
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
57
|
-
command: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
58
|
-
args: z.ZodType<string[] | undefined, z.ZodTypeDef, string[] | undefined>;
|
|
59
|
-
env: z.ZodType<Record<string, string> | undefined, z.ZodTypeDef, Record<string, string> | undefined>;
|
|
60
|
-
url: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
61
|
-
headers: z.ZodType<Record<string, string> | undefined, z.ZodTypeDef, Record<string, string> | undefined>;
|
|
62
|
-
timeout: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
63
|
-
maxReconnects: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
64
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
static schema(): z.ZodType<{
|
|
55
|
+
name: string | undefined;
|
|
56
|
+
description: string | undefined;
|
|
65
57
|
transport: "stdio" | "http" | "sse";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
76
68
|
transport: "stdio" | "http" | "sse";
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}>, {
|
|
87
|
-
transport: "stdio" | "http" | "sse";
|
|
88
|
-
name?: string | undefined;
|
|
89
|
-
description?: string | undefined;
|
|
90
|
-
command?: string | undefined;
|
|
91
|
-
args?: string[] | undefined;
|
|
92
|
-
env?: Record<string, string> | undefined;
|
|
93
|
-
url?: string | undefined;
|
|
94
|
-
headers?: Record<string, string> | undefined;
|
|
95
|
-
timeout?: number | undefined;
|
|
96
|
-
maxReconnects?: number | undefined;
|
|
97
|
-
}, {
|
|
98
|
-
transport: "stdio" | "http" | "sse";
|
|
99
|
-
name?: string | undefined;
|
|
100
|
-
description?: string | undefined;
|
|
101
|
-
command?: string | undefined;
|
|
102
|
-
args?: string[] | undefined;
|
|
103
|
-
env?: Record<string, string> | undefined;
|
|
104
|
-
url?: string | undefined;
|
|
105
|
-
headers?: Record<string, string> | undefined;
|
|
106
|
-
timeout?: number | undefined;
|
|
107
|
-
maxReconnects?: number | undefined;
|
|
108
|
-
}>, {
|
|
109
|
-
transport: "stdio" | "http" | "sse";
|
|
110
|
-
name?: string | undefined;
|
|
111
|
-
description?: string | undefined;
|
|
112
|
-
command?: string | undefined;
|
|
113
|
-
args?: string[] | undefined;
|
|
114
|
-
env?: Record<string, string> | undefined;
|
|
115
|
-
url?: string | undefined;
|
|
116
|
-
headers?: Record<string, string> | undefined;
|
|
117
|
-
timeout?: number | undefined;
|
|
118
|
-
maxReconnects?: number | undefined;
|
|
119
|
-
}, any>;
|
|
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[];
|
|
120
78
|
/**
|
|
121
79
|
* Load module from configuration file
|
|
122
80
|
*/
|
|
@@ -166,6 +124,7 @@ declare class AFSMCP extends AFSBaseProvider {
|
|
|
166
124
|
private _isConnected;
|
|
167
125
|
constructor(options: AFSMCPOptions & {
|
|
168
126
|
cwd?: string;
|
|
127
|
+
uri?: string;
|
|
169
128
|
});
|
|
170
129
|
/**
|
|
171
130
|
* List root directory children.
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;UAiDiB,iBAAA;EACf,MAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;AAAA;;;;UAMO,aAAA;EAaf;EAXA,IAAA;EAaM;EAXN,WAAA;EAiBA;EAdA,SAAA;EAkBA;EAdA,OAAA;EAgBa;EAdb,IAAA;EAuDW;EArDX,GAAA,GAAM,MAAA;;EAIN,GAAA;;EAEA,OAAA,GAAU,MAAA;;EAIV,OAAA;;EAEA,aAAA;AAAA;;;;cAyCW,MAAA,SAAe,eAAA;EAAA,SA0KE,OAAA,EAAS,aAAA;IAAkB,GAAA;IAAc,GAAA;EAAA;EAAA,SAzKnD,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;EAmOyB;;;EAAA,OA9NpC,MAAA,CAAA,GAAM,CAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;SAIN,QAAA,CAAA,GAAY,gB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AAA,CAAQ,gBAAA;EAzmBzC;;;EAgqBA,WAAA,CAAY,GAAA,EAAK,YAAA;IAAe,IAAA;EAAA,KAAkB,OAAA,CAAQ,gBAAA;EA9oB1D;;;EA0rBA,aAAA,CAAc,GAAA,EAAK,YAAA;IAAe,IAAA;EAAA,KAAkB,OAAA,CAAQ,gBAAA;EAppB5D;;;EAsrBA,eAAA,CAAgB,GAAA,EAAK,YAAA;IAAe,IAAA;EAAA,KAAkB,OAAA,CAAQ,gBAAA;EAtrBU;;;EAuuBxE,aAAA,CACJ,IAAA,EAAM,YAAA;IAAe,IAAA;EAAA,IACrB,KAAA,UACA,OAAA;IAAY,KAAA;IAAgB,aAAA;EAAA,IAC3B,OAAA,CAAQ,eAAA;EA7oBL;;;EAusBA,eAAA,CACJ,GAAA,EAAK,YAAA;IAAe,IAAA;EAAA,IACpB,IAAA,EAAM,MAAA,gBACL,OAAA,CAAQ,aAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSReadResult, AFSSearchResult, AFSStatResult, RouteContext } from "@aigne/afs";
|
|
1
|
+
import { AFSEntry, AFSExecResult, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSReadResult, AFSSearchResult, AFSStatResult, ProviderManifest, RouteContext } from "@aigne/afs";
|
|
2
2
|
import { AFSBaseProvider } from "@aigne/afs/provider";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { Prompt, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -43,6 +43,7 @@ interface AFSMCPOptions {
|
|
|
43
43
|
declare class AFSMCP extends AFSBaseProvider {
|
|
44
44
|
readonly options: AFSMCPOptions & {
|
|
45
45
|
cwd?: string;
|
|
46
|
+
uri?: string;
|
|
46
47
|
};
|
|
47
48
|
readonly name: string;
|
|
48
49
|
readonly description?: string;
|
|
@@ -50,73 +51,30 @@ declare class AFSMCP extends AFSBaseProvider {
|
|
|
50
51
|
/**
|
|
51
52
|
* Get the Zod schema for options validation
|
|
52
53
|
*/
|
|
53
|
-
static schema(): z.
|
|
54
|
-
name:
|
|
55
|
-
description:
|
|
56
|
-
transport: z.ZodEnum<["stdio", "http", "sse"]>;
|
|
57
|
-
command: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
58
|
-
args: z.ZodType<string[] | undefined, z.ZodTypeDef, string[] | undefined>;
|
|
59
|
-
env: z.ZodType<Record<string, string> | undefined, z.ZodTypeDef, Record<string, string> | undefined>;
|
|
60
|
-
url: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
61
|
-
headers: z.ZodType<Record<string, string> | undefined, z.ZodTypeDef, Record<string, string> | undefined>;
|
|
62
|
-
timeout: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
63
|
-
maxReconnects: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
64
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
static schema(): z.ZodType<{
|
|
55
|
+
name: string | undefined;
|
|
56
|
+
description: string | undefined;
|
|
65
57
|
transport: "stdio" | "http" | "sse";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
76
68
|
transport: "stdio" | "http" | "sse";
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}>, {
|
|
87
|
-
transport: "stdio" | "http" | "sse";
|
|
88
|
-
name?: string | undefined;
|
|
89
|
-
description?: string | undefined;
|
|
90
|
-
command?: string | undefined;
|
|
91
|
-
args?: string[] | undefined;
|
|
92
|
-
env?: Record<string, string> | undefined;
|
|
93
|
-
url?: string | undefined;
|
|
94
|
-
headers?: Record<string, string> | undefined;
|
|
95
|
-
timeout?: number | undefined;
|
|
96
|
-
maxReconnects?: number | undefined;
|
|
97
|
-
}, {
|
|
98
|
-
transport: "stdio" | "http" | "sse";
|
|
99
|
-
name?: string | undefined;
|
|
100
|
-
description?: string | undefined;
|
|
101
|
-
command?: string | undefined;
|
|
102
|
-
args?: string[] | undefined;
|
|
103
|
-
env?: Record<string, string> | undefined;
|
|
104
|
-
url?: string | undefined;
|
|
105
|
-
headers?: Record<string, string> | undefined;
|
|
106
|
-
timeout?: number | undefined;
|
|
107
|
-
maxReconnects?: number | undefined;
|
|
108
|
-
}>, {
|
|
109
|
-
transport: "stdio" | "http" | "sse";
|
|
110
|
-
name?: string | undefined;
|
|
111
|
-
description?: string | undefined;
|
|
112
|
-
command?: string | undefined;
|
|
113
|
-
args?: string[] | undefined;
|
|
114
|
-
env?: Record<string, string> | undefined;
|
|
115
|
-
url?: string | undefined;
|
|
116
|
-
headers?: Record<string, string> | undefined;
|
|
117
|
-
timeout?: number | undefined;
|
|
118
|
-
maxReconnects?: number | undefined;
|
|
119
|
-
}, any>;
|
|
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[];
|
|
120
78
|
/**
|
|
121
79
|
* Load module from configuration file
|
|
122
80
|
*/
|
|
@@ -166,6 +124,7 @@ declare class AFSMCP extends AFSBaseProvider {
|
|
|
166
124
|
private _isConnected;
|
|
167
125
|
constructor(options: AFSMCPOptions & {
|
|
168
126
|
cwd?: string;
|
|
127
|
+
uri?: string;
|
|
169
128
|
});
|
|
170
129
|
/**
|
|
171
130
|
* List root directory children.
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;UAiDiB,iBAAA;EACf,MAAA;EACA,IAAA;EACA,KAAA,GAAQ,MAAA;AAAA;;;;UAMO,aAAA;EAaf;EAXA,IAAA;EAaM;EAXN,WAAA;EAiBA;EAdA,SAAA;EAkBA;EAdA,OAAA;EAgBa;EAdb,IAAA;EAuDW;EArDX,GAAA,GAAM,MAAA;;EAIN,GAAA;;EAEA,OAAA,GAAU,MAAA;;EAIV,OAAA;;EAEA,aAAA;AAAA;;;;cAyCW,MAAA,SAAe,eAAA;EAAA,SA0KE,OAAA,EAAS,aAAA;IAAkB,GAAA;IAAc,GAAA;EAAA;EAAA,SAzKnD,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;EAmOyB;;;EAAA,OA9NpC,MAAA,CAAA,GAAM,CAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;SAIN,QAAA,CAAA,GAAY,gBAAA;EAgesB;;;EAAA,OAxb5B,IAAA,CAAA;IAAO,QAAA;IAAU;EAAA,IAAU,mBAAA,GAA2B,OAAA,CAAQ,MAAA;EAme/C;;;;;;;;EAAA,OAtdrB,gBAAA,CAAiB,GAAA,WAAc,iBAAA;EAkjBP;;;;;;;EAAA,OA3hBxB,gBAAA,CAAiB,QAAA;EAskBsB;;;;;;;;;;EAAA,OAjjBvC,mBAAA,CAAoB,IAAA,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AAA,KAAkB,OAAA,CAAQ,gBAAA;EAtrBU;;;EAuuBxE,aAAA,CACJ,IAAA,EAAM,YAAA;IAAe,IAAA;EAAA,IACrB,KAAA,UACA,OAAA;IAAY,KAAA;IAAgB,aAAA;EAAA,IAC3B,OAAA,CAAQ,eAAA;EA7oBL;;;EAusBA,eAAA,CACJ,GAAA,EAAK,YAAA;IAAe,IAAA;EAAA,IACpB,IAAA,EAAM,MAAA,gBACL,OAAA,CAAQ,aAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -23,9 +23,9 @@ const afsMCPOptionsSchema = camelize(z.object({
|
|
|
23
23
|
]),
|
|
24
24
|
command: optionalize(z.string()),
|
|
25
25
|
args: optionalize(z.array(z.string())),
|
|
26
|
-
env: optionalize(z.record(z.string())),
|
|
26
|
+
env: optionalize(z.record(z.string(), z.string())),
|
|
27
27
|
url: optionalize(z.string()),
|
|
28
|
-
headers: optionalize(z.record(z.string())),
|
|
28
|
+
headers: optionalize(z.record(z.string(), z.string())),
|
|
29
29
|
timeout: optionalize(z.number()),
|
|
30
30
|
maxReconnects: optionalize(z.number())
|
|
31
31
|
}).refine((data) => {
|
|
@@ -46,6 +46,50 @@ var AFSMCP = class AFSMCP extends AFSBaseProvider {
|
|
|
46
46
|
static schema() {
|
|
47
47
|
return afsMCPOptionsSchema;
|
|
48
48
|
}
|
|
49
|
+
static manifest() {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
name: "mcp-stdio",
|
|
53
|
+
description: "MCP server via stdio transport",
|
|
54
|
+
uriTemplate: "mcp+stdio://{command+}",
|
|
55
|
+
category: "integration",
|
|
56
|
+
schema: z.object({
|
|
57
|
+
command: z.string(),
|
|
58
|
+
args: z.array(z.string()).optional(),
|
|
59
|
+
env: z.record(z.string(), z.string()).optional()
|
|
60
|
+
}),
|
|
61
|
+
tags: [
|
|
62
|
+
"mcp",
|
|
63
|
+
"stdio",
|
|
64
|
+
"integration"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "mcp-http",
|
|
69
|
+
description: "MCP server via HTTP transport",
|
|
70
|
+
uriTemplate: "mcp+http://{url+}",
|
|
71
|
+
category: "integration",
|
|
72
|
+
schema: z.object({ url: z.string() }),
|
|
73
|
+
tags: [
|
|
74
|
+
"mcp",
|
|
75
|
+
"http",
|
|
76
|
+
"integration"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "mcp-sse",
|
|
81
|
+
description: "MCP server via SSE transport",
|
|
82
|
+
uriTemplate: "mcp+sse://{url+}",
|
|
83
|
+
category: "integration",
|
|
84
|
+
schema: z.object({ url: z.string() }),
|
|
85
|
+
tags: [
|
|
86
|
+
"mcp",
|
|
87
|
+
"sse",
|
|
88
|
+
"integration"
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
];
|
|
92
|
+
}
|
|
49
93
|
/**
|
|
50
94
|
* Load module from configuration file
|
|
51
95
|
*/
|
|
@@ -142,6 +186,34 @@ var AFSMCP = class AFSMCP extends AFSBaseProvider {
|
|
|
142
186
|
constructor(options) {
|
|
143
187
|
super();
|
|
144
188
|
this.options = options;
|
|
189
|
+
if (!options.transport && options.uri) {
|
|
190
|
+
const uri = options.uri;
|
|
191
|
+
if (uri.startsWith("mcp+stdio://")) {
|
|
192
|
+
options.transport = "stdio";
|
|
193
|
+
if (!options.command) options.command = uri.slice(12).split("?")[0];
|
|
194
|
+
} else if (uri.startsWith("mcp+http://")) {
|
|
195
|
+
options.transport = "http";
|
|
196
|
+
if (!options.url) options.url = uri.replace("mcp+", "");
|
|
197
|
+
} else if (uri.startsWith("mcp+sse://")) {
|
|
198
|
+
options.transport = "sse";
|
|
199
|
+
if (!options.url) options.url = uri.replace("mcp+sse://", "http://");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (typeof options.args === "string") {
|
|
203
|
+
const argsStr = options.args;
|
|
204
|
+
options.args = argsStr.includes(",") ? argsStr.split(",") : [argsStr];
|
|
205
|
+
} else if (Array.isArray(options.args)) options.args = options.args.flatMap((a) => a.includes(",") ? a.split(",") : [a]);
|
|
206
|
+
if (options.env && !Array.isArray(options.env) && typeof options.env === "string") {
|
|
207
|
+
const [key, ...rest] = options.env.split("=");
|
|
208
|
+
options.env = key ? { [key]: rest.join("=") } : {};
|
|
209
|
+
} else if (Array.isArray(options.env)) {
|
|
210
|
+
const envRecord = {};
|
|
211
|
+
for (const entry of options.env) {
|
|
212
|
+
const [key, ...rest] = entry.split("=");
|
|
213
|
+
if (key) envRecord[key] = rest.join("=");
|
|
214
|
+
}
|
|
215
|
+
options.env = envRecord;
|
|
216
|
+
}
|
|
145
217
|
zodParse(afsMCPOptionsSchema, options);
|
|
146
218
|
this.name = options.name || "mcp";
|
|
147
219
|
this.description = options.description;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * AFS MCP Provider\n *\n * 将 MCP Server 挂载为 AFS 可访问的世界。\n * - Tools → 可执行的 AFS entries(通过 `exec()`)\n * - Prompts → 可读取的世界描述\n * - Resources → 可读取的世界状态(展开为 AFS 目录结构)\n */\n\nimport type {\n AFSEntry,\n AFSExecResult,\n AFSExplainResult,\n AFSListResult,\n AFSModuleClass,\n AFSModuleLoadParams,\n AFSReadResult,\n AFSSearchResult,\n AFSStatResult,\n CapabilitiesManifest,\n RouteContext,\n ToolDefinition,\n} from \"@aigne/afs\";\nimport { AFSNotFoundError } from \"@aigne/afs\";\nimport {\n Actions,\n AFSBaseProvider,\n Exec,\n Explain,\n List,\n Meta,\n Read,\n Search,\n Stat,\n} from \"@aigne/afs/provider\";\nimport { camelize, optionalize, zodParse } from \"@aigne/afs/utils/zod\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport type { Transport } from \"@modelcontextprotocol/sdk/shared/transport.js\";\nimport type { Prompt, Resource, ResourceTemplate, Tool } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\nimport { getKindsArray } from \"./kinds.js\";\n\n/**\n * Parsed resource URI\n */\nexport interface ParsedResourceUri {\n scheme: string;\n path: string;\n query?: Record<string, string>;\n}\n\n/**\n * Configuration options for AFSMCP\n */\nexport interface AFSMCPOptions {\n /** Module name (used as mount path segment) */\n name?: string;\n /** Module description */\n description?: string;\n\n /** Transport type */\n transport: \"stdio\" | \"http\" | \"sse\";\n\n // Stdio transport options\n /** Command to execute (for stdio transport) */\n command?: string;\n /** Command arguments (for stdio transport) */\n args?: string[];\n /** Environment variables (for stdio transport) */\n env?: Record<string, string>;\n\n // HTTP/SSE transport options\n /** Server URL (for http/sse transport) */\n url?: string;\n /** HTTP headers (for http/sse transport) */\n headers?: Record<string, string>;\n\n // Common options\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Maximum reconnection attempts */\n maxReconnects?: number;\n}\n\n/**\n * Zod schema for options validation\n */\nconst afsMCPOptionsSchema = camelize(\n z\n .object({\n name: optionalize(z.string()),\n description: optionalize(z.string()),\n transport: z.enum([\"stdio\", \"http\", \"sse\"]),\n command: optionalize(z.string()),\n args: optionalize(z.array(z.string())),\n env: optionalize(z.record(z.string())),\n url: optionalize(z.string()),\n headers: optionalize(z.record(z.string())),\n timeout: optionalize(z.number()),\n maxReconnects: optionalize(z.number()),\n })\n .refine(\n (data) => {\n // stdio transport requires command\n if (data.transport === \"stdio\" && !data.command) {\n return false;\n }\n // http/sse transport requires url\n if ((data.transport === \"http\" || data.transport === \"sse\") && !data.url) {\n return false;\n }\n return true;\n },\n {\n message: \"stdio transport requires 'command', http/sse transport requires 'url'\",\n },\n ),\n);\n\n/**\n * AFS Module for MCP Server integration\n */\nexport class AFSMCP extends AFSBaseProvider {\n override readonly name: string;\n override readonly description?: string;\n override readonly accessMode = \"readwrite\" as const;\n\n /**\n * Get the Zod schema for options validation\n */\n static schema() {\n return afsMCPOptionsSchema;\n }\n\n /**\n * Load module from configuration file\n */\n static async load({ basePath, config }: AFSModuleLoadParams = {}): Promise<AFSMCP> {\n const valid = await AFSMCP.schema().parseAsync(config);\n return new AFSMCP({ ...valid, cwd: basePath });\n }\n\n /**\n * Parse a resource URI into its components\n *\n * Examples:\n * - \"file:///path/to/file.txt\" -> { scheme: \"file\", path: \"/path/to/file.txt\" }\n * - \"sqlite://posts\" -> { scheme: \"sqlite\", path: \"/posts\" }\n * - \"github://repos/owner/repo\" -> { scheme: \"github\", path: \"/repos/owner/repo\" }\n */\n static parseResourceUri(uri: string): ParsedResourceUri {\n // Handle standard URI format: scheme://path or scheme:///path\n // Scheme can contain alphanumeric, +, -, . (per RFC 3986)\n const match = uri.match(/^([\\w+.-]+):\\/\\/\\/?(.*)$/);\n if (match) {\n const scheme = match[1] as string;\n const rest = match[2] as string;\n // Ensure path starts with /\n const path = rest.startsWith(\"/\") ? rest : `/${rest}`;\n return { scheme, path };\n }\n\n // Fallback: treat entire string as path\n return { scheme: \"unknown\", path: uri };\n }\n\n /**\n * Parse a URI template and extract variable names\n *\n * Examples:\n * - \"sqlite://posts/{id}\" -> [\"id\"]\n * - \"github://repos/{owner}/{repo}/issues/{number}\" -> [\"owner\", \"repo\", \"number\"]\n */\n static parseUriTemplate(template: string): string[] {\n const vars: string[] = [];\n const regex = /\\{(\\w+)\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n while (match !== null) {\n vars.push(match[1] as string);\n match = regex.exec(template);\n }\n return vars;\n }\n\n /**\n * Match a path against a URI template and extract parameters\n *\n * Examples:\n * - matchPathToTemplate(\"/posts/123\", \"sqlite://posts/{id}\") -> { id: \"123\" }\n * - matchPathToTemplate(\"/repos/arcblock/afs/issues/42\", \"github://repos/{owner}/{repo}/issues/{number}\")\n * -> { owner: \"arcblock\", repo: \"afs\", number: \"42\" }\n *\n * Returns null if path doesn't match the template\n */\n static matchPathToTemplate(path: string, uriTemplate: string): Record<string, string> | null {\n // Parse the template to get the path pattern\n const parsed = AFSMCP.parseResourceUri(uriTemplate);\n const templatePath = parsed.path;\n\n // Convert template path to regex\n // Replace {var} with capture groups\n const vars: string[] = [];\n const regexStr = templatePath.replace(/\\{(\\w+)\\}/g, (_, varName) => {\n vars.push(varName);\n return \"([^/]+)\";\n });\n\n const regex = new RegExp(`^${regexStr}$`);\n const match = path.match(regex);\n\n if (!match) {\n return null;\n }\n\n // Extract matched values\n const params: Record<string, string> = {};\n for (let i = 0; i < vars.length; i++) {\n const varName = vars[i];\n const value = match[i + 1];\n if (varName && value) {\n params[varName] = value;\n }\n }\n\n return params;\n }\n\n /**\n * Build a complete URI from a template and parameters\n */\n static buildUriFromTemplate(template: string, params: Record<string, string>): string {\n let uri = template;\n for (const [key, value] of Object.entries(params)) {\n uri = uri.replace(`{${key}}`, value);\n }\n return uri;\n }\n\n // MCP Client instance\n private client: Client | null = null;\n private transport: Transport | null = null;\n\n // Cached capabilities\n private _tools: Tool[] = [];\n private _prompts: Prompt[] = [];\n private _resources: Resource[] = [];\n private _resourceTemplates: ResourceTemplate[] = [];\n\n // Resource path mapping cache\n private _resourcePathMap: Map<string, { resource?: Resource; template?: ResourceTemplate }> =\n new Map();\n\n // Connection state\n private _isConnected = false;\n\n constructor(public readonly options: AFSMCPOptions & { cwd?: string }) {\n super();\n zodParse(afsMCPOptionsSchema, options);\n\n this.name = options.name || \"mcp\";\n this.description = options.description;\n }\n\n // ========== Root Handlers ==========\n\n /**\n * List root directory children.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/\")\n async listRootHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n const entries: AFSEntry[] = [];\n\n // WORLD.md file\n entries.push({\n id: \"/WORLD.md\",\n path: \"/WORLD.md\",\n summary: \"MCP Server World Documentation\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n });\n\n // tools directory\n entries.push({\n id: \"/tools\",\n path: \"/tools\",\n summary: `${this._tools.length} tools available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n });\n\n // prompts directory (only if there are prompts)\n if (this._prompts.length > 0) {\n entries.push({\n id: \"/prompts\",\n path: \"/prompts\",\n summary: `${this._prompts.length} prompts available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n });\n }\n\n // resources directory (only if there are resources or templates)\n if (this._resources.length > 0 || this._resourceTemplates.length > 0) {\n entries.push({\n id: \"/resources\",\n path: \"/resources\",\n summary: `${this._resources.length} resources available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: this._resources.length,\n },\n });\n }\n\n return { data: entries };\n }\n\n /**\n * Read root directory entry\n */\n @Read(\"/\")\n async readRootHandler(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/\",\n path: \"/\",\n summary: this.description || \"MCP Server\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount:\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0),\n mcp: {\n server: { name: this.name },\n capabilities: {\n tools: this._tools.length > 0,\n prompts: this._prompts.length > 0,\n resources: this._resources.length > 0,\n },\n },\n },\n };\n }\n\n /**\n * Read root metadata\n */\n @Meta(\"/\")\n async readRootMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/.meta\",\n path: \"/.meta\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount:\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0),\n mcp: {\n server: { name: this.name },\n capabilities: {\n tools: this._tools.length > 0,\n prompts: this._prompts.length > 0,\n resources: this._resources.length > 0,\n },\n },\n },\n };\n }\n\n /**\n * Read capabilities manifest\n *\n * Returns all MCP tools as ToolDefinition objects.\n * MCP has no node-level actions, so actions is always empty.\n */\n @Read(\"/.meta/.capabilities\")\n async readCapabilities(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n const tools: ToolDefinition[] = this._tools\n .filter((tool) => tool.name) // Skip tools without name\n .map((tool) => ({\n name: tool.name,\n description: tool.description,\n path: `/tools/${tool.name}`,\n inputSchema: tool.inputSchema as ToolDefinition[\"inputSchema\"],\n }));\n\n const manifest: CapabilitiesManifest = {\n schemaVersion: 1,\n provider: this.name,\n version: \"1.0.0\",\n description: this.description,\n tools,\n actions: [], // MCP has no node-level actions\n operations: this.getOperationsDeclaration(),\n };\n\n return {\n id: \"/.meta/.capabilities\",\n path: \"/.meta/.capabilities\",\n content: manifest,\n meta: {\n kind: \"afs:capabilities\",\n description: \"MCP Provider capabilities manifest\",\n },\n };\n }\n\n /**\n * Stat root directory\n */\n @Stat(\"/\")\n async statRootHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n const childrenCount =\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0);\n\n return {\n data: {\n id: \"/\",\n path: \"/\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount,\n },\n },\n };\n }\n\n /**\n * Read WORLD.md file\n */\n @Read(\"/WORLD.md\")\n async readWorldMdHandler(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/WORLD.md\",\n path: \"/WORLD.md\",\n content: this.generateWorldMd(),\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n };\n }\n\n /**\n * List WORLD.md - files have no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/WORLD.md\")\n async listWorldMdHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n // Files are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * Read WORLD.md metadata\n */\n @Meta(\"/WORLD.md\")\n async readWorldMdMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/WORLD.md/.meta\",\n path: \"/WORLD.md/.meta\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n };\n }\n\n /**\n * Read /tools directory entry\n */\n @Read(\"/tools\")\n async readToolsDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/tools\",\n path: \"/tools\",\n summary: `${this._tools.length} tools available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n };\n }\n\n /**\n * Read /tools metadata\n */\n @Meta(\"/tools\")\n async readToolsMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/tools/.meta\",\n path: \"/tools/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n };\n }\n\n /**\n * Read /prompts directory entry\n */\n @Read(\"/prompts\")\n async readPromptsDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n return {\n id: \"/prompts\",\n path: \"/prompts\",\n summary: `${this._prompts.length} prompts available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n };\n }\n\n /**\n * Read /prompts metadata\n */\n @Meta(\"/prompts\")\n async readPromptsMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts/.meta\");\n }\n\n return {\n id: \"/prompts/.meta\",\n path: \"/prompts/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n };\n }\n\n /**\n * Read /resources directory entry\n */\n @Read(\"/resources\")\n async readResourcesDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n id: \"/resources\",\n path: \"/resources\",\n summary: `${this._resources.length} resources available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n };\n }\n\n /**\n * Read /resources metadata\n */\n @Meta(\"/resources\")\n async readResourcesMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources/.meta\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n id: \"/resources/.meta\",\n path: \"/resources/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n };\n }\n\n /**\n * Calculate immediate children count for /resources directory\n */\n private getResourcesImmediateChildrenCount(): number {\n const immediateChildren = new Set<string>();\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (!resourcePath) continue;\n const segments = resourcePath.split(\"/\").filter(Boolean);\n if (segments.length > 0) {\n immediateChildren.add(segments[0]!);\n }\n }\n return immediateChildren.size;\n }\n\n /**\n * Stat WORLD.md file\n */\n @Stat(\"/WORLD.md\")\n async statWorldMdHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n return {\n data: {\n id: \"WORLD.md\",\n path: \"/WORLD.md\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n childrenCount: 0,\n },\n },\n };\n }\n\n /**\n * Stat /tools directory\n */\n @Stat(\"/tools\")\n async statToolsHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n return {\n data: {\n id: \"tools\",\n path: \"/tools\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n },\n };\n }\n\n /**\n * Stat /prompts directory\n */\n @Stat(\"/prompts\")\n async statPromptsHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n return {\n data: {\n id: \"prompts\",\n path: \"/prompts\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n },\n };\n }\n\n /**\n * Stat /resources directory\n */\n @Stat(\"/resources\")\n async statResourcesHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n data: {\n id: \"resources\",\n path: \"/resources\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n },\n };\n }\n\n /**\n * Stat specific tool\n */\n @Stat(\"/tools/:name\")\n async statToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const { content: _content, ...statData } = this.toolToEntry(tool);\n return { data: statData };\n }\n\n /**\n * Stat specific prompt\n */\n @Stat(\"/prompts/:name\")\n async statPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const { content: _content, ...statData } = this.promptToEntry(prompt);\n return { data: statData };\n }\n\n /**\n * Stat resource paths (wildcard handler under /resources)\n */\n @Stat(\"/resources/:path+\")\n async statResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const afsPath = `/resources${resourcePath}`;\n const resourceId = ctx.params.path.split(\"/\").pop() || ctx.params.path;\n\n // Check for exact match or children\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"mcp:resource\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resourceMatch.resource.description,\n mimeType: resourceMatch.resource.mimeType,\n childrenCount: 0,\n },\n },\n };\n } else if (resourceMatch.template) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resourceMatch.template.description,\n mimeType: resourceMatch.template.mimeType,\n childrenCount: 0,\n },\n },\n };\n }\n }\n\n // Check if this is an intermediate directory (count immediate children)\n const immediateChildren = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildren.size > 0) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: immediateChildren.size,\n },\n },\n };\n }\n\n // Check if this is a template base path (dynamic children)\n if (this.isTemplateBasePath(resourcePath)) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: 0,\n },\n },\n };\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n get isConnected(): boolean {\n return this._isConnected;\n }\n\n /**\n * Get cached tools\n */\n get tools(): Tool[] {\n return this._tools;\n }\n\n /**\n * Get cached prompts\n */\n get prompts(): Prompt[] {\n return this._prompts;\n }\n\n /**\n * Get cached resources\n */\n get resources(): Resource[] {\n return this._resources;\n }\n\n /**\n * Get cached resource templates\n */\n get resourceTemplates(): ResourceTemplate[] {\n return this._resourceTemplates;\n }\n\n /** Promise for in-progress connection */\n private _connectPromise: Promise<void> | null = null;\n\n /**\n * Ensure connection is established (lazy connect)\n */\n async ensureConnected(): Promise<void> {\n if (this._isConnected) return;\n if (this._connectPromise) return this._connectPromise;\n this._connectPromise = this.connect();\n try {\n await this._connectPromise;\n } finally {\n this._connectPromise = null;\n }\n }\n\n /**\n * Connect to the MCP server\n */\n async connect(): Promise<void> {\n if (this._isConnected) return;\n\n // Create transport based on configuration\n this.transport = this.createTransport();\n\n // Create and connect client\n this.client = new Client(\n {\n name: \"afs-mcp-client\",\n version: \"1.0.0\",\n },\n {\n capabilities: {},\n },\n );\n\n await this.client.connect(this.transport);\n this._isConnected = true;\n\n // Cache capabilities\n await this.refreshCapabilities();\n\n // Build resource path mapping\n this.buildResourcePathMap();\n }\n\n /**\n * Disconnect from the MCP server\n */\n async disconnect(): Promise<void> {\n if (!this._isConnected) return;\n\n try {\n await this.client?.close();\n } catch (error) {\n // Ignore EPIPE errors during disconnect - the pipe may already be closed\n const isEpipe =\n error instanceof Error &&\n (error.message.includes(\"EPIPE\") || (error as NodeJS.ErrnoException).code === \"EPIPE\");\n if (!isEpipe) {\n throw error;\n }\n }\n this.client = null;\n this.transport = null;\n this._isConnected = false;\n\n // Clear caches\n this._tools = [];\n this._prompts = [];\n this._resources = [];\n this._resourceTemplates = [];\n this._resourcePathMap.clear();\n }\n\n /**\n * Create transport based on configuration\n */\n private createTransport(): Transport {\n switch (this.options.transport) {\n case \"stdio\":\n return new StdioClientTransport({\n command: this.options.command!,\n args: this.options.args,\n env: { ...process.env, ...this.options.env } as Record<string, string>,\n stderr: \"pipe\", // Capture stderr to prevent debug output from polluting terminal\n });\n\n case \"http\":\n return new StreamableHTTPClientTransport(new URL(this.options.url!), {\n requestInit: {\n headers: this.options.headers,\n },\n });\n\n case \"sse\":\n return new SSEClientTransport(new URL(this.options.url!), {\n requestInit: {\n headers: this.options.headers,\n },\n });\n\n default:\n throw new Error(`Unknown transport: ${this.options.transport}`);\n }\n }\n\n /**\n * Refresh cached capabilities from the server\n */\n private async refreshCapabilities(): Promise<void> {\n if (!this.client) return;\n\n try {\n const toolsResult = await this.client.listTools();\n this._tools = toolsResult.tools || [];\n } catch {\n this._tools = [];\n }\n\n try {\n const promptsResult = await this.client.listPrompts();\n this._prompts = promptsResult.prompts || [];\n } catch {\n this._prompts = [];\n }\n\n try {\n const resourcesResult = await this.client.listResources();\n this._resources = resourcesResult.resources || [];\n } catch {\n this._resources = [];\n }\n\n try {\n const templatesResult = await this.client.listResourceTemplates();\n this._resourceTemplates = templatesResult.resourceTemplates || [];\n } catch {\n this._resourceTemplates = [];\n }\n }\n\n /**\n * Build the resource path mapping from cached resources\n */\n private buildResourcePathMap(): void {\n this._resourcePathMap.clear();\n\n // Map static resources\n for (const resource of this._resources) {\n const path = this.resourceUriToPath(resource.uri);\n if (path) {\n this._resourcePathMap.set(path, { resource });\n }\n }\n\n // Map resource templates (store the base path)\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (basePath) {\n this._resourcePathMap.set(basePath, { template });\n }\n }\n }\n\n /**\n * Convert a resource URI to an AFS path\n *\n * Examples:\n * - \"file:///path/to/file.txt\" -> \"/path/to/file.txt\"\n * - \"sqlite://posts\" -> \"/posts\"\n * - \"github://repos\" -> \"/repos\"\n */\n resourceUriToPath(uri: string): string | null {\n const parsed = AFSMCP.parseResourceUri(uri);\n return parsed.path;\n }\n\n /**\n * Get the base path from a URI template (path before first variable)\n *\n * Examples:\n * - \"sqlite://posts/{id}\" -> \"/posts\"\n * - \"github://repos/{owner}/{repo}\" -> \"/repos\"\n */\n private getTemplateBasePath(uriTemplate: string): string | null {\n const parsed = AFSMCP.parseResourceUri(uriTemplate);\n // Find the position of first { and get path before it\n const varIndex = parsed.path.indexOf(\"{\");\n if (varIndex === -1) {\n return parsed.path;\n }\n // Get path up to but not including the variable segment\n const basePath = parsed.path.substring(0, varIndex);\n // Remove trailing slash if present\n return basePath.endsWith(\"/\") ? basePath.slice(0, -1) : basePath;\n }\n\n /**\n * Check if a resource path is a template base path (has dynamic children).\n */\n private isTemplateBasePath(resourcePath: string): boolean {\n return this._resourceTemplates.some((template) => {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n return basePath === resourcePath;\n });\n }\n\n /**\n * Get immediate child segments under a resource parent path,\n * scanning both static resources and template base paths.\n */\n private getImmediateResourceChildren(parentPath: string): Set<string> {\n const depth = parentPath.split(\"/\").filter(Boolean).length;\n const childSegments = new Set<string>();\n\n for (const resource of this._resources) {\n const rPath = this.resourceUriToPath(resource.uri);\n if (!rPath || !rPath.startsWith(`${parentPath}/`)) continue;\n const segments = rPath.split(\"/\").filter(Boolean);\n if (segments.length > depth) {\n childSegments.add(segments[depth]!);\n }\n }\n\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath || !basePath.startsWith(`${parentPath}/`)) continue;\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length > depth) {\n childSegments.add(segments[depth]!);\n }\n }\n\n return childSegments;\n }\n\n /**\n * Find a resource or template that matches a given path\n */\n private findResourceForPath(\n path: string,\n ): { resource?: Resource; template?: ResourceTemplate; params?: Record<string, string> } | null {\n // First check for exact match in static resources\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (resourcePath === path) {\n return { resource };\n }\n }\n\n // Then check templates\n for (const template of this._resourceTemplates) {\n const params = AFSMCP.matchPathToTemplate(path, template.uriTemplate);\n if (params) {\n return { template, params };\n }\n }\n\n return null;\n }\n\n /**\n * Convert a Tool to an AFSEntry (Meta Spec compliant)\n */\n private toolToEntry(tool: Tool): AFSEntry {\n return {\n id: `/tools/${tool.name}`,\n path: `/tools/${tool.name}`,\n summary: tool.description,\n meta: {\n kind: \"mcp:tool\",\n kinds: getKindsArray(\"mcp:tool\"),\n description: tool.description,\n inputSchema: tool.inputSchema,\n mcp: {\n name: tool.name,\n },\n },\n };\n }\n\n /**\n * Convert a Prompt to an AFSEntry (Meta Spec compliant)\n * Note: inputSchema is NOT included in prompt entry meta.\n * For prompts with arguments, use the action system (/.actions/get) to execute.\n */\n private promptToEntry(prompt: Prompt): AFSEntry {\n return {\n id: `/prompts/${prompt.name}`,\n path: `/prompts/${prompt.name}`,\n summary: prompt.description,\n meta: {\n kind: \"mcp:prompt\",\n kinds: getKindsArray(\"mcp:prompt\"),\n description: prompt.description,\n mcp: {\n name: prompt.name,\n arguments: prompt.arguments,\n },\n },\n };\n }\n\n /**\n * Convert prompt arguments to JSON Schema (for action inputSchema)\n */\n private promptArgsToSchema(args: Prompt[\"arguments\"]): Record<string, unknown> {\n if (!args || args.length === 0) {\n return { type: \"object\", properties: {} };\n }\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const arg of args) {\n properties[arg.name] = {\n type: \"string\",\n ...(arg.description ? { description: arg.description } : {}),\n };\n if (arg.required) {\n required.push(arg.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n };\n }\n\n /**\n * Extract text content from MCP prompt messages\n */\n private extractTextFromMessages(messages: any[]): string {\n const textParts: string[] = [];\n for (const msg of messages) {\n const c = msg.content;\n if (typeof c === \"string\") {\n textParts.push(c);\n } else if (c && typeof c === \"object\" && \"text\" in c) {\n textParts.push(c.text as string);\n }\n }\n return textParts.join(\"\\n\");\n }\n\n /**\n * Convert a Resource to an AFSEntry (Meta Spec compliant)\n */\n private resourceToEntry(resource: Resource, path: string): AFSEntry {\n return {\n id: path,\n path: path,\n summary: resource.description || resource.name,\n meta: {\n kind: \"mcp:resource\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resource.description,\n mimeType: resource.mimeType,\n mcp: {\n uri: resource.uri,\n name: resource.name,\n },\n },\n };\n }\n\n /**\n * Convert a ResourceTemplate to an AFSEntry (Meta Spec compliant)\n */\n private resourceTemplateToEntry(template: ResourceTemplate, path: string): AFSEntry {\n return {\n id: path,\n path: path,\n summary: template.description || template.name,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: template.description,\n mimeType: template.mimeType,\n mcp: {\n uriTemplate: template.uriTemplate,\n name: template.name,\n },\n },\n };\n }\n\n // ========== List Handlers ==========\n\n /**\n * List tools.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/tools\")\n async listToolsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n const entries = this._tools.map((tool) => this.toolToEntry(tool));\n return { data: entries };\n }\n\n /**\n * List prompts.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/prompts\")\n async listPromptsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n const entries = this._prompts.map((prompt) => this.promptToEntry(prompt));\n return { data: entries };\n }\n\n /**\n * List specific tool - tools are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/tools/:name\")\n async listToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n // Tools are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List specific prompt - prompts are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/prompts/:name\")\n async listPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n // Prompts are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List resources directory.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/resources\")\n async listResourcesHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Synthesize immediate children (directories or files at depth 1)\n const immediateChildren = new Map<string, { isDir: boolean; resource?: Resource }>();\n\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (!resourcePath) continue;\n\n const segments = resourcePath.split(\"/\").filter(Boolean);\n if (segments.length === 0) continue;\n\n const firstSegment = segments[0]!;\n const childPath = `/resources/${firstSegment}`;\n\n if (segments.length === 1) {\n immediateChildren.set(childPath, { isDir: false, resource });\n } else {\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n\n // Include template base paths in the tree\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath) continue;\n\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length === 0) continue;\n\n const firstSegment = segments[0]!;\n const childPath = `/resources/${firstSegment}`;\n\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n\n const entries: AFSEntry[] = [];\n for (const [path, info] of immediateChildren) {\n if (info.isDir) {\n const resourceSubPath = path.replace(\"/resources\", \"\");\n const childrenCount = this.getImmediateResourceChildren(resourceSubPath).size;\n entries.push({\n id: path,\n path,\n summary: `Resource directory: ${resourceSubPath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount,\n mcp: { isResource: true },\n },\n });\n } else if (info.resource) {\n entries.push(this.resourceToEntry(info.resource, path));\n }\n }\n\n return { data: entries };\n }\n\n /**\n * List resource paths (wildcard handler under /resources)\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/resources/:path+\")\n async listResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const entries: AFSEntry[] = [];\n\n // Check for exact match or collect children\n let exactMatch: Resource | null = null;\n const immediateChildren = new Map<string, { isDir: boolean; resource?: Resource }>();\n const resourcePathSegments = resourcePath.split(\"/\").filter(Boolean);\n const depth = resourcePathSegments.length;\n\n for (const resource of this._resources) {\n const rPath = this.resourceUriToPath(resource.uri);\n if (!rPath) continue;\n\n if (rPath === resourcePath) {\n exactMatch = resource;\n } else if (rPath.startsWith(`${resourcePath}/`)) {\n const segments = rPath.split(\"/\").filter(Boolean);\n if (segments.length <= depth) continue;\n\n const childSegment = segments[depth]!;\n const childPath = `/resources${resourcePath}/${childSegment}`;\n\n if (segments.length === depth + 1) {\n immediateChildren.set(childPath, { isDir: false, resource });\n } else {\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n }\n\n // Include template base paths in the tree\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath) continue;\n\n if (basePath === resourcePath) {\n // This is a template base path - it has dynamic children\n // Return empty since children are parameterized\n return { data: [] };\n } else if (basePath.startsWith(`${resourcePath}/`)) {\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length <= depth) continue;\n\n const childSegment = segments[depth]!;\n const childPath = `/resources${resourcePath}/${childSegment}`;\n\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n\n if (exactMatch) {\n // Exact resource match - resources are leaf nodes with no children\n return { data: [] };\n }\n\n if (immediateChildren.size > 0) {\n for (const [path, info] of immediateChildren) {\n if (info.isDir) {\n const resourceSubPath = path.replace(\"/resources\", \"\");\n const childrenCount = this.getImmediateResourceChildren(resourceSubPath).size;\n entries.push({\n id: path,\n path,\n summary: `Resource directory: ${resourceSubPath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount,\n mcp: { isResource: true },\n },\n });\n } else if (info.resource) {\n entries.push(this.resourceToEntry(info.resource, path));\n }\n }\n return { data: entries };\n }\n\n // No match found\n throw new AFSNotFoundError(ctx.path);\n }\n\n // ========== Meta Handlers ==========\n\n /**\n * Read metadata for tools (dynamic entries not in static tree).\n * Static entries metadata is handled by AFSBaseProvider.\n */\n @Meta(\"/tools/:name\")\n async readToolMeta(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n const entry = this.toolToEntry(tool);\n return {\n id: `/tools/${ctx.params.name}/.meta`,\n path: `/tools/${ctx.params.name}/.meta`,\n meta: entry.meta,\n };\n }\n\n /**\n * Read metadata for prompts (dynamic entries not in static tree).\n */\n @Meta(\"/prompts/:name\")\n async readPromptMeta(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n const entry = this.promptToEntry(prompt);\n return {\n id: `/prompts/${ctx.params.name}/.meta`,\n path: `/prompts/${ctx.params.name}/.meta`,\n meta: entry.meta,\n };\n }\n\n /**\n * Read metadata for resources (dynamic entries not in static tree).\n * Handles both actual resources and synthesized intermediate directories.\n */\n @Meta(\"/resources/:path+\")\n async readResourceMeta(ctx: RouteContext<{ path: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const metaPath = `/resources${resourcePath}/.meta`;\n\n // Try to match as resource path\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n // Static resource\n const entry = this.resourceToEntry(resourceMatch.resource, `/resources${resourcePath}`);\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n } else if (resourceMatch.template) {\n // Template resource\n const entry = this.resourceTemplateToEntry(\n resourceMatch.template,\n `/resources${resourcePath}`,\n );\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n }\n }\n\n // Check if this is an intermediate directory (has child resources or templates)\n const immediateChildren = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildren.size > 0) {\n return {\n id: metaPath,\n path: metaPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n mcp: { isResource: true },\n },\n };\n }\n\n // Check if this is a template base path\n if (this.isTemplateBasePath(resourcePath)) {\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n if (template) {\n const entry = this.resourceTemplateToEntry(template, `/resources${resourcePath}`);\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n }\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n // ========== Read Handlers ==========\n\n /**\n * Read tool\n */\n @Read(\"/tools/:name\")\n async readToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n return this.toolToEntry(tool);\n }\n\n /**\n * Read prompt\n *\n * Behavior:\n * - Prompts with NO arguments: returns content directly\n * - Prompts with ONLY optional arguments: returns content (empty params)\n * - Prompts with REQUIRED arguments: returns metadata only (use /.actions/get to execute)\n */\n @Read(\"/prompts/:name\")\n async readPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const entry = this.promptToEntry(prompt);\n\n // Only auto-fetch content for prompts without required args\n const hasRequiredArgs = prompt.arguments?.some((arg) => arg.required) ?? false;\n\n if (this.client && !hasRequiredArgs) {\n try {\n const result = await this.client.getPrompt({\n name: prompt.name,\n arguments: {},\n });\n const content = this.extractTextFromMessages(result.messages);\n if (content) {\n entry.content = content;\n }\n } catch {\n // Silently fall back to metadata-only if getPrompt fails\n }\n }\n\n return entry;\n }\n\n // ========== Prompt Action Handlers ==========\n\n /**\n * List actions for a prompt\n *\n * Only prompts with arguments expose a \"get\" action.\n */\n @Actions(\"/prompts/:name\")\n async listPromptActions(ctx: RouteContext<{ name: string }>): Promise<{ data: AFSEntry[] }> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n // Only expose \"get\" action for prompts with arguments\n if (!prompt.arguments || prompt.arguments.length === 0) {\n return { data: [] };\n }\n\n const actionPath = `/prompts/${prompt.name}/.actions/get`;\n return {\n data: [\n {\n id: \"get\",\n path: actionPath,\n summary: `Get ${prompt.name} prompt content with arguments`,\n meta: {\n kind: \"afs:executable\",\n kinds: getKindsArray(\"afs:executable\"),\n name: \"get\",\n description: prompt.description,\n inputSchema: this.promptArgsToSchema(prompt.arguments),\n },\n },\n ],\n };\n }\n\n /**\n * Execute prompt \"get\" action\n *\n * Fetches prompt content with provided arguments.\n */\n @Actions.Exec(\"/prompts/:name\", \"get\")\n async execPromptGetHandler(\n ctx: RouteContext<{ name: string }>,\n params: Record<string, unknown>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: `Prompt not found: ${ctx.params.name}` },\n };\n }\n\n if (!this.client) {\n return {\n success: false,\n error: { code: \"NOT_CONNECTED\", message: \"MCP client not connected\" },\n };\n }\n\n try {\n const result = await this.client.getPrompt({\n name: prompt.name,\n arguments: params as Record<string, string>,\n });\n\n const content = this.extractTextFromMessages(result.messages);\n\n return {\n success: true,\n data: {\n content,\n meta: {\n mcp: {\n name: prompt.name,\n arguments: prompt.arguments,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n success: false,\n error: { code: \"EXECUTION_ERROR\", message: error.message },\n };\n }\n }\n\n // ========== Resource Action Handlers ==========\n\n /**\n * List actions for a resource template\n *\n * Only resource templates expose a \"get\" action.\n * Static resources do not have actions.\n */\n @Actions(\"/resources/:path+\")\n async listResourceActions(ctx: RouteContext<{ path: string }>): Promise<{ data: AFSEntry[] }> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n // Check if this is a template base path\n if (!this.isTemplateBasePath(resourcePath)) {\n // Not a template - no actions\n return { data: [] };\n }\n\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n\n if (!template) {\n return { data: [] };\n }\n\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length === 0) {\n // No variables - no action needed\n return { data: [] };\n }\n\n // Build inputSchema from template variables\n const properties: Record<string, unknown> = {};\n for (const v of vars) {\n properties[v] = { type: \"string\", description: `Template variable: ${v}` };\n }\n const inputSchema = {\n type: \"object\",\n properties,\n required: vars, // All template variables are required\n };\n\n const afsPath = `/resources${resourcePath}`;\n const actionPath = `${afsPath}/.actions/get`;\n\n return {\n data: [\n {\n id: \"get\",\n path: actionPath,\n summary: `Get resource with template parameters`,\n meta: {\n kind: \"afs:executable\",\n kinds: getKindsArray(\"afs:executable\"),\n name: \"get\",\n description: template.description,\n inputSchema,\n },\n },\n ],\n };\n }\n\n /**\n * Execute resource template \"get\" action\n *\n * Fetches resource content with provided template parameters.\n */\n @Actions.Exec(\"/resources/:path+\", \"get\")\n async execResourceGetHandler(\n ctx: RouteContext<{ path: string }>,\n params: Record<string, unknown>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n // Check if this is a template base path\n if (!this.isTemplateBasePath(resourcePath)) {\n return {\n success: false,\n error: { code: \"NOT_TEMPLATE\", message: `Not a resource template: ${resourcePath}` },\n };\n }\n\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n\n if (!template) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: `Resource template not found: ${resourcePath}` },\n };\n }\n\n if (!this.client) {\n return {\n success: false,\n error: { code: \"NOT_CONNECTED\", message: \"MCP client not connected\" },\n };\n }\n\n try {\n const uri = AFSMCP.buildUriFromTemplate(\n template.uriTemplate,\n params as Record<string, string>,\n );\n const result = await this.readResourceByUri(uri);\n\n if (!result.data) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: result.message || \"Resource not found\" },\n };\n }\n\n return {\n success: true,\n data: {\n content: result.data.content,\n meta: {\n mcp: {\n uri,\n name: template.name,\n uriTemplate: template.uriTemplate,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n success: false,\n error: { code: \"EXECUTION_ERROR\", message: error.message },\n };\n }\n }\n\n /**\n * Read resource (wildcard handler under /resources)\n */\n @Read(\"/resources/:path+\")\n async readResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const afsPath = `/resources${resourcePath}`;\n\n // Try to match as resource path\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n // Static resource - read it directly\n const result = await this.readResourceByUri(resourceMatch.resource.uri);\n if (!result.data) {\n throw new AFSNotFoundError(ctx.path, result.message || `Resource not found: ${ctx.path}`);\n }\n // Update path to include /resources prefix\n result.data.path = `/resources${result.data.path}`;\n result.data.id = result.data.path;\n return result.data;\n } else if (resourceMatch.template && resourceMatch.params) {\n // Template match - build URI and read\n const uri = AFSMCP.buildUriFromTemplate(\n resourceMatch.template.uriTemplate,\n resourceMatch.params,\n );\n const result = await this.readResourceByUri(uri);\n if (!result.data) {\n throw new AFSNotFoundError(ctx.path, result.message || `Resource not found: ${ctx.path}`);\n }\n // Update path to include /resources prefix\n result.data.path = `/resources${result.data.path}`;\n result.data.id = result.data.path;\n return result.data;\n }\n }\n\n // Check if this is an intermediate directory (has child resources or templates)\n const immediateChildrenSet = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildrenSet.size > 0) {\n return {\n id: afsPath,\n path: afsPath,\n summary: `Resource directory: ${resourcePath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: immediateChildrenSet.size,\n mcp: { isResource: true },\n },\n };\n }\n\n // Check if this is a template base path (dynamic children, not enumerable)\n // For templates, return metadata only. Use /.actions/get to fetch with params.\n if (this.isTemplateBasePath(resourcePath)) {\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n return {\n id: afsPath,\n path: afsPath,\n summary: template?.description || `Resource template: ${resourcePath}`,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: template?.description,\n mimeType: template?.mimeType,\n childrenCount: 0,\n mcp: {\n uriTemplate: template?.uriTemplate,\n name: template?.name,\n parameters: template ? AFSMCP.parseUriTemplate(template.uriTemplate) : [],\n },\n },\n };\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n /**\n * Read a resource by its URI (internal helper)\n */\n private async readResourceByUri(uri: string): Promise<AFSReadResult> {\n if (!this.client) {\n return {\n data: undefined,\n message: \"MCP client not connected\",\n };\n }\n\n try {\n const result = await this.client.readResource({ uri });\n const path = this.resourceUriToPath(uri) || uri;\n\n // Extract content from the result\n let content: any;\n let mimeType: string | undefined;\n\n if (result.contents && result.contents.length > 0) {\n const firstContent = result.contents[0]!;\n mimeType = firstContent.mimeType;\n\n if (\"text\" in firstContent) {\n content = firstContent.text;\n } else if (\"blob\" in firstContent) {\n content = firstContent.blob;\n }\n }\n\n return {\n data: {\n id: path,\n path: path,\n content: content,\n meta: {\n mcp: {\n uri: uri,\n mimeType: mimeType,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n data: undefined,\n message: `Failed to read resource: ${error.message}`,\n };\n }\n }\n\n /**\n * Read a prompt with arguments, returning the prompt content\n *\n * This is a specialized method that calls the MCP getPrompt API\n * to get the actual prompt content with substituted arguments.\n */\n async readPrompt(path: string, args: Record<string, string>): Promise<AFSReadResult> {\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n\n if (!normalizedPath.startsWith(\"/prompts/\")) {\n return {\n data: undefined,\n message: `readPrompt only supported on /prompts/* paths, got: ${normalizedPath}`,\n };\n }\n\n if (!this.client) {\n return {\n data: undefined,\n message: \"MCP client not connected\",\n };\n }\n\n const promptName = normalizedPath.slice(\"/prompts/\".length);\n const prompt = this._prompts.find((p) => p.name === promptName);\n\n if (!prompt) {\n return {\n data: undefined,\n message: `Prompt not found: ${promptName}`,\n };\n }\n\n try {\n // Call MCP getPrompt to get the actual prompt content\n const result = await this.client.getPrompt({\n name: promptName,\n arguments: args,\n });\n\n return {\n data: {\n id: `/prompts/${promptName}`,\n path: `/prompts/${promptName}`,\n summary: prompt.description,\n content: result.messages,\n meta: {\n arguments: prompt.arguments,\n mcp: {\n name: prompt.name,\n description: prompt.description,\n arguments: prompt.arguments,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n data: undefined,\n message: `Failed to get prompt: ${error.message}`,\n };\n }\n }\n\n /**\n * Generate WORLD.md content describing this MCP server's capabilities\n */\n generateWorldMd(): string {\n const lines: string[] = [];\n\n // Header\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n if (this.description) {\n lines.push(this.description);\n lines.push(\"\");\n }\n\n // Server Info\n lines.push(\"## Server Information\");\n lines.push(\"\");\n lines.push(`- **Name**: ${this.name}`);\n lines.push(`- **Transport**: ${this.options.transport}`);\n if (this.options.transport === \"stdio\") {\n lines.push(`- **Command**: ${this.options.command}`);\n } else {\n lines.push(`- **URL**: ${this.options.url}`);\n }\n lines.push(\"\");\n\n // Capabilities Summary\n lines.push(\"## Capabilities\");\n lines.push(\"\");\n lines.push(`- Tools: ${this._tools.length}`);\n lines.push(`- Prompts: ${this._prompts.length}`);\n lines.push(`- Resources: ${this._resources.length}`);\n lines.push(`- Resource Templates: ${this._resourceTemplates.length}`);\n lines.push(\"\");\n\n // Tools\n if (this._tools.length > 0) {\n lines.push(\"## Tools\");\n lines.push(\"\");\n for (const tool of this._tools) {\n lines.push(`### ${tool.name}`);\n lines.push(\"\");\n if (tool.description) {\n lines.push(tool.description);\n lines.push(\"\");\n }\n lines.push(`**Path**: \\`/tools/${tool.name}\\``);\n lines.push(\"\");\n if (tool.inputSchema) {\n lines.push(\"**Input Schema**:\");\n lines.push(\"```json\");\n lines.push(JSON.stringify(tool.inputSchema, null, 2));\n lines.push(\"```\");\n lines.push(\"\");\n }\n }\n }\n\n // Prompts\n if (this._prompts.length > 0) {\n lines.push(\"## Prompts\");\n lines.push(\"\");\n for (const prompt of this._prompts) {\n lines.push(`### ${prompt.name}`);\n lines.push(\"\");\n if (prompt.description) {\n lines.push(prompt.description);\n lines.push(\"\");\n }\n lines.push(`**Path**: \\`/prompts/${prompt.name}\\``);\n lines.push(\"\");\n if (prompt.arguments && prompt.arguments.length > 0) {\n lines.push(\"**Arguments**:\");\n for (const arg of prompt.arguments) {\n const required = arg.required ? \" (required)\" : \" (optional)\";\n lines.push(`- \\`${arg.name}\\`${required}: ${arg.description || \"\"}`);\n }\n lines.push(\"\");\n }\n }\n }\n\n // Resources\n if (this._resources.length > 0) {\n lines.push(\"## Resources\");\n lines.push(\"\");\n for (const resource of this._resources) {\n lines.push(`### ${resource.name}`);\n lines.push(\"\");\n if (resource.description) {\n lines.push(resource.description);\n lines.push(\"\");\n }\n lines.push(`**URI**: \\`${resource.uri}\\``);\n const afsPath = this.resourceUriToPath(resource.uri);\n if (afsPath) {\n lines.push(`**AFS Path**: \\`${afsPath}\\``);\n }\n if (resource.mimeType) {\n lines.push(`**MIME Type**: ${resource.mimeType}`);\n }\n lines.push(\"\");\n }\n }\n\n // Resource Templates\n if (this._resourceTemplates.length > 0) {\n lines.push(\"## Resource Templates\");\n lines.push(\"\");\n for (const template of this._resourceTemplates) {\n lines.push(`### ${template.name}`);\n lines.push(\"\");\n if (template.description) {\n lines.push(template.description);\n lines.push(\"\");\n }\n lines.push(`**URI Template**: \\`${template.uriTemplate}\\``);\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length > 0) {\n lines.push(`**Variables**: ${vars.map((v) => `\\`{${v}}\\``).join(\", \")}`);\n }\n if (template.mimeType) {\n lines.push(`**MIME Type**: ${template.mimeType}`);\n }\n lines.push(\"\");\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n // ========== Explain Handlers ==========\n\n /**\n * Explain root → server name, tools/prompts/resources counts\n */\n @Explain(\"/\")\n async explainRoot(_ctx: RouteContext): Promise<AFSExplainResult> {\n await this.ensureConnected();\n\n const lines: string[] = [];\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n if (this.description) {\n lines.push(this.description);\n lines.push(\"\");\n }\n lines.push(\"## Overview\");\n lines.push(\"\");\n lines.push(`- **Tool count**: ${this._tools.length}`);\n lines.push(`- **Prompt count**: ${this._prompts.length}`);\n lines.push(`- **Resource count**: ${this._resources.length}`);\n lines.push(`- **Resource template count**: ${this._resourceTemplates.length}`);\n lines.push(\"\");\n\n if (this._tools.length > 0) {\n lines.push(\"## Tools\");\n lines.push(\"\");\n for (const tool of this._tools) {\n lines.push(`- **${tool.name}**: ${tool.description ?? \"(no description)\"}`);\n }\n lines.push(\"\");\n }\n\n if (this._prompts.length > 0) {\n lines.push(\"## Prompts\");\n lines.push(\"\");\n for (const prompt of this._prompts) {\n const argNames = prompt.arguments?.map((a) => a.name).join(\", \") ?? \"\";\n lines.push(\n `- **${prompt.name}**: ${prompt.description ?? \"(no description)\"}${argNames ? ` (args: ${argNames})` : \"\"}`,\n );\n }\n lines.push(\"\");\n }\n\n if (this._resources.length > 0) {\n lines.push(\"## Resources\");\n lines.push(\"\");\n for (const resource of this._resources) {\n lines.push(`- **${resource.name}**: ${resource.description ?? resource.uri}`);\n }\n lines.push(\"\");\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific tool → name, description, inputSchema\n */\n @Explain(\"/tools/:name\")\n async explainTool(ctx: RouteContext<{ name: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path, `Tool not found: ${ctx.params.name}`);\n }\n\n const lines: string[] = [];\n lines.push(`# Tool: ${tool.name}`);\n lines.push(\"\");\n if (tool.description) {\n lines.push(tool.description);\n lines.push(\"\");\n }\n if (tool.inputSchema) {\n lines.push(\"## Input Schema\");\n lines.push(\"\");\n lines.push(\"```json\");\n lines.push(JSON.stringify(tool.inputSchema, null, 2));\n lines.push(\"```\");\n lines.push(\"\");\n const props = (tool.inputSchema as Record<string, unknown>).properties as\n | Record<string, unknown>\n | undefined;\n if (props) {\n lines.push(\"## Parameters\");\n lines.push(\"\");\n for (const [key, val] of Object.entries(props)) {\n const prop = val as Record<string, unknown>;\n lines.push(\n `- **${key}** (${prop.type ?? \"unknown\"}): ${prop.description ?? \"(no description)\"}`,\n );\n }\n lines.push(\"\");\n }\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific prompt → name, description, arguments\n */\n @Explain(\"/prompts/:name\")\n async explainPrompt(ctx: RouteContext<{ name: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path, `Prompt not found: ${ctx.params.name}`);\n }\n\n const lines: string[] = [];\n lines.push(`# Prompt: ${prompt.name}`);\n lines.push(\"\");\n if (prompt.description) {\n lines.push(prompt.description);\n lines.push(\"\");\n }\n if (prompt.arguments && prompt.arguments.length > 0) {\n lines.push(\"## Arguments\");\n lines.push(\"\");\n for (const arg of prompt.arguments) {\n const required = arg.required ? \" (required)\" : \" (optional)\";\n lines.push(`- **${arg.name}**${required}: ${arg.description ?? \"(no description)\"}`);\n }\n lines.push(\"\");\n } else {\n lines.push(\"*No arguments required.*\");\n lines.push(\"\");\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific resource → name, URI, description\n */\n @Explain(\"/resources/:path+\")\n async explainResource(ctx: RouteContext<{ path: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n const resourceMatch = this.findResourceForPath(resourcePath);\n if (resourceMatch?.resource) {\n const resource = resourceMatch.resource;\n const lines: string[] = [];\n lines.push(`# Resource: ${resource.name}`);\n lines.push(\"\");\n if (resource.description) {\n lines.push(resource.description);\n lines.push(\"\");\n }\n lines.push(`- **URI**: ${resource.uri}`);\n if (resource.mimeType) {\n lines.push(`- **MIME Type**: ${resource.mimeType}`);\n }\n lines.push(\"\");\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n if (resourceMatch?.template) {\n const template = resourceMatch.template;\n const lines: string[] = [];\n lines.push(`# Resource Template: ${template.name}`);\n lines.push(\"\");\n if (template.description) {\n lines.push(template.description);\n lines.push(\"\");\n }\n lines.push(`- **URI Template**: ${template.uriTemplate}`);\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length > 0) {\n lines.push(`- **Variables**: ${vars.join(\", \")}`);\n }\n lines.push(\"\");\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n throw new AFSNotFoundError(ctx.path, `Resource not found: ${ctx.path}`);\n }\n\n // ========== Search Handler ==========\n\n /**\n * Search tools, prompts, and resources by name or description\n */\n @Search(\"/:path*\")\n async searchHandler(\n _ctx: RouteContext<{ path?: string }>,\n query: string,\n options?: { limit?: number; caseSensitive?: boolean },\n ): Promise<AFSSearchResult> {\n await this.ensureConnected();\n\n const results: AFSEntry[] = [];\n const limit = options?.limit;\n\n // Escape regex special characters to prevent injection\n const escapedQuery = query.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const flags = options?.caseSensitive ? \"\" : \"i\";\n const pattern = new RegExp(escapedQuery, flags);\n const matchAll = query === \"\";\n\n // Search tools\n for (const tool of this._tools) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(tool.name) ||\n (tool.description && pattern.test(tool.description))\n ) {\n results.push(this.toolToEntry(tool));\n }\n }\n\n // Search prompts\n for (const prompt of this._prompts) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(prompt.name) ||\n (prompt.description && pattern.test(prompt.description))\n ) {\n results.push(this.promptToEntry(prompt));\n }\n }\n\n // Search resources\n for (const resource of this._resources) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(resource.name) ||\n (resource.description && pattern.test(resource.description))\n ) {\n const path = this.resourceUriToPath(resource.uri);\n results.push(this.resourceToEntry(resource, `/resources${path}`));\n }\n }\n\n return { data: results };\n }\n\n // ========== Exec Handlers ==========\n\n /**\n * Execute a tool\n */\n @Exec(\"/tools/:name\")\n async execToolHandler(\n ctx: RouteContext<{ name: string }>,\n args: Record<string, any>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n\n if (!this.client) {\n throw new Error(\"MCP client not connected\");\n }\n\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n\n if (!tool) {\n throw new Error(`Tool not found: ${ctx.params.name}`);\n }\n\n // Call the MCP tool\n const result = await this.client.callTool({\n name: ctx.params.name,\n arguments: args,\n });\n\n return {\n success: true,\n data: result as Record<string, any>,\n };\n }\n}\n\n// Type check for AFSModuleClass compliance\nconst _typeCheck: AFSModuleClass<AFSMCP, AFSMCPOptions> = AFSMCP;\n\nexport default AFSMCP;\n"],"mappings":";;;;;;;;;;;;;;;AA0FA,MAAM,sBAAsB,SAC1B,EACG,OAAO;CACN,MAAM,YAAY,EAAE,QAAQ,CAAC;CAC7B,aAAa,YAAY,EAAE,QAAQ,CAAC;CACpC,WAAW,EAAE,KAAK;EAAC;EAAS;EAAQ;EAAM,CAAC;CAC3C,SAAS,YAAY,EAAE,QAAQ,CAAC;CAChC,MAAM,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;CACtC,KAAK,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;CACtC,KAAK,YAAY,EAAE,QAAQ,CAAC;CAC5B,SAAS,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;CAC1C,SAAS,YAAY,EAAE,QAAQ,CAAC;CAChC,eAAe,YAAY,EAAE,QAAQ,CAAC;CACvC,CAAC,CACD,QACE,SAAS;AAER,KAAI,KAAK,cAAc,WAAW,CAAC,KAAK,QACtC,QAAO;AAGT,MAAK,KAAK,cAAc,UAAU,KAAK,cAAc,UAAU,CAAC,KAAK,IACnE,QAAO;AAET,QAAO;GAET,EACE,SAAS,yEACV,CACF,CACJ;;;;AAKD,IAAa,SAAb,MAAa,eAAe,gBAAgB;CAC1C,AAAkB;CAClB,AAAkB;CAClB,AAAkB,aAAa;;;;CAK/B,OAAO,SAAS;AACd,SAAO;;;;;CAMT,aAAa,KAAK,EAAE,UAAU,WAAgC,EAAE,EA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,eAAe;YA4CvB,QAAQ,iBAAiB;YAkCzB,QAAQ,oBAAoB;YAiD5B,OAAO,UAAU;YA8DjB,KAAK,eAAe;AAiCvB,kBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * AFS MCP Provider\n *\n * 将 MCP Server 挂载为 AFS 可访问的世界。\n * - Tools → 可执行的 AFS entries(通过 `exec()`)\n * - Prompts → 可读取的世界描述\n * - Resources → 可读取的世界状态(展开为 AFS 目录结构)\n */\n\nimport type {\n AFSEntry,\n AFSExecResult,\n AFSExplainResult,\n AFSListResult,\n AFSModuleClass,\n AFSModuleLoadParams,\n AFSReadResult,\n AFSSearchResult,\n AFSStatResult,\n CapabilitiesManifest,\n ProviderManifest,\n RouteContext,\n ToolDefinition,\n} from \"@aigne/afs\";\nimport { AFSNotFoundError } from \"@aigne/afs\";\nimport {\n Actions,\n AFSBaseProvider,\n Exec,\n Explain,\n List,\n Meta,\n Read,\n Search,\n Stat,\n} from \"@aigne/afs/provider\";\nimport { camelize, optionalize, zodParse } from \"@aigne/afs/utils/zod\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport { SSEClientTransport } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\nimport { StreamableHTTPClientTransport } from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport type { Transport } from \"@modelcontextprotocol/sdk/shared/transport.js\";\nimport type { Prompt, Resource, ResourceTemplate, Tool } from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\nimport { getKindsArray } from \"./kinds.js\";\n\n/**\n * Parsed resource URI\n */\nexport interface ParsedResourceUri {\n scheme: string;\n path: string;\n query?: Record<string, string>;\n}\n\n/**\n * Configuration options for AFSMCP\n */\nexport interface AFSMCPOptions {\n /** Module name (used as mount path segment) */\n name?: string;\n /** Module description */\n description?: string;\n\n /** Transport type */\n transport: \"stdio\" | \"http\" | \"sse\";\n\n // Stdio transport options\n /** Command to execute (for stdio transport) */\n command?: string;\n /** Command arguments (for stdio transport) */\n args?: string[];\n /** Environment variables (for stdio transport) */\n env?: Record<string, string>;\n\n // HTTP/SSE transport options\n /** Server URL (for http/sse transport) */\n url?: string;\n /** HTTP headers (for http/sse transport) */\n headers?: Record<string, string>;\n\n // Common options\n /** Connection timeout in milliseconds */\n timeout?: number;\n /** Maximum reconnection attempts */\n maxReconnects?: number;\n}\n\n/**\n * Zod schema for options validation\n */\nconst afsMCPOptionsSchema = camelize(\n z\n .object({\n name: optionalize(z.string()),\n description: optionalize(z.string()),\n transport: z.enum([\"stdio\", \"http\", \"sse\"]),\n command: optionalize(z.string()),\n args: optionalize(z.array(z.string())),\n env: optionalize(z.record(z.string(), z.string())),\n url: optionalize(z.string()),\n headers: optionalize(z.record(z.string(), z.string())),\n timeout: optionalize(z.number()),\n maxReconnects: optionalize(z.number()),\n })\n .refine(\n (data) => {\n // stdio transport requires command\n if (data.transport === \"stdio\" && !data.command) {\n return false;\n }\n // http/sse transport requires url\n if ((data.transport === \"http\" || data.transport === \"sse\") && !data.url) {\n return false;\n }\n return true;\n },\n {\n message: \"stdio transport requires 'command', http/sse transport requires 'url'\",\n },\n ),\n);\n\n/**\n * AFS Module for MCP Server integration\n */\nexport class AFSMCP extends AFSBaseProvider {\n override readonly name: string;\n override readonly description?: string;\n override readonly accessMode = \"readwrite\" as const;\n\n /**\n * Get the Zod schema for options validation\n */\n static schema() {\n return afsMCPOptionsSchema;\n }\n\n static manifest(): ProviderManifest[] {\n return [\n {\n name: \"mcp-stdio\",\n description: \"MCP server via stdio transport\",\n uriTemplate: \"mcp+stdio://{command+}\",\n category: \"integration\",\n schema: z.object({\n command: z.string(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n }),\n tags: [\"mcp\", \"stdio\", \"integration\"],\n },\n {\n name: \"mcp-http\",\n description: \"MCP server via HTTP transport\",\n uriTemplate: \"mcp+http://{url+}\",\n category: \"integration\",\n schema: z.object({\n url: z.string(),\n }),\n tags: [\"mcp\", \"http\", \"integration\"],\n },\n {\n name: \"mcp-sse\",\n description: \"MCP server via SSE transport\",\n uriTemplate: \"mcp+sse://{url+}\",\n category: \"integration\",\n schema: z.object({\n url: z.string(),\n }),\n tags: [\"mcp\", \"sse\", \"integration\"],\n },\n ];\n }\n\n /**\n * Load module from configuration file\n */\n static async load({ basePath, config }: AFSModuleLoadParams = {}): Promise<AFSMCP> {\n const valid = await AFSMCP.schema().parseAsync(config);\n return new AFSMCP({ ...valid, cwd: basePath });\n }\n\n /**\n * Parse a resource URI into its components\n *\n * Examples:\n * - \"file:///path/to/file.txt\" -> { scheme: \"file\", path: \"/path/to/file.txt\" }\n * - \"sqlite://posts\" -> { scheme: \"sqlite\", path: \"/posts\" }\n * - \"github://repos/owner/repo\" -> { scheme: \"github\", path: \"/repos/owner/repo\" }\n */\n static parseResourceUri(uri: string): ParsedResourceUri {\n // Handle standard URI format: scheme://path or scheme:///path\n // Scheme can contain alphanumeric, +, -, . (per RFC 3986)\n const match = uri.match(/^([\\w+.-]+):\\/\\/\\/?(.*)$/);\n if (match) {\n const scheme = match[1] as string;\n const rest = match[2] as string;\n // Ensure path starts with /\n const path = rest.startsWith(\"/\") ? rest : `/${rest}`;\n return { scheme, path };\n }\n\n // Fallback: treat entire string as path\n return { scheme: \"unknown\", path: uri };\n }\n\n /**\n * Parse a URI template and extract variable names\n *\n * Examples:\n * - \"sqlite://posts/{id}\" -> [\"id\"]\n * - \"github://repos/{owner}/{repo}/issues/{number}\" -> [\"owner\", \"repo\", \"number\"]\n */\n static parseUriTemplate(template: string): string[] {\n const vars: string[] = [];\n const regex = /\\{(\\w+)\\}/g;\n let match: RegExpExecArray | null = regex.exec(template);\n while (match !== null) {\n vars.push(match[1] as string);\n match = regex.exec(template);\n }\n return vars;\n }\n\n /**\n * Match a path against a URI template and extract parameters\n *\n * Examples:\n * - matchPathToTemplate(\"/posts/123\", \"sqlite://posts/{id}\") -> { id: \"123\" }\n * - matchPathToTemplate(\"/repos/arcblock/afs/issues/42\", \"github://repos/{owner}/{repo}/issues/{number}\")\n * -> { owner: \"arcblock\", repo: \"afs\", number: \"42\" }\n *\n * Returns null if path doesn't match the template\n */\n static matchPathToTemplate(path: string, uriTemplate: string): Record<string, string> | null {\n // Parse the template to get the path pattern\n const parsed = AFSMCP.parseResourceUri(uriTemplate);\n const templatePath = parsed.path;\n\n // Convert template path to regex\n // Replace {var} with capture groups\n const vars: string[] = [];\n const regexStr = templatePath.replace(/\\{(\\w+)\\}/g, (_, varName) => {\n vars.push(varName);\n return \"([^/]+)\";\n });\n\n const regex = new RegExp(`^${regexStr}$`);\n const match = path.match(regex);\n\n if (!match) {\n return null;\n }\n\n // Extract matched values\n const params: Record<string, string> = {};\n for (let i = 0; i < vars.length; i++) {\n const varName = vars[i];\n const value = match[i + 1];\n if (varName && value) {\n params[varName] = value;\n }\n }\n\n return params;\n }\n\n /**\n * Build a complete URI from a template and parameters\n */\n static buildUriFromTemplate(template: string, params: Record<string, string>): string {\n let uri = template;\n for (const [key, value] of Object.entries(params)) {\n uri = uri.replace(`{${key}}`, value);\n }\n return uri;\n }\n\n // MCP Client instance\n private client: Client | null = null;\n private transport: Transport | null = null;\n\n // Cached capabilities\n private _tools: Tool[] = [];\n private _prompts: Prompt[] = [];\n private _resources: Resource[] = [];\n private _resourceTemplates: ResourceTemplate[] = [];\n\n // Resource path mapping cache\n private _resourcePathMap: Map<string, { resource?: Resource; template?: ResourceTemplate }> =\n new Map();\n\n // Connection state\n private _isConnected = false;\n\n constructor(public readonly options: AFSMCPOptions & { cwd?: string; uri?: string }) {\n super();\n\n // Normalize registry-passed options: infer transport from URI scheme\n if (!options.transport && (options as any).uri) {\n const uri = (options as any).uri as string;\n if (uri.startsWith(\"mcp+stdio://\")) {\n options.transport = \"stdio\";\n if (!options.command) {\n // Extract command from URI body (strip query params)\n const body = uri.slice(\"mcp+stdio://\".length).split(\"?\")[0]!;\n options.command = body;\n }\n } else if (uri.startsWith(\"mcp+http://\")) {\n options.transport = \"http\";\n if (!options.url) options.url = uri.replace(\"mcp+\", \"\");\n } else if (uri.startsWith(\"mcp+sse://\")) {\n options.transport = \"sse\";\n if (!options.url) options.url = uri.replace(\"mcp+sse://\", \"http://\");\n }\n }\n\n // Coerce query-param types: args (string|string[] → string[]), env (string|string[] → Record)\n // At runtime, URI query params may deliver args as string (single value) or string[]\n // Supports comma-separated: \"a,b\" → [\"a\", \"b\"], and mixed: [\"a,b\", \"c\"] → [\"a\", \"b\", \"c\"]\n if (typeof options.args === \"string\") {\n const argsStr = options.args as string;\n options.args = argsStr.includes(\",\") ? argsStr.split(\",\") : [argsStr];\n } else if (Array.isArray(options.args)) {\n options.args = (options.args as string[]).flatMap((a) =>\n a.includes(\",\") ? a.split(\",\") : [a],\n );\n }\n if (options.env && !Array.isArray(options.env) && typeof options.env === \"string\") {\n // Single env string \"KEY=VALUE\"\n const [key, ...rest] = (options.env as string).split(\"=\");\n options.env = key ? { [key]: rest.join(\"=\") } : {};\n } else if (Array.isArray(options.env)) {\n // Array of \"KEY=VALUE\" strings\n const envRecord: Record<string, string> = {};\n for (const entry of options.env as string[]) {\n const [key, ...rest] = entry.split(\"=\");\n if (key) envRecord[key] = rest.join(\"=\");\n }\n options.env = envRecord;\n }\n\n zodParse(afsMCPOptionsSchema, options);\n\n this.name = options.name || \"mcp\";\n this.description = options.description;\n }\n\n // ========== Root Handlers ==========\n\n /**\n * List root directory children.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/\")\n async listRootHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n const entries: AFSEntry[] = [];\n\n // WORLD.md file\n entries.push({\n id: \"/WORLD.md\",\n path: \"/WORLD.md\",\n summary: \"MCP Server World Documentation\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n });\n\n // tools directory\n entries.push({\n id: \"/tools\",\n path: \"/tools\",\n summary: `${this._tools.length} tools available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n });\n\n // prompts directory (only if there are prompts)\n if (this._prompts.length > 0) {\n entries.push({\n id: \"/prompts\",\n path: \"/prompts\",\n summary: `${this._prompts.length} prompts available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n });\n }\n\n // resources directory (only if there are resources or templates)\n if (this._resources.length > 0 || this._resourceTemplates.length > 0) {\n entries.push({\n id: \"/resources\",\n path: \"/resources\",\n summary: `${this._resources.length} resources available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: this._resources.length,\n },\n });\n }\n\n return { data: entries };\n }\n\n /**\n * Read root directory entry\n */\n @Read(\"/\")\n async readRootHandler(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/\",\n path: \"/\",\n summary: this.description || \"MCP Server\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount:\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0),\n mcp: {\n server: { name: this.name },\n capabilities: {\n tools: this._tools.length > 0,\n prompts: this._prompts.length > 0,\n resources: this._resources.length > 0,\n },\n },\n },\n };\n }\n\n /**\n * Read root metadata\n */\n @Meta(\"/\")\n async readRootMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/.meta\",\n path: \"/.meta\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount:\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0),\n mcp: {\n server: { name: this.name },\n capabilities: {\n tools: this._tools.length > 0,\n prompts: this._prompts.length > 0,\n resources: this._resources.length > 0,\n },\n },\n },\n };\n }\n\n /**\n * Read capabilities manifest\n *\n * Returns all MCP tools as ToolDefinition objects.\n * MCP has no node-level actions, so actions is always empty.\n */\n @Read(\"/.meta/.capabilities\")\n async readCapabilities(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n const tools: ToolDefinition[] = this._tools\n .filter((tool) => tool.name) // Skip tools without name\n .map((tool) => ({\n name: tool.name,\n description: tool.description,\n path: `/tools/${tool.name}`,\n inputSchema: tool.inputSchema as ToolDefinition[\"inputSchema\"],\n }));\n\n const manifest: CapabilitiesManifest = {\n schemaVersion: 1,\n provider: this.name,\n version: \"1.0.0\",\n description: this.description,\n tools,\n actions: [], // MCP has no node-level actions\n operations: this.getOperationsDeclaration(),\n };\n\n return {\n id: \"/.meta/.capabilities\",\n path: \"/.meta/.capabilities\",\n content: manifest,\n meta: {\n kind: \"afs:capabilities\",\n description: \"MCP Provider capabilities manifest\",\n },\n };\n }\n\n /**\n * Stat root directory\n */\n @Stat(\"/\")\n async statRootHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n const childrenCount =\n 2 + (this._prompts.length > 0 ? 1 : 0) + (this._resources.length > 0 ? 1 : 0);\n\n return {\n data: {\n id: \"/\",\n path: \"/\",\n meta: {\n kind: \"mcp:module\",\n kinds: getKindsArray(\"mcp:module\"),\n description: this.description || \"MCP Server\",\n childrenCount,\n },\n },\n };\n }\n\n /**\n * Read WORLD.md file\n */\n @Read(\"/WORLD.md\")\n async readWorldMdHandler(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/WORLD.md\",\n path: \"/WORLD.md\",\n content: this.generateWorldMd(),\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n };\n }\n\n /**\n * List WORLD.md - files have no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/WORLD.md\")\n async listWorldMdHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n // Files are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * Read WORLD.md metadata\n */\n @Meta(\"/WORLD.md\")\n async readWorldMdMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/WORLD.md/.meta\",\n path: \"/WORLD.md/.meta\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n mcp: { type: \"world\" },\n },\n };\n }\n\n /**\n * Read /tools directory entry\n */\n @Read(\"/tools\")\n async readToolsDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/tools\",\n path: \"/tools\",\n summary: `${this._tools.length} tools available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n };\n }\n\n /**\n * Read /tools metadata\n */\n @Meta(\"/tools\")\n async readToolsMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n return {\n id: \"/tools/.meta\",\n path: \"/tools/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n };\n }\n\n /**\n * Read /prompts directory entry\n */\n @Read(\"/prompts\")\n async readPromptsDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n return {\n id: \"/prompts\",\n path: \"/prompts\",\n summary: `${this._prompts.length} prompts available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n };\n }\n\n /**\n * Read /prompts metadata\n */\n @Meta(\"/prompts\")\n async readPromptsMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts/.meta\");\n }\n\n return {\n id: \"/prompts/.meta\",\n path: \"/prompts/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n };\n }\n\n /**\n * Read /resources directory entry\n */\n @Read(\"/resources\")\n async readResourcesDir(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n id: \"/resources\",\n path: \"/resources\",\n summary: `${this._resources.length} resources available`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n };\n }\n\n /**\n * Read /resources metadata\n */\n @Meta(\"/resources\")\n async readResourcesMeta(_ctx: RouteContext): Promise<AFSEntry> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources/.meta\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n id: \"/resources/.meta\",\n path: \"/resources/.meta\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n };\n }\n\n /**\n * Calculate immediate children count for /resources directory\n */\n private getResourcesImmediateChildrenCount(): number {\n const immediateChildren = new Set<string>();\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (!resourcePath) continue;\n const segments = resourcePath.split(\"/\").filter(Boolean);\n if (segments.length > 0) {\n immediateChildren.add(segments[0]!);\n }\n }\n return immediateChildren.size;\n }\n\n /**\n * Stat WORLD.md file\n */\n @Stat(\"/WORLD.md\")\n async statWorldMdHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n return {\n data: {\n id: \"WORLD.md\",\n path: \"/WORLD.md\",\n meta: {\n kind: \"afs:document\",\n kinds: getKindsArray(\"afs:document\"),\n description: \"MCP Server World Documentation\",\n mimeType: \"text/markdown\",\n childrenCount: 0,\n },\n },\n };\n }\n\n /**\n * Stat /tools directory\n */\n @Stat(\"/tools\")\n async statToolsHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n return {\n data: {\n id: \"tools\",\n path: \"/tools\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._tools.length} tools available`,\n childrenCount: this._tools.length,\n },\n },\n };\n }\n\n /**\n * Stat /prompts directory\n */\n @Stat(\"/prompts\")\n async statPromptsHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n return {\n data: {\n id: \"prompts\",\n path: \"/prompts\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._prompts.length} prompts available`,\n childrenCount: this._prompts.length,\n },\n },\n };\n }\n\n /**\n * Stat /resources directory\n */\n @Stat(\"/resources\")\n async statResourcesHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Calculate immediate children count (not total resources)\n const immediateChildrenCount = this.getResourcesImmediateChildrenCount();\n\n return {\n data: {\n id: \"resources\",\n path: \"/resources\",\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n description: `${this._resources.length} resources available`,\n childrenCount: immediateChildrenCount,\n },\n },\n };\n }\n\n /**\n * Stat specific tool\n */\n @Stat(\"/tools/:name\")\n async statToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const { content: _content, ...statData } = this.toolToEntry(tool);\n return { data: statData };\n }\n\n /**\n * Stat specific prompt\n */\n @Stat(\"/prompts/:name\")\n async statPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const { content: _content, ...statData } = this.promptToEntry(prompt);\n return { data: statData };\n }\n\n /**\n * Stat resource paths (wildcard handler under /resources)\n */\n @Stat(\"/resources/:path+\")\n async statResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSStatResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const afsPath = `/resources${resourcePath}`;\n const resourceId = ctx.params.path.split(\"/\").pop() || ctx.params.path;\n\n // Check for exact match or children\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"mcp:resource\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resourceMatch.resource.description,\n mimeType: resourceMatch.resource.mimeType,\n childrenCount: 0,\n },\n },\n };\n } else if (resourceMatch.template) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resourceMatch.template.description,\n mimeType: resourceMatch.template.mimeType,\n childrenCount: 0,\n },\n },\n };\n }\n }\n\n // Check if this is an intermediate directory (count immediate children)\n const immediateChildren = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildren.size > 0) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: immediateChildren.size,\n },\n },\n };\n }\n\n // Check if this is a template base path (dynamic children)\n if (this.isTemplateBasePath(resourcePath)) {\n return {\n data: {\n id: resourceId,\n path: afsPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: 0,\n },\n },\n };\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n get isConnected(): boolean {\n return this._isConnected;\n }\n\n /**\n * Get cached tools\n */\n get tools(): Tool[] {\n return this._tools;\n }\n\n /**\n * Get cached prompts\n */\n get prompts(): Prompt[] {\n return this._prompts;\n }\n\n /**\n * Get cached resources\n */\n get resources(): Resource[] {\n return this._resources;\n }\n\n /**\n * Get cached resource templates\n */\n get resourceTemplates(): ResourceTemplate[] {\n return this._resourceTemplates;\n }\n\n /** Promise for in-progress connection */\n private _connectPromise: Promise<void> | null = null;\n\n /**\n * Ensure connection is established (lazy connect)\n */\n async ensureConnected(): Promise<void> {\n if (this._isConnected) return;\n if (this._connectPromise) return this._connectPromise;\n this._connectPromise = this.connect();\n try {\n await this._connectPromise;\n } finally {\n this._connectPromise = null;\n }\n }\n\n /**\n * Connect to the MCP server\n */\n async connect(): Promise<void> {\n if (this._isConnected) return;\n\n // Create transport based on configuration\n this.transport = this.createTransport();\n\n // Create and connect client\n this.client = new Client(\n {\n name: \"afs-mcp-client\",\n version: \"1.0.0\",\n },\n {\n capabilities: {},\n },\n );\n\n await this.client.connect(this.transport);\n this._isConnected = true;\n\n // Cache capabilities\n await this.refreshCapabilities();\n\n // Build resource path mapping\n this.buildResourcePathMap();\n }\n\n /**\n * Disconnect from the MCP server\n */\n async disconnect(): Promise<void> {\n if (!this._isConnected) return;\n\n try {\n await this.client?.close();\n } catch (error) {\n // Ignore EPIPE errors during disconnect - the pipe may already be closed\n const isEpipe =\n error instanceof Error &&\n (error.message.includes(\"EPIPE\") || (error as NodeJS.ErrnoException).code === \"EPIPE\");\n if (!isEpipe) {\n throw error;\n }\n }\n this.client = null;\n this.transport = null;\n this._isConnected = false;\n\n // Clear caches\n this._tools = [];\n this._prompts = [];\n this._resources = [];\n this._resourceTemplates = [];\n this._resourcePathMap.clear();\n }\n\n /**\n * Create transport based on configuration\n */\n private createTransport(): Transport {\n switch (this.options.transport) {\n case \"stdio\":\n return new StdioClientTransport({\n command: this.options.command!,\n args: this.options.args,\n env: { ...process.env, ...this.options.env } as Record<string, string>,\n stderr: \"pipe\", // Capture stderr to prevent debug output from polluting terminal\n });\n\n case \"http\":\n return new StreamableHTTPClientTransport(new URL(this.options.url!), {\n requestInit: {\n headers: this.options.headers,\n },\n });\n\n case \"sse\":\n return new SSEClientTransport(new URL(this.options.url!), {\n requestInit: {\n headers: this.options.headers,\n },\n });\n\n default:\n throw new Error(`Unknown transport: ${this.options.transport}`);\n }\n }\n\n /**\n * Refresh cached capabilities from the server\n */\n private async refreshCapabilities(): Promise<void> {\n if (!this.client) return;\n\n try {\n const toolsResult = await this.client.listTools();\n this._tools = toolsResult.tools || [];\n } catch {\n this._tools = [];\n }\n\n try {\n const promptsResult = await this.client.listPrompts();\n this._prompts = promptsResult.prompts || [];\n } catch {\n this._prompts = [];\n }\n\n try {\n const resourcesResult = await this.client.listResources();\n this._resources = resourcesResult.resources || [];\n } catch {\n this._resources = [];\n }\n\n try {\n const templatesResult = await this.client.listResourceTemplates();\n this._resourceTemplates = templatesResult.resourceTemplates || [];\n } catch {\n this._resourceTemplates = [];\n }\n }\n\n /**\n * Build the resource path mapping from cached resources\n */\n private buildResourcePathMap(): void {\n this._resourcePathMap.clear();\n\n // Map static resources\n for (const resource of this._resources) {\n const path = this.resourceUriToPath(resource.uri);\n if (path) {\n this._resourcePathMap.set(path, { resource });\n }\n }\n\n // Map resource templates (store the base path)\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (basePath) {\n this._resourcePathMap.set(basePath, { template });\n }\n }\n }\n\n /**\n * Convert a resource URI to an AFS path\n *\n * Examples:\n * - \"file:///path/to/file.txt\" -> \"/path/to/file.txt\"\n * - \"sqlite://posts\" -> \"/posts\"\n * - \"github://repos\" -> \"/repos\"\n */\n resourceUriToPath(uri: string): string | null {\n const parsed = AFSMCP.parseResourceUri(uri);\n return parsed.path;\n }\n\n /**\n * Get the base path from a URI template (path before first variable)\n *\n * Examples:\n * - \"sqlite://posts/{id}\" -> \"/posts\"\n * - \"github://repos/{owner}/{repo}\" -> \"/repos\"\n */\n private getTemplateBasePath(uriTemplate: string): string | null {\n const parsed = AFSMCP.parseResourceUri(uriTemplate);\n // Find the position of first { and get path before it\n const varIndex = parsed.path.indexOf(\"{\");\n if (varIndex === -1) {\n return parsed.path;\n }\n // Get path up to but not including the variable segment\n const basePath = parsed.path.substring(0, varIndex);\n // Remove trailing slash if present\n return basePath.endsWith(\"/\") ? basePath.slice(0, -1) : basePath;\n }\n\n /**\n * Check if a resource path is a template base path (has dynamic children).\n */\n private isTemplateBasePath(resourcePath: string): boolean {\n return this._resourceTemplates.some((template) => {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n return basePath === resourcePath;\n });\n }\n\n /**\n * Get immediate child segments under a resource parent path,\n * scanning both static resources and template base paths.\n */\n private getImmediateResourceChildren(parentPath: string): Set<string> {\n const depth = parentPath.split(\"/\").filter(Boolean).length;\n const childSegments = new Set<string>();\n\n for (const resource of this._resources) {\n const rPath = this.resourceUriToPath(resource.uri);\n if (!rPath || !rPath.startsWith(`${parentPath}/`)) continue;\n const segments = rPath.split(\"/\").filter(Boolean);\n if (segments.length > depth) {\n childSegments.add(segments[depth]!);\n }\n }\n\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath || !basePath.startsWith(`${parentPath}/`)) continue;\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length > depth) {\n childSegments.add(segments[depth]!);\n }\n }\n\n return childSegments;\n }\n\n /**\n * Find a resource or template that matches a given path\n */\n private findResourceForPath(\n path: string,\n ): { resource?: Resource; template?: ResourceTemplate; params?: Record<string, string> } | null {\n // First check for exact match in static resources\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (resourcePath === path) {\n return { resource };\n }\n }\n\n // Then check templates\n for (const template of this._resourceTemplates) {\n const params = AFSMCP.matchPathToTemplate(path, template.uriTemplate);\n if (params) {\n return { template, params };\n }\n }\n\n return null;\n }\n\n /**\n * Convert a Tool to an AFSEntry (Meta Spec compliant)\n */\n private toolToEntry(tool: Tool): AFSEntry {\n return {\n id: `/tools/${tool.name}`,\n path: `/tools/${tool.name}`,\n summary: tool.description,\n meta: {\n kind: \"mcp:tool\",\n kinds: getKindsArray(\"mcp:tool\"),\n description: tool.description,\n inputSchema: tool.inputSchema,\n mcp: {\n name: tool.name,\n },\n },\n };\n }\n\n /**\n * Convert a Prompt to an AFSEntry (Meta Spec compliant)\n * Note: inputSchema is NOT included in prompt entry meta.\n * For prompts with arguments, use the action system (/.actions/get) to execute.\n */\n private promptToEntry(prompt: Prompt): AFSEntry {\n return {\n id: `/prompts/${prompt.name}`,\n path: `/prompts/${prompt.name}`,\n summary: prompt.description,\n meta: {\n kind: \"mcp:prompt\",\n kinds: getKindsArray(\"mcp:prompt\"),\n description: prompt.description,\n mcp: {\n name: prompt.name,\n arguments: prompt.arguments,\n },\n },\n };\n }\n\n /**\n * Convert prompt arguments to JSON Schema (for action inputSchema)\n */\n private promptArgsToSchema(args: Prompt[\"arguments\"]): Record<string, unknown> {\n if (!args || args.length === 0) {\n return { type: \"object\", properties: {} };\n }\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const arg of args) {\n properties[arg.name] = {\n type: \"string\",\n ...(arg.description ? { description: arg.description } : {}),\n };\n if (arg.required) {\n required.push(arg.name);\n }\n }\n\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n };\n }\n\n /**\n * Extract text content from MCP prompt messages\n */\n private extractTextFromMessages(messages: any[]): string {\n const textParts: string[] = [];\n for (const msg of messages) {\n const c = msg.content;\n if (typeof c === \"string\") {\n textParts.push(c);\n } else if (c && typeof c === \"object\" && \"text\" in c) {\n textParts.push(c.text as string);\n }\n }\n return textParts.join(\"\\n\");\n }\n\n /**\n * Convert a Resource to an AFSEntry (Meta Spec compliant)\n */\n private resourceToEntry(resource: Resource, path: string): AFSEntry {\n return {\n id: path,\n path: path,\n summary: resource.description || resource.name,\n meta: {\n kind: \"mcp:resource\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: resource.description,\n mimeType: resource.mimeType,\n mcp: {\n uri: resource.uri,\n name: resource.name,\n },\n },\n };\n }\n\n /**\n * Convert a ResourceTemplate to an AFSEntry (Meta Spec compliant)\n */\n private resourceTemplateToEntry(template: ResourceTemplate, path: string): AFSEntry {\n return {\n id: path,\n path: path,\n summary: template.description || template.name,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: template.description,\n mimeType: template.mimeType,\n mcp: {\n uriTemplate: template.uriTemplate,\n name: template.name,\n },\n },\n };\n }\n\n // ========== List Handlers ==========\n\n /**\n * List tools.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/tools\")\n async listToolsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n const entries = this._tools.map((tool) => this.toolToEntry(tool));\n return { data: entries };\n }\n\n /**\n * List prompts.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/prompts\")\n async listPromptsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n if (this._prompts.length === 0) {\n throw new AFSNotFoundError(\"/prompts\");\n }\n\n const entries = this._prompts.map((prompt) => this.promptToEntry(prompt));\n return { data: entries };\n }\n\n /**\n * List specific tool - tools are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/tools/:name\")\n async listToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n // Tools are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List specific prompt - prompts are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/prompts/:name\")\n async listPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n // Prompts are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List resources directory.\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/resources\")\n async listResourcesHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureConnected();\n\n if (this._resources.length === 0 && this._resourceTemplates.length === 0) {\n throw new AFSNotFoundError(\"/resources\");\n }\n\n // Synthesize immediate children (directories or files at depth 1)\n const immediateChildren = new Map<string, { isDir: boolean; resource?: Resource }>();\n\n for (const resource of this._resources) {\n const resourcePath = this.resourceUriToPath(resource.uri);\n if (!resourcePath) continue;\n\n const segments = resourcePath.split(\"/\").filter(Boolean);\n if (segments.length === 0) continue;\n\n const firstSegment = segments[0]!;\n const childPath = `/resources/${firstSegment}`;\n\n if (segments.length === 1) {\n immediateChildren.set(childPath, { isDir: false, resource });\n } else {\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n\n // Include template base paths in the tree\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath) continue;\n\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length === 0) continue;\n\n const firstSegment = segments[0]!;\n const childPath = `/resources/${firstSegment}`;\n\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n\n const entries: AFSEntry[] = [];\n for (const [path, info] of immediateChildren) {\n if (info.isDir) {\n const resourceSubPath = path.replace(\"/resources\", \"\");\n const childrenCount = this.getImmediateResourceChildren(resourceSubPath).size;\n entries.push({\n id: path,\n path,\n summary: `Resource directory: ${resourceSubPath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount,\n mcp: { isResource: true },\n },\n });\n } else if (info.resource) {\n entries.push(this.resourceToEntry(info.resource, path));\n }\n }\n\n return { data: entries };\n }\n\n /**\n * List resource paths (wildcard handler under /resources)\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/resources/:path+\")\n async listResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSListResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const entries: AFSEntry[] = [];\n\n // Check for exact match or collect children\n let exactMatch: Resource | null = null;\n const immediateChildren = new Map<string, { isDir: boolean; resource?: Resource }>();\n const resourcePathSegments = resourcePath.split(\"/\").filter(Boolean);\n const depth = resourcePathSegments.length;\n\n for (const resource of this._resources) {\n const rPath = this.resourceUriToPath(resource.uri);\n if (!rPath) continue;\n\n if (rPath === resourcePath) {\n exactMatch = resource;\n } else if (rPath.startsWith(`${resourcePath}/`)) {\n const segments = rPath.split(\"/\").filter(Boolean);\n if (segments.length <= depth) continue;\n\n const childSegment = segments[depth]!;\n const childPath = `/resources${resourcePath}/${childSegment}`;\n\n if (segments.length === depth + 1) {\n immediateChildren.set(childPath, { isDir: false, resource });\n } else {\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n }\n\n // Include template base paths in the tree\n for (const template of this._resourceTemplates) {\n const basePath = this.getTemplateBasePath(template.uriTemplate);\n if (!basePath) continue;\n\n if (basePath === resourcePath) {\n // This is a template base path - it has dynamic children\n // Return empty since children are parameterized\n return { data: [] };\n } else if (basePath.startsWith(`${resourcePath}/`)) {\n const segments = basePath.split(\"/\").filter(Boolean);\n if (segments.length <= depth) continue;\n\n const childSegment = segments[depth]!;\n const childPath = `/resources${resourcePath}/${childSegment}`;\n\n if (!immediateChildren.has(childPath)) {\n immediateChildren.set(childPath, { isDir: true });\n }\n }\n }\n\n if (exactMatch) {\n // Exact resource match - resources are leaf nodes with no children\n return { data: [] };\n }\n\n if (immediateChildren.size > 0) {\n for (const [path, info] of immediateChildren) {\n if (info.isDir) {\n const resourceSubPath = path.replace(\"/resources\", \"\");\n const childrenCount = this.getImmediateResourceChildren(resourceSubPath).size;\n entries.push({\n id: path,\n path,\n summary: `Resource directory: ${resourceSubPath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount,\n mcp: { isResource: true },\n },\n });\n } else if (info.resource) {\n entries.push(this.resourceToEntry(info.resource, path));\n }\n }\n return { data: entries };\n }\n\n // No match found\n throw new AFSNotFoundError(ctx.path);\n }\n\n // ========== Meta Handlers ==========\n\n /**\n * Read metadata for tools (dynamic entries not in static tree).\n * Static entries metadata is handled by AFSBaseProvider.\n */\n @Meta(\"/tools/:name\")\n async readToolMeta(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n const entry = this.toolToEntry(tool);\n return {\n id: `/tools/${ctx.params.name}/.meta`,\n path: `/tools/${ctx.params.name}/.meta`,\n meta: entry.meta,\n };\n }\n\n /**\n * Read metadata for prompts (dynamic entries not in static tree).\n */\n @Meta(\"/prompts/:name\")\n async readPromptMeta(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n const entry = this.promptToEntry(prompt);\n return {\n id: `/prompts/${ctx.params.name}/.meta`,\n path: `/prompts/${ctx.params.name}/.meta`,\n meta: entry.meta,\n };\n }\n\n /**\n * Read metadata for resources (dynamic entries not in static tree).\n * Handles both actual resources and synthesized intermediate directories.\n */\n @Meta(\"/resources/:path+\")\n async readResourceMeta(ctx: RouteContext<{ path: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const metaPath = `/resources${resourcePath}/.meta`;\n\n // Try to match as resource path\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n // Static resource\n const entry = this.resourceToEntry(resourceMatch.resource, `/resources${resourcePath}`);\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n } else if (resourceMatch.template) {\n // Template resource\n const entry = this.resourceTemplateToEntry(\n resourceMatch.template,\n `/resources${resourcePath}`,\n );\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n }\n }\n\n // Check if this is an intermediate directory (has child resources or templates)\n const immediateChildren = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildren.size > 0) {\n return {\n id: metaPath,\n path: metaPath,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n mcp: { isResource: true },\n },\n };\n }\n\n // Check if this is a template base path\n if (this.isTemplateBasePath(resourcePath)) {\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n if (template) {\n const entry = this.resourceTemplateToEntry(template, `/resources${resourcePath}`);\n return {\n id: metaPath,\n path: metaPath,\n meta: entry.meta,\n };\n }\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n // ========== Read Handlers ==========\n\n /**\n * Read tool\n */\n @Read(\"/tools/:name\")\n async readToolHandler(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path);\n }\n return this.toolToEntry(tool);\n }\n\n /**\n * Read prompt\n *\n * Behavior:\n * - Prompts with NO arguments: returns content directly\n * - Prompts with ONLY optional arguments: returns content (empty params)\n * - Prompts with REQUIRED arguments: returns metadata only (use /.actions/get to execute)\n */\n @Read(\"/prompts/:name\")\n async readPromptHandler(ctx: RouteContext<{ name: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n const entry = this.promptToEntry(prompt);\n\n // Only auto-fetch content for prompts without required args\n const hasRequiredArgs = prompt.arguments?.some((arg) => arg.required) ?? false;\n\n if (this.client && !hasRequiredArgs) {\n try {\n const result = await this.client.getPrompt({\n name: prompt.name,\n arguments: {},\n });\n const content = this.extractTextFromMessages(result.messages);\n if (content) {\n entry.content = content;\n }\n } catch {\n // Silently fall back to metadata-only if getPrompt fails\n }\n }\n\n return entry;\n }\n\n // ========== Prompt Action Handlers ==========\n\n /**\n * List actions for a prompt\n *\n * Only prompts with arguments expose a \"get\" action.\n */\n @Actions(\"/prompts/:name\")\n async listPromptActions(ctx: RouteContext<{ name: string }>): Promise<{ data: AFSEntry[] }> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path);\n }\n\n // Only expose \"get\" action for prompts with arguments\n if (!prompt.arguments || prompt.arguments.length === 0) {\n return { data: [] };\n }\n\n const actionPath = `/prompts/${prompt.name}/.actions/get`;\n return {\n data: [\n {\n id: \"get\",\n path: actionPath,\n summary: `Get ${prompt.name} prompt content with arguments`,\n meta: {\n kind: \"afs:executable\",\n kinds: getKindsArray(\"afs:executable\"),\n name: \"get\",\n description: prompt.description,\n inputSchema: this.promptArgsToSchema(prompt.arguments),\n },\n },\n ],\n };\n }\n\n /**\n * Execute prompt \"get\" action\n *\n * Fetches prompt content with provided arguments.\n */\n @Actions.Exec(\"/prompts/:name\", \"get\")\n async execPromptGetHandler(\n ctx: RouteContext<{ name: string }>,\n params: Record<string, unknown>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: `Prompt not found: ${ctx.params.name}` },\n };\n }\n\n if (!this.client) {\n return {\n success: false,\n error: { code: \"NOT_CONNECTED\", message: \"MCP client not connected\" },\n };\n }\n\n try {\n const result = await this.client.getPrompt({\n name: prompt.name,\n arguments: params as Record<string, string>,\n });\n\n const content = this.extractTextFromMessages(result.messages);\n\n return {\n success: true,\n data: {\n content,\n meta: {\n mcp: {\n name: prompt.name,\n arguments: prompt.arguments,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n success: false,\n error: { code: \"EXECUTION_ERROR\", message: error.message },\n };\n }\n }\n\n // ========== Resource Action Handlers ==========\n\n /**\n * List actions for a resource template\n *\n * Only resource templates expose a \"get\" action.\n * Static resources do not have actions.\n */\n @Actions(\"/resources/:path+\")\n async listResourceActions(ctx: RouteContext<{ path: string }>): Promise<{ data: AFSEntry[] }> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n // Check if this is a template base path\n if (!this.isTemplateBasePath(resourcePath)) {\n // Not a template - no actions\n return { data: [] };\n }\n\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n\n if (!template) {\n return { data: [] };\n }\n\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length === 0) {\n // No variables - no action needed\n return { data: [] };\n }\n\n // Build inputSchema from template variables\n const properties: Record<string, unknown> = {};\n for (const v of vars) {\n properties[v] = { type: \"string\", description: `Template variable: ${v}` };\n }\n const inputSchema = {\n type: \"object\",\n properties,\n required: vars, // All template variables are required\n };\n\n const afsPath = `/resources${resourcePath}`;\n const actionPath = `${afsPath}/.actions/get`;\n\n return {\n data: [\n {\n id: \"get\",\n path: actionPath,\n summary: `Get resource with template parameters`,\n meta: {\n kind: \"afs:executable\",\n kinds: getKindsArray(\"afs:executable\"),\n name: \"get\",\n description: template.description,\n inputSchema,\n },\n },\n ],\n };\n }\n\n /**\n * Execute resource template \"get\" action\n *\n * Fetches resource content with provided template parameters.\n */\n @Actions.Exec(\"/resources/:path+\", \"get\")\n async execResourceGetHandler(\n ctx: RouteContext<{ path: string }>,\n params: Record<string, unknown>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n // Check if this is a template base path\n if (!this.isTemplateBasePath(resourcePath)) {\n return {\n success: false,\n error: { code: \"NOT_TEMPLATE\", message: `Not a resource template: ${resourcePath}` },\n };\n }\n\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n\n if (!template) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: `Resource template not found: ${resourcePath}` },\n };\n }\n\n if (!this.client) {\n return {\n success: false,\n error: { code: \"NOT_CONNECTED\", message: \"MCP client not connected\" },\n };\n }\n\n try {\n const uri = AFSMCP.buildUriFromTemplate(\n template.uriTemplate,\n params as Record<string, string>,\n );\n const result = await this.readResourceByUri(uri);\n\n if (!result.data) {\n return {\n success: false,\n error: { code: \"NOT_FOUND\", message: result.message || \"Resource not found\" },\n };\n }\n\n return {\n success: true,\n data: {\n content: result.data.content,\n meta: {\n mcp: {\n uri,\n name: template.name,\n uriTemplate: template.uriTemplate,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n success: false,\n error: { code: \"EXECUTION_ERROR\", message: error.message },\n };\n }\n }\n\n /**\n * Read resource (wildcard handler under /resources)\n */\n @Read(\"/resources/:path+\")\n async readResourceHandler(ctx: RouteContext<{ path: string }>): Promise<AFSEntry> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n const afsPath = `/resources${resourcePath}`;\n\n // Try to match as resource path\n const resourceMatch = this.findResourceForPath(resourcePath);\n\n if (resourceMatch) {\n if (resourceMatch.resource) {\n // Static resource - read it directly\n const result = await this.readResourceByUri(resourceMatch.resource.uri);\n if (!result.data) {\n throw new AFSNotFoundError(ctx.path, result.message || `Resource not found: ${ctx.path}`);\n }\n // Update path to include /resources prefix\n result.data.path = `/resources${result.data.path}`;\n result.data.id = result.data.path;\n return result.data;\n } else if (resourceMatch.template && resourceMatch.params) {\n // Template match - build URI and read\n const uri = AFSMCP.buildUriFromTemplate(\n resourceMatch.template.uriTemplate,\n resourceMatch.params,\n );\n const result = await this.readResourceByUri(uri);\n if (!result.data) {\n throw new AFSNotFoundError(ctx.path, result.message || `Resource not found: ${ctx.path}`);\n }\n // Update path to include /resources prefix\n result.data.path = `/resources${result.data.path}`;\n result.data.id = result.data.path;\n return result.data;\n }\n }\n\n // Check if this is an intermediate directory (has child resources or templates)\n const immediateChildrenSet = this.getImmediateResourceChildren(resourcePath);\n\n if (immediateChildrenSet.size > 0) {\n return {\n id: afsPath,\n path: afsPath,\n summary: `Resource directory: ${resourcePath}`,\n meta: {\n kind: \"afs:node\",\n kinds: getKindsArray(\"afs:node\"),\n childrenCount: immediateChildrenSet.size,\n mcp: { isResource: true },\n },\n };\n }\n\n // Check if this is a template base path (dynamic children, not enumerable)\n // For templates, return metadata only. Use /.actions/get to fetch with params.\n if (this.isTemplateBasePath(resourcePath)) {\n const template = this._resourceTemplates.find(\n (t) => this.getTemplateBasePath(t.uriTemplate) === resourcePath,\n );\n return {\n id: afsPath,\n path: afsPath,\n summary: template?.description || `Resource template: ${resourcePath}`,\n meta: {\n kind: \"mcp:resource-template\",\n kinds: getKindsArray(\"mcp:resource\"),\n description: template?.description,\n mimeType: template?.mimeType,\n childrenCount: 0,\n mcp: {\n uriTemplate: template?.uriTemplate,\n name: template?.name,\n parameters: template ? AFSMCP.parseUriTemplate(template.uriTemplate) : [],\n },\n },\n };\n }\n\n throw new AFSNotFoundError(ctx.path);\n }\n\n /**\n * Read a resource by its URI (internal helper)\n */\n private async readResourceByUri(uri: string): Promise<AFSReadResult> {\n if (!this.client) {\n return {\n data: undefined,\n message: \"MCP client not connected\",\n };\n }\n\n try {\n const result = await this.client.readResource({ uri });\n const path = this.resourceUriToPath(uri) || uri;\n\n // Extract content from the result\n let content: any;\n let mimeType: string | undefined;\n\n if (result.contents && result.contents.length > 0) {\n const firstContent = result.contents[0]!;\n mimeType = firstContent.mimeType;\n\n if (\"text\" in firstContent) {\n content = firstContent.text;\n } else if (\"blob\" in firstContent) {\n content = firstContent.blob;\n }\n }\n\n return {\n data: {\n id: path,\n path: path,\n content: content,\n meta: {\n mcp: {\n uri: uri,\n mimeType: mimeType,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n data: undefined,\n message: `Failed to read resource: ${error.message}`,\n };\n }\n }\n\n /**\n * Read a prompt with arguments, returning the prompt content\n *\n * This is a specialized method that calls the MCP getPrompt API\n * to get the actual prompt content with substituted arguments.\n */\n async readPrompt(path: string, args: Record<string, string>): Promise<AFSReadResult> {\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n\n if (!normalizedPath.startsWith(\"/prompts/\")) {\n return {\n data: undefined,\n message: `readPrompt only supported on /prompts/* paths, got: ${normalizedPath}`,\n };\n }\n\n if (!this.client) {\n return {\n data: undefined,\n message: \"MCP client not connected\",\n };\n }\n\n const promptName = normalizedPath.slice(\"/prompts/\".length);\n const prompt = this._prompts.find((p) => p.name === promptName);\n\n if (!prompt) {\n return {\n data: undefined,\n message: `Prompt not found: ${promptName}`,\n };\n }\n\n try {\n // Call MCP getPrompt to get the actual prompt content\n const result = await this.client.getPrompt({\n name: promptName,\n arguments: args,\n });\n\n return {\n data: {\n id: `/prompts/${promptName}`,\n path: `/prompts/${promptName}`,\n summary: prompt.description,\n content: result.messages,\n meta: {\n arguments: prompt.arguments,\n mcp: {\n name: prompt.name,\n description: prompt.description,\n arguments: prompt.arguments,\n },\n },\n },\n };\n } catch (error: any) {\n return {\n data: undefined,\n message: `Failed to get prompt: ${error.message}`,\n };\n }\n }\n\n /**\n * Generate WORLD.md content describing this MCP server's capabilities\n */\n generateWorldMd(): string {\n const lines: string[] = [];\n\n // Header\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n if (this.description) {\n lines.push(this.description);\n lines.push(\"\");\n }\n\n // Server Info\n lines.push(\"## Server Information\");\n lines.push(\"\");\n lines.push(`- **Name**: ${this.name}`);\n lines.push(`- **Transport**: ${this.options.transport}`);\n if (this.options.transport === \"stdio\") {\n lines.push(`- **Command**: ${this.options.command}`);\n } else {\n lines.push(`- **URL**: ${this.options.url}`);\n }\n lines.push(\"\");\n\n // Capabilities Summary\n lines.push(\"## Capabilities\");\n lines.push(\"\");\n lines.push(`- Tools: ${this._tools.length}`);\n lines.push(`- Prompts: ${this._prompts.length}`);\n lines.push(`- Resources: ${this._resources.length}`);\n lines.push(`- Resource Templates: ${this._resourceTemplates.length}`);\n lines.push(\"\");\n\n // Tools\n if (this._tools.length > 0) {\n lines.push(\"## Tools\");\n lines.push(\"\");\n for (const tool of this._tools) {\n lines.push(`### ${tool.name}`);\n lines.push(\"\");\n if (tool.description) {\n lines.push(tool.description);\n lines.push(\"\");\n }\n lines.push(`**Path**: \\`/tools/${tool.name}\\``);\n lines.push(\"\");\n if (tool.inputSchema) {\n lines.push(\"**Input Schema**:\");\n lines.push(\"```json\");\n lines.push(JSON.stringify(tool.inputSchema, null, 2));\n lines.push(\"```\");\n lines.push(\"\");\n }\n }\n }\n\n // Prompts\n if (this._prompts.length > 0) {\n lines.push(\"## Prompts\");\n lines.push(\"\");\n for (const prompt of this._prompts) {\n lines.push(`### ${prompt.name}`);\n lines.push(\"\");\n if (prompt.description) {\n lines.push(prompt.description);\n lines.push(\"\");\n }\n lines.push(`**Path**: \\`/prompts/${prompt.name}\\``);\n lines.push(\"\");\n if (prompt.arguments && prompt.arguments.length > 0) {\n lines.push(\"**Arguments**:\");\n for (const arg of prompt.arguments) {\n const required = arg.required ? \" (required)\" : \" (optional)\";\n lines.push(`- \\`${arg.name}\\`${required}: ${arg.description || \"\"}`);\n }\n lines.push(\"\");\n }\n }\n }\n\n // Resources\n if (this._resources.length > 0) {\n lines.push(\"## Resources\");\n lines.push(\"\");\n for (const resource of this._resources) {\n lines.push(`### ${resource.name}`);\n lines.push(\"\");\n if (resource.description) {\n lines.push(resource.description);\n lines.push(\"\");\n }\n lines.push(`**URI**: \\`${resource.uri}\\``);\n const afsPath = this.resourceUriToPath(resource.uri);\n if (afsPath) {\n lines.push(`**AFS Path**: \\`${afsPath}\\``);\n }\n if (resource.mimeType) {\n lines.push(`**MIME Type**: ${resource.mimeType}`);\n }\n lines.push(\"\");\n }\n }\n\n // Resource Templates\n if (this._resourceTemplates.length > 0) {\n lines.push(\"## Resource Templates\");\n lines.push(\"\");\n for (const template of this._resourceTemplates) {\n lines.push(`### ${template.name}`);\n lines.push(\"\");\n if (template.description) {\n lines.push(template.description);\n lines.push(\"\");\n }\n lines.push(`**URI Template**: \\`${template.uriTemplate}\\``);\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length > 0) {\n lines.push(`**Variables**: ${vars.map((v) => `\\`{${v}}\\``).join(\", \")}`);\n }\n if (template.mimeType) {\n lines.push(`**MIME Type**: ${template.mimeType}`);\n }\n lines.push(\"\");\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n // ========== Explain Handlers ==========\n\n /**\n * Explain root → server name, tools/prompts/resources counts\n */\n @Explain(\"/\")\n async explainRoot(_ctx: RouteContext): Promise<AFSExplainResult> {\n await this.ensureConnected();\n\n const lines: string[] = [];\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n if (this.description) {\n lines.push(this.description);\n lines.push(\"\");\n }\n lines.push(\"## Overview\");\n lines.push(\"\");\n lines.push(`- **Tool count**: ${this._tools.length}`);\n lines.push(`- **Prompt count**: ${this._prompts.length}`);\n lines.push(`- **Resource count**: ${this._resources.length}`);\n lines.push(`- **Resource template count**: ${this._resourceTemplates.length}`);\n lines.push(\"\");\n\n if (this._tools.length > 0) {\n lines.push(\"## Tools\");\n lines.push(\"\");\n for (const tool of this._tools) {\n lines.push(`- **${tool.name}**: ${tool.description ?? \"(no description)\"}`);\n }\n lines.push(\"\");\n }\n\n if (this._prompts.length > 0) {\n lines.push(\"## Prompts\");\n lines.push(\"\");\n for (const prompt of this._prompts) {\n const argNames = prompt.arguments?.map((a) => a.name).join(\", \") ?? \"\";\n lines.push(\n `- **${prompt.name}**: ${prompt.description ?? \"(no description)\"}${argNames ? ` (args: ${argNames})` : \"\"}`,\n );\n }\n lines.push(\"\");\n }\n\n if (this._resources.length > 0) {\n lines.push(\"## Resources\");\n lines.push(\"\");\n for (const resource of this._resources) {\n lines.push(`- **${resource.name}**: ${resource.description ?? resource.uri}`);\n }\n lines.push(\"\");\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific tool → name, description, inputSchema\n */\n @Explain(\"/tools/:name\")\n async explainTool(ctx: RouteContext<{ name: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n if (!tool) {\n throw new AFSNotFoundError(ctx.path, `Tool not found: ${ctx.params.name}`);\n }\n\n const lines: string[] = [];\n lines.push(`# Tool: ${tool.name}`);\n lines.push(\"\");\n if (tool.description) {\n lines.push(tool.description);\n lines.push(\"\");\n }\n if (tool.inputSchema) {\n lines.push(\"## Input Schema\");\n lines.push(\"\");\n lines.push(\"```json\");\n lines.push(JSON.stringify(tool.inputSchema, null, 2));\n lines.push(\"```\");\n lines.push(\"\");\n const props = (tool.inputSchema as Record<string, unknown>).properties as\n | Record<string, unknown>\n | undefined;\n if (props) {\n lines.push(\"## Parameters\");\n lines.push(\"\");\n for (const [key, val] of Object.entries(props)) {\n const prop = val as Record<string, unknown>;\n lines.push(\n `- **${key}** (${prop.type ?? \"unknown\"}): ${prop.description ?? \"(no description)\"}`,\n );\n }\n lines.push(\"\");\n }\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific prompt → name, description, arguments\n */\n @Explain(\"/prompts/:name\")\n async explainPrompt(ctx: RouteContext<{ name: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const prompt = this._prompts.find((p) => p.name === ctx.params.name);\n if (!prompt) {\n throw new AFSNotFoundError(ctx.path, `Prompt not found: ${ctx.params.name}`);\n }\n\n const lines: string[] = [];\n lines.push(`# Prompt: ${prompt.name}`);\n lines.push(\"\");\n if (prompt.description) {\n lines.push(prompt.description);\n lines.push(\"\");\n }\n if (prompt.arguments && prompt.arguments.length > 0) {\n lines.push(\"## Arguments\");\n lines.push(\"\");\n for (const arg of prompt.arguments) {\n const required = arg.required ? \" (required)\" : \" (optional)\";\n lines.push(`- **${arg.name}**${required}: ${arg.description ?? \"(no description)\"}`);\n }\n lines.push(\"\");\n } else {\n lines.push(\"*No arguments required.*\");\n lines.push(\"\");\n }\n\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n /**\n * Explain a specific resource → name, URI, description\n */\n @Explain(\"/resources/:path+\")\n async explainResource(ctx: RouteContext<{ path: string }>): Promise<AFSExplainResult> {\n await this.ensureConnected();\n const resourcePath = `/${ctx.params.path}`;\n\n const resourceMatch = this.findResourceForPath(resourcePath);\n if (resourceMatch?.resource) {\n const resource = resourceMatch.resource;\n const lines: string[] = [];\n lines.push(`# Resource: ${resource.name}`);\n lines.push(\"\");\n if (resource.description) {\n lines.push(resource.description);\n lines.push(\"\");\n }\n lines.push(`- **URI**: ${resource.uri}`);\n if (resource.mimeType) {\n lines.push(`- **MIME Type**: ${resource.mimeType}`);\n }\n lines.push(\"\");\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n if (resourceMatch?.template) {\n const template = resourceMatch.template;\n const lines: string[] = [];\n lines.push(`# Resource Template: ${template.name}`);\n lines.push(\"\");\n if (template.description) {\n lines.push(template.description);\n lines.push(\"\");\n }\n lines.push(`- **URI Template**: ${template.uriTemplate}`);\n const vars = AFSMCP.parseUriTemplate(template.uriTemplate);\n if (vars.length > 0) {\n lines.push(`- **Variables**: ${vars.join(\", \")}`);\n }\n lines.push(\"\");\n return { format: \"markdown\", content: lines.join(\"\\n\") };\n }\n\n throw new AFSNotFoundError(ctx.path, `Resource not found: ${ctx.path}`);\n }\n\n // ========== Search Handler ==========\n\n /**\n * Search tools, prompts, and resources by name or description\n */\n @Search(\"/:path*\")\n async searchHandler(\n _ctx: RouteContext<{ path?: string }>,\n query: string,\n options?: { limit?: number; caseSensitive?: boolean },\n ): Promise<AFSSearchResult> {\n await this.ensureConnected();\n\n const results: AFSEntry[] = [];\n const limit = options?.limit;\n\n // Escape regex special characters to prevent injection\n const escapedQuery = query.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const flags = options?.caseSensitive ? \"\" : \"i\";\n const pattern = new RegExp(escapedQuery, flags);\n const matchAll = query === \"\";\n\n // Search tools\n for (const tool of this._tools) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(tool.name) ||\n (tool.description && pattern.test(tool.description))\n ) {\n results.push(this.toolToEntry(tool));\n }\n }\n\n // Search prompts\n for (const prompt of this._prompts) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(prompt.name) ||\n (prompt.description && pattern.test(prompt.description))\n ) {\n results.push(this.promptToEntry(prompt));\n }\n }\n\n // Search resources\n for (const resource of this._resources) {\n if (limit && results.length >= limit) break;\n if (\n matchAll ||\n pattern.test(resource.name) ||\n (resource.description && pattern.test(resource.description))\n ) {\n const path = this.resourceUriToPath(resource.uri);\n results.push(this.resourceToEntry(resource, `/resources${path}`));\n }\n }\n\n return { data: results };\n }\n\n // ========== Exec Handlers ==========\n\n /**\n * Execute a tool\n */\n @Exec(\"/tools/:name\")\n async execToolHandler(\n ctx: RouteContext<{ name: string }>,\n args: Record<string, any>,\n ): Promise<AFSExecResult> {\n await this.ensureConnected();\n\n if (!this.client) {\n throw new Error(\"MCP client not connected\");\n }\n\n const tool = this._tools.find((t) => t.name === ctx.params.name);\n\n if (!tool) {\n throw new Error(`Tool not found: ${ctx.params.name}`);\n }\n\n // Call the MCP tool\n const result = await this.client.callTool({\n name: ctx.params.name,\n arguments: args,\n });\n\n return {\n success: true,\n data: result as Record<string, any>,\n };\n }\n}\n\n// Type check for AFSModuleClass compliance\nconst _typeCheck: AFSModuleClass<AFSMCP, AFSMCPOptions> = AFSMCP;\n\nexport default AFSMCP;\n"],"mappings":";;;;;;;;;;;;;;;AA2FA,MAAM,sBAAsB,SAC1B,EACG,OAAO;CACN,MAAM,YAAY,EAAE,QAAQ,CAAC;CAC7B,aAAa,YAAY,EAAE,QAAQ,CAAC;CACpC,WAAW,EAAE,KAAK;EAAC;EAAS;EAAQ;EAAM,CAAC;CAC3C,SAAS,YAAY,EAAE,QAAQ,CAAC;CAChC,MAAM,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;CACtC,KAAK,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;CAClD,KAAK,YAAY,EAAE,QAAQ,CAAC;CAC5B,SAAS,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;CACtD,SAAS,YAAY,EAAE,QAAQ,CAAC;CAChC,eAAe,YAAY,EAAE,QAAQ,CAAC;CACvC,CAAC,CACD,QACE,SAAS;AAER,KAAI,KAAK,cAAc,WAAW,CAAC,KAAK,QACtC,QAAO;AAGT,MAAK,KAAK,cAAc,UAAU,KAAK,cAAc,UAAU,CAAC,KAAK,IACnE,QAAO;AAET,QAAO;GAET,EACE,SAAS,yEACV,CACF,CACJ;;;;AAKD,IAAa,SAAb,MAAa,eAAe,gBAAgB;CAC1C,AAAkB;CAClB,AAAkB;CAClB,AAAkB,aAAa;;;;CAK/B,OAAO,SAAS;AACd,SAAO;;CAGT,OAAO,WAA+B;AACpC,SAAO;GACL;IACE,MAAM;IACN,aAAa;IACb,aAAa;IACb,UAAU;IACV,QAAQ,EAAE,OAAO;KAC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K,YAAY;YAsBjB,KAAK,SAAS;YAqBd,KAAK,WAAW;YAyBhB,KAAK,aAAa;YA4BlB,KAAK,eAAe;YAepB,KAAK,iBAAiB;YAetB,KAAK,oBAAoB;YA0fzB,KAAK,SAAS;YAWd,KAAK,WAAW;YAgBhB,KAAK,eAAe;YAepB,KAAK,iBAAiB;YAetB,KAAK,aAAa;YA0ElB,KAAK,oBAAoB;YA+FzB,KAAK,eAAe;YAkBpB,KAAK,iBAAiB;YAmBtB,KAAK,oBAAoB;YAsEzB,KAAK,eAAe;YAkBpB,KAAK,iBAAiB;YAsCtB,QAAQ,iBAAiB;YAqCzB,QAAQ,KAAK,kBAAkB,MAAM;YAyDrC,QAAQ,oBAAoB;YA8D5B,QAAQ,KAAK,qBAAqB,MAAM;YAwExC,KAAK,oBAAoB;YA6UzB,QAAQ,IAAI;YAuDZ,QAAQ,eAAe;YA4CvB,QAAQ,iBAAiB;YAkCzB,QAAQ,oBAAoB;YAiD5B,OAAO,UAAU;YA8DjB,KAAK,eAAe;AAiCvB,kBAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs-mcp",
|
|
3
|
-
"version": "1.11.0-beta.
|
|
3
|
+
"version": "1.11.0-beta.8",
|
|
4
4
|
"description": "AIGNE AFS module for MCP (Model Context Protocol) server integration",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
37
|
-
"zod": "^
|
|
38
|
-
"@aigne/afs": "^1.11.0-beta.
|
|
37
|
+
"zod": "^4.0.0",
|
|
38
|
+
"@aigne/afs": "^1.11.0-beta.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@modelcontextprotocol/server-everything": "^2026.1.14",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": "5.9.2",
|
|
47
47
|
"@aigne/scripts": "0.0.0",
|
|
48
48
|
"@aigne/typescript-config": "0.0.0",
|
|
49
|
-
"@aigne/afs-testing": "1.11.0-beta.
|
|
49
|
+
"@aigne/afs-testing": "1.11.0-beta.8"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown",
|