Skip to content

Connect the MultitaskAI MCP server to Pydantic AI

Pydantic AI builds agents in Python. Add MultitaskAI as an MCPToolset with its URL and your API key, then pass it to your agent.

Endpoint

Text
https://mcp.multitaskai.com

Steps

  1. Create an API key in your MultitaskAI account.
  2. Install the MCP extra with pip install "pydantic-ai-slim[mcp]".
  3. Add the toolset below to your agent, with your key in place of YOUR_API_KEY.
  4. Run the agent and ask which MultitaskAI tools it can use.
Python
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPToolset

toolset = MCPToolset('https://mcp.multitaskai.com', auth='YOUR_API_KEY', id='multitaskai')
agent = Agent('openai:gpt-6.1-sol', toolsets=[toolset])

Authentication

Pydantic AI sends your MultitaskAI API key in the Authorization header. Create a key in your account and use it in place of YOUR_API_KEY. Keep the key out of files you share or commit.

Text
Authorization: Bearer YOUR_API_KEY

Good to know

  • MCPToolset replaces the older MCPServerStreamableHTTP class.
  • A URL that does not end in /sse is treated as Streamable HTTP.
  • auth takes the key as a bearer token string; static headers can go in headers instead.
  • Use async with agent to open and close the MCP connection around several runs.

Official documentation

The Pydantic MCP documentation covers Pydantic AI's own settings in detail. See the overview for the endpoint and authentication, and pricing for the daily free requests.