Lago MCP Server for Pydantic AIGive Pydantic AI instant access to 12 tools to Apply Coupon, Batch Events, Create Billable Metric, and more
Pydantic AI brings type-safe agent development to Python with first-class MCP support. Connect Lago through Vinkius and every tool is automatically validated against Pydantic schemas. catch errors at build time, not in production.
Ask AI about this MCP Server for Pydantic AI
The Lago MCP Server for Pydantic AI is a standout in the Money Moves category — giving your AI agent 12 tools to work with, ready to go from day one.
Vinkius delivers Streamable HTTP and SSE to any MCP client
import asyncio
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerHTTP
async def main():
# Your Vinkius token. get it at cloud.vinkius.com
server = MCPServerHTTP(url="https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp")
agent = Agent(
model="openai:gpt-4o",
mcp_servers=[server],
system_prompt=(
"You are an assistant with access to Lago "
"(12 tools)."
),
)
result = await agent.run(
"What tools are available in Lago?"
)
print(result.data)
asyncio.run(main())
* Every MCP server runs on Vinkius-managed infrastructure inside AWS - a purpose-built runtime with per-request V8 isolates, Ed25519 signed audit chains, and sub-40ms cold starts optimized for native MCP execution. See our infrastructure
About Lago MCP Server
Connect Lago to your AI agent to automate your metering and billing infrastructure. Lago is the open-source alternative to Stripe Billing, designed for complex usage-based pricing models.
Pydantic AI validates every Lago tool response against typed schemas, catching data inconsistencies at build time. Connect 12 tools through Vinkius and switch between OpenAI, Anthropic, or Gemini without changing your integration code. full type safety, structured output guarantees, and dependency injection for testable agents.
What you can do
- Customer Management — Create and update customer profiles with
upsert_customerand retrieve details withget_customer. - Subscription Lifecycle — Assign plans to customers using
create_subscriptionand monitor them withget_subscription. - Billing Infrastructure — Define billing plans with
create_planand set upcreate_billable_metricto track consumption. - Usage Tracking — Send real-time usage data with
send_eventorbatch_eventsto trigger accurate billing. - Financial Operations — Manage wallets, apply coupons, and list invoices to keep your revenue operations running smoothly.
The Lago MCP Server exposes 12 tools through the Vinkius. Connect it to Pydantic AI in under two minutes — credentials fully managed, no infrastructure to provision, no vendor lock-in. Your configuration, your data, your control.
All 12 Lago tools available for Pydantic AI
When Pydantic AI connects to Lago through Vinkius, your AI agent gets direct access to every tool listed below — spanning usage-based-billing, metering, saas-metrics, and more. Every call runs in a secure, isolated environment with full audit visibility. Beyond a simple connection, you get real-time monitoring of agent activity, enterprise governance, and optimized token usage.
Apply coupon on Lago
Apply a coupon to a customer
Batch events on Lago
Send a batch of usage events
Create billable metric on Lago
Create a billable metric
Create coupon on Lago
Create a coupon
Create plan on Lago
Create a new billing plan
Create subscription on Lago
Assign a plan to a customer (create subscription)
Create wallet on Lago
Create a wallet for prepaid credits
Get customer on Lago
Retrieve a customer by external ID
Get subscription on Lago
Retrieve a subscription by external ID
List invoices on Lago
List all invoices
Send event on Lago
Send a usage event
Upsert customer on Lago
Requires an external_id. Create or update a customer in Lago
Connect Lago to Pydantic AI via MCP
Follow these steps to wire Lago into Pydantic AI. The entire setup takes under two minutes — your credentials stay safe behind Vinkius.
Install Pydantic AI
pip install pydantic-aiReplace the token
[YOUR_TOKEN_HERE] with your Vinkius tokenRun the agent
agent.py and run: python agent.pyExplore tools
Why Use Pydantic AI with the Lago MCP Server
Pydantic AI provides unique advantages when paired with Lago through the Model Context Protocol.
Full type safety: every MCP tool response is validated against Pydantic models, catching data inconsistencies before they reach your application
Model-agnostic architecture. switch between OpenAI, Anthropic, or Gemini without changing your Lago integration code
Structured output guarantee: Pydantic AI ensures tool results conform to defined schemas, eliminating runtime type errors
Dependency injection system cleanly separates your Lago connection logic from agent behavior for testable, maintainable code
Lago + Pydantic AI Use Cases
Practical scenarios where Pydantic AI combined with the Lago MCP Server delivers measurable value.
Type-safe data pipelines: query Lago with guaranteed response schemas, feeding validated data into downstream processing
API orchestration: chain multiple Lago tool calls with Pydantic validation at each step to ensure data integrity end-to-end
Production monitoring: build validated alert agents that query Lago and output structured, schema-compliant notifications
Testing and QA: use Pydantic AI's dependency injection to mock Lago responses and write comprehensive agent tests
Example Prompts for Lago in Pydantic AI
Ready-to-use prompts you can give your Pydantic AI agent to start working with Lago immediately.
"Create a new customer in Lago with external ID 'user_123' and email 'dev@example.com'."
"Show me the subscription details for ID 'sub_98765'."
"List all invoices for my Lago account."
Troubleshooting Lago MCP Server with Pydantic AI
Common issues when connecting Lago to Pydantic AI through Vinkius, and how to resolve them.
MCPServerHTTP not found
pip install --upgrade pydantic-aiLago + Pydantic AI FAQ
Common questions about integrating Lago MCP Server with Pydantic AI.
How does Pydantic AI discover MCP tools?
MCPServerHTTP instance with the server URL. Pydantic AI connects, discovers all tools, and generates typed Python interfaces automatically.Does Pydantic AI validate MCP tool responses?
Can I switch LLM providers without changing MCP code?
Explore More MCP Servers
View all →
Umbraco
10 toolsAutomate content workflows via Umbraco — retrieve delivery content, execute backoffice CRUD, and browse media assets directly from your AI agent.

Beisen (iTalentX)
10 toolsComprehensive HR cloud platform — manage employees, attendance, and recruitment via AI.

Starburst
6 toolsConnect your AI to Starburst Enterprise. Query federated data lakes, manage access roles, and orchestrate complex data environments seamlessly.

Codecov
8 toolsManage test coverage and engineering metrics via Codecov — track coverage reports, monitor commit totals, and audit code quality directly from any AI agent.
