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

Function writeMcpEntry

src/installer/targets/gemini.ts:131–149  ·  view source on GitHub ↗
(loc: Location)

Source from the content-addressed store, hash-verified

129}
130
131function writeMcpEntry(loc: Location): WriteResult['files'][number] {
132 const file = settingsJsonPath(loc);
133 const dir = path.dirname(file);
134 if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
135
136 const existing = readJsonFile(file);
137 const before = existing.mcpServers?.codegraph;
138 const after = getMcpServerConfig();
139
140 if (jsonDeepEqual(before, after)) {
141 return { path: file, action: 'unchanged' };
142 }
143 const action: 'created' | 'updated' =
144 before ? 'updated' : (fs.existsSync(file) ? 'updated' : 'created');
145 if (!existing.mcpServers) existing.mcpServers = {};
146 existing.mcpServers.codegraph = after;
147 writeJsonFile(file, existing);
148 return { path: file, action };
149}
150
151/**
152 * Strip the marker-delimited CodeGraph block from GEMINI.md if a prior

Callers 1

installMethod · 0.70

Calls 5

readJsonFileFunction · 0.90
getMcpServerConfigFunction · 0.90
jsonDeepEqualFunction · 0.90
writeJsonFileFunction · 0.90
settingsJsonPathFunction · 0.70

Tested by

no test coverage detected