MCPServerStreamableHTTP class handles session management and tool discovery automatically.
Prerequisites
- Python 3.11+
- A Civic account at app.civic.com with a configured toolkit
Installation
Authentication
- Script / Agent (Civic Token)
- Web App (Civic Auth)
For standalone scripts and autonomous agents — the simplest path.For production agents, lock to a specific toolkit by appending a
Generate a Civic Token
- Log in to app.civic.com
- Click your account name in the bottom left
- Go to Install → MCP URL
- Click Generate Token and copy it immediately — it won’t be shown again
Set Environment Variables
profile parameter:Use the Token
Pass the token as a Bearer token in theAuthorization header:Full credentials guide
Token generation, URL parameters, OAuth vs token comparison
Use
mcp_servers=[server] — not toolsets=[server]. The mcp_servers parameter is the current Pydantic AI API for MCP connections.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

