(config: ScopedMcpServerConfig)
| 155 | * `{b:2,a:1}` hash the same. |
| 156 | */ |
| 157 | export function hashMcpConfig(config: ScopedMcpServerConfig): string { |
| 158 | const { scope: _scope, ...rest } = config |
| 159 | const stable = jsonStringify(rest, (_k, v: unknown) => { |
| 160 | if (v && typeof v === 'object' && !Array.isArray(v)) { |
| 161 | const obj = v as Record<string, unknown> |
| 162 | const sorted: Record<string, unknown> = {} |
| 163 | for (const k of Object.keys(obj).sort()) sorted[k] = obj[k] |
| 164 | return sorted |
| 165 | } |
| 166 | return v |
| 167 | }) |
| 168 | return createHash('sha256').update(stable).digest('hex').slice(0, 16) |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Remove stale MCP clients and their tools/commands/resources. A client is |
no test coverage detected