Created
December 26, 2025 19:53
-
-
Save larkintuckerllc/1e54ac9fae5ef588b5dedcccb0f85971 to your computer and use it in GitHub Desktop.
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
| import asyncio | |
| from langchain.agents import create_agent | |
| from langchain.messages import HumanMessage | |
| from langchain_mcp_adapters.client import MultiServerMCPClient | |
| QUESTION = HumanMessage(content="What's the weather in San Francisco?") | |
| client = MultiServerMCPClient( | |
| { | |
| "local_server": { | |
| "transport": "stdio", | |
| "command": "uv", | |
| "args": [ | |
| "--directory", | |
| "/Users/jtucker/desktop/working/weather", | |
| "run", | |
| "weather.py" | |
| ], | |
| } | |
| } | |
| ) | |
| async def main(): | |
| tools = await client.get_tools() | |
| agent = create_agent( | |
| model="gpt-5-nano", | |
| tools=tools, | |
| ) | |
| response = await agent.ainvoke({ | |
| "messages": [QUESTION], | |
| }) | |
| print(response["messages"][-1].content) | |
| if __name__ == "__main__": | |
| asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment