MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseHeaders

Function parseHeaders

src/services/mcp/utils.ts:325–349  ·  view source on GitHub ↗
(headerArray: string[])

Source from the content-addressed store, hash-verified

323}
324
325export function parseHeaders(headerArray: string[]): Record<string, string> {
326 const headers: Record<string, string> = {}
327
328 for (const header of headerArray) {
329 const colonIndex = header.indexOf(':')
330 if (colonIndex === -1) {
331 throw new Error(
332 `Invalid header format: "${header}". Expected format: "Header-Name: value"`,
333 )
334 }
335
336 const key = header.substring(0, colonIndex).trim()
337 const value = header.substring(colonIndex + 1).trim()
338
339 if (!key) {
340 throw new Error(
341 `Invalid header: "${header}". Header name cannot be empty.`,
342 )
343 }
344
345 headers[key] = value
346 }
347
348 return headers
349}
350
351export function getProjectMcpServerStatus(
352 serverName: string,

Callers 1

registerMcpAddCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected