Fix dynamic tooling#28
Conversation
arangatang
left a comment
There was a problem hiding this comment.
Thanks for the changes, one major thing, we need to ensure that proper logging is maintained, did you verify that errors/info/debug logs are propagated properly to i.e. qcli, cline, cursor, terminal etc?
A user must be able to identify problems and such and last I remember from the terminal logs were not showing up. At the very least i'm thinking we should have smth like:
- Connection to endpoint successfull
- Exceptions bubbling up when stuff breaks like network
- Optional - ListTools called (and how many was filtered out)
6fd659b to
ea8c905
Compare
wzxxing
left a comment
There was a problem hiding this comment.
Please also add some description of how this change was tested.
wzxxing
left a comment
There was a problem hiding this comment.
You can run pre-commit install so that the linters are checked before updating the PR.
bbe670e to
8fa5769
Compare
Thanks for the comment. The logs have stayed essentially identical, outside of the change in behavior with regard to removing the |
Instead of using the mcp_proxy_manager, here we directly add middleware to the proxy. This effectively makes the mcp_proxy_manager redundant.
…ing mcp_proxy_manager.py
this fixes issues with logging, especially with printing to the terminal.
114ef38 to
39b5e61
Compare
| if args.retries: | ||
| add_retry_middleware(proxy, args.retries) | ||
|
|
||
| await proxy.run_async() |
There was a problem hiding this comment.
why is this run_async lifted to this function?
There was a problem hiding this comment.
I directly replaced the first call to mcp_proxy_manager with it, although it's original placement outside of this function does make more sense and we can directly run the function.
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| async def setup_mcp_mode(local_mcp: FastMCP, args) -> None: |
There was a problem hiding this comment.
local_mcp is not used any more, can we directly run this function? Since the fastmcp instance created in main is not used anymore?
There was a problem hiding this comment.
We'd have to use asyncio.run somewhere, since we can't really await the main method, so we'd just be hoisting it elsewhere. I think it makes sense where it is.
There was a problem hiding this comment.
No, I meant the local_mcp is not used any more, we can remove this argument, also remove the FastMCP instance created in main.
| await proxy.run_async() | ||
|
|
||
|
|
||
| def add_tool_filtering_middleware(mcp: FastMCP, read_only: bool = False) -> None: |
There was a problem hiding this comment.
Rant for another PR/issue (we should review the code for this in general).
- We should not have default values where they are not needed, we should fail rather than accidentally set defaults if omitted. Makes stuff less prone of unexpected behaviour as the code grows.
- Ideally we should probably be using kwargs instead of args everywhere, more verbose but much more scalable.
- We should use proper typing
Probs I should create an issue for this tbh, when thinking about it.
| logger.info('Starting AWS MCP Proxy Server') | ||
|
|
||
| # Create FastMCP instance | ||
| mcp = FastMCP[Any]( |
There was a problem hiding this comment.
This is not used anymore.
We can rename setup_mcp_mode to run_mcp_proxy
| raise | ||
|
|
||
| # Run the server | ||
| asyncio.run(setup_and_run()) |
There was a problem hiding this comment.
Then simply do asyncio.run(run_mcp_proxy(args)) here
Summary
Changes
mcp_proxy_manager.pyand redundant MCP server.server.pyUser experience
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change? (Y/N)
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.