A TypeScript-based Model Context Protocol (MCP) server that integrates with calendar systems to calculate working days and generate professional PDF invoices for freelancers and consultants.
- Smart Business Logic: Automatically excludes weekends, holidays, and calendar events
- Multi-Country Support: Holiday detection for 100+ countries via Nager.Date API
- Google Calendar Integration: Excludes personal events from working days calculations
- Detailed Breakdown: Day-by-day analysis with reasons for exclusions
- Automated PDF Creation: Generate beautiful invoices using Puppeteer
- Working Days Integration: Automatically calculates billable days and totals
- Professional Templates: Modern, responsive HTML templates with print optimization
- Multi-Currency Support: EUR, USD, and other currencies with proper formatting
- Tax Calculations: Configurable tax rates with automatic calculations
- 3 Powerful Tools:
get_working_days,get_holidays,generate_invoice - Resource Access: Direct access to generated PDFs and templates via MCP resources
- Claude Desktop Ready: Seamless integration with Claude Desktop
- Tool + Resource Pattern: Proper MCP architecture implementation
- Node.js 18+
- npm or yarn
- Claude Desktop (for MCP integration)
# Clone the repository
git clone https://github.com/Sitraka003/mcp-calendar-invoice-server.git
cd mcp-calendar-invoice-server
# Install dependencies
npm install
# Build the project
npm run buildCreate a .env file (optional - defaults provided):
# Google Calendar API (optional)
GOOGLE_CREDENTIALS_PATH=./credentials/google-service-account.json
GOOGLE_CALENDAR_ID=primary
# Company Information
COMPANY_NAME=FreelancePro Services
COMPANY_EMAIL=contact@freelancepro.com
COMPANY_PHONE=+33 1 23 45 67 89
# Invoice Configuration
DEFAULT_CURRENCY=EUR
DEFAULT_DAILY_RATE=500
OUTPUT_DIRECTORY=./output/invoicesAdd to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"calendar-invoice-server": {
"command": "tsx",
"args": ["/path/to/your/project/src/index.ts"],
"env": {
"NODE_ENV": "production"
}
}
}
}Calculate working days in a date range with comprehensive exclusions.
Parameters:
startDate(string): Start date in YYYY-MM-DD formatendDate(string): End date in YYYY-MM-DD formatcountryCode(string, optional): Country for holidays (default: "FR")includeCalendarEvents(boolean, optional): Exclude calendar events (default: true)calendarId(string, optional): Google Calendar ID
Example:
Calculate working days from 2024-01-01 to 2024-01-31 for France
Retrieve holidays for specific countries and years with filtering options.
Parameters:
year(number): Year (2000-2050)countryCode(string, optional): Country code (default: "FR")startDate(string, optional): Filter start dateendDate(string, optional): Filter end date
Example:
Get French holidays for 2024 between March and June
Generate professional PDF invoices with automatic working days calculation.
Parameters:
clientName(string): Client or company namestartDate(string): Work period start dateendDate(string): Work period end datedailyRate(number): Daily rate in eurosclientAddress(string, optional): Client addressclientEmail(string, optional): Client emaildescription(string, optional): Work descriptiontaxRate(number, optional): Tax rate as decimal (0.20 = 20%)currency(string, optional): Currency code (default: "EUR")
Example:
Generate an invoice for "Acme Corporation" from 2024-01-01 to 2024-01-31 at โฌ500/day
Access the HTML template used for invoice generation.
Access generated invoice PDF files by invoice ID (e.g., file://invoices/INV-2025-06-123456.pdf).
JSON listing of recently generated invoices with metadata.
The server implements the proper MCP architecture:
- Tools perform actions (calculate working days, generate PDFs)
- Resources provide access to content (PDF files, templates)
- Workflow: Tool creates content โ Returns metadata with resourceUri โ Resource accessible for content
src/
โโโ index.ts # MCP server entry point
โโโ services/
โ โโโ calendar.ts # Google Calendar integration
โ โโโ holidays.ts # Holiday API with provider pattern
โ โโโ invoice.ts # PDF invoice generation
โโโ utils/
โ โโโ working-days.ts # Business days calculation
โ โโโ date-helpers.ts # Date utility functions
โโโ types/
โ โโโ calendar.ts # Calendar type definitions
โ โโโ holidays.ts # Holiday type definitions
โ โโโ invoice.ts # Invoice type definitions
โโโ config/
โโโ environment.ts # Configuration management
User: "How many working days are there in January 2024 in France?"
โ Tool: get_working_days
โ Result: 23 working days (excludes weekends + New Year's Day)
User: "Generate an invoice for Acme Corp for January 2024"
โ Tool: generate_invoice (creates PDF)
โ Resource: file://invoices/INV-2025-06-123456.pdf (access PDF)
โ Result: Invoice metadata + direct PDF access
User: "Show me all French holidays in Q2 2024"
โ Tool: get_holidays (with date filtering)
โ Result: Easter Monday, Labour Day, Victory Day, Ascension Day, etc.
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Watch mode
npm run test:watchnpm run dev # Development server with hot reload
npm run build # Build TypeScript to JavaScript
npm run start # Start production server
npm run test # Run test suite
npm run clean # Clean build artifactscalendar-mcp-server/
โโโ src/ # Source code
โโโ templates/ # Invoice HTML templates
โโโ output/invoices/ # Generated PDF invoices
โโโ credentials/ # Google API credentials (optional)
โโโ docs/ # Documentation
โโโ tests/ # Test files
The server supports holiday detection for 100+ countries including:
- ๐ซ๐ท France (FR) - Default
- ๐บ๐ธ United States (US)
- ๐ฌ๐ง United Kingdom (GB)
- ๐ฉ๐ช Germany (DE)
- ๐จ๐ฆ Canada (CA)
- ๐ฆ๐บ Australia (AU)
- ๐ช๐ธ Spain (ES)
- ๐ฎ๐น Italy (IT)
- And many more...
- Node.js 18.0.0 or higher
- Memory: 2GB+ RAM (for PDF generation)
- Storage: File system write access for invoice output
- Network: Internet access for holiday API calls
- Google Calendar API: For calendar event exclusions
- Claude Desktop: For MCP client integration
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- FastMCP - TypeScript MCP framework
- Nager.Date - Holiday API service
- Google Calendar API - Calendar integration
- Puppeteer - PDF generation
- Claude Desktop - MCP client platform
- Issues: GitHub Issues
- Documentation: Project Wiki
- MCP Protocol: Model Context Protocol
Built with โค๏ธ for the freelancer community using the Model Context Protocol