@kya-os/mcp-i 0.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +406 -71
- package/dist/149.js +1 -0
- package/dist/189.js +1 -0
- package/dist/261.js +1 -0
- package/dist/28.js +1 -0
- package/dist/295.js +1 -0
- package/dist/460.js +1 -0
- package/dist/570.js +1 -0
- package/dist/634.js +1 -0
- package/dist/647.js +1 -0
- package/dist/67.js +1 -0
- package/dist/739.js +1 -0
- package/dist/742.js +1 -0
- package/dist/904.js +1 -0
- package/dist/938.js +1 -0
- package/dist/auth/api-key.d.ts +16 -0
- package/dist/auth/api-key.js +82 -0
- package/dist/auth/jwt.d.ts +43 -0
- package/dist/auth/jwt.js +51 -0
- package/dist/auth/oauth/factory.d.ts +12 -0
- package/dist/auth/oauth/factory.js +36 -0
- package/dist/auth/oauth/index.d.ts +5 -0
- package/dist/auth/oauth/index.js +27 -0
- package/dist/auth/oauth/providers/proxy-provider.d.ts +13 -0
- package/dist/auth/oauth/providers/proxy-provider.js +159 -0
- package/dist/auth/oauth/router.d.ts +4 -0
- package/dist/auth/oauth/router.js +294 -0
- package/dist/auth/oauth/storage/memory-storage.d.ts +12 -0
- package/dist/auth/oauth/storage/memory-storage.js +40 -0
- package/dist/auth/oauth/types.d.ts +112 -0
- package/dist/auth/oauth/types.js +2 -0
- package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/cloudflare-kv-nonce-cache.test.js +176 -0
- package/dist/cache/__tests__/concurrency.test.d.ts +5 -0
- package/dist/cache/__tests__/concurrency.test.js +300 -0
- package/dist/cache/__tests__/dynamodb-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/dynamodb-nonce-cache.test.js +176 -0
- package/dist/cache/__tests__/memory-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/memory-nonce-cache.test.js +132 -0
- package/dist/cache/__tests__/nonce-cache-factory-simple.test.d.ts +4 -0
- package/dist/cache/__tests__/nonce-cache-factory-simple.test.js +133 -0
- package/dist/cache/__tests__/nonce-cache-factory.test.d.ts +4 -0
- package/dist/cache/__tests__/nonce-cache-factory.test.js +252 -0
- package/dist/cache/__tests__/redis-nonce-cache.test.d.ts +4 -0
- package/dist/cache/__tests__/redis-nonce-cache.test.js +95 -0
- package/dist/cache/cloudflare-kv-nonce-cache.d.ts +14 -0
- package/dist/cache/cloudflare-kv-nonce-cache.js +93 -0
- package/dist/cache/dynamodb-nonce-cache.d.ts +15 -0
- package/dist/cache/dynamodb-nonce-cache.js +92 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/index.js +32 -0
- package/dist/cache/memory-nonce-cache.d.ts +44 -0
- package/dist/cache/memory-nonce-cache.js +105 -0
- package/dist/cache/nonce-cache-factory.d.ts +20 -0
- package/dist/cache/nonce-cache-factory.js +208 -0
- package/dist/cache/redis-nonce-cache.d.ts +14 -0
- package/dist/cache/redis-nonce-cache.js +53 -0
- package/dist/compiler/compiler-context.d.ts +23 -0
- package/dist/compiler/compiler-context.js +24 -0
- package/dist/compiler/config/constants.d.ts +41 -0
- package/dist/compiler/config/constants.js +45 -0
- package/dist/compiler/config/index.d.ts +252 -0
- package/dist/compiler/config/index.js +15 -0
- package/dist/compiler/config/injection.d.ts +26 -0
- package/dist/compiler/config/injection.js +58 -0
- package/dist/compiler/config/schemas/experimental/index.d.ts +91 -0
- package/dist/compiler/config/schemas/experimental/index.js +16 -0
- package/dist/compiler/config/schemas/experimental/oauth.d.ts +74 -0
- package/dist/compiler/config/schemas/experimental/oauth.js +25 -0
- package/dist/compiler/config/schemas/index.d.ts +6 -0
- package/dist/compiler/config/schemas/index.js +17 -0
- package/dist/compiler/config/schemas/paths.d.ts +9 -0
- package/dist/compiler/config/schemas/paths.js +12 -0
- package/dist/compiler/config/schemas/transport/http.d.ts +82 -0
- package/dist/compiler/config/schemas/transport/http.js +33 -0
- package/dist/compiler/config/schemas/transport/stdio.d.ts +9 -0
- package/dist/compiler/config/schemas/transport/stdio.js +15 -0
- package/dist/compiler/config/schemas/webpack.d.ts +3 -0
- package/dist/compiler/config/schemas/webpack.js +15 -0
- package/dist/compiler/config/types.d.ts +1 -0
- package/dist/compiler/config/types.js +2 -0
- package/dist/compiler/config/utils.d.ts +20 -0
- package/dist/compiler/config/utils.js +36 -0
- package/dist/compiler/generate-env-code.d.ts +1 -0
- package/dist/compiler/generate-env-code.js +8 -0
- package/dist/compiler/generate-import-code.d.ts +1 -0
- package/dist/compiler/generate-import-code.js +24 -0
- package/dist/compiler/get-webpack-config/get-entries.d.ts +3 -0
- package/dist/compiler/get-webpack-config/get-entries.js +29 -0
- package/dist/compiler/get-webpack-config/get-externals.d.ts +7 -0
- package/dist/compiler/get-webpack-config/get-externals.js +88 -0
- package/dist/compiler/get-webpack-config/get-injected-variables.d.ts +8 -0
- package/dist/compiler/get-webpack-config/get-injected-variables.js +25 -0
- package/dist/compiler/get-webpack-config/index.d.ts +4 -0
- package/dist/compiler/get-webpack-config/index.js +101 -0
- package/dist/compiler/get-webpack-config/plugins.d.ts +8 -0
- package/dist/compiler/get-webpack-config/plugins.js +132 -0
- package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.d.ts +9 -0
- package/dist/compiler/get-webpack-config/resolve-tsconfig-paths.js +40 -0
- package/dist/compiler/index.d.ts +6 -0
- package/dist/compiler/index.js +194 -0
- package/dist/compiler/on-first-build.d.ts +3 -0
- package/dist/compiler/on-first-build.js +58 -0
- package/dist/compiler/parse-xmcp-config.d.ts +9 -0
- package/dist/compiler/parse-xmcp-config.js +155 -0
- package/dist/compiler/start-http-server.d.ts +1 -0
- package/dist/compiler/start-http-server.js +34 -0
- package/dist/index.d.ts +12 -54
- package/dist/index.js +22 -190
- package/dist/index.js.LICENSE.txt +49 -0
- package/dist/runtime/__tests__/audit.test.d.ts +4 -0
- package/dist/runtime/__tests__/audit.test.js +328 -0
- package/dist/runtime/__tests__/identity.test.d.ts +4 -0
- package/dist/runtime/__tests__/identity.test.js +164 -0
- package/dist/runtime/__tests__/mcpi-runtime.test.d.ts +4 -0
- package/dist/runtime/__tests__/mcpi-runtime.test.js +372 -0
- package/dist/runtime/__tests__/proof.test.d.ts +4 -0
- package/dist/runtime/__tests__/proof.test.js +302 -0
- package/dist/runtime/__tests__/session.test.d.ts +4 -0
- package/dist/runtime/__tests__/session.test.js +254 -0
- package/dist/runtime/__tests__/well-known.test.d.ts +4 -0
- package/dist/runtime/__tests__/well-known.test.js +312 -0
- package/dist/runtime/adapter-express.js +2 -0
- package/dist/runtime/adapter-express.js.LICENSE.txt +252 -0
- package/dist/runtime/adapter-nextjs.js +2 -0
- package/dist/runtime/adapter-nextjs.js.LICENSE.txt +53 -0
- package/dist/runtime/adapters/express/index.d.ts +2 -0
- package/dist/runtime/adapters/express/index.js +48 -0
- package/dist/runtime/adapters/nextjs/index.d.ts +8 -0
- package/dist/runtime/adapters/nextjs/index.js +18 -0
- package/dist/runtime/audit.d.ts +93 -0
- package/dist/runtime/audit.js +212 -0
- package/dist/runtime/debug.d.ts +118 -0
- package/dist/runtime/debug.js +612 -0
- package/dist/runtime/delegation-hooks.d.ts +85 -0
- package/dist/runtime/delegation-hooks.js +116 -0
- package/dist/runtime/demo.d.ts +71 -0
- package/dist/runtime/demo.js +135 -0
- package/dist/runtime/headers.d.ts +1 -0
- package/dist/runtime/headers.js +9 -0
- package/dist/runtime/http.js +2 -0
- package/dist/runtime/http.js.LICENSE.txt +252 -0
- package/dist/runtime/identity.d.ts +105 -0
- package/dist/runtime/identity.js +232 -0
- package/dist/runtime/index.d.ts +16 -0
- package/dist/runtime/index.js +56 -0
- package/dist/runtime/mcpi-runtime.d.ts +164 -0
- package/dist/runtime/mcpi-runtime.js +352 -0
- package/dist/runtime/proof.d.ts +87 -0
- package/dist/runtime/proof.js +223 -0
- package/dist/runtime/session.d.ts +88 -0
- package/dist/runtime/session.js +216 -0
- package/dist/runtime/stdio.js +2 -0
- package/dist/runtime/stdio.js.LICENSE.txt +1 -0
- package/dist/runtime/templates/home.d.ts +2 -0
- package/dist/runtime/templates/home.js +50 -0
- package/dist/runtime/transports/http/base-streamable-http.d.ts +25 -0
- package/dist/runtime/transports/http/base-streamable-http.js +16 -0
- package/dist/runtime/transports/http/http-context.d.ts +9 -0
- package/dist/runtime/transports/http/http-context.js +8 -0
- package/dist/runtime/transports/http/index.d.ts +1 -0
- package/dist/runtime/transports/http/index.js +55 -0
- package/dist/runtime/transports/http/setup-cors.d.ts +4 -0
- package/dist/runtime/transports/http/setup-cors.js +24 -0
- package/dist/runtime/transports/http/stateless-streamable-http.d.ts +39 -0
- package/dist/runtime/transports/http/stateless-streamable-http.js +331 -0
- package/dist/runtime/transports/stdio/index.d.ts +1 -0
- package/dist/runtime/transports/stdio/index.js +51 -0
- package/dist/runtime/utils/server.d.ts +42 -0
- package/dist/runtime/utils/server.js +39 -0
- package/dist/runtime/utils/tools.d.ts +8 -0
- package/dist/runtime/utils/tools.js +115 -0
- package/dist/runtime/verifier-middleware.d.ts +76 -0
- package/dist/runtime/verifier-middleware.js +322 -0
- package/dist/runtime/well-known.d.ts +151 -0
- package/dist/runtime/well-known.js +258 -0
- package/dist/storage/config.d.ts +28 -0
- package/dist/storage/config.js +79 -0
- package/dist/storage/delegation.d.ts +59 -0
- package/dist/storage/delegation.js +130 -0
- package/dist/storage/merkle-verifier.d.ts +84 -0
- package/dist/storage/merkle-verifier.js +261 -0
- package/dist/test/__tests__/nonce-cache-integration.test.d.ts +1 -0
- package/dist/test/__tests__/nonce-cache-integration.test.js +116 -0
- package/dist/test/__tests__/nonce-cache.test.d.ts +1 -0
- package/dist/test/__tests__/nonce-cache.test.js +122 -0
- package/dist/test/__tests__/runtime-integration.test.d.ts +4 -0
- package/dist/test/__tests__/runtime-integration.test.js +192 -0
- package/dist/test/__tests__/test-infrastructure.test.d.ts +4 -0
- package/dist/test/__tests__/test-infrastructure.test.js +178 -0
- package/dist/test/deterministic-keys.d.ts +31 -0
- package/dist/test/deterministic-keys.js +108 -0
- package/dist/test/examples/test-usage-example.d.ts +140 -0
- package/dist/test/examples/test-usage-example.js +175 -0
- package/dist/test/index.d.ts +11 -0
- package/dist/test/index.js +27 -0
- package/dist/test/local-verification.d.ts +28 -0
- package/dist/test/local-verification.js +342 -0
- package/dist/test/mock-identity-provider.d.ts +96 -0
- package/dist/test/mock-identity-provider.js +243 -0
- package/dist/test/runtime-integration.d.ts +63 -0
- package/dist/test/runtime-integration.js +140 -0
- package/dist/test/test-environment.d.ts +26 -0
- package/dist/test/test-environment.js +50 -0
- package/dist/types/declarations.d.ts +1 -0
- package/dist/types/declarations.js +6 -0
- package/dist/types/middleware.d.ts +2 -0
- package/dist/types/middleware.js +2 -0
- package/dist/types/tool.d.ts +80 -0
- package/dist/types/tool.js +2 -0
- package/dist/utils/cli-icons.d.ts +3 -0
- package/dist/utils/cli-icons.js +7 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +13 -0
- package/dist/utils/context.d.ts +33 -0
- package/dist/utils/context.js +58 -0
- package/dist/utils/file-watcher.d.ts +19 -0
- package/dist/utils/file-watcher.js +49 -0
- package/dist/utils/fs-utils.d.ts +2 -0
- package/dist/utils/fs-utils.js +22 -0
- package/dist/utils/path-validation.d.ts +3 -0
- package/dist/utils/path-validation.js +56 -0
- package/dist/utils/spawn-process.d.ts +9 -0
- package/dist/utils/spawn-process.js +50 -0
- package/dist/utils/subscribable.d.ts +12 -0
- package/dist/utils/subscribable.js +44 -0
- package/package.json +99 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const oauthEndpointsSchema: z.ZodObject<{
|
|
3
|
+
authorizationUrl: z.ZodString;
|
|
4
|
+
tokenUrl: z.ZodString;
|
|
5
|
+
revocationUrl: z.ZodOptional<z.ZodString>;
|
|
6
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
7
|
+
registerUrl: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
authorizationUrl: string;
|
|
10
|
+
tokenUrl: string;
|
|
11
|
+
registerUrl: string;
|
|
12
|
+
revocationUrl?: string | undefined;
|
|
13
|
+
userInfoUrl?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
authorizationUrl: string;
|
|
16
|
+
tokenUrl: string;
|
|
17
|
+
registerUrl: string;
|
|
18
|
+
revocationUrl?: string | undefined;
|
|
19
|
+
userInfoUrl?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type OauthEndpoints = z.infer<typeof oauthEndpointsSchema>;
|
|
22
|
+
export declare const oauthConfigSchema: z.ZodObject<{
|
|
23
|
+
endpoints: z.ZodObject<{
|
|
24
|
+
authorizationUrl: z.ZodString;
|
|
25
|
+
tokenUrl: z.ZodString;
|
|
26
|
+
revocationUrl: z.ZodOptional<z.ZodString>;
|
|
27
|
+
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
28
|
+
registerUrl: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
authorizationUrl: string;
|
|
31
|
+
tokenUrl: string;
|
|
32
|
+
registerUrl: string;
|
|
33
|
+
revocationUrl?: string | undefined;
|
|
34
|
+
userInfoUrl?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
authorizationUrl: string;
|
|
37
|
+
tokenUrl: string;
|
|
38
|
+
registerUrl: string;
|
|
39
|
+
revocationUrl?: string | undefined;
|
|
40
|
+
userInfoUrl?: string | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
issuerUrl: z.ZodString;
|
|
43
|
+
baseUrl: z.ZodString;
|
|
44
|
+
serviceDocumentationUrl: z.ZodOptional<z.ZodString>;
|
|
45
|
+
pathPrefix: z.ZodDefault<z.ZodString>;
|
|
46
|
+
defaultScopes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
endpoints: {
|
|
49
|
+
authorizationUrl: string;
|
|
50
|
+
tokenUrl: string;
|
|
51
|
+
registerUrl: string;
|
|
52
|
+
revocationUrl?: string | undefined;
|
|
53
|
+
userInfoUrl?: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
issuerUrl: string;
|
|
56
|
+
baseUrl: string;
|
|
57
|
+
pathPrefix: string;
|
|
58
|
+
defaultScopes: string[];
|
|
59
|
+
serviceDocumentationUrl?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
endpoints: {
|
|
62
|
+
authorizationUrl: string;
|
|
63
|
+
tokenUrl: string;
|
|
64
|
+
registerUrl: string;
|
|
65
|
+
revocationUrl?: string | undefined;
|
|
66
|
+
userInfoUrl?: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
issuerUrl: string;
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
serviceDocumentationUrl?: string | undefined;
|
|
71
|
+
pathPrefix?: string | undefined;
|
|
72
|
+
defaultScopes?: string[] | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
export type OAuthConfig = z.infer<typeof oauthConfigSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oauthConfigSchema = exports.oauthEndpointsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// ------------------------------------------------------------
|
|
6
|
+
// OAuth endpoints schema
|
|
7
|
+
// ------------------------------------------------------------
|
|
8
|
+
exports.oauthEndpointsSchema = zod_1.z.object({
|
|
9
|
+
authorizationUrl: zod_1.z.string(),
|
|
10
|
+
tokenUrl: zod_1.z.string(),
|
|
11
|
+
revocationUrl: zod_1.z.string().optional(),
|
|
12
|
+
userInfoUrl: zod_1.z.string().optional(),
|
|
13
|
+
registerUrl: zod_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
// ------------------------------------------------------------
|
|
16
|
+
// OAuth config schema
|
|
17
|
+
// ------------------------------------------------------------
|
|
18
|
+
exports.oauthConfigSchema = zod_1.z.object({
|
|
19
|
+
endpoints: exports.oauthEndpointsSchema,
|
|
20
|
+
issuerUrl: zod_1.z.string(),
|
|
21
|
+
baseUrl: zod_1.z.string(),
|
|
22
|
+
serviceDocumentationUrl: zod_1.z.string().optional(),
|
|
23
|
+
pathPrefix: zod_1.z.string().default("/oauth2"),
|
|
24
|
+
defaultScopes: zod_1.z.array(zod_1.z.string()).default(["openid", "profile", "email"]),
|
|
25
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { httpTransportConfigSchema, corsConfigSchema, type HttpTransportConfig, type CorsConfig, } from "./transport/http";
|
|
2
|
+
export { stdioTransportConfigSchema, type StdioTransportConfig, } from "./transport/stdio";
|
|
3
|
+
export { oauthConfigSchema, type OAuthConfig } from "./experimental/oauth";
|
|
4
|
+
export { experimentalConfigSchema, type ExperimentalConfig, } from "./experimental";
|
|
5
|
+
export { pathsConfigSchema, type PathsConfig } from "./paths";
|
|
6
|
+
export { webpackConfigSchema, type WebpackConfig } from "./webpack";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webpackConfigSchema = exports.pathsConfigSchema = exports.experimentalConfigSchema = exports.oauthConfigSchema = exports.stdioTransportConfigSchema = exports.corsConfigSchema = exports.httpTransportConfigSchema = void 0;
|
|
4
|
+
// re export
|
|
5
|
+
var http_1 = require("./transport/http");
|
|
6
|
+
Object.defineProperty(exports, "httpTransportConfigSchema", { enumerable: true, get: function () { return http_1.httpTransportConfigSchema; } });
|
|
7
|
+
Object.defineProperty(exports, "corsConfigSchema", { enumerable: true, get: function () { return http_1.corsConfigSchema; } });
|
|
8
|
+
var stdio_1 = require("./transport/stdio");
|
|
9
|
+
Object.defineProperty(exports, "stdioTransportConfigSchema", { enumerable: true, get: function () { return stdio_1.stdioTransportConfigSchema; } });
|
|
10
|
+
var oauth_1 = require("./experimental/oauth");
|
|
11
|
+
Object.defineProperty(exports, "oauthConfigSchema", { enumerable: true, get: function () { return oauth_1.oauthConfigSchema; } });
|
|
12
|
+
var experimental_1 = require("./experimental");
|
|
13
|
+
Object.defineProperty(exports, "experimentalConfigSchema", { enumerable: true, get: function () { return experimental_1.experimentalConfigSchema; } });
|
|
14
|
+
var paths_1 = require("./paths");
|
|
15
|
+
Object.defineProperty(exports, "pathsConfigSchema", { enumerable: true, get: function () { return paths_1.pathsConfigSchema; } });
|
|
16
|
+
var webpack_1 = require("./webpack");
|
|
17
|
+
Object.defineProperty(exports, "webpackConfigSchema", { enumerable: true, get: function () { return webpack_1.webpackConfigSchema; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const pathsConfigSchema: z.ZodObject<{
|
|
3
|
+
tools: z.ZodDefault<z.ZodString>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
tools: string;
|
|
6
|
+
}, {
|
|
7
|
+
tools?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export type PathsConfig = z.infer<typeof pathsConfigSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pathsConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
// ------------------------------------------------------------
|
|
7
|
+
// Paths config schema
|
|
8
|
+
// ------------------------------------------------------------
|
|
9
|
+
exports.pathsConfigSchema = zod_1.z.object({
|
|
10
|
+
tools: zod_1.z.string().default(constants_1.DEFAULT_PATHS_CONFIG.tools),
|
|
11
|
+
// TO DO add resources prompts etc
|
|
12
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const corsConfigSchema: z.ZodObject<{
|
|
3
|
+
origin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodBoolean]>>;
|
|
4
|
+
methods: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
5
|
+
allowedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
6
|
+
exposedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
7
|
+
credentials: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
maxAge: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
origin?: string | boolean | string[] | undefined;
|
|
11
|
+
methods?: string | string[] | undefined;
|
|
12
|
+
allowedHeaders?: string | string[] | undefined;
|
|
13
|
+
exposedHeaders?: string | string[] | undefined;
|
|
14
|
+
credentials?: boolean | undefined;
|
|
15
|
+
maxAge?: number | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
origin?: string | boolean | string[] | undefined;
|
|
18
|
+
methods?: string | string[] | undefined;
|
|
19
|
+
allowedHeaders?: string | string[] | undefined;
|
|
20
|
+
exposedHeaders?: string | string[] | undefined;
|
|
21
|
+
credentials?: boolean | undefined;
|
|
22
|
+
maxAge?: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type CorsConfig = z.infer<typeof corsConfigSchema>;
|
|
25
|
+
export declare const httpTransportConfigSchema: z.ZodUnion<[z.ZodBoolean, z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
26
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
host: z.ZodOptional<z.ZodString>;
|
|
28
|
+
bodySizeLimit: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
debug: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
31
|
+
cors: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
origin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodBoolean]>>;
|
|
33
|
+
methods: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
34
|
+
allowedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
35
|
+
exposedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
36
|
+
credentials: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
maxAge: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
origin?: string | boolean | string[] | undefined;
|
|
40
|
+
methods?: string | string[] | undefined;
|
|
41
|
+
allowedHeaders?: string | string[] | undefined;
|
|
42
|
+
exposedHeaders?: string | string[] | undefined;
|
|
43
|
+
credentials?: boolean | undefined;
|
|
44
|
+
maxAge?: number | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
origin?: string | boolean | string[] | undefined;
|
|
47
|
+
methods?: string | string[] | undefined;
|
|
48
|
+
allowedHeaders?: string | string[] | undefined;
|
|
49
|
+
exposedHeaders?: string | string[] | undefined;
|
|
50
|
+
credentials?: boolean | undefined;
|
|
51
|
+
maxAge?: number | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
port?: number | undefined;
|
|
55
|
+
host?: string | undefined;
|
|
56
|
+
bodySizeLimit?: number | undefined;
|
|
57
|
+
debug?: boolean | undefined;
|
|
58
|
+
endpoint?: string | undefined;
|
|
59
|
+
cors?: {
|
|
60
|
+
origin?: string | boolean | string[] | undefined;
|
|
61
|
+
methods?: string | string[] | undefined;
|
|
62
|
+
allowedHeaders?: string | string[] | undefined;
|
|
63
|
+
exposedHeaders?: string | string[] | undefined;
|
|
64
|
+
credentials?: boolean | undefined;
|
|
65
|
+
maxAge?: number | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
port?: number | undefined;
|
|
69
|
+
host?: string | undefined;
|
|
70
|
+
bodySizeLimit?: number | undefined;
|
|
71
|
+
debug?: boolean | undefined;
|
|
72
|
+
endpoint?: string | undefined;
|
|
73
|
+
cors?: {
|
|
74
|
+
origin?: string | boolean | string[] | undefined;
|
|
75
|
+
methods?: string | string[] | undefined;
|
|
76
|
+
allowedHeaders?: string | string[] | undefined;
|
|
77
|
+
exposedHeaders?: string | string[] | undefined;
|
|
78
|
+
credentials?: boolean | undefined;
|
|
79
|
+
maxAge?: number | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
}>>>]>;
|
|
82
|
+
export type HttpTransportConfig = z.infer<typeof httpTransportConfigSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpTransportConfigSchema = exports.corsConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
// ------------------------------------------------------------
|
|
7
|
+
// Cors config schema
|
|
8
|
+
// ------------------------------------------------------------
|
|
9
|
+
exports.corsConfigSchema = zod_1.z.object({
|
|
10
|
+
origin: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string()), zod_1.z.boolean()]).optional(),
|
|
11
|
+
methods: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
12
|
+
allowedHeaders: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
13
|
+
exposedHeaders: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
14
|
+
credentials: zod_1.z.boolean().optional(),
|
|
15
|
+
maxAge: zod_1.z.number().optional(),
|
|
16
|
+
});
|
|
17
|
+
// ------------------------------------------------------------
|
|
18
|
+
// HTTP Transport config schema
|
|
19
|
+
// ------------------------------------------------------------
|
|
20
|
+
exports.httpTransportConfigSchema = zod_1.z.union([
|
|
21
|
+
zod_1.z.boolean(),
|
|
22
|
+
zod_1.z
|
|
23
|
+
.object({
|
|
24
|
+
port: zod_1.z.number().optional(),
|
|
25
|
+
host: zod_1.z.string().optional(),
|
|
26
|
+
bodySizeLimit: zod_1.z.number().optional(),
|
|
27
|
+
debug: zod_1.z.boolean().optional(),
|
|
28
|
+
endpoint: zod_1.z.string().optional(),
|
|
29
|
+
cors: exports.corsConfigSchema.optional(),
|
|
30
|
+
})
|
|
31
|
+
.default(constants_1.DEFAULT_HTTP_CONFIG)
|
|
32
|
+
.optional(),
|
|
33
|
+
]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const stdioTransportConfigSchema: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
3
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
debug: boolean;
|
|
6
|
+
}, {
|
|
7
|
+
debug?: boolean | undefined;
|
|
8
|
+
}>]>>;
|
|
9
|
+
export type StdioTransportConfig = z.infer<typeof stdioTransportConfigSchema>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stdioTransportConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// ------------------------------------------------------------
|
|
6
|
+
// stdio transport config schema
|
|
7
|
+
// ------------------------------------------------------------
|
|
8
|
+
exports.stdioTransportConfigSchema = zod_1.z
|
|
9
|
+
.union([
|
|
10
|
+
zod_1.z.boolean(),
|
|
11
|
+
zod_1.z.object({
|
|
12
|
+
debug: zod_1.z.boolean().default(false),
|
|
13
|
+
}),
|
|
14
|
+
])
|
|
15
|
+
.optional();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.webpackConfigSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
// ------------------------------------------------------------
|
|
9
|
+
// Webpack config schema
|
|
10
|
+
// ------------------------------------------------------------
|
|
11
|
+
exports.webpackConfigSchema = zod_1.default
|
|
12
|
+
.function()
|
|
13
|
+
.args(zod_1.default.any())
|
|
14
|
+
.returns(zod_1.default.any())
|
|
15
|
+
.optional();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { HttpTransportConfig, StdioTransportConfig, CorsConfig, OAuthConfig, ExperimentalConfig, PathsConfig, WebpackConfig, } from "./schemas";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpTransportConfig, CorsConfig, PathsConfig, OAuthConfig, StdioTransportConfig } from "./schemas";
|
|
2
|
+
export declare function getResolvedHttpConfig(userConfig: HttpTransportConfig | undefined): {
|
|
3
|
+
port: number;
|
|
4
|
+
host: string;
|
|
5
|
+
bodySizeLimit: number;
|
|
6
|
+
debug: boolean;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
cors: {
|
|
9
|
+
origin?: string | boolean | string[] | undefined;
|
|
10
|
+
methods?: string | string[] | undefined;
|
|
11
|
+
allowedHeaders?: string | string[] | undefined;
|
|
12
|
+
exposedHeaders?: string | string[] | undefined;
|
|
13
|
+
credentials?: boolean | undefined;
|
|
14
|
+
maxAge?: number | undefined;
|
|
15
|
+
};
|
|
16
|
+
} | null;
|
|
17
|
+
export declare function getResolvedCorsConfig(httpConfig: HttpTransportConfig | null): CorsConfig;
|
|
18
|
+
export declare function getResolvedPathsConfig(userConfig: any): PathsConfig;
|
|
19
|
+
export declare function getResolvedOAuthConfig(userConfig: any): OAuthConfig | null;
|
|
20
|
+
export declare function getResolvedStdioConfig(userConfig: any): StdioTransportConfig | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResolvedHttpConfig = getResolvedHttpConfig;
|
|
4
|
+
exports.getResolvedCorsConfig = getResolvedCorsConfig;
|
|
5
|
+
exports.getResolvedPathsConfig = getResolvedPathsConfig;
|
|
6
|
+
exports.getResolvedOAuthConfig = getResolvedOAuthConfig;
|
|
7
|
+
exports.getResolvedStdioConfig = getResolvedStdioConfig;
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
function getResolvedHttpConfig(userConfig) {
|
|
10
|
+
if (typeof userConfig === "boolean") {
|
|
11
|
+
return userConfig ? constants_1.DEFAULT_HTTP_CONFIG : null;
|
|
12
|
+
}
|
|
13
|
+
if (typeof userConfig === "object") {
|
|
14
|
+
return { ...constants_1.DEFAULT_HTTP_CONFIG, ...userConfig };
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function getResolvedCorsConfig(httpConfig) {
|
|
19
|
+
if (typeof httpConfig === "object" && httpConfig?.cors) {
|
|
20
|
+
return { ...constants_1.DEFAULT_HTTP_CONFIG.cors, ...httpConfig.cors };
|
|
21
|
+
}
|
|
22
|
+
return constants_1.DEFAULT_HTTP_CONFIG.cors;
|
|
23
|
+
}
|
|
24
|
+
function getResolvedPathsConfig(userConfig) {
|
|
25
|
+
const userPaths = userConfig?.paths;
|
|
26
|
+
if (!userPaths) {
|
|
27
|
+
return constants_1.DEFAULT_PATHS_CONFIG;
|
|
28
|
+
}
|
|
29
|
+
return { ...constants_1.DEFAULT_PATHS_CONFIG, ...userPaths };
|
|
30
|
+
}
|
|
31
|
+
function getResolvedOAuthConfig(userConfig) {
|
|
32
|
+
return userConfig?.experimental?.oauth || null;
|
|
33
|
+
}
|
|
34
|
+
function getResolvedStdioConfig(userConfig) {
|
|
35
|
+
return userConfig?.stdio || constants_1.DEFAULT_STDIO_CONFIG;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateEnvCode(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateImportCode(): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateImportCode = generateImportCode;
|
|
4
|
+
const compiler_context_1 = require("./compiler-context");
|
|
5
|
+
function generateImportCode() {
|
|
6
|
+
const { toolPaths, hasMiddleware } = compiler_context_1.compilerContext.getContext();
|
|
7
|
+
const importToolsCode = Array.from(toolPaths)
|
|
8
|
+
.map((p) => {
|
|
9
|
+
const path = p.replace(/\\/g, "/");
|
|
10
|
+
const relativePath = `../${path}`;
|
|
11
|
+
return `"${path}": () => import("${relativePath}"),`;
|
|
12
|
+
})
|
|
13
|
+
.join("\n");
|
|
14
|
+
const importMiddlewareCode = hasMiddleware
|
|
15
|
+
? `export const middleware = () => import("../src/middleware.ts");`
|
|
16
|
+
: "";
|
|
17
|
+
return `
|
|
18
|
+
export const tools = {
|
|
19
|
+
${importToolsCode}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
${importMiddlewareCode}
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getEntries = getEntries;
|
|
7
|
+
const constants_1 = require("../../utils/constants");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
/** Get what packages are gonna be built by xmcp */
|
|
10
|
+
function getEntries(xmcpConfig) {
|
|
11
|
+
const entries = {};
|
|
12
|
+
if (xmcpConfig.stdio) {
|
|
13
|
+
entries.stdio = path_1.default.join(constants_1.runtimeFolderPath, "stdio.js");
|
|
14
|
+
}
|
|
15
|
+
if (xmcpConfig["http"]) {
|
|
16
|
+
// non adapter mode
|
|
17
|
+
if (!xmcpConfig.experimental?.adapter) {
|
|
18
|
+
entries["http"] = path_1.default.join(constants_1.runtimeFolderPath, "http.js");
|
|
19
|
+
}
|
|
20
|
+
// adapter mode enabled
|
|
21
|
+
if (xmcpConfig.experimental?.adapter === "express") {
|
|
22
|
+
entries["adapter"] = path_1.default.join(constants_1.runtimeFolderPath, "adapter-express.js");
|
|
23
|
+
}
|
|
24
|
+
if (xmcpConfig.experimental?.adapter === "nextjs") {
|
|
25
|
+
entries["adapter"] = path_1.default.join(constants_1.runtimeFolderPath, "adapter-nextjs.js");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return entries;
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Configuration } from "webpack";
|
|
2
|
+
/**
|
|
3
|
+
* This function will decide is a file is bundled by xmcp compiler or not.
|
|
4
|
+
* We want to avoid building node modules.
|
|
5
|
+
* When using Next.js, we want to avoid building tools/*, since the nexjs compiler will handle that code.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getExternals(): Configuration["externals"];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExternals = getExternals;
|
|
4
|
+
const compiler_context_1 = require("../compiler-context");
|
|
5
|
+
const module_1 = require("module");
|
|
6
|
+
const plugins_1 = require("./plugins");
|
|
7
|
+
/**
|
|
8
|
+
* This function will decide is a file is bundled by xmcp compiler or not.
|
|
9
|
+
* We want to avoid building node modules.
|
|
10
|
+
* When using Next.js, we want to avoid building tools/*, since the nexjs compiler will handle that code.
|
|
11
|
+
*/
|
|
12
|
+
function getExternals() {
|
|
13
|
+
const xmcpConfig = (0, compiler_context_1.getXmcpConfig)();
|
|
14
|
+
const replacedImports = new Set();
|
|
15
|
+
return [
|
|
16
|
+
function (data, callback) {
|
|
17
|
+
const { request } = data;
|
|
18
|
+
if (!request) {
|
|
19
|
+
return callback();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Externalize Node.js built-in modules, bundle everything else
|
|
23
|
+
*/
|
|
24
|
+
const isBuiltinModule = module_1.builtinModules.includes(request) ||
|
|
25
|
+
module_1.builtinModules.includes(request.replace(/^node:/, ""));
|
|
26
|
+
if (isBuiltinModule) {
|
|
27
|
+
return callback(null, `commonjs ${request}`);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Externalize packages with native binaries (.node files)
|
|
31
|
+
* These can't be bundled by webpack and must be external
|
|
32
|
+
*/
|
|
33
|
+
const nativeBinaryPackages = [
|
|
34
|
+
'fsevents',
|
|
35
|
+
'cpu-features',
|
|
36
|
+
'@swc/wasm',
|
|
37
|
+
'@swc/core-darwin-arm64',
|
|
38
|
+
'@swc/core-darwin-x64',
|
|
39
|
+
'@swc/core-linux-arm64-gnu',
|
|
40
|
+
'@swc/core-linux-arm64-musl',
|
|
41
|
+
'@swc/core-linux-x64-gnu',
|
|
42
|
+
'@swc/core-linux-x64-musl',
|
|
43
|
+
'@swc/core-win32-arm64-msvc',
|
|
44
|
+
'@swc/core-win32-ia32-msvc',
|
|
45
|
+
'@swc/core-win32-x64-msvc',
|
|
46
|
+
];
|
|
47
|
+
if (nativeBinaryPackages.some(pkg => request === pkg || request.startsWith(`${pkg}/`))) {
|
|
48
|
+
return callback(null, `commonjs ${request}`);
|
|
49
|
+
}
|
|
50
|
+
// Check if request is inside .xmcp folder - if so, bundle it
|
|
51
|
+
if (request.includes(".xmcp")) {
|
|
52
|
+
return callback();
|
|
53
|
+
}
|
|
54
|
+
// Check if request is a runtime file - if so, bundle it
|
|
55
|
+
const filesToInclude = [...Object.keys(plugins_1.runtimeFiles), "import-map.js"];
|
|
56
|
+
for (const file of filesToInclude) {
|
|
57
|
+
if (request.endsWith(`./${file}`) ||
|
|
58
|
+
request.endsWith(`./${file.replace(".js", "")}`)) {
|
|
59
|
+
return callback();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* When using Next.js, we want them to bundle the code for the tool file,
|
|
64
|
+
* so just keep the reference for the import as external
|
|
65
|
+
*/
|
|
66
|
+
if (xmcpConfig.experimental?.adapter === "nextjs") {
|
|
67
|
+
// Bundle imports from the same folder
|
|
68
|
+
if (request.startsWith("./")) {
|
|
69
|
+
return callback();
|
|
70
|
+
}
|
|
71
|
+
let pathRequest = request;
|
|
72
|
+
/**
|
|
73
|
+
* Paths are relative to the .xmcp/nextjs-adapter folder,
|
|
74
|
+
* but we are building in .xmcp/adapter/index.js, so we need to go up 2 levels
|
|
75
|
+
*/
|
|
76
|
+
if (request.startsWith("../")) {
|
|
77
|
+
// Only replace the import if it hasn't been replaced yet
|
|
78
|
+
if (!replacedImports.has(request)) {
|
|
79
|
+
pathRequest = pathRequest.replace("../", "../../");
|
|
80
|
+
replacedImports.add(pathRequest);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return callback(null, `commonjs ${pathRequest}`);
|
|
84
|
+
}
|
|
85
|
+
callback();
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { XmcpConfigOuputSchema } from "../config";
|
|
2
|
+
import { InjectedVariables } from "../config/injection";
|
|
3
|
+
/**
|
|
4
|
+
* The XMCP runtime uses variables that are not defined by default.
|
|
5
|
+
*
|
|
6
|
+
* This utility will define those variables based on the user's config.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getInjectedVariables(xmcpConfig: XmcpConfigOuputSchema): InjectedVariables;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInjectedVariables = getInjectedVariables;
|
|
4
|
+
const compiler_context_1 = require("../compiler-context");
|
|
5
|
+
const injection_1 = require("../config/injection");
|
|
6
|
+
/**
|
|
7
|
+
* The XMCP runtime uses variables that are not defined by default.
|
|
8
|
+
*
|
|
9
|
+
* This utility will define those variables based on the user's config.
|
|
10
|
+
*/
|
|
11
|
+
function getInjectedVariables(xmcpConfig) {
|
|
12
|
+
const { mode } = compiler_context_1.compilerContext.getContext();
|
|
13
|
+
const httpVariables = (0, injection_1.injectHttpVariables)(xmcpConfig.http, mode);
|
|
14
|
+
const corsVariables = (0, injection_1.injectCorsVariables)(xmcpConfig.http);
|
|
15
|
+
const oauthVariables = (0, injection_1.injectOAuthVariables)(xmcpConfig);
|
|
16
|
+
const pathsVariables = (0, injection_1.injectPathsVariables)(xmcpConfig);
|
|
17
|
+
const stdioVariables = (0, injection_1.injectStdioVariables)(xmcpConfig.stdio);
|
|
18
|
+
return {
|
|
19
|
+
...httpVariables,
|
|
20
|
+
...corsVariables,
|
|
21
|
+
...oauthVariables,
|
|
22
|
+
...pathsVariables,
|
|
23
|
+
...stdioVariables,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Configuration } from "webpack";
|
|
2
|
+
import { XmcpConfigOuputSchema } from "../config";
|
|
3
|
+
/** Creates the webpack configuration that xmcp will use to bundle the user's code */
|
|
4
|
+
export declare function getWebpackConfig(xmcpConfig: XmcpConfigOuputSchema): Configuration;
|