{"record":{"id":"baf1ff4216f1d6aa","repo":"langchain-ai/deepagents","slug":"server-server-name-missing-required-command","errorCode":null,"errorMessage":"Server '{server_name}' missing required 'command' field","messagePattern":"Server '(.+?)' missing required 'command' field","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_tools.py","lineNumber":911,"sourceCode":"            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 = (\n                        f\"Server '{server_name}' header {name!r} must be \"\n                        f\"a string, got {type(value).__name__}\"\n                    )\n                    raise TypeError(error_msg)\n    elif server_type == \"stdio\":\n        if \"command\" not in server_config:\n            error_msg = f\"Server '{server_name}' missing required 'command' field\"\n            raise ValueError(error_msg)\n\n        if \"url\" in server_config:\n            error_msg = (\n                f\"Server '{server_name}' has type 'stdio' but also declares \"\n                \"a 'url' field. Remove 'url' or set \"\n                '`\"type\": \"http\"` (or `\"sse\"`) for a remote server.'\n            )\n            raise ValueError(error_msg)\n\n        if \"args\" in server_config and not isinstance(server_config[\"args\"], list):\n            error_msg = f\"Server '{server_name}' 'args' must be a list\"\n            raise TypeError(error_msg)\n\n        if \"env\" in server_config and not isinstance(server_config[\"env\"], dict):\n            error_msg = f\"Server '{server_name}' 'env' must be a dictionary\"\n            raise TypeError(error_msg)\n    else:\n        error_msg = (","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_tools.py#L893-L929","documentation":"A stdio MCP server is launched as a local subprocess, so its config must specify the executable via the required `command` field. `_validate_server_config` raises this ValueError when a server resolves to type `stdio` but has no `command` key, because there is no way to start the server process.","triggerScenarios":"Calling `select_server`, `resolve_and_load_mcp_tools`, or config validation with a server entry that resolves to stdio (explicit `\"type\": \"stdio\"` or omitted type defaulting to stdio) but lacks `command`, e.g. `{\"myserver\": {\"args\": [\"-y\", \"@modelcontextprotocol/server-x\"]}}`.","commonSituations":"Config entries copied from remote-server examples and left without `command`; type key renamed to something else so stdio defaulting kicks in; truncated config where the command line was deleted; YAML where `command:` is present but empty (parsing to None may still count as missing depending on the `in` check).","solutions":["Add the required `command` field naming the executable, e.g. \"command\": \"npx\" or \"command\": \"python\".","If the server is actually remote, set `\"type\": \"http\"` (or `\"sse\"`) and provide a `url` instead of `command`.","Verify the server entry includes both `command` and any needed `args` list.","Validate the corrected config with `resolve_and_load_mcp_tools` before reloading the app."],"exampleFix":"// before\n{\"fetch\": {\"type\": \"stdio\", \"args\": [\"mcp-server-fetch\"]}}\n// after\n{\"fetch\": {\"type\": \"stdio\", \"command\": \"python\", \"args\": [\"-m\", \"mcp_server_fetch\"]}}","handlingStrategy":"validation","validationCode":"def validate_stdio_entry(name: str, cfg: dict) -> None:\n    if cfg.get(\"type\", \"stdio\") == \"stdio\" and \"command\" not in cfg:\n        raise ValueError(f\"Server '{name}' missing required 'command' field\")","typeGuard":"def is_valid_stdio_entry(cfg: dict) -> bool:\n    return cfg.get(\"type\", \"stdio\") == \"stdio\" and isinstance(cfg.get(\"command\"), str) and bool(cfg[\"command\"])","tryCatchPattern":"try:\n    tools = resolve_and_load_mcp_tools(config)\nexcept ValueError as e:\n    if \"missing required 'command' field\" in str(e):\n        print(f\"Fix config: {e}\")  # add command or switch type to http/sse with url\n    else:\n        raise","preventionTips":["Every stdio server entry must have a `command`; make this a checklist item when adding servers.","Use templates: local servers start with {\"type\": \"stdio\", \"command\": ..., \"args\": [...]}.","For remote servers, always set type http/sse explicitly so missing `command` is not ambiguous.","Validate configs in CI before distribution."],"tags":["mcp","config-validation","stdio","missing-field"],"backgroundTag":"mcp-server-config-invalid","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}