UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

175 lines (174 loc) 4.49 kB
/** * Node.js Runtime Configuration * * Platform-specific configuration for MCP-I running on Node.js. * Extends the base MCP-I configuration with Node-specific runtime concerns. * * @module @kya-os/mcp-i/config */ import type { MCPIConfig, ToolProtectionSourceConfig } from '@kya-os/contracts/config'; /** * Node.js-specific runtime configuration * Extends MCPIConfig with Node.js platform concerns */ export interface NodeRuntimeConfig extends MCPIConfig { /** * Node.js-specific server configuration */ server?: { /** * Port to listen on * @default 3000 */ port?: number; /** * Host to bind to * @default '0.0.0.0' */ host?: string; /** * Enable CORS * @default true */ cors?: boolean; /** * Request timeout in milliseconds * @default 30000 */ timeout?: number; }; /** * Storage configuration for Node.js */ storage?: { /** * Storage type */ type: 'memory' | 'redis' | 'postgres' | 'mongodb'; /** * Connection options */ connection?: { url?: string; host?: string; port?: number; database?: string; username?: string; password?: string; }; }; /** * Tool protection configuration * Node.js can use all source types including file-based */ toolProtection?: ToolProtectionSourceConfig; /** * Node.js-specific environment configuration */ nodeEnv?: { /** * Node environment (development, production, test) * @default process.env.NODE_ENV || 'development' */ environment?: 'development' | 'production' | 'test'; /** * Enable Node.js-specific debug logging * @default false */ debug?: boolean; /** * Custom environment variables prefix * @default 'MCPI_' */ envPrefix?: string; }; } /** * Node.js build-time configuration * Used by the builder to configure compiled MCP-I servers */ export interface NodeBuildConfig { /** * Output directory for build artifacts * @default 'dist' */ outputDir?: string; /** * Enable source maps * @default true in development, false in production */ sourceMaps?: boolean; /** * Bundle external dependencies * @default false */ bundleDependencies?: boolean; /** * Tool registry configuration (for compiled bundles) */ toolRegistry?: { /** * Include tool registry in bundle * @default true */ include?: boolean; /** * Path to tool registry file * @default './tool-registry.json' */ path?: string; /** * Generate types for tool registry * @default true */ generateTypes?: boolean; }; /** * Optimization settings */ optimization?: { /** * Minify code * @default true in production */ minify?: boolean; /** * Tree-shake unused code * @default true */ treeShaking?: boolean; /** * Target Node.js version * @default 'node18' */ target?: string; }; } /** * Complete Node.js configuration * Combines runtime and build configurations */ export interface NodeConfig { runtime?: NodeRuntimeConfig; build?: NodeBuildConfig; } /** * Re-export base types for convenience with aliases to avoid conflicts */ export type { MCPIConfig, MCPIBaseConfig, RuntimeIdentityConfig as BaseIdentityConfig, ProofingConfig, DelegationConfig, ToolProtectionSourceConfig } from '@kya-os/contracts/config'; /** * Default Node.js runtime configuration */ export declare const defaultNodeRuntimeConfig: NodeRuntimeConfig; /** * Default Node.js build configuration */ export declare const defaultNodeBuildConfig: NodeBuildConfig; /** * Create a Node.js runtime configuration with defaults */ export declare function createNodeRuntimeConfig(config?: Partial<NodeRuntimeConfig>): NodeRuntimeConfig; /** * Create a Node.js build configuration with defaults */ export declare function createNodeBuildConfig(config?: Partial<NodeBuildConfig>): NodeBuildConfig;