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

Function mergeServerEntry

packages/cli/src/setup/mcp-writer.ts:44–63  ·  view source on GitHub ↗
(
  existing: Record<string, unknown>,
  configKey: string,
  serverName: string,
  entry: Record<string, unknown>
)

Source from the content-addressed store, hash-verified

42}
43
44export function mergeServerEntry(
45 existing: Record<string, unknown>,
46 configKey: string,
47 serverName: string,
48 entry: Record<string, unknown>
49): { config: Record<string, unknown>; alreadyExists: boolean } {
50 const section = (existing[configKey] as Record<string, unknown> | undefined) ?? {};
51 const alreadyExists = serverName in section;
52
53 return {
54 config: {
55 ...existing,
56 [configKey]: {
57 ...section,
58 [serverName]: entry,
59 },
60 },
61 alreadyExists,
62 };
63}
64
65export function removeServerEntry(
66 existing: Record<string, unknown>,

Callers 2

setupAgentFunction · 0.85
setup.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected