FoundationAgents/OpenManus · error · ValueError
Command is required for stdio connection
Error message
Command is required for stdio connection
What it means
Raised by MCPSelfCorruptAgent.initialize() when connection_type is "stdio" but the command argument is empty/None. The stdio transport needs an executable to spawn the MCP server locally; without it there is nothing to run. Note args defaults to [] so only command is mandatory.
Source
Thrown at app/agent/mcp.py:65
"""Initialize the MCP connection.
Args:
connection_type: Type of connection to use ("stdio" or "sse")
server_url: URL of the MCP server (for SSE connection)
command: Command to run (for stdio connection)
args: Arguments for the command (for stdio connection)
"""
if connection_type:
self.connection_type = connection_type
# Connect to the MCP server based on connection type
if self.connection_type == "sse":
if not server_url:
raise ValueError("Server URL is required for SSE connection")
await self.mcp_clients.connect_sse(server_url=server_url)
elif self.connection_type == "stdio":
if not command:
raise ValueError("Command is required for stdio connection")
await self.mcp_clients.connect_stdio(command=command, args=args or [])
else:
raise ValueError(f"Unsupported connection type: {self.connection_type}")
# Set available_tools to our MCP instance
self.available_tools = self.mcp_clients
# Store initial tool schemas
await self._refresh_tools()
# Add system message about available tools
tool_names = list(self.mcp_clients.tool_map.keys())
tools_info = ", ".join(tool_names)
# Add system prompt and available tools information
self.memory.add_message(
Message.system_message(
f"{self.system_prompt}\n\nAvailable MCP tools: {tools_info}"View on GitHub (pinned to 52a13f2a57)
Solutions
- Pass a valid command, e.g. await agent.initialize(connection_type="stdio", command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])
- Validate config: ensure server_config["command"] is present when type == "stdio" before constructing the agent
- Switch to connection_type="sse" with server_url if the server is remote
Example fix
// before await agent.initialize(connection_type="stdio", args=["-y", "server-pkg"]) // after await agent.initialize(connection_type="stdio", command="npx", args=["-y", "server-pkg"])
Defensive patterns
Strategy: validation
Validate before calling
def valid_stdio_params(connection_type: str, command: str | None) -> bool:
return connection_type == "stdio" and bool(command and command.strip()) Prevention
- Schema-check MCP config files: stdio entries require command, sse entries require url
- Prefer defining a pydantic model for server config so missing keys fail with precise messages at load time
- Do not rely on prior initialize() calls — pass the full parameter set each time
When it happens
Trigger: Calling initialize(connection_type="stdio") with no command, or initialize(connection_type="stdio", command="") or command=None. Also happens when a stored connection_type of "stdio" persists and a later initialize() call omits command.
Common situations: Config entry mcpServers.<id> has type="stdio" but command key missing; typo like "cmd" or "executable" instead of "command"; assuming the agent remembers the command from a prior call.
Related errors
- Server command is required.
- Server URL is required for SSE connection
- Unsupported connection type: {self.connection_type}
- Failed to load MCP server config: {e}
- Server URL is required.
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/b5f7b5ccfd0f9aed.
Report an issue: GitHub.