Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ npx @magicuidesign/cli@latest install <client>

### Supported Clients

- [x] vscode
- [x] cursor
- [x] windsurf
- [x] claude
Expand Down
6 changes: 6 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ export const clientPaths: Record<string, string> = {
),
windsurf: path.join(homeDir, ".codeium", "windsurf", "mcp_config.json"),
cursor: path.join(homeDir, ".cursor", "mcp.json"),
vscode: path.join(
baseDir,
vscodePath,
"..",
"settings.json",
),
};

export const createPlatformCommand = (passedArgs: string[]) => {
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ export type ValidClient =
| "cline"
| "roo-cline"
| "windsurf"
| "cursor";
| "cursor"
| "vscode";

export const VALID_CLIENTS: ValidClient[] = [
"claude",
"cline",
"roo-cline",
"windsurf",
"cursor",
"vscode",
];

export interface ServerConfig {
Expand Down
20 changes: 18 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function writeConfig(client: ValidClient, config: ClientConfig): void {
throw new Error("Invalid mcpServers structure");
}

let existingConfig: ClientConfig = { mcpServers: {} };
let existingConfig: any = {};
try {
if (fs.existsSync(configPath)) {
existingConfig = JSON.parse(fs.readFileSync(configPath, "utf8"));
Expand All @@ -58,5 +58,21 @@ export function writeConfig(client: ValidClient, config: ClientConfig): void {
},
};

fs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));
const mergedServers = {
...existingConfig.mcp?.servers,
...config.mcpServers
};

// For VS Code, preserve all existing settings and just update mcp.servers
const finalConfig = client === "vscode"
? {
...existingConfig,
mcp: {
...existingConfig.mcp,
servers: mergedServers
}
}
: mergedConfig;

fs.writeFileSync(configPath, JSON.stringify(finalConfig, null, 2));
}