Simple Billing API for MCP demonstration.
The repo gives you a lightweight FastAPI service with in-memory data stores for customers, invoices, and payments. You can start the server with uvicorn, create customers, issue invoices, record payments, and query the current state without any external dependencies.
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
-
Start the API server:
uvicorn app.main:app --reload
-
Create a customer:
curl -X POST http://localhost:8000/customers \ -H "Content-Type: application/json" \ -d '{"name": "Example Customer", "email": "customer@example.com"}'
-
Issue an invoice for that customer:
curl -X POST http://localhost:8000/invoices \ -H "Content-Type: application/json" \ -d '{"customer_id": 1, "amount": 120.0, "currency": "USD", "due_date": "2024-12-31"}'
-
Record a payment against the invoice:
curl -X POST http://localhost:8000/payments \ -H "Content-Type: application/json" \ -d '{"invoice_id": 1, "amount": 120.0}'
-
Retrieve the current invoices:
curl http://localhost:8000/invoices