Hacker News new | ask | show | jobs
by wedn3sday 506 days ago
The example code reminds me how much I absolutely loath python async/await syntax.

>>> server_names=["fetch", "filesystem"]

This is, IMO, bad design. Where is the fetch defined? How would I find these? If it was an imported module I could easily find the definition to see what its doing, or subclass it to make my own, but instead its just some magic strings getting passed making it astronomically more difficult to understand what the heck is going on.

2 comments

Ah, just saw your edited comment. I am open to suggestions about this. These names are defined in the mcp_agent.config.yaml (e.g. https://github.com/lastmile-ai/mcp-agent/blob/main/examples/...). The logic that manages keeping track of them is mcp_server_registry.py.

I am open to alternative suggestions for this. I just wanted to make it easy to reference MCP servers by name and hide the logic of how they are initialized, what transport they use, what args are passed to them, into configs

Haha, are you referring to the async context managers? I have an example that calls .initialize and .cleanup explicitly: https://github.com/lastmile-ai/mcp-agent/blob/main/examples/...

Python isn't my first programming language and I find a lot of it peculiar, but with some of the latest tooling around it (uv, ruff, etc.), I must confess it has grown on me. :)