Add OpenHands app support on windows without WSL (#8674)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk>
This commit is contained in:
Graham Neubig
2025-05-31 02:15:35 -04:00
committed by GitHub
parent 277b87413b
commit 59858dc73b
12 changed files with 471 additions and 143 deletions

View File

@@ -354,6 +354,14 @@ class ActionExecutionClient(Runtime):
def get_mcp_config(
self, extra_stdio_servers: list[MCPStdioServerConfig] | None = None
) -> MCPConfig:
import sys
# Check if we're on Windows - MCP is disabled on Windows
if sys.platform == 'win32':
# Return empty MCP config on Windows
self.log('debug', 'MCP is disabled on Windows, returning empty config')
return MCPConfig(sse_servers=[], stdio_servers=[])
# Add the runtime as another MCP server
updated_mcp_config = self.config.mcp.model_copy()
@@ -436,6 +444,15 @@ class ActionExecutionClient(Runtime):
return updated_mcp_config
async def call_tool_mcp(self, action: MCPAction) -> Observation:
import sys
from openhands.events.observation import ErrorObservation
# Check if we're on Windows - MCP is disabled on Windows
if sys.platform == 'win32':
self.log('info', 'MCP functionality is disabled on Windows')
return ErrorObservation('MCP functionality is not available on Windows')
# Import here to avoid circular imports
from openhands.mcp.utils import call_tool_mcp as call_tool_mcp_handler
from openhands.mcp.utils import create_mcp_clients

View File

@@ -238,6 +238,7 @@ class LocalRuntime(ActionExecutionClient):
env['PYTHONPATH'] = os.pathsep.join([code_repo_path, env.get('PYTHONPATH', '')])
env['OPENHANDS_REPO_PATH'] = code_repo_path
env['LOCAL_RUNTIME_MODE'] = '1'
env['VSCODE_PORT'] = str(self._vscode_port)
# Derive environment paths using sys.executable
interpreter_path = sys.executable