Skip to main content

XmcpConfig

The main configuration object for xmcp. All fields are optional.
stdio
StdioTransportConfig
STDIO transport configuration. See STDIO Transport for details.
http
HttpTransportConfig
HTTP transport configuration. See HTTP Transport for details.
paths
PathsConfig
Custom paths for tools, prompts, and resources. See Paths for details.
experimental
ExperimentalConfig
Experimental features and adapters. See Experimental for details.
bundler
(config: RspackOptions) => RspackOptions
Custom bundler configuration function. Receives the default Rspack configuration and should return the modified configuration.
template
TemplateConfig
Template configuration for code generation.
typescript
TypescriptConfig
TypeScript compiler configuration options.

Config File Structure

Create an xmcp.config.ts file in your project root:
import type { XmcpConfigInputSchema } from "xmcp";

const config: XmcpConfigInputSchema = {
  http: {
    port: 3001,
    host: "127.0.0.1",
    endpoint: "/mcp",
    cors: {
      origin: "*",
      credentials: false,
    },
  },
  stdio: true,
  paths: {
    tools: "src/tools",
    prompts: "src/prompts",
    resources: "src/resources",
  },
  experimental: {
    adapter: "express",
  },
};

export default config;

Boolean Shortcuts

Many configuration options accept boolean values as shortcuts:
  • http: true - Enable HTTP transport with defaults
  • http: false - Disable HTTP transport
  • stdio: true - Enable STDIO transport with defaults
  • stdio: false - Disable STDIO transport

Type Exports

import type {
  XmcpConfigInputSchema,
  XmcpConfigOutputSchema,
  HttpTransportConfig,
  StdioTransportConfig,
  PathsConfig,
  ExperimentalConfig,
  CorsConfig,
} from "xmcp";

Build docs developers (and LLMs) love