(serverName: string, entry: Record<string, unknown>)
| 228 | } |
| 229 | |
| 230 | export 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 | |
| 250 | export async function appendTomlServer( |
| 251 | filePath: string, |
no outgoing calls
no test coverage detected