Skip to main content
Glama
kmexnx
by kmexnx

Invoice MCP Server

A Model Context Protocol (MCP) server for generating professional invoices as PDFs or sending them via email. This server provides tools that allow Claude to create, customize, and distribute invoices based on a professional template.

๐Ÿš€ Quick Start

Run directly without installation:

npx invoice-mcp-server

Option 2: Docker

# Pull and run
docker run -p 3000:3000 -v $(pwd)/invoices:/app/invoices invoice-mcp-server

# Or build locally
docker build -t invoice-mcp-server .
docker run -p 3000:3000 -v $(pwd)/invoices:/app/invoices invoice-mcp-server

Option 3: Traditional Installation

git clone https://github.com/kmexnx/invoice-mcp-server.git
cd invoice-mcp-server
npm install
npm run build

Related MCP server: Invoices Generator MCP Server

โœจ Features

  • ๐Ÿ“„ PDF Generation: Create professional invoices as PDF files

  • ๐Ÿ“ง Email Integration: Send invoices directly via email

  • ๐ŸŽจ Template-based: Uses a clean, professional invoice template

  • ๐Ÿ’ผ Business Ready: Includes all standard invoice fields (tax rates, line items, etc.)

  • ๐Ÿ”ง Customizable: Easy to modify template and styling

  • ๐Ÿณ Docker Support: Run in containers for easy deployment

  • โšก NPX Ready: No installation required with npx

  • ๐Ÿ“ Smart Directory Handling: Automatic directory creation with fallbacks

๐Ÿ“‹ Prerequisites

For NPX/Local Installation:

  • Node.js 18+

  • For email functionality: SMTP server credentials

For Docker:

  • Docker installed

  • For email functionality: SMTP server credentials

๐Ÿ› ๏ธ Installation & Setup

Method 1: NPX (Zero Installation)

The easiest way to get started:

# Run directly
npx invoice-mcp-server

# With custom output directory
OUTPUT_DIR=/Users/yourname/Documents/invoices npx invoice-mcp-server

# With environment variables
SMTP_HOST=smtp.gmail.com SMTP_USER=you@gmail.com OUTPUT_DIR=/tmp/invoices npx invoice-mcp-server

Method 2: Docker Setup

  1. Create a docker-compose.yml:

version: '3.8'
services:
  invoice-mcp:
    image: invoice-mcp-server
    ports:
      - "3000:3000"
    volumes:
      - ./invoices:/app/invoices
      - ./.env:/app/.env
    environment:
      - SMTP_HOST=smtp.gmail.com
      - SMTP_PORT=587
      - SMTP_USER=your-email@gmail.com
      - SMTP_PASS=your-app-password
      - FROM_EMAIL=your-email@gmail.com
      - FROM_NAME=Your Company Name
      - OUTPUT_DIR=/app/invoices
  1. Run with Docker Compose:

docker-compose up -d

Method 3: Traditional Installation

  1. Clone and install:

git clone https://github.com/kmexnx/invoice-mcp-server.git
cd invoice-mcp-server
npm install
npm run setup  # Creates directories and checks permissions
  1. Configure environment:

cp .env.example .env
# Edit .env with your settings
  1. Build and run:

npm run build
npm start

๐Ÿ“ Directory Configuration

The server needs a directory to save generated PDF invoices. It uses this priority order:

  1. Custom Directory (Recommended): Set OUTPUT_DIR environment variable

  2. Default Local: ./invoices in current directory

  3. Fallback: System temporary directory

Setting Custom Output Directory

For NPX users:

# Set for current session
export OUTPUT_DIR=/Users/yourname/Documents/invoices
npx invoice-mcp-server

# Or inline
OUTPUT_DIR=/path/to/your/invoices npx invoice-mcp-server

For permanent setup:

Add to your shell profile (~/.zshrc, ~/.bashrc, etc.):

export OUTPUT_DIR=/Users/yourname/Documents/invoices

For Docker users:

docker run -e OUTPUT_DIR=/app/invoices -v /your/local/path:/app/invoices invoice-mcp-server

Directory Permissions

The server automatically:

  • โœ… Creates the output directory if it doesn't exist

  • โœ… Tests write permissions

  • โœ… Falls back to temporary directories if needed

  • โœ… Provides clear error messages

If you encounter permission issues:

# Create and set permissions manually
mkdir -p /path/to/your/invoices
chmod 755 /path/to/your/invoices

# Or use a directory you own
export OUTPUT_DIR=$HOME/Documents/invoices

๐Ÿ”ง Claude Desktop Configuration

Add this server to your Claude Desktop configuration:

For NPX Usage:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "invoice-server": {
      "command": "npx",
      "args": ["invoice-mcp-server"],
      "env": {
        "OUTPUT_DIR": "/Users/yourname/Documents/invoices",
        "SMTP_HOST": "smtp.gmail.com",
        "SMTP_PORT": "587",
        "SMTP_USER": "your-email@gmail.com",
        "SMTP_PASS": "your-app-password",
        "FROM_EMAIL": "your-email@gmail.com",
        "FROM_NAME": "Your Company Name"
      }
    }
  }
}

For Docker Usage:

{
  "mcpServers": {
    "invoice-server": {
      "command": "docker",
      "args": ["exec", "invoice-mcp-container", "node", "/app/dist/index.js"],
      "env": {
        "OUTPUT_DIR": "/app/invoices",
        "SMTP_HOST": "smtp.gmail.com",
        "SMTP_PORT": "587",
        "SMTP_USER": "your-email@gmail.com",
        "SMTP_PASS": "your-app-password"
      }
    }
  }
}

For Local Installation:

{
  "mcpServers": {
    "invoice-server": {
      "command": "node",
      "args": ["/path/to/invoice-mcp-server/dist/index.js"],
      "env": {
        "OUTPUT_DIR": "/Users/yourname/Documents/invoices",
        "SMTP_HOST": "smtp.gmail.com",
        "SMTP_PORT": "587",
        "SMTP_USER": "your-email@gmail.com",
        "SMTP_PASS": "your-app-password"
      }
    }
  }
}

๐Ÿ’ฌ Usage Examples

Basic Invoice Creation

Claude, create me an invoice for "Acme Corp" for the amount of $5000

Detailed Invoice

Claude, create an invoice with the following details:
- Client: TechStart Inc.
- Services: Web Development (40 hours at $125/hour), Logo Design ($500)
- Tax rate: 8.5%
- Due date: 30 days from today
- Save as PDF and email to client@techstart.com

Multiple Line Items

Claude, generate an invoice for:
- Company: Global Solutions LLC
- Item 1: Consulting Services - $2,500
- Item 2: Project Management - $1,200
- Item 3: Documentation - $800
- Tax rate: 7.25%
- Email it to accounting@globalsolutions.com

๐Ÿ› ๏ธ Available Tools

1. create_invoice_pdf

Generates a PDF invoice file.

Parameters:

  • invoice_data: Complete invoice information

  • filename: Optional custom filename

2. send_invoice_email

Creates and sends an invoice via email.

Parameters:

  • invoice_data: Complete invoice information

  • recipient_email: Email address to send to

  • subject: Optional custom email subject

  • message: Optional custom email message

3. get_invoice_template

Returns the current invoice template structure for reference.

๐Ÿ“Š Invoice Data Structure

{
  // Company Information
  company: {
    name: string;
    address: string;
    city: string;
    state: string;
    zipCode: string;
    phone?: string;
    fax?: string;
    email?: string;
  };
  
  // Client Information
  billTo: {
    name: string;
    company?: string;
    address: string;
    city: string;
    state: string;
    zipCode: string;
    phone?: string;
  };
  
  // Invoice Details
  invoiceNumber: string;
  date: string;
  dueDate?: string;
  
  // Line Items
  items: Array<{
    description: string;
    amount: number;
  }>;
  
  // Financial Details
  taxRate?: number; // as percentage (e.g., 8.5 for 8.5%)
  other?: number;   // additional fees/discounts
}

๐Ÿ” Environment Variables

Variable

Description

Required

Default

Example

OUTPUT_DIR

PDF output directory

Recommended

./invoices

/Users/name/Documents/invoices

SMTP_HOST

SMTP server host

No*

-

smtp.gmail.com

SMTP_PORT

SMTP server port

No

587

587

SMTP_USER

SMTP username

No*

-

you@gmail.com

SMTP_PASS

SMTP password

No*

-

your-app-password

FROM_EMAIL

From email address

No

SMTP_USER

billing@company.com

FROM_NAME

From name

No

-

Your Company Name

TEMP_DIR

Temporary files directory

No

System temp

/tmp

*Required only for email functionality

Important Notes:

  • OUTPUT_DIR: Highly recommended to set this to avoid permission issues

  • SMTP credentials: Only needed if you want to email invoices

  • Paths: Use absolute paths for best results

  • Permissions: Ensure the OUTPUT_DIR is writable

๐Ÿณ Docker Configuration

Dockerfile

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY dist ./dist
COPY .env.example ./.env

RUN mkdir -p invoices

EXPOSE 3000

CMD ["node", "dist/index.js"]

Docker Environment

# Run with environment variables
docker run -e SMTP_HOST=smtp.gmail.com \
           -e SMTP_USER=you@gmail.com \
           -e SMTP_PASS=yourpassword \
           -e OUTPUT_DIR=/app/invoices \
           -v $(pwd)/invoices:/app/invoices \
           invoice-mcp-server

๐Ÿงช Development

Project Structure

invoice-mcp-server/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts              # Main MCP server
โ”‚   โ”œโ”€โ”€ invoice-generator.ts  # PDF generation logic
โ”‚   โ”œโ”€โ”€ email-service.ts      # Email functionality
โ”‚   โ”œโ”€โ”€ invoice-template.ts   # HTML template
โ”‚   โ””โ”€โ”€ setup.js             # Setup script
โ”œโ”€โ”€ dist/                     # Compiled JavaScript
โ”œโ”€โ”€ invoices/                 # Generated PDFs (created by setup)
โ”œโ”€โ”€ Dockerfile               # Docker configuration
โ”œโ”€โ”€ docker-compose.yml       # Docker Compose setup
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

NPM Scripts

npm run build      # Compile TypeScript
npm run dev        # Development mode with watch
npm start          # Run compiled server
npm run setup      # Create directories and check setup
npm run clean      # Clean build directory
npm run docker     # Build Docker image

Testing

Test the server using the MCP inspector:

npx @modelcontextprotocol/inspector node dist/index.js

Setup Script

The setup script (npm run setup) will:

  • โœ… Create necessary directories

  • โœ… Test write permissions

  • โœ… Check Node.js version

  • โœ… Verify package structure

  • โœ… Display helpful diagnostics

๐Ÿ› Troubleshooting

Common Issues

Directory Permission Errors

# Solution 1: Set custom directory
export OUTPUT_DIR=/Users/yourname/Documents/invoices
mkdir -p $OUTPUT_DIR

# Solution 2: Use setup script
npm run setup

# Solution 3: Use temporary directory
export OUTPUT_DIR=/tmp/invoices

NPX Issues

  • Package not found: Ensure you have npm 5.2+ for npx support

  • Permission errors: Try setting OUTPUT_DIR to a directory you own

  • Directory creation fails: Use OUTPUT_DIR=/tmp/invoices npx invoice-mcp-server

Docker Issues

  • Port conflicts: Change port mapping -p 3001:3000

  • Volume issues: Ensure local directories exist and are writable

  • Memory limits: Increase Docker memory for large invoices

Email Issues

  • Gmail: Use App Passwords instead of regular password

  • SMTP Errors: Verify host, port, and credentials

  • Firewall: Ensure SMTP ports aren't blocked

PDF Generation Issues

  • Missing fonts: Install system fonts or use web fonts

  • Memory issues: Increase Node.js memory limit

  • Puppeteer errors: Install Chrome dependencies

Debug Mode

Enable debug logging:

DEBUG=invoice-mcp:* npx invoice-mcp-server

Environment Diagnostics

Run the setup script to diagnose issues:

npm run setup

This will show:

  • โœ… Directory creation status

  • โœ… Write permissions

  • โœ… Node.js version

  • โœ… Environment information

  • โœ… Troubleshooting suggestions

๐Ÿ“ˆ Performance

Optimization Tips

  1. Use custom OUTPUT_DIR for faster file access

  2. Docker multi-stage builds for smaller images

  3. PDF caching for repeated templates

  4. Email queuing for bulk operations

  5. Resource limits for container deployments

Scaling

  • Use Redis for session storage

  • Implement queue system for PDF generation

  • Load balance multiple containers

  • Use external SMTP service

๐Ÿค Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests if applicable

  5. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ†˜ Support


Quick Start Example:

  1. Set your directory: export OUTPUT_DIR=/Users/yourname/Documents/invoices

  2. Run: npx invoice-mcp-server

  3. Configure Claude Desktop (see above)

  4. Ask Claude: "Create an invoice for ABC Company for $2,500"

  5. Claude handles the rest automatically! ๐ŸŽ‰

The server handles all formatting, calculations, and delivery automatically while saving PDFs to your specified directory.

Available Tools

3 tools
create_invoice_pdfC

Generate a PDF invoice file

ParametersJSON Schema
NameRequiredDescriptionDefault
invoice_dataYesComplete invoice data including company info, bill-to info, items, etc.
filenameNoOptional custom filename for the PDF (without .pdf extension)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full disclosure burden but only states the basic action. It fails to specify where the generated file is stored (returned as binary, saved to disk, etc.), whether it overwrites existing files, or any idempotency characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely brief (5 words) and front-loaded with the action verb. No wasted words or redundancy, though the extreme brevity contributes to the lack of behavioral and contextual detail given the absence of annotations and output schemas.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Inadequate for a file-generation tool with nested parameters, no annotations, and no output schema. The description fails to hint at return values (file path vs. binary data) or explain relationships to sibling tools, leaving significant gaps in the agent's understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% description coverage, establishing a baseline of 3. The description adds no additional parameter context beyond what the schema already provides (e.g., no details on invoice_data structure or formatting constraints).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific action (Generate) and resource (PDF invoice file). Clear and direct, though it does not explicitly differentiate from sibling tools like get_invoice_template or send_invoice_email.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides no guidance on when to use this tool versus alternatives (e.g., when to generate a PDF vs. sending an email or retrieving a template). No prerequisites or workflow context is mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_invoice_templateB

Get the current invoice template structure for reference

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must carry full burden. While 'Get' implies read-only and 'current' suggests temporal relevance, the description fails to disclose side effects, authentication requirements, rate limits, or what the 'structure' actually contains (fields, schema, etc.).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single 9-word sentence is appropriately front-loaded with the action verb. However, given the absence of annotations and output schema, the extreme brevity leaves significant gaps rather than demonstrating efficient completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description should specify what the template structure includes or its format. 'Structure for reference' is vague and insufficient for an agent to predict the return value or utility of calling this tool before creating PDFs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 0 parameters with 100% coverage. Per guidelines, 0 params = baseline 4. The description does not mention parameters (none exist), which is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses specific verb 'Get' and resource 'invoice template structure'. Clearly identifies the operation and target resource, though it does not explicitly differentiate from siblings 'create_invoice_pdf' or 'send_invoice_email' in the description text (distinction relies on tool names).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides no guidance on when to use this tool versus the sibling tools. No mention of workflow sequence (e.g., whether to call this before create_invoice_pdf) or prerequisites. The phase 'for reference' hints at read-only usage but doesn't establish clear usage boundaries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

send_invoice_emailC

Create and send an invoice via email

ParametersJSON Schema
NameRequiredDescriptionDefault
invoice_dataYesComplete invoice data including company info, bill-to info, items, etc.
recipient_emailYesEmail address to send the invoice to
subjectNoOptional custom email subject
messageNoOptional custom email message body

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but fails to disclose critical behavioral traits: that sending email triggers external irreversible actions, potential for duplicate sends if retried, delivery status limitations, or authentication requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise at seven words with no redundancy. However, the brevity constitutes under-specification rather than efficient information density given the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Inadequate for a 4-parameter mutation tool with nested objects and external side effects. No output schema, no annotations, and minimal description leaves significant gaps in understanding prerequisites, error cases, and return behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear descriptions for all four parameters. The tool description adds no parameter-specific guidance beyond the schema, which warrants the baseline score of 3 for high-coverage schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the core action (create and send) and medium (email), but lacks specificity about the invoice content/structure and does not explicitly differentiate from sibling 'create_invoice_pdf' which presumably also creates invoices but does not send them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance provided on when to use this versus 'create_invoice_pdf' or prerequisites like invoice validation. No mention of idempotency concerns for email sending or retry behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv1.0.2
    • First observedcreate_invoice_pdf
    • First observedget_invoice_template
    • First observedsend_invoice_email

TDQS

B3.1/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: create_invoice_pdf generates a PDF file, get_invoice_template retrieves template structure, and send_invoice_email handles email delivery. There is no overlap in functionality, making tool selection unambiguous for an agent.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (create_invoice_pdf, get_invoice_template, send_invoice_email) with clear verbs and descriptive nouns. The naming is uniform and predictable throughout the set.

Tool Count3/5

With only 3 tools, the set feels thin for an invoice management server, lacking operations like updating, deleting, or listing invoices. While the tools cover core actions, the count is borderline low for typical domain coverage.

Completeness2/5

The tool set has significant gaps for invoice management: it includes creation, template retrieval, and email sending, but misses essential CRUD operations (e.g., list_invoices, update_invoice, delete_invoice) and other lifecycle steps like payment tracking or status updates, which could lead to agent failures in workflows.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables creation and management of invoices with JSON storage and LaTeX-based PDF rendering. Supports draft creation and professional PDF generation through customizable LaTeX templates.
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Wave invoicing operations including listing invoices, retrieving details, and generating branded PDFs directly from AI assistants.
    21
    ISC

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kmexnx/invoice-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server