FoundationAgents/OpenManus · error · ValueError
Server URL is required for SSE connection
Error message
Server URL is required for SSE connection
What it means
Raised by MCPSelfCorruptAgent.initialize() when the agent's connection_type is 'sse' but the server_url argument is empty/None. The SSE transport requires an explicit http(s) endpoint to connect to, unlike stdio which launches a local command. The check is a plain falsy test, so empty strings also trigger it.
Source
Thrown at app/agent/mcp.py:61
server_url: Optional[str] = None,
command: Optional[str] = None,
args: Optional[List[str]] = None,
) -> None:
"""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)
View on GitHub (pinned to 52a13f2a57)
Solutions
- Pass a valid server_url, e.g. await agent.initialize(connection_type="sse", server_url="http://localhost:8080/sse")
- If loading from config, verify the mcpServers.<id>.url key exists and is non-empty before calling initialize
- Confirm connection_type matches the transport you actually have parameters for (use "stdio" with command/args instead)
Example fix
// before await agent.initialize(connection_type="sse") # ValueError // after await agent.initialize(connection_type="sse", server_url="http://localhost:8080/sse")
Defensive patterns
Strategy: validation
Validate before calling
def valid_sse_params(connection_type: str, server_url: str | None) -> bool:
return connection_type == "sse" and bool(server_url and server_url.strip()) Prevention
- Build a small config validator that checks type/url/command consistency for every mcpServers entry before agent startup
- Treat empty string and None identically when validating url fields
- Log the resolved connection_type and server_url (redacted) right before initialize()
When it happens
Trigger: Calling agent.initialize(connection_type="sse") or initialize(connection_type="sse", server_url="") or omitting server_url while the agent was previously constructed with connection_type="sse". The stored self.connection_type wins whenever the passed connection_type is falsy.
Common situations: Copying a stdio MCP config and switching type to "sse" without adding a url; reading config from config.toml mcpServers where url key is missing; passing server_url=None as a default argument.
Related errors
- Command is required for stdio connection
- Unsupported connection type: {self.connection_type}
- Failed to load MCP server config: {e}
- Server URL is required.
- Server command is required.
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/226a29b1d3c15ea9.
Report an issue: GitHub.