/Pydantic Logfire

Pydantic AI MCP Support & Pydantic Logfire MCP Server Announcement

Samuel Colvin avatar
Samuel Colvin
2 mins

Today we're excited to announce two powerful additions to the Model Context Protocol (MCP) ecosystem: Pydantic AI Agents as MCP clients, and the Pydantic Logfire MCP server. These tools bring enhanced capabilities to AI applications through standardized integrations.

Pydantic AI now supports the Model Context Protocol in three key ways:

  1. Agents as MCP Clients: Pydantic AI agents can connect to MCP servers to leverage their tools and capabilities
  2. Agents in MCP Servers: Pydantic AI agents can be used within MCP servers
  3. mcp-run-python: As part of our ecosystem, we're building specialized MCP servers, including mcp-run-python

Learn more on the Pydantic AI docs.

Our latest MCP server implementation is for our Pydantic Logfire observability platform. This MCP server enables AI applications to search and analyze logs, traces, and metrics directly. This powerful integration helps debugging workflows by providing AI assistants with crucial observability context. Because Pydantic Logfire allows you to query your data using SQL, it is particularly well-suited to AI agent support.

Here's a video demo showing how you can query your Pydantic Logfire data in Cursor using the Pydantic Logfire MCP server:

This enables working with Cursor's coding agent (or any other IDE that supports MCP) for:

  • AI-driven fixes based on issues found in your live applications
  • Identification of bottlenecks in your code based on live data
  • Easy querying and understanding of your errors

And many more!

Getting started with the Pydantic Logfire MCP server in Cursor is straightforward. Create or update your .cursor/mcp.json as per our setup instructions, make sure you select agent mode in the Cursor chat, and then your AI agents will start using Pydantic Logfire!

The Model Context Protocol provides a standardized interface for AI applications to connect with external tools and services. This common interface enables applications like Pydantic AI agents, coding assistants like Cursor, and desktop apps like Claude Desktop to seamlessly interact with various services.

The MCP ecosystem is growing rapidly, with many implementations available at github.com/modelcontextprotocol/servers. Samuel and Marcelo from Pydantic are helping to maintain the official Python SDK for MCP servers and clients.

  • Create deep research agents by connecting Pydantic AI to web search MCP servers
  • Help Cursor (or Windsurf, Claude Code etc.) debug complex issues by connecting to Pydantic Logfire's MCP server for observability context
  • Run sandboxed Python code through Pydantic Logfire's Run Python MCP server from any MCP client

If you've got any questions or suggestions, please let us know.