MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / writeMcpEntry

Function writeMcpEntry

src/installer/targets/cursor.ts:177–191  ·  view source on GitHub ↗
(loc: Location)

Source from the content-addressed store, hash-verified

175}
176
177function writeMcpEntry(loc: Location): WriteResult['files'][number] {
178 const file = mcpJsonPath(loc);
179 const existing = readJsonFile(file);
180 const before = existing.mcpServers?.codegraph;
181 const after = buildCursorMcpConfig(loc);
182
183 if (jsonDeepEqual(before, after)) {
184 return { path: file, action: 'unchanged' };
185 }
186 const action: 'created' | 'updated' = before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created');
187 if (!existing.mcpServers) existing.mcpServers = {};
188 existing.mcpServers.codegraph = after;
189 writeJsonFile(file, existing);
190 return { path: file, action };
191}
192
193/**
194 * Remove the Cursor rules file on uninstall (and as a self-heal on

Callers 1

installMethod · 0.70

Calls 5

readJsonFileFunction · 0.90
jsonDeepEqualFunction · 0.90
writeJsonFileFunction · 0.90
buildCursorMcpConfigFunction · 0.85
mcpJsonPathFunction · 0.70

Tested by

no test coverage detected