Skip to content
nofeb

nofeb with Pydantic AI

Agent framework · configuration checked against the vendor's documentation on 2026-10-01

In Pydantic AI v2, add MCPToolset("https://api.nofeb.com/mcp", headers={"Authorization": …}) to an Agent's toolsets, then run the agent inside async with agent. The v1 class MCPServerStreamableHTTP took the same url and headers.

Checked against the engine on .

Where does the configuration go?

pydantic_ai.mcp.MCPToolset (Pydantic AI v2).

Install
pip install "pydantic-ai-slim[mcp]"

How do I connect Pydantic AI?

  1. pip install "pydantic-ai-slim[mcp]".
  2. Create MCPToolset with the nofeb URL and headers as below.
  3. Pass it in toolsets=[…] and run the agent inside async with agent.
Pydantic AI: Python
import os
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPToolset

toolset = MCPToolset(
    'https://api.nofeb.com/mcp',
    headers={'Authorization': f"Bearer {os.environ['NOFEB_API_KEY']}"},
)
agent = Agent('openai:gpt-5', toolsets=[toolset])

async with agent:
    result = await agent.run('List my nofeb inboxes')

Checked against Pydantic AI's documentation on . source: pydantic.dev

What should I know about Pydantic AI's setup?

  • Pydantic AI v2 replaced MCPServerStreamableHTTP with MCPToolset, built on the FastMCP client.
  • headers cannot be combined with a custom http_client.

What can I ask it to do?

"List my nofeb inboxes" as in the snippet, then a typed result model that extracts the latest code from wait_for_email.

117 tools are available, including create_inbox, wait_for_email, reply_to_message, get_thread_context, set_thread_state and get_dns_setup. Whether a send goes out at once or waits for a person is decided by the inbox's autonomy tier on the server, not by Pydantic AI.

Frequently asked questions

Which Pydantic AI version does this need?

MCPToolset is the v2 API. On v1, use MCPServerStreamableHTTP(url, headers=...) from pydantic_ai.mcp.

Status of everything on this page

Every capability named above, with its status as reconciled against the engine.

CapabilityWhat it doesStatus
MCP server A remote MCP server over streamable HTTP whose tools are generated from the same operation table as the REST API and dispatched through the same router, so a tool cannot behave differently from its endpoint. Shipped
Scoped API keys Keys bound to the organization, one pod or one inbox, holding only the scopes they are given. A key cannot mint a key wider than itself. Shipped
Autonomy tiers enforced by the server Every inbox carries a sending policy, from read-only to autonomous, enforced on the server for every surface that sends, so switching from the API to MCP cannot bypass it. Shipped
Wait for an email Long-poll an inbox for up to a minute until a message matching sender, subject or has-a-code arrives. Shipped
TypeScript and Python SDKs Official clients generated from the OpenAPI document: @nofeb/sdk for Node, Deno, Bun and edge runtimes, and nofeb for Python with sync and asyncio clients. Both chain long polls for waitForEmail, retry idempotent requests, page through lists and verify webhook signatures. Shipped
MCP sign-in with OAuth MCP clients connect by signing in instead of pasting a key: OAuth 2.1 with discovery, dynamic client registration, client ID metadata documents, PKCE, tokens bound to the MCP server, refresh-token rotation and immediate revocation. A person approves the scopes, and optionally one inbox, in the console, and can disconnect the app at any time. API keys keep working beside it. Shipped