MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / normalizeServers

Function normalizeServers

src/mcp/config.ts:124–135  ·  view source on GitHub ↗

Validate + normalize a whole `mcpServers` record.

(
	raw: unknown,
)

Source from the content-addressed store, hash-verified

122
123/** Validate + normalize a whole `mcpServers` record. */
124function normalizeServers(
125 raw: unknown,
126): Record<string, McpServerConfig> {
127 if (!isPlainObject(raw)) return {}
128 const servers: Record<string, McpServerConfig> = {}
129 for (const [name, cfg] of Object.entries(raw)) {
130 if (!/^[A-Za-z0-9_-]+$/.test(name)) continue
131 const normalized = normalizeServerConfig(cfg)
132 if (normalized) servers[name] = normalized
133 }
134 return servers
135}
136
137/** Read `mcpServers` from a settings.json file (user or local scope). */
138function readSettingsServers(filePath: string): Record<string, McpServerConfig> {

Callers 4

readSettingsServersFunction · 0.85
readMcpJsonFunction · 0.85
addMcpServerFunction · 0.85
removeMcpServerFunction · 0.85

Calls 2

normalizeServerConfigFunction · 0.85
isPlainObjectFunction · 0.70

Tested by

no test coverage detected