{"record":{"id":"0ecb2d47193a9344","repo":"anthropics/skills","slug":"url-is-required-for-http-transport","errorCode":null,"errorMessage":"URL is required for http transport","messagePattern":"URL is required for http transport","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/mcp-builder/scripts/connections.py","lineNumber":147,"sourceCode":"\n    Returns:\n        MCPConnection instance\n    \"\"\"\n    transport = transport.lower()\n\n    if transport == \"stdio\":\n        if not command:\n            raise ValueError(\"Command is required for stdio transport\")\n        return MCPConnectionStdio(command=command, args=args, env=env)\n\n    elif transport == \"sse\":\n        if not url:\n            raise ValueError(\"URL is required for sse transport\")\n        return MCPConnectionSSE(url=url, headers=headers)\n\n    elif transport in [\"http\", \"streamable_http\", \"streamable-http\"]:\n        if not url:\n            raise ValueError(\"URL is required for http transport\")\n        return MCPConnectionHTTP(url=url, headers=headers)\n\n    else:\n        raise ValueError(f\"Unsupported transport type: {transport}. Use 'stdio', 'sse', or 'http'\")\n","sourceCodeStart":129,"sourceCodeEnd":152,"githubUrl":"https://github.com/anthropics/skills/blob/f6656c1256d5a8adfa37db9110046ef20bac644c/skills/mcp-builder/scripts/connections.py#L129-L152","documentation":"create_connection() requires a url for transport in ('http', 'streamable_http', 'streamable-http'): streamable-HTTP MCP servers live at a known HTTP endpoint, so constructing MCPConnectionHTTP without a url is always a caller error. The check fires before any connection attempt.","triggerScenarios":"Calling create_connection(transport='http') with url omitted — e.g. a config entry that only defines command/args (a stdio server) but declares http transport, or the url field left blank by a config generator.","commonSituations":"Migrating MCP configs from older sse/stdio examples without adding the url; JSON schema drift between client versions (url vs serverUrl key); empty template values never filled in.","solutions":["Provide the endpoint: create_connection(name='x', transport='http', url='http://localhost:3000/mcp').","If the entry has command/args and no url, it is a stdio server — use transport='stdio'.","Confirm the url key spelling and that the value includes the scheme and full path (often '/mcp').","Add any required headers dict alongside the url."],"exampleFix":"# before\ncreate_connection(name=\"api\", transport=\"http\")\n\n# after\ncreate_connection(name=\"api\", transport=\"http\", url=\"http://127.0.0.1:3000/mcp\", headers={\"Authorization\": \"Bearer tok\"})","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef valid_http_entry(entry: dict) -> bool:\n    url = entry.get(\"url\") or \"\"\n    return bool(url) and urlparse(url).scheme in (\"http\", \"https\")","typeGuard":null,"tryCatchPattern":"try:\n    conn = create_connection(name=n, transport=\"http\", url=u)\nexcept ValueError as e:\n    if \"URL is required\" in str(e):\n        raise ConfigError(f\"server {n!r}: http entry missing 'url'\") from e\n    raise","preventionTips":["Validate that entries declaring http/sse transports carry a url at startup.","If an entry only has command/args, classify it as stdio automatically.","Test config parsing in CI so schema drift fails the build, not production."],"tags":["mcp","validation","config","http"],"backgroundTag":null,"analyzedSha":"f6656c1256d5a8adfa37db9110046ef20bac644c","analyzedAt":"2026-08-14T16:09:17.493Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}