Download Latest Version v3.2.7 source code.tar.gz (2.0 MB)
Email in envelope

Get an email when there's a new version of Marvin

Home / v3.2.5
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-01-06 1.3 kB
v3.2.5 source code.tar.gz 2026-01-06 1.9 MB
v3.2.5 source code.zip 2026-01-06 2.0 MB
Totals: 3 Items   3.8 MB 1

MCP Server Lifecycle Fix

This patch release fixes a critical issue where MCP servers were being restarted for each agent.run() call instead of staying alive for the session.

What was happening

When using MCP servers with agents, each agent.run() call would:

  1. Start the MCP server subprocess
  2. Run the agent
  3. Stop the MCP server subprocess

This caused unnecessary overhead and defeated the purpose of having persistent MCP connections.

What this release fixes

#1260: MCP servers now persist across multiple agent.run() calls within the same Thread context:

:::python
import marvin
from pydantic_ai.mcp import MCPServerStdio

hub_mcp = MCPServerStdio(command="uvx", args=["some-mcp-server"])
agent = marvin.Agent(mcp_servers=[hub_mcp])

with marvin.Thread():
    agent.run("first query")   # starts MCP server
    agent.run("second query")  # reuses running server ✓
    agent.run("third query")   # reuses running server ✓
# Thread exits → MCP server cleaned up

#1261: Fixed a follow-up issue where MCP cleanup could fail when Thread.__exit__ was called from an async context (the orchestrator). The cleanup now happens properly in the orchestrator's async finally block.

Full Changelog

https://github.com/PrefectHQ/marvin/compare/v3.2.4...v3.2.5

Source: README.md, updated 2026-01-06