{"record":{"id":"5863c3a2c3c9f078","repo":"langchain-ai/deepagents","slug":"mcp-server-server-name-missing-command-in-c","errorCode":null,"errorMessage":"MCP server '{server_name}': missing 'command' in config.","messagePattern":"MCP server '(.+?)': missing 'command' in config\\.","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/mcp_tools.py","lineNumber":1854,"sourceCode":"    except (json.JSONDecodeError, ValueError, TypeError) as exc:\n        logger.warning(\"Skipping invalid MCP config %s: %s\", config_path, exc)\n        return None, str(exc)\n\n\ndef _check_stdio_server(server_name: str, server_config: dict[str, Any]) -> None:\n    \"\"\"Verify that a stdio server's command exists on PATH.\n\n    Args:\n        server_name: Server name for error messages.\n        server_config: Validated server config.\n\n    Raises:\n        RuntimeError: If the command is missing or not found on PATH.\n    \"\"\"\n    command = server_config.get(\"command\")\n    if command is None:\n        msg = f\"MCP server '{server_name}': missing 'command' in config.\"\n        raise RuntimeError(msg)\n    if shutil.which(command) is None:\n        msg = (\n            f\"MCP server '{server_name}': configured command not found on PATH. \"\n            \"Install it or check your MCP config.\"\n        )\n        raise RuntimeError(msg)\n\n\nasync def _check_remote_server(server_name: str, server_config: dict[str, Any]) -> None:\n    \"\"\"Check network connectivity to a remote MCP server URL.\n\n    Args:\n        server_name: Server name for error messages.\n        server_config: Validated remote server config.\n\n    Raises:\n        RuntimeError: If the URL is missing, unreachable, or returns 5xx.\n    \"\"\"","sourceCodeStart":1836,"sourceCodeEnd":1872,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/mcp_tools.py#L1836-L1872","documentation":"Stdio-based MCP servers are launched by executing the `command` from their config. `_check_stdio_server` raises this RuntimeError when the server config dict has no `command` key at all (value None), before any process is spawned. It's part of the connectivity/pre-flight check for stdio servers.","triggerScenarios":"A server entry under 'mcpServers' that only has fields like 'args'/'env'/'url' but no 'command', e.g. {\"mcpServers\": {\"fs\": {\"args\": [\"/tmp\"]}}}, or \"command\": null explicitly present.","commonSituations":"Copying a remote/HTTP server entry (which uses 'url') into a stdio slot without a command; hand-writing a config and forgetting the launch line; templates where the command was meant to be filled in.","solutions":["Add the 'command' key with the executable to launch, e.g. \"command\": \"npx\" plus \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/tmp\"].","If this server is actually remote, replace the stdio fields with a \"url\" entry so it's checked as a remote server instead.","Replace any explicit null 'command' value with a real executable string."],"exampleFix":"// before\n{\"mcpServers\": {\"fs\": {\"args\": [\"/tmp\"]}}}\n// after\n{\"mcpServers\": {\"fs\": {\"command\": \"npx\", \"args\": [\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/tmp\"]}}}","handlingStrategy":"validation","validationCode":"def check_stdio_entry(server):\n    if \"url\" not in server and \"command\" not in server:\n        raise SystemExit(\"stdio MCP server config requires 'command'\")","typeGuard":"def is_valid_stdio_entry(server: dict) -> bool:\n    return isinstance(server.get(\"command\"), str) and bool(server[\"command\"])","tryCatchPattern":"try:\n    check_mcp_servers(cfg)\nexcept RuntimeError as e:\n    if \"missing 'command'\" in str(e):\n        add_command_field(cfg_path, server_name=...)\n    else:\n        raise","preventionTips":["Template new server entries with command+args pre-filled.","Decide stdio vs remote first: stdio needs 'command', remote needs 'url' — don't mix fields.","Lint configs for required keys per server type before use."],"tags":["mcp","config","stdio","validation"],"backgroundTag":"missing-config-field","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}