Skip to content

Commit 102a996

Browse files
committed
fix: update MCP servers directory path for platform compatibility
1 parent 2243036 commit 102a996

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
@@ -1971,11 +1971,24 @@ export class ClineProvider implements vscode.WebviewViewProvider {
19711971
// MCP
19721972

19731973
async ensureMcpServersDirectoryExists(): Promise<string> {
1974-
const mcpServersDir = path.join(os.homedir(), "Documents", "Cline", "MCP")
1974+
// Get platform-specific application data directory
1975+
let mcpServersDir: string
1976+
if (process.platform === "win32") {
1977+
// Windows: %APPDATA%\Cline\MCP
1978+
mcpServersDir = path.join(os.homedir(), "AppData", "Roaming", "Roo-Code", "MCP")
1979+
} else if (process.platform === "darwin") {
1980+
// macOS: ~/Documents/Cline/MCP
1981+
mcpServersDir = path.join(os.homedir(), "Documents", "Cline", "MCP")
1982+
} else {
1983+
// Linux: ~/.local/share/Cline/MCP
1984+
mcpServersDir = path.join(os.homedir(), ".local", "share", "Roo-Code", "MCP")
1985+
}
1986+
19751987
try {
19761988
await fs.mkdir(mcpServersDir, { recursive: true })
19771989
} catch (error) {
1978-
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
1990+
// Fallback to a relative path if directory creation fails
1991+
return path.join("~", ".roo-code", "mcp")
19791992
}
19801993
return mcpServersDir
19811994
}

0 commit comments

Comments
 (0)