Get the full code: https://github.com/riza-io/examples/tree/main/demos/mcp_and_pydanticai
Try out Riza's MCP server: https://docs.riza.io/getting-started/mcp-servers
PydanticAI is one of the most popular frameworks for building AI agents in Python, and it recently launched MCP support. If you've been wanting to learn MCP, this is a great place to start.
In this tutorial you'll build a simple agent with PydanticAI, and then add an MCP server called fetch, which enables web browsing. Then we'll use the Postgres MCP server to add database querying to our agent. Then we'll use Riza's remote MCP server to add a code interpreter to our agent.