MCPcopy
hub / github.com/upstash/context7 / readJsonConfig

Function readJsonConfig

packages/cli/src/setup/mcp-writer.ts:30–42  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

28}
29
30export async function readJsonConfig(filePath: string): Promise<Record<string, unknown>> {
31 let raw: string;
32 try {
33 raw = await readFile(filePath, "utf-8");
34 } catch {
35 return {};
36 }
37
38 raw = raw.trim();
39 if (!raw) return {};
40
41 return JSON.parse(stripJsonComments(raw)) as Record<string, unknown>;
42}
43
44export function mergeServerEntry(
45 existing: Record<string, unknown>,

Callers 4

hasMcpConfigFunction · 0.85
uninstallMcpFunction · 0.85
setupAgentFunction · 0.85
setup.test.tsFile · 0.85

Calls 1

stripJsonCommentsFunction · 0.85

Tested by

no test coverage detected