Invoice MCP Server
Enables invoice management through MCP, including customer, invoice, and report operations with CLI and web interfaces.
README
Invoice MCP Server
A Model Context Protocol (MCP) server for invoice management with modular architecture.
Documentation
- Examples Guide - Comprehensive usage examples, workflows, and error handling
- Development Guide - Developer setup, testing, and contributing
- Architecture Guide - Technical architecture and component details
- API Reference - MCP tools, resources, and prompts reference
- Contributing - Contribution guidelines
Features
- MCP Protocol Support: Full implementation of Tools, Resources, and Prompts
- Multiple Transports: STDIO and HTTP/SSE support
- Dual GUI: CLI and Web interfaces
- SDK Layer: All operations through unified SDK
- Modular Design: Swappable components without code changes
Architecture
┌─────────────────────────────────────────────────────────────┐
│ GUI Layer │
│ ┌─────────┐ ┌─────────┐ │
│ │ CLI │ │ Web │ │
│ └────┬────┘ └────┬────┘ │
├───────────────────┴──────────────┴──────────────────────────┤
│ SDK Layer │
│ CustomerOperations │ InvoiceOperations │ ReportOperations │
├─────────────────────────────────────────────────────────────┤
│ MCP Server │
│ ┌─────────┐ ┌───────────┐ ┌─────────┐ │
│ │ Tools │ │ Resources │ │ Prompts │ │
│ └─────────┘ └───────────┘ └─────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Transport Layer │
│ ┌─────────┐ ┌─────────┐ │
│ │ STDIO │ │ HTTP │ │
│ └─────────┘ └─────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Infrastructure │
│ Database │ Repositories │ Lock Manager │ Config │
└─────────────────────────────────────────────────────────────┘
Quick Start
# 1. Clone and install
git clone <repository-url>
cd MCP_Server
pip install -e ".[dev]"
# 2. Test the CLI
python -m invoice_mcp_server cli customer list
# 3. Run the MCP server
python -m invoice_mcp_server stdio
Installation
Requirements
- Python 3.10+
- pip
Install for Development
# Install with dev dependencies (pytest, mypy, ruff)
pip install -e ".[dev]"
Install for Production
pip install -e .
Configuration
All configuration via environment variables or .env file:
# Server
SERVER_HOST=127.0.0.1
SERVER_PORT=8080
# Database
DB_PATH=data/invoices.db
# Invoice
VAT_RATE=0.17
CURRENCY=ILS
# Transport
TRANSPORT_TYPE=stdio
# Logging
LOG_LEVEL=INFO
Running the Server
MCP Server (STDIO) - For MCP Clients
python -m invoice_mcp_server stdio
Use this mode when connecting from Claude Desktop or other MCP clients.
MCP Server (HTTP)
python -m invoice_mcp_server http
Web Interface
python -m invoice_mcp_server web
# Access at http://localhost:8080
Help
python -m invoice_mcp_server --help
CLI Reference
The CLI provides direct access to all operations for testing and management.
Customer Commands
# List all customers
python -m invoice_mcp_server cli customer list
# Create a new customer
python -m invoice_mcp_server cli customer create --name "Acme Corp" --email "contact@acme.com"
# Create with all fields
python -m invoice_mcp_server cli customer create --name "Acme Corp" --email "contact@acme.com" --address "123 Main St" --phone "555-1234"
# Delete a customer
python -m invoice_mcp_server cli customer delete <customer-id>
Invoice Commands
# List all invoices
python -m invoice_mcp_server cli invoice list
# Create a new invoice
python -m invoice_mcp_server cli invoice create --customer-id <customer-id>
# Create with due date and notes
python -m invoice_mcp_server cli invoice create --customer-id <customer-id> --due-date "2024-12-31" --notes "Project payment"
# Add item to invoice
python -m invoice_mcp_server cli invoice add-item --invoice-id <invoice-id> --description "Consulting services" --quantity 10 --price 150.00
# Send invoice
python -m invoice_mcp_server cli invoice send <invoice-id>
# Record payment
python -m invoice_mcp_server cli invoice pay --invoice-id <invoice-id> --amount 1500.00 --method "bank_transfer"
Report Commands
# Show statistics
python -m invoice_mcp_server cli report stats
# Show overdue invoices
python -m invoice_mcp_server cli report overdue
MCP Client Configuration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"invoice-server": {
"command": "python",
"args": ["-m", "invoice_mcp_server", "stdio"],
"cwd": "/path/to/MCP_Server"
}
}
}
Testing MCP Connection
You can test the MCP server by sending JSON-RPC messages via stdio:
# Start the server and send an initialize request
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{}}}' | python -m invoice_mcp_server stdio
MCP Primitives
Tools (Write Operations)
create_customer- Create new customerupdate_customer- Update customer detailsdelete_customer- Delete customercreate_invoice- Create new invoiceadd_invoice_item- Add item to invoiceupdate_invoice_status- Change invoice statusrecord_payment- Record paymentsend_invoice- Send invoice to customer
Resources (Read Operations)
invoice://config- Server configurationinvoice://vat-rates- VAT ratesinvoice://customers/list- Customer listinvoice://invoices/list- Invoice listinvoice://invoices/recent- Recent invoicesinvoice://invoices/overdue- Overdue invoicesinvoice://statistics/overview- Statistics
Prompts (Model Guidance)
create_invoice- Guide for invoice creationmanage_customer- Guide for customer managementprocess_payment- Guide for payment processinggenerate_report- Guide for report generation
Testing
Run All Tests
pytest
Run with Coverage Report
pytest --cov=src/invoice_mcp_server --cov-report=term-missing
Run Specific Test Files
# Test models
pytest tests/test_models.py -v
# Test database
pytest tests/test_database.py -v
# Test SDK
pytest tests/test_sdk.py -v
# Test MCP server
pytest tests/test_mcp_server.py -v
Run Tests by Pattern
# Run all customer-related tests
pytest -k "customer" -v
# Run all invoice-related tests
pytest -k "invoice" -v
Code Quality
# Type checking
mypy src/invoice_mcp_server
# Linting
ruff check src/invoice_mcp_server
# Format check
ruff format --check src/invoice_mcp_server
Example Workflow
# 1. Create a customer
python -m invoice_mcp_server cli customer create --name "Test Company" --email "test@company.com"
# Returns: {"id": "uuid-here", "name": "Test Company", ...}
# 2. List customers to get the ID
python -m invoice_mcp_server cli customer list
# 3. Create an invoice for the customer
python -m invoice_mcp_server cli invoice create --customer-id <customer-id-from-step-2>
# 4. Add items to the invoice
python -m invoice_mcp_server cli invoice add-item --invoice-id <invoice-id> --description "Service" --quantity 1 --price 100
# 5. Check statistics
python -m invoice_mcp_server cli report stats
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。