Skip to content

Conversation

YeIIcw
Copy link
Contributor

@YeIIcw YeIIcw commented Sep 25, 2025

Summary

  • Added helper utilities and updated run_cua_task so each chunk from ComputerAgent.run() immediately invokes the MCP context streaming hooks for messages, tool calls, and tool results while still accumulating text for the final response and capturing the closing screenshot.

  • Kept multi-task execution streaming-aware by having run_multi_cua_tasks forward progress updates around each delegated call to run_cua_task.

  • Introduced stub-based tests that load the server module in isolation and confirm both incremental streaming behaviour and progress reporting for long-running or batched tasks.

Testing

  • pytest tests/test_mcp_server_streaming.py

@jamesmurdza
Copy link
Collaborator

@YeIIcw Were you able to get the entire MCP server up and running?

…mcp_server.sh

Changes
- Refactored `server.py`:
  - Delayed server instantiation to avoid double-import issues and RuntimeWarning.
  - Reworked `run_cua_task` and `run_multi_cua_tasks` to yield structured output
    (text + screenshots) in a Pydantic-compatible format.
  - Added helper functions for normalising message content, extracting text,
    and serialising tool outputs.
  - Improved logging and error handling for clearer debugging.

- Updated `start_mcp_server.sh`:
  - Ensures Python path points to repo-local `.venv`.
  - Sets `PYTHONPATH` correctly for all `libs/python/*` packages.
  - Added clear debug output for python binary, repo dir, and PYTHONPATH.

Why
- Fixed `PydanticSchemaGenerationError` when returning `Image` objects from
  tool functions.
- Prevented `FastMCP.__init__()` errors by aligning with supported arguments.
- Removed duplicate module loading at startup that triggered RuntimeWarnings.
- Improved clarity of server startup logs for easier integration with Claude Desktop.

Outcome
The MCP server now starts cleanly, registers all tools, and stays connected
with Claude Desktop without schema errors or double-import issues.
@YeIIcw
Copy link
Contributor Author

YeIIcw commented Sep 30, 2025

@YeIIcw Were you able to get the entire MCP server up and running?

Yes, I managed to get it working in Claude desktop.
image

YeIIcw and others added 2 commits October 1, 2025 11:49
- Updated the README to clarify how to configure cua-mcp-server for Claude Desktop and other MCP clients.
- Fixed the example development configuration to use an absolute/expanded path rather than `~`, preventing issues with Claude’s sandboxed execution.
- Aligned instructions with the current start_mcp_server.sh behavior, ensuring the correct virtual environment and PYTHONPATH are always set.
- Improved wording for consistency across installation, development, and usage sections.
Implement concurrent session management for MCP server with:

- SessionManager with computer instance pooling
- Concurrent task execution support
- New tools: get_session_stats, cleanup_session
- Graceful shutdown and resource cleanup
- Fix nested asyncio event loop issues
- Add comprehensive tests and documentation

Enables multiple concurrent clients with proper resource isolation
while maintaining backward compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants