* 保存配置
()
| 46 | * 保存配置 |
| 47 | */ |
| 48 | private saveConfig(): void { |
| 49 | try { |
| 50 | const dir = this.configPath.substring(0, this.configPath.lastIndexOf('/')); |
| 51 | if (!existsSync(dir)) { |
| 52 | const { mkdirSync } = require('fs'); |
| 53 | mkdirSync(dir, { recursive: true }); |
| 54 | } |
| 55 | writeFileSync(this.configPath, JSON.stringify(this.config, null, 2)); |
| 56 | } catch (error) { |
| 57 | throw new Error(`Failed to save MCP config: ${error}`); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * 获取默认配置 |
no outgoing calls
no test coverage detected