Skip to content

Commit d6a9e0f

Browse files
authored
Merge pull request RooCodeInc#1552 from RooVetGit/mcp-home-dir
fix: update MCP servers directory path for platform compatibility
2 parents 00bca30 + 7462906 commit d6a9e0f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,11 +2077,24 @@ export class ClineProvider implements vscode.WebviewViewProvider {
20772077
// MCP
20782078

20792079
async ensureMcpServersDirectoryExists(): Promise<string> {
2080-
const mcpServersDir = path.join(os.homedir(), "Documents", "Cline", "MCP")
2080+
// Get platform-specific application data directory
2081+
let mcpServersDir: string
2082+
if (process.platform === "win32") {
2083+
// Windows: %APPDATA%\Roo-Code\MCP
2084+
mcpServersDir = path.join(os.homedir(), "AppData", "Roaming", "Roo-Code", "MCP")
2085+
} else if (process.platform === "darwin") {
2086+
// macOS: ~/Documents/Cline/MCP
2087+
mcpServersDir = path.join(os.homedir(), "Documents", "Cline", "MCP")
2088+
} else {
2089+
// Linux: ~/.local/share/Cline/MCP
2090+
mcpServersDir = path.join(os.homedir(), ".local", "share", "Roo-Code", "MCP")
2091+
}
2092+
20812093
try {
20822094
await fs.mkdir(mcpServersDir, { recursive: true })
20832095
} catch (error) {
2084-
return "~/Documents/Cline/MCP" // in case creating a directory in documents fails for whatever reason (e.g. permissions) - this is fine since this path is only ever used in the system prompt
2096+
// Fallback to a relative path if directory creation fails
2097+
return path.join(os.homedir(), ".roo-code", "mcp")
20852098
}
20862099
return mcpServersDir
20872100
}

0 commit comments

Comments
 (0)