MCPcopy Create free account
hub / github.com/echoVic/blade-code / loadConfig

Method loadConfig

src/mcp/config/MCPConfig.ts:21–43  ·  view source on GitHub ↗

* 加载配置

()

Source from the content-addressed store, hash-verified

19 * 加载配置
20 */
21 private loadConfig(): void {
22 if (existsSync(this.configPath)) {
23 try {
24 const content = readFileSync(this.configPath, 'utf-8');
25 this.config = JSON.parse(content);
26 } catch (error) {
27 console.warn('Failed to load MCP config, using defaults');
28 this.config = this.getDefaultConfig();
29 }
30 } else {
31 this.config = this.getDefaultConfig();
32 }
33
34 // 确保配置结构完整
35 this.config = {
36 ...this.getDefaultConfig(),
37 ...this.config,
38 servers: {
39 ...this.getDefaultConfig().servers,
40 ...this.config.servers,
41 },
42 };
43 }
44
45 /**
46 * 保存配置

Callers 1

constructorMethod · 0.95

Calls 2

getDefaultConfigMethod · 0.95
warnMethod · 0.45

Tested by

no test coverage detected