12.03

Connect agents to MCP servers

skillmaxingPython with AIConnect agents to MCP servers
Visual lesson

Connect agents to MCP servers

Included with Pro · 4:10
Lessons · 972 words

The Relay MCP server from the last lesson is running on port 8001 with three tools. It does not know or care what will call it. This lesson points two agents at it: one built with the OpenAI Agents SDK and one built with LangChain's create_agent. Neither imports a Relay module. Each connects, asks the server what it can do, and hands those descriptions to its model as if they were local functions.

One server, two agents
Figure 1One server, two agentsDifferent frameworks, different models, the same tool running in the same place.

The mechanics are the same in both. At start-up the framework opens a client to the server and calls tools/list. It converts each tool's schema into its own tool type. When the model picks one, the framework sends tools/call, waits for the result, and puts it back into the conversation as a tool result. The agent loop is unchanged; only the place the tool runs has moved.

Pro

Continue reading

Pro unlocks every video lesson, the full notes and runnable code across the Python with AI course, from the language itself to agents, MCP, Langfuse and deployment.

Unlock full access to
Python with AIAI researchComplete system design
30% off with LAUNCH30ends in 7h 40m
Buy now
View all plans ·Already Pro? Sign in
124 online