invoiceshelf-mcp
An MCP server that acts as a secure, multi-tenant proxy to the InvoiceShelf API, enabling AI assistants to manage invoices, estimates, customers, payments, expenses, and more with 109 tools and TOON compression for efficient token usage.
README
InvoiceShelf MCP Multitenant Proxy Server
This repository contains a Model Context Protocol (MCP) server that acts as a secure, multi-tenant proxy between an AI Assistant and the InvoiceShelf backend API. It exposes 109 MCP tools covering 14 resource domains with full CRUD, search, dashboard, and relationship management.
✨ Features
- 🔑 Identity Passthrough — Extracts the
Authorization: Bearer <token>header from incoming HTTP requests and forwards it to the InvoiceShelf API without server-side authentication. - 👥 Multi-Tenancy — Uses Python
contextvarsto maintain thread-safe user identity isolation, ensuring all AI-driven actions are scoped to the authenticated user's permissions. - 📊 Full InvoiceShelf Coverage — 109 tools mapped to InvoiceShelf API endpoints across 14 resource domains.
- ⚡ TOON Optimization — All list responses are automatically compressed using TOON (Token-Optimized Object Notation) to reduce token consumption and maximize context window efficiency.
- ⚡ Efficient Gets — GET responses return only commonly used fields by
default. Full objects are available via an
include_all_fieldsflag. - 🧪 Comprehensive Testing — 208 automated tests covering all tool domains, run via the test runner pipeline.
🔧 Environment Variables
| Variable | Required | Description |
|---|---|---|
INVOICESHELF_BASE_URL |
Yes | Docker-internal URL of the InvoiceShelf API |
MCP_SERVER_PORT |
Yes | Port number the MCP server listens on |
ALLOW_ALL_AGGREGATE |
No | When true, aggregate listing tools honor the include_all_fields parameter. When false (default), the parameter is silently forced to False for aggregate list operations. |
IS_STATEFUL |
No | When true, uses stateful Streamable HTTP with session tracking. When false (default), uses stateless mode. |
INVOICESHELF_PUBLIC_URL |
No | Public-facing URL to replace internal Docker URLs in responses. Defaults to INVOICESHELF_BASE_URL if not set. |
📦 Installation & Local Development
- Ensure you have Python 3.12+ installed.
- Install dependencies:
pip install fastmcp httpx pydantic uvicorn toon-mcp-server - Run the server:
export INVOICESHELF_BASE_URL=http://localhost:8080 export INVOICESHELF_PUBLIC_URL=https://invoiceshelf.example.com export MCP_SERVER_PORT=80 python -m src.main
🐳 Docker Deployment
Build and run the server using Docker:
docker build -t invoiceshelf-mcp:latest .
docker run -d --name invoiceshelf-mcp \
-e INVOICESHELF_BASE_URL="http://invoiceshelf-app:8080" \
-e INVOICESHELF_PUBLIC_URL="https://invoiceshelf.example.com" \
-e MCP_SERVER_PORT=80 \
invoiceshelf-mcp:latest
The MCP server serves at `http://invoiceshelf-mcp:80/mcp`
(Streamable HTTP).
⚠️ Important Notes
- 📋
include_all_fields— Theinclude_all_fieldsparameter (available on allget_*andlist_*tools) controls whether all available fields are included in responses. Defaults toFalsefor performance; set toTrueonly when additional fields are needed. - ⚡ TOON Compression — All list responses are automatically compressed using TOON (Token-Optimized Object Notation) to reduce token consumption by 30-60%.
- 📝 Required Fields & Defaults — Each
create_*tool requires specific key fields (e.g.namefor resources). All other fields default to empty strings or reasonable values. The company assignment is automatically set to the authenticated user's company for most resources.
🛠️ API Tool Mapping
The server implements 109 MCP tools organized into the following categories:
🧾 Invoices (10 tools)
list_all_invoices— List all invoice recordsget_invoice_by_id— Get a single invoice by IDcreate_invoice— Create a new invoiceupdate_invoice— Update an existing invoicedelete_invoices_by_id— Delete an invoice by IDsend_invoice— Send an invoice via emailclone_invoice— Clone an existing invoicechange_invoice_status— Change an invoice's statuslist_invoice_templates— List available invoice templatesget_invoice_send_preview— Get an invoice send preview
📋 Estimates (11 tools)
list_all_estimates— List all estimate recordsget_estimate_by_id— Get a single estimate by IDcreate_estimate— Create a new estimateupdate_estimate— Update an existing estimatedelete_estimates_by_id— Delete an estimate by IDsend_estimate— Send an estimate via emailclone_estimate— Clone an existing estimatechange_estimate_status— Change an estimate's statusconvert_estimate_to_invoice— Convert an estimate to an invoicelist_estimate_templates— List available estimate templatesget_estimate_send_preview— Get an estimate send preview
👥 Customers (7 tools)
list_all_customers— List all customer recordsget_customer_by_id— Get a single customer by IDget_customer_roles_by_id— Get the roles assigned to a customercreate_customer— Create a new customerupdate_customer— Update an existing customerdelete_customers_by_id— Delete a customer by IDget_customer_stats— Get statistics for a single customer
📦 Items (5 tools)
list_all_items— List all item recordsget_item_by_id— Get a single item by IDcreate_item— Create a new itemupdate_item— Update an existing itemdelete_items_by_id— Delete an item by ID
📏 Units (5 tools)
list_all_units— List all unit recordsget_unit_by_id— Get a single unit by IDcreate_unit— Create a new unitupdate_unit— Update an existing unitdelete_unit_by_id— Delete a unit by ID
🔁 Recurring Invoices (5 tools)
list_all_recurring_invoices— List all recurring invoice recordsget_recurring_invoice_by_id— Get a single recurring invoice by IDcreate_recurring_invoice— Create a new recurring invoiceupdate_recurring_invoice— Update an existing recurring invoicedelete_recurring_invoices_by_id— Delete a recurring invoice by ID
💳 Payments (7 tools)
list_all_payments— List all payment recordsget_payment_by_id— Get a single payment by IDcreate_payment— Create a new paymentupdate_payment— Update an existing paymentdelete_payments_by_id— Delete a payment by IDsend_payment— Send a payment receipt via emailget_payment_send_preview— Get a payment send preview
🏦 Payment Methods (5 tools)
list_all_payment_methods— List all payment method recordsget_payment_method_by_id— Get a single payment method by IDcreate_payment_method— Create a new payment methodupdate_payment_method— Update an existing payment methoddelete_payment_method_by_id— Delete a payment method by ID
💸 Expenses (6 tools)
list_all_expenses— List all expense recordsget_expense_by_id— Get a single expense by IDcreate_expense— Create a new expenseupdate_expense— Update an existing expensedelete_expenses_by_id— Delete an expense by IDduplicate_expense— Duplicate an existing expense
🗂️ Expense Categories (5 tools)
list_all_expense_categories— List all expense category recordsget_expense_category_by_id— Get a single expense category by IDcreate_expense_category— Create a new expense categoryupdate_expense_category— Update an existing expense categorydelete_expense_category_by_id— Delete an expense category by ID
🧮 Tax Types (5 tools)
list_all_tax_types— List all tax type recordsget_tax_type_by_id— Get a single tax type by IDcreate_tax_type— Create a new tax typeupdate_tax_type— Update an existing tax typedelete_tax_type_by_id— Delete a tax type by ID
📝 Notes (5 tools)
list_all_notes— List all note recordsget_note_by_id— Get a single note by IDcreate_note— Create a new noteupdate_note— Update an existing notedelete_note_by_id— Delete a note by ID
🏷️ Custom Fields (5 tools)
list_all_custom_fields— List all custom field recordsget_custom_field_by_id— Get a single custom field by IDcreate_custom_field— Create a new custom fieldupdate_custom_field— Update an existing custom fielddelete_custom_field_by_id— Delete a custom field by ID
🛡️ Roles (5 tools)
list_all_roles— List all role recordsget_role_by_id— Get a single role by IDcreate_role— Create a new roleupdate_role— Update an existing roledelete_role_by_id— Delete a role by ID
🌐 Domain (23 tools)
check_server_status— Check connectivity to the InvoiceShelf backendget_dashboard— Get dashboard dataget_bootstrap— Get application bootstrap datasearch_customers_and_users— Search across customers and userssearch_users— Search users by emaillist_all_currencies— List all currencieslist_used_currencies— List currencies in uselist_all_countries— List all countrieslist_timezones— List available timezoneslist_date_formats— List available date formatslist_time_formats— List available time formatsget_next_number— Get the next number for a resourceget_number_placeholders— Get number placeholders for a formatget_current_company— Get the current companyget_company_roles_by_id— Get the roles for a companyget_current_user_roles— Get the roles assigned to the current userlist_all_companies— List all companieslist_abilities— List all available abilitiesget_recurring_invoice_frequency— Get the next occurrence for a recurring frequencyget_exchange_rate— Get an exchange rate for a currencyget_active_exchange_rate_provider— Get the active exchange-rate providerlist_used_currencies_for_exchange— List currencies used for exchangelist_supported_currencies— List currencies supported by an exchange-rate provider
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。