-
-
Notifications
You must be signed in to change notification settings - Fork 114
feat: Concurrent Operations, Enhanced Logging & Robustness #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR accelerates MCP-Bridge startup and discovery ops by introducing concurrent client initialization and lookup, adds pervasive structured logging for better observability, and hardens error handling to isolate failures per client.
- Concurrent initialization and tool/prompt/resource aggregation using
asyncio.gather - Extensive
logurulogging across SSE handlers, server endpoints, and client sessions - Granular error trapping so individual client failures don’t cascade
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Bumped mcp to ≥1.8.0 and added aiodocker dependency |
| mcp_config.json | New JSON config defining multiple MCP servers |
| mcp_bridge/utils/message_adapter.py | Introduced MessageWrapper to normalize JSONRPCMessage access |
| mcp_bridge/utils/library_patcher.py | Patches JSONRPCMessage and SessionMessage for v2+ compatibility |
| mcp_bridge/mcp_server/sse.py | Added detailed logs and more specific exception handlers |
| mcp_bridge/mcp_server/server.py | Refactored list_* endpoints for concurrent aggregation |
| mcp_bridge/mcp_clients/session.py | Enhanced _consume_messages with robust wrapping and logging |
| mcp_bridge/mcp_clients/McpClientManager.py | Concurrent client startup with improved logging and resilience |
| mcp_bridge/config/docker.py | New Docker-based transport using aiodocker |
| compose.yml & Dockerfile | Updated exposed port to 3989, mounted new config, installed Docker CLI |
| backup_mcp_config.json | Duplicate backup of the new config (redundant) |
Comments suppressed due to low confidence (4)
mcp_bridge/mcp_server/sse.py:57
- [nitpick] Using the private attribute
request._sendties you to Starlette/FastAPI internals. Consider using a supported public API or helper to forward the message.
await sse.handle_post_message(request.scope, request.receive, request._send)
mcp_bridge/mcp_server/sse.py:30
ValidationErroris not imported in this module, causing a potentialNameError. Import it (e.g., frompydantic) or catch a fully qualified exception.
except ValidationError as ve:
mcp_bridge/mcp_clients/McpClientManager.py:75
- The
DockerMCPServermodel defines the image field asimage, notimage_name, leading toAttributeError. Change toserver_config.image.
logger.info(f"Creating DockerClient for '{name}' with image: '{server_config.image_name}'")
backup_mcp_config.json:1
- [nitpick] This backup of
mcp_config.jsonis redundant and may cause confusion; consider removing it.
{
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces significant improvements to the MCP-Bridge, focusing on performance, reliability, and observability.
Key Enhancements:
Concurrent Client Initialization & Operations:
asyncio.gather, leading to faster startup times.list_tools,list_prompts,list_resources) has been refactored to perform these lookups concurrently, significantly improving the responsiveness of these discovery endpoints.Enhanced Logging & Observability:
loguru-based structured logging has been integrated throughoutMcpClientManager.py,mcp_server/server.py, andmcp_server/sse.py.Improved Robustness & Error Handling:
get_client_from_toolandget_client_from_promptnow have more specific error trapping and explicitly returnNoneon failure, making their behavior more predictable.BrokenResourceError,CancelledError).Impact:
These changes aim to make the MCP-Bridge more performant, especially in environments with multiple downstream MCP servers, more resilient to transient issues, and significantly easier to operate and troubleshoot due to the improved logging.
This update moves the submodule from commit
971d29etoe8ce8d7.To Test: