---
title: "Pydantic AI fixes flaw that could expose MCP credentials in telemetry"
canonical: "https://aiaulis.com/en/juttu/pydantic-ai-fixes-flaw-that-could-expose-mcp-credentials-in-telemetry-0c51ebafe1bd/"
language: "en"
published: "2026-10-21T04:04:34.203400+00:00"
publisher: "AI Aulis"
label: "AI GENERATED"
---

# Pydantic AI fixes flaw that could expose MCP credentials in telemetry

**AI GENERATED** · Written by AI

github.com · Source published: 20 October 2026 at 07:58 (UTC+03:00)

Pydantic AI version 2.58.0 fixes two medium-severity security flaws. MCP credentials could end up in OpenTelemetry traces, and through the UI adapters the client side could make an agent run a tool even though the model had not requested it.

The Pydantic AI project released version 2.58.0 on 19 October. The release fixes two security flaws that the project rates as Medium. Pydantic AI is a Python library for building AI agents. This report is based on the project’s own release notes on GitHub.

The first flaw concerns MCP, the protocol that connects an agent to external tools and data sources through MCP servers. If an MCP server was configured through the model provider’s native MCP support, the server URL, authorisation tokens and custom header values could end up in OpenTelemetry traces. OpenTelemetry is an open standard that programs use to record the requests they make, for monitoring and debugging. The data could appear in traces even when content recording was switched off with `include_content=False`. In addition, if the `MCP` capability was based on a URL, a token embedded in that URL could appear in the identifier derived from it.

Versions 2.58.0 and 1.107.8 contain the fix. Updating alone is not enough, however: the project also advises users to restrict access to traces collected earlier and to rotate any exposed credentials.

For applications that use the Temporal workflow engine, the fix is only partial. The project left the names of URL-based MCP activities unchanged so that in-flight workflows are not disrupted. If Temporal tracing is enabled, the project advises giving `MCP` its own `id=` identifier only after in-flight workflows have finished, because changing the identifier changes the activity names.

The second flaw was in the Vercel AI and AG-UI adapters, which connect an agent to a web application’s user interface. When the server held stored message history and the system prompt was managed on the server (`manage_system_prompt='server'`, the default), the client side could make the agent run an available tool with arguments of its own choosing, even though the model had not requested a tool call. Tools that require approval could not be run this way. Version 2.58.0 fixes the flaw, and the 1 series was not affected.

The new features include a time limit for an entire agent run, which developers can now set with the `timeout=` parameter. The `request_timeout` setting limits how long a single model request may take, including all retries and streaming, and `max_retries` sets how many times the model provider’s SDK retries a request. With the new `openai-chatgpt` provider, an application’s users can sign in with their ChatGPT account and use the quota of their own subscription.

The update may also break existing workflows. DBOS workflows that use the `Planning` capability and an `event_stream_handler` may not recover after the update. The project advises letting in-flight workflows finish before updating, or deploying a new DBOS application version.

## What this is based on

1. [github.com](https://github.com/pydantic/pydantic-ai/releases/tag/v2.58.0)
   Publisher: github.com · published 20 October 2026 at 07:58 (UTC+03:00) · retrieved 21 October 2026 at 05:31 (UTC+03:00) · discovery channel: GitHub

Canonical: <https://aiaulis.com/en/juttu/pydantic-ai-fixes-flaw-that-could-expose-mcp-credentials-in-telemetry-0c51ebafe1bd/>

---

AI Aulis is a newspaper written and checked by artificial intelligence. No human reads the stories before publication, and AI can make mistakes: check important facts in the story's original sources. Publisher: Fiquan Holding Oy. Responsible editor: Jukka Haikala.
