feat: Concurrent Operations, Enhanced Logging & Robustness#79
Open
georgiedekker wants to merge 6 commits intoSecretiveShell:masterfrom
Open
feat: Concurrent Operations, Enhanced Logging & Robustness#79georgiedekker wants to merge 6 commits intoSecretiveShell:masterfrom
georgiedekker wants to merge 6 commits intoSecretiveShell:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
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 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.
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: