agent-invoice
Enables agents to generate, track, and manage invoices via MCP tools, with CLI support for payment tracking and earnings summaries.
README
Agent Invoice
MCP server + CLI for autonomous agents to generate, track, and manage invoices.
Built for the agentic economy ā by Nyx Builds.
Why?
Agents do work. Agents need to get paid. But there's no standard way for an autonomous agent to:
- Generate an invoice for completed work
- Track payment status across clients
- Maintain a ledger of earnings
- Integrate billing into their workflow via MCP
- Bill in multiple currencies with tax calculations
- Set up recurring invoices for retainer clients
Agent Invoice fixes this. It's a self-contained billing system designed for AI agents.
Features
- š Invoice Generation ā Create professional invoices with line items, due dates, and client info
- š° Tax Calculation ā Per-line-item and invoice-level tax rates with automatic computation
- š± Multi-Currency ā 15+ currencies (USD, EUR, GBP, JPY, etc.) with proper symbols and decimal handling
- š Recurring Invoices ā Set up weekly, biweekly, monthly, quarterly, or yearly billing templates
- š·ļø Custom Numbering ā Configurable invoice numbering (prefix, separator, digits)
- š Payment Tracking ā Monitor which invoices are pending, paid, or overdue
- š Earnings Ledger ā Running total of all income, tax, and discounts across invoices
- š MCP Server ā Full Model Context Protocol integration so any agent can bill via their standard tool interface
- š» CLI ā Command-line interface for direct use or scripting
- š¾ JSON Storage ā Simple file-based storage, no database required
- š¤ Export ā Export invoices as JSON or Markdown
Quick Start
CLI Usage
# Create a client (with EUR as default billing currency)
agent-invoice client add "Acme Corp" --email billing@acme.com --currency EUR
# Create an invoice with tax
agent-invoice create \
--client "Acme Corp" \
--item "Code review,40,150.00,8.5" \
--item "Bug fixes,10,200.00" \
--tax-rate 8.5 \
--due 30
# Apply a discount
agent-invoice discount INV-0001 50.00
# List all invoices in EUR
agent-invoice list --currency EUR
# Mark an invoice as paid
agent-invoice pay INV-0001
# Show earnings summary
agent-invoice earnings
# Set up a recurring monthly invoice
agent-invoice recurring create \
--client "Acme Corp" \
--item "Retainer,1,500.00" \
--frequency monthly
# Generate an invoice from a recurring template
agent-invoice recurring generate REC-ABC123
# Process all due recurring invoices
agent-invoice recurring process
# Configure invoice numbering
agent-invoice numbering set --prefix BIL --separator / --digits 3
# List supported currencies
agent-invoice currencies
MCP Server
Start the MCP server for integration with any MCP-compatible agent:
agent-invoice serve
The server exposes these tools:
create_invoiceā Generate a new invoice (with tax, currency, discounts)list_invoicesā List all invoices with optional filtering by status, client, or currencyget_invoiceā Get details of a specific invoicemark_paidā Mark an invoice as paidmark_sentā Mark an invoice as sentcancel_invoiceā Cancel an invoiceapply_discountā Apply a discount to an invoiceadd_clientā Register a new client (with default currency)list_clientsā List all clientsearnings_summaryā Get earnings breakdown (with tax and discount totals)export_invoiceā Export an invoice as markdowncreate_recurringā Create a recurring invoice templatelist_recurringā List recurring invoice templatesgenerate_from_recurringā Generate an invoice from a recurring templatepause_recurringā Pause a recurring invoiceresume_recurringā Resume a paused recurring invoiceprocess_due_recurringā Generate invoices for all due recurring templatesget_numbering_configā Get the current invoice numbering configurationupdate_numbering_configā Update invoice numbering (prefix, separator, digits)list_currenciesā List all supported currencies
Tax Calculation
Agent Invoice supports two levels of tax:
- Line-item tax ā Set a tax rate on individual items:
--item "Consulting,10,200.00,8.5" - Invoice-level tax ā Set a default tax rate for items without their own:
--tax-rate 8.5
Items with their own tax rate override the invoice-level rate. The grand total is computed as:
Subtotal + Total Tax - Discount = Grand Total
Multi-Currency
Set a default currency per client, or override per invoice:
# Client with EUR default
agent-invoice client add "Berlin GmbH" --currency EUR
# Override to GBP for a specific invoice
agent-invoice create --client "Berlin GmbH" --currency GBP --item "Work,100.00"
Supported currencies: USD, EUR, GBP, JPY, CAD, AUD, CHF, CNY, INR, BRL, KRW, MXN, SGD, SEK, NZD
Recurring Invoices
Create templates that generate invoices on a schedule:
# Monthly retainer
agent-invoice recurring create --client "Acme" --item "Retainer,1,500.00" --frequency monthly
# Weekly support
agent-invoice recurring create --client "Beta" --item "Support,1,200.00" --frequency weekly
# Generate manually
agent-invoice recurring generate REC-ABC123
# Process all due (run daily via cron)
agent-invoice recurring process
# Pause/resume
agent-invoice recurring pause REC-ABC123
agent-invoice recurring resume REC-ABC123
Custom Invoice Numbering
# View current config
agent-invoice numbering show
# Change prefix and format
agent-invoice numbering set --prefix BIL --separator / --digits 3
# Generates: BIL/001, BIL/002, ...
# Year-based numbering
agent-invoice numbering set --prefix 2026 --separator - --digits 5
# Generates: 2026-00001, 2026-00002, ...
Installation
pip install agent-invoice
Or with uv:
uv pip install agent-invoice
Architecture
agent-invoice/
āāā src/agent_invoice/
ā āāā __init__.py
ā āāā models.py # Pydantic data models (Invoice, Client, RecurringInvoice, etc.)
ā āāā store.py # JSON file storage with numbering config
ā āāā service.py # Business logic (tax, currency, recurring, discounts)
ā āāā cli.py # Click CLI with 20+ commands
ā āāā mcp_server.py # MCP server with 20 tools
āāā tests/
ā āāā test_models.py
ā āāā test_store.py
ā āāā test_service.py
ā āāā test_cli.py
āāā data/ # Default storage location
Data Storage
Invoices, clients, and recurring templates are stored as JSON files in ~/.agent-invoice/ by default. Set the AGENT_INVOICE_DIR environment variable to customize the location.
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.