Skip to content

Commit 0f0432c

Browse files
author
Eric Wheeler
committed
fix: use pretty-printing for .roo/mcp.json
Support user-serviceable .roo/mcp.json file with pretty-printing - Remove safeWriteJson in favor of direct JSON.stringify to pretty-print user serviceable MCP configuration files Cc: @mrubens Signed-off-by: Eric Wheeler <[email protected]>
1 parent 7aae0d5 commit 0f0432c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/services/mcp/McpHub.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { safeWriteJson } from "../../utils/safeWriteJson"
21
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
32
import { StdioClientTransport, getDefaultEnvironment } from "@modelcontextprotocol/sdk/client/stdio.js"
43
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"
@@ -1345,7 +1344,7 @@ export class McpHub {
13451344
mcpServers: config.mcpServers,
13461345
}
13471346

1348-
await safeWriteJson(configPath, updatedConfig)
1347+
await fs.writeFile(configPath, JSON.stringify(updatedConfig, null, 2))
13491348
}
13501349

13511350
public async updateServerTimeout(
@@ -1423,7 +1422,7 @@ export class McpHub {
14231422
mcpServers: config.mcpServers,
14241423
}
14251424

1426-
await safeWriteJson(configPath, updatedConfig)
1425+
await fs.writeFile(configPath, JSON.stringify(updatedConfig, null, 2))
14271426

14281427
// Update server connections with the correct source
14291428
await this.updateServerConnections(config.mcpServers, serverSource)
@@ -1568,7 +1567,7 @@ export class McpHub {
15681567
targetList.splice(toolIndex, 1)
15691568
}
15701569

1571-
await safeWriteJson(normalizedPath, config)
1570+
await fs.writeFile(normalizedPath, JSON.stringify(config, null, 2))
15721571

15731572
if (connection) {
15741573
connection.server.tools = await this.fetchToolsList(serverName, source)

0 commit comments

Comments
 (0)