/** * Client module for MCP Clients * * Common interfaces and types for MCP client implementations */ import { VERSION } from '../common/version.js'; import type { ConfigureOptions } from '../configure.js'; export { VERSION }; export interface MCPConfigPath { configDir: string; configFileName: string; } /** * MCP Server configuration */ export interface MCPServerConfig { type?: string; command: string; args: Array; env: Record; } /** * Standard MCP configuration format (Claude, Cursor, Windsurf) */ export interface StandardMCPConfig { mcpServers: { glean: MCPServerConfig; [key: string]: MCPServerConfig; }; } /** * VS Code global configuration format */ export interface VSCodeGlobalConfig { mcp: { servers: { glean: MCPServerConfig; [key: string]: MCPServerConfig; }; }; [key: string]: unknown; } /** * VS Code workspace configuration format */ export interface VSCodeWorkspaceConfig { servers: { glean: MCPServerConfig; [key: string]: MCPServerConfig; }; [key: string]: unknown; } /** * Union of all possible MCP configuration formats */ export type MCPConfig = StandardMCPConfig | VSCodeGlobalConfig | VSCodeWorkspaceConfig; /** * Generic config file contents that might contain MCP configuration * Represents the parsed contents of client config files like VS Code settings.json */ export type ConfigFileContents = Record & Partial; /** * Interface for MCP client configuration details */ export interface MCPClientConfig { /** Display name for the client */ displayName: string; /** * Path to the config file, supports OS-specific paths and client-specific options. * If GLEAN_MCP_CONFIG_DIR environment variable is set, it will override the default path. */ configFilePath: (homedir: string, options?: ConfigureOptions) => string; /** Function to generate the config JSON for this client */ configTemplate: (subdomainOrUrl?: string, apiToken?: string, options?: ConfigureOptions) => MCPConfig; /** Instructions displayed after successful configuration */ successMessage: (configPath: string, options?: ConfigureOptions) => string; /** * Check if configuration exists in the existing config object * @param existingConfig Existing configuration object from the config file * @param options Additional options that may affect detection logic * @returns boolean indicating if configuration exists */ hasExistingConfig: (existingConfig: ConfigFileContents, options?: ConfigureOptions) => boolean; /** * Update existing configuration with new config * @param existingConfig Existing configuration object to update * @param newConfig New configuration to merge with existing * @param options Additional options that may affect merging logic * @returns Updated configuration object */ updateConfig: (existingConfig: ConfigFileContents, newConfig: MCPConfig, options?: ConfigureOptions) => ConfigFileContents; } /** * Creates a standard MCP server configuration template */ export declare function createConfigTemplate(instanceOrUrl?: string, apiToken?: string): StandardMCPConfig; /** * Creates a standard file path resolver that respects GLEAN_MCP_CONFIG_DIR */ export declare function createStandardPathResolver(configPath: MCPConfigPath): (homedir: string) => string; /** * Creates a success message with standardized format */ export declare function createSuccessMessage(clientName: string, configPath: string, instructions: string[]): string; /** * Creates a base client configuration that can be extended */ export declare function createBaseClient(displayName: string, configPath: MCPConfigPath, instructions: string[], pathResolverOverride?: (homedir: string) => string): MCPClientConfig; /** * Map of all available MCP clients * Will be populated dynamically by scanning the client directory */ export declare const availableClients: Record; export declare function ensureClientsLoaded(): Promise; //# sourceMappingURL=index.d.ts.map