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

Function removeServerEntry

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

Source from the content-addressed store, hash-verified

63}
64
65export function removeServerEntry(
66 existing: Record<string, unknown>,
67 configKey: string,
68 serverName: string
69): { config: Record<string, unknown>; removed: boolean } {
70 const section = existing[configKey];
71 if (!section || typeof section !== "object" || Array.isArray(section)) {
72 return { config: existing, removed: false };
73 }
74
75 const current = section as Record<string, unknown>;
76 if (!(serverName in current)) {
77 return { config: existing, removed: false };
78 }
79
80 const rest = Object.fromEntries(Object.entries(current).filter(([key]) => key !== serverName));
81 const next = { ...existing };
82
83 if (Object.keys(rest).length === 0) {
84 delete next[configKey];
85 } else {
86 next[configKey] = rest;
87 }
88
89 return { config: next, removed: true };
90}
91
92export async function resolveMcpPath(candidates: string[]): Promise<string> {
93 for (const candidate of candidates) {

Callers 2

uninstallMcpFunction · 0.85
setup.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected