Multi-Tenant Invoice Autofill MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi-Tenant Invoice Autofill MCP ServerAutofill invoice for tenant Acme Corp using the extracted order JSON."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Multi-Tenant Invoice Autofill MCP Server
A Python backend service enabling function-calling or MCP-capable LLMs (Claude, Gemini, GPT, etc.) to autofill and save invoices on Digital Invoicing Software on behalf of tenants.
Features
Dual Transport Support: Exposed via standard MCP protocol (stdio / Streamable HTTP) and REST API (FastAPI) with OpenAPI schema.
Multi-Tenancy & Auth: Per-tenant credential encryption, custom MCP API keys, and isolated session management.
Resilient Adapter: Encapsulated HTTP adapter replicating browser headers, with reactive session refresh and dynamic cookie expiry parsing.
Idempotency & Concurrency: Deduplication via document hash and per-tenant Redis distributed locking (
lock:tenant:{id}).Privacy First: Mandatory structured log redaction layer scrubbing passwords, cookies, keys, and tokens.
Zero Hardcoded Values: No credentials or business identities baked into code, comments, or tests; full synthetic test data generation.
Related MCP server: Invoice MCP Server
Local Prerequisites
Python 3.12+
Docker & Docker Compose (for local Postgres & Redis)
Getting Started
1. Environment Setup
Copy .env.example to .env and set local variables:
cp .env.example .env2. Launch Local Database & Redis
docker-compose up -d3. Install Dependencies
python -m venv .venv
# Windows:
.\.venv\Scripts\pip install -r requirements.txt
# Linux/macOS:
source .venv/bin/activate
pip install -r requirements.txt4. Run Migrations
.\.venv\Scripts\alembic upgrade head5. Start the Server
# Start FastAPI REST server:
.\.venv\Scripts\uvicorn mcp_digitalinvoice.main:app --reload --port 8000
# Run MCP stdio server:
.\.venv\Scripts\python -m mcp_digitalinvoice.mcp_server.serverSecurity
Encryption Key Management: The ENCRYPTION_KEY environment variable must be set to a secure 32-byte base64-encoded Fernet key. Application startup will fail immediately if ENCRYPTION_KEY is not provided. If an encryption key was ever used to encrypt real tenant data and is suspected of exposure, that data must be re-encrypted under a freshly generated key, since the old key must be considered compromised.
Workflows
Tenant Onboarding (connect_account)
Call
connect_accountwith the tenant's Digital Invoicing Software login email, password, and business name.The server encrypts credentials, validates them via an initial login, and returns a unique
mcp_api_key.Provide this
mcp_api_keyto the LLM (as a Bearer token or header) for subsequent tool invocations.
Invoice Autofill (fill_invoice)
The LLM invokes fill_invoice with extracted invoice JSON payload (buyer, items, meta). The service validates required fields, enforces single-document sequencing, checks idempotency, resolves tenant session, maps payload to downstream shape, and creates the invoice draft.
Running Tests
.\.venv\Scripts\pytest -v tests/This server cannot be deployed
Maintenance
Related MCP Connectors
Invoicing you drive by talking to your AI: log time, raise invoices and track what's owed via MCP.
Multi-tenant MCP gateway for AI commerce. One connection, every store.
Multi-tenant MCP gateway for AI commerce. One connection, every store.
Multi-tenant MCP gateway for AI commerce. One connection, every store.
Related MCP Servers
- -licenseNot gradedqualityBmaintenanceEnables AI assistants to prepare and create invoices via Outvoicer's invoicing platform using Streamable HTTP MCP.-
- AlicenseNot gradedqualityCmaintenanceAllows AI clients like Claude and Cursor to authenticate and interact with an invoice generator backend, enabling login, invoice creation, and invoice download.2 npmMIT
- AlicenseAqualityBmaintenanceEnables AI assistants to securely interact with rental management data (leases, rent status, tenant records, tax filings) through a per-user OAuth 2.0 authenticated MCP server, with human-in-the-loop for sensitive actions.5AGPL 3.0
- AlicenseAqualityBmaintenanceMCP server for POP — enabling LLMs to generate, submit, and manage Italian e-invoices (FatturaPA/SdI), Peppol invoices, and PDF invoices directly from AI assistants.1624 npmMIT