Prerequisites
- Python 3.10+
- Xquik API key (
xq_...) - An LLM API key (Anthropic, OpenAI, or any Pydantic AI-supported provider)
Install
Full Example
Reusing Connections
Wrap multiple calls inasync with agent to keep the MCP connection open across requests:
Deferred Tool Loading
For large tool sets, useDeferredLoadingToolset to hide tools from the model until they’re discovered via tool search. This reduces prompt token usage:
Loading from JSON Config
If you manage MCP servers via a config file:mcp_config.json
Tool Prefixes
Avoid naming conflicts when connecting multiple MCP servers:Environment Variables
.env
Package Versions
| Package | Version |
|---|---|
pydantic-ai | 1.78.0+ |
mcp | 1.25.0+ |