xmcp 0.6.13 → 0.7.1
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/cli.js +8 -8
- package/dist/index.js +2 -2
- package/dist/runtime/adapter-express.js +2 -2
- package/dist/runtime/adapter-fastify.js +2 -2
- package/dist/runtime/adapter-nestjs.js +7 -7
- package/dist/runtime/adapter-nextjs.js +11 -11
- package/dist/runtime/http.js +3 -3
- package/dist/runtime/stdio.js +8 -8
- package/package.json +10 -11
- package/src/auth/api-key.ts +0 -120
- package/src/auth/jwt.ts +0 -52
- package/src/cli/commands/create/__tests__/create.test.ts +0 -99
- package/src/cli/commands/create/index.ts +0 -74
- package/src/cli/commands/create/templates/index.ts +0 -4
- package/src/cli/commands/create/templates/prompt.ts +0 -30
- package/src/cli/commands/create/templates/resource.ts +0 -20
- package/src/cli/commands/create/templates/tool.ts +0 -34
- package/src/cli/commands/create/templates/widget.ts +0 -33
- package/src/cli/utils/naming.ts +0 -39
- package/src/cli.ts +0 -125
- package/src/client/headers.ts +0 -61
- package/src/client/index.ts +0 -180
- package/src/client/types.ts +0 -122
- package/src/client/utils.ts +0 -133
- package/src/cloudflare.ts +0 -6
- package/src/compiler/build-telemetry.ts +0 -88
- package/src/compiler/client/component-compiler.ts +0 -250
- package/src/compiler/client/transpile.ts +0 -21
- package/src/compiler/compiler-context.ts +0 -61
- package/src/compiler/config/__tests__/config.test.ts +0 -459
- package/src/compiler/config/index.ts +0 -62
- package/src/compiler/config/injection.ts +0 -210
- package/src/compiler/config/schemas/bundler.ts +0 -12
- package/src/compiler/config/schemas/experimental/index.ts +0 -22
- package/src/compiler/config/schemas/index.ts +0 -20
- package/src/compiler/config/schemas/paths.ts +0 -35
- package/src/compiler/config/schemas/template.ts +0 -80
- package/src/compiler/config/schemas/transport/http.ts +0 -116
- package/src/compiler/config/schemas/transport/stdio.ts +0 -31
- package/src/compiler/config/schemas/typescript.ts +0 -26
- package/src/compiler/config/utils.ts +0 -168
- package/src/compiler/generate-env-code.ts +0 -5
- package/src/compiler/generate-import-code.ts +0 -187
- package/src/compiler/generate-tools-code.ts +0 -174
- package/src/compiler/get-bundler-config/get-entries.ts +0 -44
- package/src/compiler/get-bundler-config/get-externals.ts +0 -114
- package/src/compiler/get-bundler-config/get-injected-variables.ts +0 -46
- package/src/compiler/get-bundler-config/index.ts +0 -288
- package/src/compiler/get-bundler-config/plugins/index.ts +0 -140
- package/src/compiler/get-bundler-config/plugins/types/express.ts +0 -3
- package/src/compiler/get-bundler-config/plugins/types/fastify.ts +0 -4
- package/src/compiler/get-bundler-config/plugins/types/index.ts +0 -5
- package/src/compiler/get-bundler-config/plugins/types/nest.ts +0 -65
- package/src/compiler/get-bundler-config/plugins/types/next.ts +0 -52
- package/src/compiler/get-bundler-config/resolve-tsconfig-paths.ts +0 -51
- package/src/compiler/index.ts +0 -484
- package/src/compiler/on-first-build.ts +0 -54
- package/src/compiler/parse-xmcp-config.ts +0 -200
- package/src/compiler/start-http-server.ts +0 -42
- package/src/compiler/utils/__tests__/config-detection.test.ts +0 -307
- package/src/compiler/utils/__tests__/path-utils.test.ts +0 -137
- package/src/compiler/utils/config-detection.ts +0 -34
- package/src/compiler/utils/path-utils.ts +0 -22
- package/src/compiler/watcher-recovery.ts +0 -72
- package/src/host-bridge.ts +0 -36
- package/src/index.ts +0 -94
- package/src/platforms/build-cloudflare-output.ts +0 -116
- package/src/platforms/build-vercel-output.ts +0 -131
- package/src/plugins/index.ts +0 -1
- package/src/plugins/x402/index.ts +0 -24
- package/src/runtime/adapters/express/index.ts +0 -75
- package/src/runtime/adapters/fastify/__tests__/fastify.test.ts +0 -115
- package/src/runtime/adapters/fastify/index.ts +0 -78
- package/src/runtime/adapters/nestjs/index.ts +0 -16
- package/src/runtime/adapters/nestjs/xmcp.controller.ts +0 -34
- package/src/runtime/adapters/nestjs/xmcp.guard.ts +0 -101
- package/src/runtime/adapters/nestjs/xmcp.oauth.controller.ts +0 -36
- package/src/runtime/adapters/nestjs/xmcp.oauth.module.ts +0 -21
- package/src/runtime/adapters/nestjs/xmcp.oauth.service.ts +0 -36
- package/src/runtime/adapters/nestjs/xmcp.service.ts +0 -96
- package/src/runtime/adapters/nestjs/xmcp.utils.ts +0 -11
- package/src/runtime/adapters/nextjs/auth.ts +0 -265
- package/src/runtime/adapters/nextjs/handler/error-handler.ts +0 -67
- package/src/runtime/adapters/nextjs/handler/node-to-web-adapter.ts +0 -143
- package/src/runtime/adapters/nextjs/handler/request-converter.ts +0 -74
- package/src/runtime/adapters/nextjs/handler/server-lifecycle.ts +0 -69
- package/src/runtime/adapters/nextjs/index.ts +0 -82
- package/src/runtime/contexts/client-info-context.ts +0 -16
- package/src/runtime/contexts/http-request-context.ts +0 -21
- package/src/runtime/contexts/http-transport-context.ts +0 -18
- package/src/runtime/headers.ts +0 -42
- package/src/runtime/middlewares/utils.ts +0 -72
- package/src/runtime/platforms/cloudflare/cors.ts +0 -44
- package/src/runtime/platforms/cloudflare/middlewares/api-key.ts +0 -102
- package/src/runtime/platforms/cloudflare/middlewares/jwt.ts +0 -127
- package/src/runtime/platforms/cloudflare/types.ts +0 -23
- package/src/runtime/platforms/cloudflare/worker.ts +0 -270
- package/src/runtime/templates/home.ts +0 -746
- package/src/runtime/transports/http/base-streamable-http.ts +0 -46
- package/src/runtime/transports/http/cors/headers.ts +0 -58
- package/src/runtime/transports/http/cors/index.ts +0 -34
- package/src/runtime/transports/http/index.ts +0 -78
- package/src/runtime/transports/http/stateless-streamable-http.ts +0 -311
- package/src/runtime/transports/http/web-stateless-http.ts +0 -288
- package/src/runtime/transports/stdio/index.ts +0 -109
- package/src/runtime/utils/__tests__/client-info.test.ts +0 -146
- package/src/runtime/utils/__tests__/tool-extra.test.ts +0 -239
- package/src/runtime/utils/client-info.ts +0 -114
- package/src/runtime/utils/elicitation.ts +0 -396
- package/src/runtime/utils/ext-apps-registry.ts +0 -151
- package/src/runtime/utils/mcp-app-protocol.ts +0 -16
- package/src/runtime/utils/mcp-app-types.ts +0 -113
- package/src/runtime/utils/mcp-host-bridge.ts +0 -473
- package/src/runtime/utils/path-to-tool-name.ts +0 -69
- package/src/runtime/utils/prompt-loader.ts +0 -151
- package/src/runtime/utils/prompts.ts +0 -69
- package/src/runtime/utils/react/generate-html.ts +0 -69
- package/src/runtime/utils/react/index.ts +0 -6
- package/src/runtime/utils/request-tool-names.ts +0 -48
- package/src/runtime/utils/resource-loader.ts +0 -151
- package/src/runtime/utils/resources.ts +0 -331
- package/src/runtime/utils/server.ts +0 -107
- package/src/runtime/utils/tool-loader.ts +0 -149
- package/src/runtime/utils/tools.ts +0 -183
- package/src/runtime/utils/transformers/prompt.ts +0 -120
- package/src/runtime/utils/transformers/resource.ts +0 -196
- package/src/runtime/utils/transformers/tool.ts +0 -400
- package/src/runtime/utils/ui/__tests__/split-meta.test.ts +0 -803
- package/src/runtime/utils/ui/flatten-meta.ts +0 -44
- package/src/runtime/utils/ui/split-meta.ts +0 -78
- package/src/runtime/utils/utils/resource-uri-composer.ts +0 -204
- package/src/runtime/utils/validators/index.ts +0 -138
- package/src/telemetry/ci-info.ts +0 -6
- package/src/telemetry/debug.ts +0 -8
- package/src/telemetry/events/definitions.ts +0 -52
- package/src/telemetry/events/detached-flush.ts +0 -83
- package/src/telemetry/events/post-payload.ts +0 -141
- package/src/telemetry/events/tracker.ts +0 -281
- package/src/telemetry/index.ts +0 -7
- package/src/telemetry/metadata.ts +0 -49
- package/src/telemetry/project-id.ts +0 -35
- package/src/telemetry/storage.ts +0 -218
- package/src/types/adapter.d.ts +0 -5
- package/src/types/client-info.ts +0 -20
- package/src/types/declarations.ts +0 -37
- package/src/types/injected.d.ts +0 -62
- package/src/types/middleware.ts +0 -19
- package/src/types/prompt.ts +0 -6
- package/src/types/resource.ts +0 -15
- package/src/types/tool.ts +0 -192
- package/src/types/ui-meta.ts +0 -42
- package/src/utils/cli-icons.ts +0 -5
- package/src/utils/constants.ts +0 -31
- package/src/utils/context.ts +0 -105
- package/src/utils/detect-package-manager.ts +0 -46
- package/src/utils/file-watcher.ts +0 -66
- package/src/utils/fs-utils.ts +0 -16
- package/src/utils/path-validation.ts +0 -66
- package/src/utils/port-utils.ts +0 -43
- package/src/utils/spawn-process.ts +0 -49
- package/src/utils/subscribable.ts +0 -62
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { rspack } from "@rspack/core";
|
|
3
|
-
import type { RspackOptions } from "@rspack/core";
|
|
4
|
-
import { findGlobalsCss, hasPostCSSConfig } from "../utils/config-detection";
|
|
5
|
-
|
|
6
|
-
interface CompileOptions {
|
|
7
|
-
entries: Map<string, string>;
|
|
8
|
-
outputDir: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface ResolvedBuildRequest {
|
|
12
|
-
absoluteEntries: { [k: string]: string };
|
|
13
|
-
absoluteOutputDir: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export class ClientComponentCompiler {
|
|
17
|
-
private buildQueue: Promise<void> = Promise.resolve();
|
|
18
|
-
|
|
19
|
-
async compile(request: CompileOptions): Promise<string> {
|
|
20
|
-
const resolved = this.resolveRequest(request);
|
|
21
|
-
|
|
22
|
-
const nextBuild = this.buildQueue.then(() =>
|
|
23
|
-
this.runBuild(resolved, request.outputDir)
|
|
24
|
-
);
|
|
25
|
-
this.buildQueue = nextBuild.catch(() => Promise.resolve());
|
|
26
|
-
|
|
27
|
-
await nextBuild;
|
|
28
|
-
return request.outputDir;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private runBuild(
|
|
32
|
-
resolved: ResolvedBuildRequest,
|
|
33
|
-
outputDir: string
|
|
34
|
-
): Promise<void> {
|
|
35
|
-
const compiler = rspack(this.createConfig(resolved));
|
|
36
|
-
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
compiler.run((err, stats) => {
|
|
39
|
-
const finalize = (maybeError?: Error) => {
|
|
40
|
-
compiler.close((closeErr) => {
|
|
41
|
-
if (maybeError || closeErr) {
|
|
42
|
-
reject(maybeError ?? closeErr);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
resolve();
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
if (err) {
|
|
50
|
-
finalize(err);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (stats?.hasErrors()) {
|
|
55
|
-
finalize(
|
|
56
|
-
new Error(
|
|
57
|
-
stats.toString({
|
|
58
|
-
colors: false,
|
|
59
|
-
errors: true,
|
|
60
|
-
})
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log(`✓ Built client bundle: ${outputDir}`);
|
|
67
|
-
finalize();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private resolveRequest(request: CompileOptions): ResolvedBuildRequest {
|
|
73
|
-
const absoluteEntries = Object.fromEntries(
|
|
74
|
-
Array.from(request.entries, ([key, value]) => [
|
|
75
|
-
key,
|
|
76
|
-
path.resolve(process.cwd(), value),
|
|
77
|
-
])
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
const absoluteOutputDir = path.resolve(process.cwd(), request.outputDir);
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
absoluteEntries,
|
|
84
|
-
absoluteOutputDir,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
private createVirtualModules(absoluteEntries: Record<string, string>) {
|
|
89
|
-
const virtualModules: Record<string, string> = {};
|
|
90
|
-
const virtualEntries: Record<string, string> = {};
|
|
91
|
-
|
|
92
|
-
for (const [name, realEntry] of Object.entries(absoluteEntries)) {
|
|
93
|
-
const virtualPath = this.getVirtualPath(name);
|
|
94
|
-
virtualEntries[name] = virtualPath;
|
|
95
|
-
virtualModules[virtualPath] = this.createEntryModule(realEntry);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return { virtualModules, virtualEntries };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private getVirtualPath(name: string): string {
|
|
102
|
-
return path.posix.join(".", "__virtual__", `${name}.entry.tsx`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private createEntryModule(componentPath: string): string {
|
|
106
|
-
const globalsCssPath = findGlobalsCss();
|
|
107
|
-
const globalsCssImport = globalsCssPath
|
|
108
|
-
? `import ${JSON.stringify(globalsCssPath)};`
|
|
109
|
-
: "";
|
|
110
|
-
|
|
111
|
-
return `
|
|
112
|
-
import React from "react";
|
|
113
|
-
import { createRoot } from "react-dom/client";
|
|
114
|
-
${globalsCssImport}
|
|
115
|
-
import Component from ${JSON.stringify(componentPath)};
|
|
116
|
-
|
|
117
|
-
const el = document.getElementById("root");
|
|
118
|
-
if (!el) {
|
|
119
|
-
throw new Error("Root element not found");
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const root = createRoot(el);
|
|
123
|
-
|
|
124
|
-
function render(props) {
|
|
125
|
-
root.render(React.createElement(Component, props));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
render({});
|
|
129
|
-
|
|
130
|
-
window.addEventListener("message", (event) => {
|
|
131
|
-
if (event.source !== window.parent && event.source !== null) return;
|
|
132
|
-
const method = event.data?.method;
|
|
133
|
-
const isInputNotification =
|
|
134
|
-
method === "ui/notifications/tool-input" ||
|
|
135
|
-
method === "tool-input" ||
|
|
136
|
-
method === "mcp-apps:tool-input" ||
|
|
137
|
-
method === "ui/notifications/tool-input-partial";
|
|
138
|
-
|
|
139
|
-
const isResultNotification = method === "ui/notifications/tool-result";
|
|
140
|
-
|
|
141
|
-
if (!isInputNotification && !isResultNotification) return;
|
|
142
|
-
|
|
143
|
-
const args = isResultNotification
|
|
144
|
-
? event.data?.params?.structuredContent?.args ??
|
|
145
|
-
event.data?.params?.arguments ??
|
|
146
|
-
event.data?.params?.input ??
|
|
147
|
-
event.data?.arguments ??
|
|
148
|
-
{}
|
|
149
|
-
: event.data?.params?.arguments ??
|
|
150
|
-
event.data?.params?.input ??
|
|
151
|
-
event.data?.arguments ??
|
|
152
|
-
{};
|
|
153
|
-
|
|
154
|
-
render(args);
|
|
155
|
-
});
|
|
156
|
-
`;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
private createConfig(config: ResolvedBuildRequest): RspackOptions {
|
|
160
|
-
const { virtualModules, virtualEntries } = this.createVirtualModules(
|
|
161
|
-
config.absoluteEntries
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
mode: "production",
|
|
166
|
-
entry: virtualEntries,
|
|
167
|
-
target: "web",
|
|
168
|
-
experiments: {
|
|
169
|
-
outputModule: true,
|
|
170
|
-
css: true,
|
|
171
|
-
},
|
|
172
|
-
output: {
|
|
173
|
-
path: config.absoluteOutputDir,
|
|
174
|
-
filename: "[name].bundle.js",
|
|
175
|
-
module: true,
|
|
176
|
-
library: {
|
|
177
|
-
type: "module",
|
|
178
|
-
},
|
|
179
|
-
clean: true,
|
|
180
|
-
},
|
|
181
|
-
externalsType: "module",
|
|
182
|
-
resolve: {
|
|
183
|
-
extensions: [".tsx", ".ts", ".jsx", ".js", ".json"],
|
|
184
|
-
preferRelative: true,
|
|
185
|
-
},
|
|
186
|
-
resolveLoader: {
|
|
187
|
-
modules: [
|
|
188
|
-
"node_modules",
|
|
189
|
-
path.resolve(__dirname, "../node_modules"),
|
|
190
|
-
path.resolve(__dirname, "../.."),
|
|
191
|
-
],
|
|
192
|
-
},
|
|
193
|
-
module: {
|
|
194
|
-
rules: [
|
|
195
|
-
{
|
|
196
|
-
test: /\.(ts|tsx|js|jsx)$/,
|
|
197
|
-
exclude: /node_modules/,
|
|
198
|
-
use: {
|
|
199
|
-
loader: "builtin:swc-loader",
|
|
200
|
-
options: {
|
|
201
|
-
jsc: {
|
|
202
|
-
parser: {
|
|
203
|
-
syntax: "typescript",
|
|
204
|
-
tsx: true,
|
|
205
|
-
},
|
|
206
|
-
transform: {
|
|
207
|
-
react: {
|
|
208
|
-
runtime: "automatic",
|
|
209
|
-
importSource: "react",
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
target: "es2017",
|
|
213
|
-
},
|
|
214
|
-
module: {
|
|
215
|
-
type: "es6",
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
test: /\.css$/,
|
|
222
|
-
use: hasPostCSSConfig() ? ["postcss-loader"] : [],
|
|
223
|
-
type: "css/auto",
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
test: /\.less$/,
|
|
227
|
-
type: "css/auto",
|
|
228
|
-
use: ["less-loader"],
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
parser: {
|
|
232
|
-
"css/auto": {
|
|
233
|
-
namedExports: false,
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
plugins: [new rspack.experiments.VirtualModulesPlugin(virtualModules)],
|
|
238
|
-
optimization: {
|
|
239
|
-
minimize: true,
|
|
240
|
-
usedExports: true,
|
|
241
|
-
sideEffects: true,
|
|
242
|
-
concatenateModules: true,
|
|
243
|
-
moduleIds: "deterministic",
|
|
244
|
-
},
|
|
245
|
-
cache: false,
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export const clientComponentCompiler = new ClientComponentCompiler();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { clientComponentCompiler } from "./component-compiler";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Build a client-side bundle for a React component
|
|
5
|
-
* Writes the bundle to disk at outputDir/${toolName}.bundle.js
|
|
6
|
-
*/
|
|
7
|
-
export async function transpileClientComponent(
|
|
8
|
-
entries: Map<string, string>,
|
|
9
|
-
outputDir: string
|
|
10
|
-
): Promise<void> {
|
|
11
|
-
try {
|
|
12
|
-
await clientComponentCompiler.compile({
|
|
13
|
-
entries,
|
|
14
|
-
outputDir,
|
|
15
|
-
});
|
|
16
|
-
} catch (error) {
|
|
17
|
-
throw new Error(
|
|
18
|
-
`Failed to transpile client component: ${error instanceof Error ? error.message : String(error)}`
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CompilerMode } from ".";
|
|
2
|
-
import { createContext } from "../utils/context";
|
|
3
|
-
import { XmcpConfigOutputSchema } from "./config";
|
|
4
|
-
|
|
5
|
-
interface CompilerContext {
|
|
6
|
-
/** The mode of the compiler. */
|
|
7
|
-
mode: CompilerMode;
|
|
8
|
-
/** Whether the adapter is enabled. */
|
|
9
|
-
adapter?: boolean;
|
|
10
|
-
/** The platforms to build for. */
|
|
11
|
-
platforms: {
|
|
12
|
-
/** Generates a .vercel folder to deploy on Vercel */
|
|
13
|
-
vercel?: boolean;
|
|
14
|
-
/** Builds a Cloudflare Workers bundle */
|
|
15
|
-
cloudflare?: boolean;
|
|
16
|
-
};
|
|
17
|
-
/** The paths to the tools. */
|
|
18
|
-
toolPaths: Set<string>;
|
|
19
|
-
/** The paths to the prompts. */
|
|
20
|
-
promptPaths: Set<string>;
|
|
21
|
-
/** The paths to the resources. */
|
|
22
|
-
resourcePaths: Set<string>;
|
|
23
|
-
/** Whether the middleware is enabled. */
|
|
24
|
-
hasMiddleware: boolean;
|
|
25
|
-
/** The parsed config. */
|
|
26
|
-
xmcpConfig?: XmcpConfigOutputSchema;
|
|
27
|
-
/** Client bundles mapping for React (toolName -> bundlePath). */
|
|
28
|
-
clientBundles?: Map<string, string>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const compilerContext = createContext<CompilerContext>({
|
|
32
|
-
name: "xmcp-compiler",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Preset some defaults for the compiler context
|
|
36
|
-
export const compilerContextProvider = async (
|
|
37
|
-
initialValue: Omit<
|
|
38
|
-
CompilerContext,
|
|
39
|
-
"toolPaths" | "promptPaths" | "resourcePaths" | "hasMiddleware"
|
|
40
|
-
>,
|
|
41
|
-
callback: () => void
|
|
42
|
-
) => {
|
|
43
|
-
return compilerContext.provider(
|
|
44
|
-
{
|
|
45
|
-
...initialValue,
|
|
46
|
-
toolPaths: new Set(),
|
|
47
|
-
promptPaths: new Set(),
|
|
48
|
-
resourcePaths: new Set(),
|
|
49
|
-
hasMiddleware: false,
|
|
50
|
-
},
|
|
51
|
-
() => Promise.resolve(callback())
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const getXmcpConfig = () => {
|
|
56
|
-
const { xmcpConfig } = compilerContext.getContext();
|
|
57
|
-
if (!xmcpConfig) {
|
|
58
|
-
throw new Error("xmcp config not found");
|
|
59
|
-
}
|
|
60
|
-
return xmcpConfig;
|
|
61
|
-
};
|