{"record":{"id":"d2d143d9e37ecb18","repo":"vercel/ai","slug":"cline-mcp-server-json-stringify-input-servername","errorCode":null,"errorMessage":"Cline MCP server ${JSON.stringify(input.serverName)} must define a transport, command, or URL.","messagePattern":"Cline MCP server (.+?) must define a transport, command, or URL\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/harness-cline/src/cline-mcp.ts","lineNumber":79,"sourceCode":"        : {}),\n      ...(env ? { env } : {}),\n    };\n  }\n\n  if (typeof input.config.url === 'string') {\n    const configuredType = input.config.type ?? input.config.transportType;\n    const headers = optionalStringRecord(input.config.headers);\n    return {\n      type:\n        configuredType === 'http' || configuredType === 'streamableHttp'\n          ? 'streamableHttp'\n          : 'sse',\n      url: input.config.url,\n      ...(headers ? { headers } : {}),\n    };\n  }\n\n  throw new Error(\n    `Cline MCP server ${JSON.stringify(input.serverName)} must define a transport, command, or URL.`,\n  );\n}\n\nfunction resolveRegistration(input: {\n  serverName: string;\n  config: unknown;\n}): McpServerRegistration {\n  if (!isRecord(input.config)) {\n    throw new Error(\n      `Cline MCP server ${JSON.stringify(input.serverName)} must be configured with an object value.`,\n    );\n  }\n\n  return {\n    name: input.serverName,\n    transport: resolveTransport({\n      serverName: input.serverName,","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-cline/src/cline-mcp.ts#L61-L97","documentation":"resolveTransport normalizes a Cline MCP server registration into a concrete transport (stdio via command, or SSE/streamable-HTTP via URL). If the server entry has none of a transport definition, a command, or a URL, no transport can be derived, so it throws this error. It is a configuration-validation error for the MCP server config.","triggerScenarios":"Registering a Cline MCP server whose config object omits all of: a transport spec, a `command` (stdio), and a `url` (remote server) — e.g. an empty or near-empty config object under that server name.","commonSituations":"Copy-pasting a server entry and deleting the command/url fields; a config file where the actual connection details live under a differently-named key so they are not picked up; partially migrating config formats where `transport` was renamed; typo'd field names (e.g. `cmd` instead of `command`, `endpoint` instead of `url`).","solutions":["Add a `command` (with args) for a local stdio MCP server to the server's config","Add a `url` for a remote MCP server (SSE or streamable HTTP)","Or set an explicit `transport` definition in the config","Double-check field spelling/nesting so the existing command/url is actually read by the resolver"],"exampleFix":"// before\nconst registration = {\n  serverName: 'my-mcp',\n  config: { env: { FOO: 'bar' } } // no transport/command/url\n};\n\n// after\nconst registration = {\n  serverName: 'my-mcp',\n  config: { command: 'npx', args: ['-y', 'my-mcp-server'], env: { FOO: 'bar' } }\n};","handlingStrategy":"validation","validationCode":"function assertClineMcpConfig(input) {\n  const { config = {} } = input;\n  const hasTransport = config.transport != null;\n  const hasCommand = typeof config.command === 'string' && config.command.length > 0;\n  const hasUrl = typeof config.url === 'string' && config.url.length > 0;\n  if (!hasTransport && !hasCommand && !hasUrl) {\n    throw new Error(`Cline MCP server ${JSON.stringify(input.serverName)} must define a transport, command, or URL.`);\n  }\n}","typeGuard":"interface ClineMcpInput { serverName: string; config?: { transport?: unknown; command?: string; url?: string } }\nfunction hasValidTransport(input: ClineMcpInput): boolean {\n  const c = input.config ?? {};\n  return c.transport != null || !!c.command || !!c.url;\n}","tryCatchPattern":"try {\n  const registration = resolveRegistration({ serverName, config });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('must define a transport, command, or URL')) {\n    // fix config or skip this server with a clear log message\n  }\n  throw err;\n}","preventionTips":["Validate MCP server configs at startup with a schema (zod) requiring transport, command, or url","Check field spelling (command/url/transport) when porting configs between formats","Never ship an empty config object for a named MCP server","Fail fast in CI by resolving all configured MCP servers during build tests"],"tags":["config","mcp","cline","validation"],"backgroundTag":"missing-mcp-transport-config","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}