{"record":{"id":"61c978f25222946a","repo":"langchain-ai/deepagents","slug":"server-server-name-with-type-server-type-m","errorCode":null,"errorMessage":"Server '{server_name}' with type '{server_type}' missing required 'url' field","messagePattern":"Server '(.+?)' with type '(.+?)' missing required 'url' field","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_tools.py","lineNumber":885,"sourceCode":"        error_msg = (\n            f\"Invalid server name {server_name!r}: server names must contain \"\n            \"only alphanumerics, hyphens, and underscores.\"\n        )\n        raise ValueError(error_msg)\n\n    if not isinstance(server_config, dict):\n        error_msg = f\"Server '{server_name}' config must be a dictionary\"\n        raise TypeError(error_msg)\n\n    server_type = _resolve_server_type(server_config)\n\n    if server_type in _SUPPORTED_REMOTE_TYPES:\n        if \"url\" not in server_config:\n            error_msg = (\n                f\"Server '{server_name}' with type '{server_type}' \"\n                \"missing required 'url' field\"\n            )\n            raise ValueError(error_msg)\n\n        if \"command\" in server_config:\n            error_msg = (\n                f\"Server '{server_name}' has type '{server_type}' (remote) \"\n                \"but also declares a 'command' field. Remove 'command' or \"\n                'set `\"type\": \"stdio\"`.'\n            )\n            raise ValueError(error_msg)\n\n        headers = server_config.get(\"headers\")\n        if headers is not None and not isinstance(headers, dict):\n            error_msg = f\"Server '{server_name}' 'headers' must be a dictionary\"\n            raise TypeError(error_msg)\n\n        if isinstance(headers, dict):\n            for name, value in headers.items():\n                if not isinstance(value, str):\n                    error_msg = (","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_tools.py#L867-L903","documentation":"Remote server types (in _SUPPORTED_REMOTE_TYPES, e.g. http/sse) require a 'url' field. Validation raises ValueError when the type is remote but 'url' is absent.","triggerScenarios":"Declaring {\"type\": \"http\"} or {\"type\": \"sse\"} without a 'url' key; omitting 'type' such that it resolves to a remote type while only providing command fields.","commonSituations":"Partial config from a template missing the url; server migrated from stdio to remote with the url left blank; provider config copy-paste dropping the url line.","solutions":["Add the 'url' field to the server config","Set \"type\": \"stdio\" if the server is actually launched via command","Validate config (resolve_and_load_mcp_tools / _validate_mcp_config_servers) before connecting"],"exampleFix":"// before\n{\"search\": {\"type\": \"http\"}}\n// after\n{\"search\": {\"type\": \"http\", \"url\": \"https://mcp.example.com/mcp\"}}","handlingStrategy":"validation","validationCode":"def remote_entry_has_url(name: str, cfg: dict) -> bool:\n    return cfg.get('type') not in ('http', 'sse', 'streamable-http') or 'url' in cfg","typeGuard":"def is_remote_config(cfg: dict) -> bool:\n    return cfg.get('type') in ('http', 'sse', 'streamable-http')","tryCatchPattern":"try:\n    tools = await resolve_and_load_mcp_tools(config)\nexcept ValueError as e:\n    if \"missing required 'url' field\" in str(e):\n        log.error('add a url for remote MCP server: %s', e)\n    raise","preventionTips":["Always pair remote 'type' with 'url' in config templates","Validate configs at load time, before attempting connections","Keep example configs in the repo as canonical shapes"],"tags":["mcp","validation","configuration"],"backgroundTag":"missing-required-field","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}