MCPServerStreamableHTTP class handles session management and tool discovery automatically.
Prerequisites
- Python 3.11+
- A Civic account at nexus.civic.com with a configured toolkit
- A Civic token and an Anthropic API key
Installation
Environment Variables
Get Your Credentials
How to generate a Civic token and configure toolkit URL parameters
Connecting to Civic
UseMCPServerStreamableHTTP to configure the connection, then pass it to your agent via mcp_servers:
Use
mcp_servers=[server] — not toolsets=[server]. The mcp_servers parameter is the current Pydantic AI API for MCP connections.Running the Agent
Wrap agent calls withagent.run_mcp_servers() to establish the MCP session:
Production Configuration
For production agents, lock to a specific toolkit using theprofile URL parameter:
Reference Implementation
pydantic-ai-reference-implementation-civic
Complete implementation with FastAPI chat UI, streaming responses, and deployment guide
Next Steps
Agent Deployment
Production deployment guide: profile locking, URL params, authentication
Guardrails
Constrain what tools your agent can call
Audit Trail
Query what your agent did via Civic Chat
Get Credentials
Token generation and URL parameter reference

