/** * Profile Manager for NCP * Manages different profiles with their MCP configurations */ import type { OAuthConfig } from '../auth/oauth-device-flow.js'; interface MCPConfig { command?: string; args?: string[]; env?: Record; url?: string; auth?: { type: 'oauth' | 'bearer' | 'apiKey' | 'basic'; oauth?: OAuthConfig; token?: string; username?: string; password?: string; }; } interface Profile { name: string; description: string; mcpServers: Record; metadata: { created: string; modified: string; }; } export declare class ProfileManager { private profilesDir; private profiles; private credentialStore; constructor(); /** * Store sensitive credentials in secure storage and replace with references */ private storeCredentials; /** * Load actual credentials from secure storage if references are found */ private loadCredentials; initialize(skipAutoImport?: boolean): Promise; /** * Auto-sync MCPs from any MCP client on every startup * Detects both config files (JSON/TOML) and extensions (.dxt/dxt bundles) * Imports missing MCPs using add command for cache coherence * * Supports: Claude Desktop, Perplexity, Cursor, Cline, Continue, and more * * How it works: * 1. Client identifies itself via MCP initialize request (clientInfo.name) * 2. Name is matched against CLIENT_REGISTRY (with normalization) * 3. Client-specific importer reads config and extensions * 4. Missing MCPs are added to 'all' profile * * ⚠️ CRITICAL: This MUST target the 'all' profile - DO NOT CHANGE! * Auto-imported MCPs go to 'all' to maintain consistency with manual `ncp add`. */ tryAutoImportFromClient(clientName: string, elicitationServer?: any, notificationManager?: any): Promise; /** * Ask user about replacing client config with NCP-only (optional optimization) * Only triggered after successful auto-import */ private maybeReplaceClientConfig; /** * Ask user for permission to replace config (with timeout) */ private askConfigReplacementPermission; /** * Queue notification about config optimization opportunity * (for non-Claude Desktop clients that can't disable MCPs via UI) */ private queueConfigOptimizationNotification; /** * Backup and replace client config with NCP-only */ private backupAndReplaceConfig; private backupClientConfigFile; private readJsonConfig; private buildNcpServerDefinition; private resolveNcpLaunchCommand; private getNestedProperty; private setNestedProperty; private normalizeClientName; private loadProfiles; /** * ⚠️ CRITICAL: Profile name MUST be 'all' - DO NOT CHANGE! * * This creates the universal 'all' profile that: * 1. Is the default target for `ncp add`, `ncp config import`, auto-import * 2. Merges all MCPs from other profiles at runtime * 3. Is used by default when running NCP as MCP server * * DO NOT change the name to 'default' or anything else - it will break: * - All CLI commands that depend on 'all' being the default * - Auto-import from Claude Desktop * - User expectations (docs say 'all' is the universal profile) */ private createDefaultProfile; saveProfile(profile: Profile): Promise; getProfile(name: string): Promise; addMCPToProfile(profileName: string, mcpName: string, config: MCPConfig): Promise; removeMCPFromProfile(profileName: string, mcpName: string): Promise; listProfiles(): string[]; getProfileMCPs(profileName: string): Promise | undefined>; getConfigPath(): string; getProfilePath(profileName: string): string; /** * Migrate all plain-text credentials in a profile to secure storage */ migrateProfileCredentials(profileName: string): Promise<{ migrated: number; errors: number; }>; /** * Migrate all plain-text credentials across all profiles */ migrateAllCredentials(): Promise<{ migrated: number; errors: number; }>; /** * Migrate runtime commands in a profile (npx → npx.cmd on Windows) */ migrateProfileRuntimeCommands(profileName: string): Promise<{ migrated: number; errors: number; }>; /** * Migrate runtime commands across all profiles */ migrateAllRuntimeCommands(): Promise<{ migrated: number; errors: number; }>; } export default ProfileManager; //# sourceMappingURL=profile-manager.d.ts.map