Skip to content

Commit 482b5b6

Browse files
authored
fix: add fallback value for parsing cursor mcp.json (#7)
1 parent c18b169 commit 482b5b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vite-plugin-mcp/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function ViteMcp(options: ViteMcpOptions = {}): Plugin {
3636
if (cursorMcpOptions.enabled) {
3737
if (existsSync(join(root, '.cursor'))) {
3838
const mcp = existsSync(join(root, '.cursor/mcp.json'))
39-
? JSON.parse(await fs.readFile(join(root, '.cursor/mcp.json'), 'utf-8'))
39+
? JSON.parse(await fs.readFile(join(root, '.cursor/mcp.json'), 'utf-8') || '{}')
4040
: {}
4141
mcp.mcpServers ||= {}
4242
mcp.mcpServers[cursorMcpOptions.serverName || 'vite'] = { url: sseUrl }

0 commit comments

Comments
 (0)