{"record":{"id":"d98a1b76bd8ee5a3","repo":"vercel/ai","slug":"acp-mcp-server-json-stringify-name-must-be-con","errorCode":null,"errorMessage":"ACP MCP server ${JSON.stringify(name)} must be configured with an object value.","messagePattern":"ACP MCP server (.+?) must be configured with an object value\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/bridge/index.ts","lineNumber":640,"sourceCode":"  initializationDiagnostic = createACPInitializationDiagnostic({\n    initialization,\n    sessionId: createdSession.sessionId,\n  });\n  sessionConfigurationFingerprint = fingerprint;\n  return { initialHostToolCatalogRefreshRequired: tools.length > 0 };\n}\n\nfunction createExternalMcpServers({\n  mcpServers,\n  initialization,\n}: {\n  mcpServers: Record<string, unknown> | undefined;\n  initialization: acp.InitializeResponse;\n}): acp.McpServer[] {\n  if (mcpServers == null) return [];\n  return Object.entries(mcpServers).map(([name, value]) => {\n    if (!isRecord(value)) {\n      throw new Error(\n        `ACP MCP server ${JSON.stringify(name)} must be configured with an object value.`,\n      );\n    }\n    if (value.type === 'acp') {\n      throw new HarnessBridgeCapabilityUnsupportedError({\n        harnessId: bridgeType,\n        message:\n          'ACP-transport MCP servers require client-side mcp/connect handling, which this harness does not provide.',\n      });\n    }\n    const mcpCapabilities = initialization.agentCapabilities?.mcpCapabilities;\n    if (\n      (value.type === 'http' && mcpCapabilities?.http !== true) ||\n      (value.type === 'sse' && mcpCapabilities?.sse !== true)\n    ) {\n      throw new HarnessBridgeCapabilityUnsupportedError({\n        harnessId: bridgeType,\n        message: `The ACP agent does not advertise support for ${value.type.toUpperCase()} MCP servers.`,","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/bridge/index.ts#L622-L658","documentation":"createExternalMcpServers maps the user-supplied mcpServers record into ACP McpServer configurations and requires each entry's value to be an object (isRecord check). Non-object values (strings, numbers, booleans, arrays) are rejected with this Error because the ACP protocol needs a structured server config. This validates user configuration before it is sent to the agent.","triggerScenarios":"Passing mcpServers where any key's value is not a plain object — e.g. mcpServers: { context7: 'https://mcp.example.com' } or { fs: ['npx', '-y', 'fs-mcp'] } — during bridge/session creation.","commonSituations":"Copying CLI-style MCP config (command arrays or URL strings) from another tool (e.g. a claude-style JSON) into the harness mcpServers option without wrapping it in the expected object shape; typos that flatten the object; template expansion producing a scalar.","solutions":["Wrap each MCP server entry in an object with the expected fields (e.g. { type: 'http', url } or { type: 'stdio', command, args }).","Validate the mcpServers record shape before creating the bridge (each value an object).","Compare against the harness-acp docs/examples for the exact McpServer config schema supported by your agent."],"exampleFix":"// before\nmcpServers: { context7: 'https://mcp.example.com/mcp' }\n// after\nmcpServers: {\n  context7: { type: 'http', url: 'https://mcp.example.com/mcp' },\n}","handlingStrategy":"validation","validationCode":"function isMcpServerConfig(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v);\n}\nfor (const [name, value] of Object.entries(mcpServers ?? {})) {\n  if (!isMcpServerConfig(value)) {\n    throw new Error(`MCP server '${name}' must be an object config`);\n  }\n}","typeGuard":"function isRecord(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v);\n}","tryCatchPattern":"try {\n  await createBridge({ mcpServers });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('must be configured with an object value')) {\n    // fix the mcpServers entry shape before retrying\n  }\n  throw error;\n}","preventionTips":["Always express each mcpServers entry as a structured object, never a URL string or command array.","Validate config against the harness-acp McpServer schema before creating the bridge.","Write a unit test asserting every configured server value isRecord()."],"tags":["acp","mcp","configuration","validation"],"backgroundTag":"invalid-mcp-server-config","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}