Consuming MCP servers with MCPAdapter
Notebook· 05.03· 120–150 min· Lesson 42 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Load tools from an MCP server with
MCPAdapterandlist_tools(). - Run an agent over MCP tools with
create_agentandawait agent.ainvoke(...)(MCP tools are async-only). - Read MCP tool results: content blocks,
artifact,status="error", and the server metadata. - Combine several servers (prefixed tool names) and avoid name clashes.
- Explain the connection lifecycle: sessions, caching, and when tools reconnect.
Before you start
Lesson 05.02 (MCP fundamentals, top-level await), Lesson 02.03 (create_agent).
