Learning resourcesReviewed · Pydantic

Pydantic AI MCP Capability Guide

This guide teaches Python developers to connect Pydantic AI agents to MCP tools, but naming and server-instruction controls differ between local and provider-managed connections. It covers connection options, tool-name prefixes, server trust and credentials supplied separately for each user.

Researched 13 Nov 2026

In short.

This Pydantic AI guide helps Python developers add MCP tools to agents, but controls for tool names and server instructions depend on the connection mode. It documents default local handling, provider-native preference with local fallback, strict native-only configuration and per-run authentication. Locally constructed toolsets include server instructions by default; disabling them there does not control native provider behavior. Compatible releases, provider support, costs and runtime reliability are not established by this page. No code was executed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage is the complete selected documentation page at [https://pydantic.dev/docs/ai/capabilities/mcp/index.md], including its introductory documentation-index and query-parameter notices and all MCP capability sections. The documentation index and every linked page are excluded. No code was executed and no server or provider connection was exercised. Runtime behavior, compatibility, performance, costs and reuse rights remain unverified where the page does not establish them.

The overview

identity

MCP Capability is a Pydantic AI documentation page explaining how to expose MCP server tools to an AI agent through pydantic_ai.capabilities.MCP. The original page is [https://pydantic.dev/docs/ai/capabilities/mcp/index.md].

Its scope is the capability interface, including local inputs, provider-native configuration, naming, server instructions and per-user credentials. It points to separate documentation for lower-level clients, provider support and advanced configuration.

assessment

The guide is useful when adding MCP connections to a Pydantic AI application because it explains several choices that affect behavior: who handles the connection, how tools are named, whether server instructions reach the agent and how credentials vary by user.

The main adoption concern is that similar-looking configurations do not provide identical controls. Tool prefixes apply only locally, pre-built toolsets retain their own instruction settings, and native providers decide how to handle server instructions. The page supplies configuration guidance without evidence of runtime reliability or performance.

users

The strongest fit is Python developers using Pydantic AI, particularly applications connecting multiple MCP servers or serving users with separate server credentials.

Beginners receive short examples, but the later authentication example assumes familiarity with Python functions, dataclasses, asynchronous execution and values passed into an agent run. These concepts are used rather than taught in depth.

capabilities

MCP accepts a server URL or a local input such as a FastMCP client, transport, in-process FastMCP server or script path. Inputs that are not already toolsets are wrapped in MCPToolset automatically.

The documented controls include explicit identifiers, local tool-name prefixes, exclusion of server instructions and functions that supply authorization tokens or headers for each run. An explicit MCPServerTool provides control over native settings such as its identifier, authorization token and description.

Using it

requirements

The URL-based local example specifies pydantic-ai-slim[mcp]. Strict native-only configuration does not require the mcp extra. The examples assume a Pydantic AI agent and an appropriate MCP server or client input.

The page does not specify a minimum Python version, compatible package release or complete native-provider support list. Its per-user example requires dependencies carrying the current user's token; the asynchronous example also needs asyncio imported and asyncio.run(main()) added.

mechanism

The capability uses local MCP handling by default, which the page associates with application control over credentials, hooks and tracing. Setting native=True prefers the provider-native path with local fallback. Adding local=False makes that configuration native-only. Explicit native and local inputs can use independent configurations, such as a relay connection for the provider and a direct local connection.

Without an explicit identifier, MCP derives one from the server URL's hostname. It excludes the path and query because those can contain credentials. Two capabilities using the same hostname therefore need explicit, distinct identifiers.

Authorization-token and header functions are called with the run context at the start of each run. The returned token is used for native configuration and the local connection. The page states that concurrent local runs use separate MCP sessions; returning None sends no Authorization header. This behavior was not independently verified.

setup

Add an MCP capability to the agent's capabilities collection, supplying a server URL or local input. Choose the default local mode, native preference with fallback, or strict native-only mode according to the intended connection path.

Assign distinct identifiers when connecting servers on the same host. To prefix local tool names, provide a string through tool_prefix, or use tool_prefix=True with an explicit id. A hostname-derived identifier does not satisfy the latter requirement.

For an untrusted server, include_instructions=False excludes its instructions from a toolset built by the capability. Configure a pre-built MCPToolset separately because it keeps its own setting. The native provider's treatment of instructions must be established separately.

example

One example connects documentation and ticket servers that could both expose a tool named search. The documentation connection uses id='docs' and tool_prefix=True, producing docs_search locally. The ticket connection uses tool_prefix='tickets', producing tickets_search. The allowed_tools setting continues to match the original server name, search.

A second example stores mcp_token in a Deps dataclass. A function reads ctx.deps.mcp_token and returns a Bearer authorization value for the current run. The agent receives that function through authorization_token, and each call supplies its own dependency value. These are documented examples; neither was executed.

Assessment & evidence

limitations

Server tool names are unprefixed by default and can collide with another server's tools or the application's own tools. Prefixing changes local names only; the provider controls names on the native path. Prefixing leaves capability and toolset identifiers unchanged.

The page warns that server-provided instructions are included by default and reach the model with the same authority as instructions written by the application developer. The capability's exclusion setting applies only to the local toolset it constructs.

No benchmark, compatibility matrix, deployment result or independent security evaluation is supplied. Session separation, fallback behavior and authentication correctness in a particular application remain unverified until exercised there.

reasoning

The documented design addresses concrete integration problems. Hostname-only identifiers avoid incorporating credentials from URL paths or queries, while explicit identifiers resolve the resulting same-host collisions. Tool prefixes distinguish generic names, and per-run credential functions avoid fixing one user's token into a shared agent configuration.

A practical inference is that the local path offers more direct application control over naming and instruction inclusion. Native configuration requires understanding the provider's behavior separately. The page does not establish which path is more reliable or faster.

alternatives

Within Pydantic AI, the page points to direct MCPToolset use for lifecycle management, advanced transport or client configuration, and MCP connections outside the capability interface.

An explicit MCPServerTool is another documented option when native configuration needs different identifiers, authorization or descriptions. The page provides no comparison with competing frameworks, and the linked implementation details are outside the supplied evidence.

evidence

The evidence is the complete MCP Capability page at [https://pydantic.dev/docs/ai/capabilities/mcp/index.md]. Its captured source SHA-256 is 2c8bd1850d74f6767d377eabc529870c946c1c2d31edd89c861612da778842cc.

The page supports descriptions of configuration syntax and the maintainers' stated behavior. It supplies no observed execution results for this report. Linked API references, client documentation and provider-support pages are excluded.

Access & freshness

costs

The page supplies no prices for the library, model-provider usage, MCP servers or hosting. Total cost is unknown.

The distinction between local and native connections is documented as a configuration choice, without a cost comparison. Neither path can be described as cheaper from this evidence.

rights

The supplied page contains no licence terms for its text, Python examples, the Pydantic AI package or connected servers. Reuse and redistribution rights are unknown from this evidence.

Permissions for copying documentation or code and terms for using a particular server must be established from their applicable licences and service terms.

freshness

The supplied page was captured on 13 November 2026 at 02:52:51.779 UTC. It gives no last-updated date or package release number.

It says default tool-name prefixing is planned for v3. That is a stated plan; the captured instructions describe names as unprefixed by default. Whether a later release changes this behavior is unknown.

actions

Before implementation, confirm the package release and native-provider support relevant to the application. Choose the connection mode, assign explicit identifiers where needed and decide how local tool names should be prefixed.

Review whether each server is trusted to supply agent instructions. For applications with separate user credentials, use the documented per-run authentication pattern and verify token and session separation under concurrent requests.

Exercise tool discovery, authentication failures, naming collisions and any intended native-to-local fallback in the target environment. These are suggested validation steps; no such execution results are available here.

Evidence for this report

selected-page.txtselected · checked 2026-11-13