xmcp
Version:
The TypeScript MCP framework
410 lines (409 loc) • 16.2 kB
TypeScript
import type { RspackOptions } from "@rspack/core";
import { z } from "zod/v3";
/**
* xmcp Config schema
*/
export declare const configSchema: z.ZodObject<{
stdio: z.ZodOptional<z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodObject<{
debug: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
silent: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
debug?: boolean | undefined;
silent?: boolean | undefined;
}, {
debug?: boolean | undefined;
silent?: boolean | undefined;
}>, {
debug: boolean;
silent: boolean;
}, {
debug?: boolean | undefined;
silent?: boolean | undefined;
}>]>>>;
http: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodObject<{
port: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
host: z.ZodOptional<z.ZodDefault<z.ZodString>>;
bodySizeLimit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
debug: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
endpoint: z.ZodOptional<z.ZodDefault<z.ZodString>>;
maxSubscriptions: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
cors: z.ZodOptional<z.ZodEffects<z.ZodObject<{
origin: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodBoolean]>>>;
methods: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
allowedHeaders: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
exposedHeaders: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
credentials: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
maxAge: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
}, {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
}>, {
origin: string | boolean | string[];
methods: string | string[];
allowedHeaders: string | string[];
exposedHeaders: string | string[];
credentials: boolean;
maxAge: number;
}, {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
port?: number | undefined;
host?: string | undefined;
bodySizeLimit?: number | undefined;
debug?: boolean | undefined;
endpoint?: string | undefined;
maxSubscriptions?: number | undefined;
cors?: {
origin: string | boolean | string[];
methods: string | string[];
allowedHeaders: string | string[];
exposedHeaders: string | string[];
credentials: boolean;
maxAge: number;
} | undefined;
}, {
port?: number | undefined;
host?: string | undefined;
bodySizeLimit?: number | undefined;
debug?: boolean | undefined;
endpoint?: string | undefined;
maxSubscriptions?: number | undefined;
cors?: {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
} | undefined;
}>, {
port: number;
host: string;
bodySizeLimit: number;
debug: boolean;
endpoint: string;
cors: {
origin: string | boolean | string[];
methods: string | string[];
allowedHeaders: string | string[];
exposedHeaders: string | string[];
credentials: boolean;
maxAge: number;
};
maxSubscriptions?: number | undefined;
}, {
port?: number | undefined;
host?: string | undefined;
bodySizeLimit?: number | undefined;
debug?: boolean | undefined;
endpoint?: string | undefined;
maxSubscriptions?: number | undefined;
cors?: {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
} | undefined;
}>]>>;
experimental: z.ZodOptional<z.ZodObject<{
adapter: z.ZodOptional<z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack", "hono", "sveltekit", "nuxt", "react-router", "astro"]>>;
inferToolSchemas: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
inferToolSchemas?: boolean | undefined;
}, {
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
inferToolSchemas?: boolean | undefined;
}>>;
paths: z.ZodOptional<z.ZodEffects<z.ZodObject<{
tools: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>;
prompts: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>;
resources: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>;
}, "strip", z.ZodTypeAny, {
tools?: string | boolean | undefined;
prompts?: string | boolean | undefined;
resources?: string | boolean | undefined;
}, {
tools?: string | boolean | undefined;
prompts?: string | boolean | undefined;
resources?: string | boolean | undefined;
}>, {
tools: string | boolean;
prompts: string | boolean;
resources: string | boolean;
}, {
tools?: string | boolean | undefined;
prompts?: string | boolean | undefined;
resources?: string | boolean | undefined;
}>>;
bundler: z.ZodOptional<z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodAny>>>;
template: z.ZodOptional<z.ZodEffects<z.ZodObject<{
name: z.ZodOptional<z.ZodDefault<z.ZodString>>;
description: z.ZodOptional<z.ZodDefault<z.ZodString>>;
icons: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
src: z.ZodString;
mimeType: z.ZodOptional<z.ZodString>;
sizes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
theme: z.ZodOptional<z.ZodEnum<["light", "dark"]>>;
}, "strip", z.ZodTypeAny, {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}, {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}>, "many">>>;
instructions: z.ZodOptional<z.ZodOptional<z.ZodString>>;
homePage: z.ZodOptional<z.ZodOptional<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
name?: string | undefined;
description?: string | undefined;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
}, {
name?: string | undefined;
description?: string | undefined;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
}>, {
name: string;
description: string;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
}, {
name?: string | undefined;
description?: string | undefined;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
}>>;
typescript: z.ZodOptional<z.ZodEffects<z.ZodObject<{
skipTypeCheck: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
skipTypeCheck?: boolean | undefined;
}, {
skipTypeCheck?: boolean | undefined;
}>, {
skipTypeCheck: boolean;
}, {
skipTypeCheck?: boolean | undefined;
}>>;
observability: z.ZodOptional<z.ZodObject<{
enabled: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
enabled: boolean;
}, {
enabled: boolean;
}>>;
components: z.ZodOptional<z.ZodObject<{
include: z.ZodOptional<z.ZodObject<{
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strict", z.ZodTypeAny, {
tags?: string[] | undefined;
names?: string[] | undefined;
}, {
tags?: string[] | undefined;
names?: string[] | undefined;
}>>;
exclude: z.ZodOptional<z.ZodObject<{
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strict", z.ZodTypeAny, {
tags?: string[] | undefined;
names?: string[] | undefined;
}, {
tags?: string[] | undefined;
names?: string[] | undefined;
}>>;
}, "strict", z.ZodTypeAny, {
include?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
exclude?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
}, {
include?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
exclude?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
stdio?: boolean | {
debug: boolean;
silent: boolean;
} | undefined;
http?: boolean | {
port: number;
host: string;
bodySizeLimit: number;
debug: boolean;
endpoint: string;
cors: {
origin: string | boolean | string[];
methods: string | string[];
allowedHeaders: string | string[];
exposedHeaders: string | string[];
credentials: boolean;
maxAge: number;
};
maxSubscriptions?: number | undefined;
} | undefined;
experimental?: {
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
inferToolSchemas?: boolean | undefined;
} | undefined;
paths?: {
tools: string | boolean;
prompts: string | boolean;
resources: string | boolean;
} | undefined;
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
template?: {
name: string;
description: string;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
} | undefined;
typescript?: {
skipTypeCheck: boolean;
} | undefined;
observability?: {
enabled: boolean;
} | undefined;
components?: {
include?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
exclude?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
} | undefined;
}, {
stdio?: boolean | {
debug?: boolean | undefined;
silent?: boolean | undefined;
} | undefined;
http?: boolean | {
port?: number | undefined;
host?: string | undefined;
bodySizeLimit?: number | undefined;
debug?: boolean | undefined;
endpoint?: string | undefined;
maxSubscriptions?: number | undefined;
cors?: {
origin?: string | boolean | string[] | undefined;
methods?: string | string[] | undefined;
allowedHeaders?: string | string[] | undefined;
exposedHeaders?: string | string[] | undefined;
credentials?: boolean | undefined;
maxAge?: number | undefined;
} | undefined;
} | undefined;
experimental?: {
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
inferToolSchemas?: boolean | undefined;
} | undefined;
paths?: {
tools?: string | boolean | undefined;
prompts?: string | boolean | undefined;
resources?: string | boolean | undefined;
} | undefined;
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
template?: {
name?: string | undefined;
description?: string | undefined;
icons?: {
src: string;
mimeType?: string | undefined;
sizes?: string[] | undefined;
theme?: "light" | "dark" | undefined;
}[] | undefined;
instructions?: string | undefined;
homePage?: string | undefined;
} | undefined;
typescript?: {
skipTypeCheck?: boolean | undefined;
} | undefined;
observability?: {
enabled: boolean;
} | undefined;
components?: {
include?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
exclude?: {
tags?: string[] | undefined;
names?: string[] | undefined;
} | undefined;
} | undefined;
}>;
type BundlerConfigType = {
bundler?: (config: RspackOptions) => RspackOptions;
};
export type XmcpConfigInputSchema = Omit<z.input<typeof configSchema>, "bundler"> & BundlerConfigType;
export type XmcpConfigOutputSchema = Omit<z.output<typeof configSchema>, "bundler"> & BundlerConfigType;
export type { ResolvedExperimentalConfig, ResolvedHttpConfig, ResolvedPathsConfig, ResolvedStdioConfig, } from "./utils";
export type { BundlerConfig, ComponentsConfig, ComponentSelector, CorsConfig, ExperimentalConfig, HttpTransportConfig, PathsConfig, StdioTransportConfig, TemplateConfig, TypescriptConfig, } from "./schemas";
export { getResolvedCorsConfig, getResolvedExperimentalConfig, getResolvedHttpConfig, getResolvedPathsConfig, getResolvedStdioConfig, getResolvedTemplateConfig, getResolvedTypescriptConfig, } from "./utils";