Repository navigation
Stream MCP responses instead of buffering - #427
Merged
Merged
Conversation
test_mcp_server_streaming.py update typo
Contributor
|
@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.
Contributor
Author
|
- 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.
3 of 4 tasks
Contributor
|
Tested, and it works! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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