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

Function buildTomlServerBlock

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

Source from the content-addressed store, hash-verified

228}
229
230export function buildTomlServerBlock(serverName: string, entry: Record<string, unknown>): string {
231 const lines: string[] = [`[mcp_servers.${serverName}]`];
232 const headers = entry.headers as Record<string, string> | undefined;
233
234 for (const [key, value] of Object.entries(entry)) {
235 if (key === "headers") continue;
236 lines.push(`${key} = ${JSON.stringify(value)}`);
237 }
238
239 if (headers && Object.keys(headers).length > 0) {
240 lines.push("");
241 lines.push(`[mcp_servers.${serverName}.http_headers]`);
242 for (const [key, value] of Object.entries(headers)) {
243 lines.push(`${key} = ${JSON.stringify(value)}`);
244 }
245 }
246
247 return lines.join("\n") + "\n";
248}
249
250export async function appendTomlServer(
251 filePath: string,

Callers 2

appendTomlServerFunction · 0.85
setup.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected