lodgify-mcp
CLAUDE.md4 starsChanged 16 months agoMITView on GitHub
This is a Model Context Protocol (MCP) server that exposes Lodgify Public API v2 endpoints as MCP tools, enabling AI assistants to interact with Lodgify's property management system programmatically. Required environment variables in .env: When implementing new Lodgify tools, follow this modular pattern:
- Reads credentials
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/architecture-patterns.mdcCursor rule
- .cursor/rules/coding-standards.mdcCursor rule
- .cursor/rules/cursor_rules.mdcCursor rule
- .cursor/rules/development-workflow.mdcCursor rule
- .cursor/rules/mcp-development.mdcCursor rule
- .cursor/rules/project-overview.mdcCursor rule
- .cursor/rules/self_improve.mdcCursor rule
- .cursor/rules/taskmaster/dev_workflow.mdcCursor rule
- .cursor/rules/taskmaster/taskmaster.mdcCursor rule
- .cursor/rules/testing-guidelines.mdcCursor rule
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
18 rules. About 0 are common, 13 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
Read-only mode support for operational safety
- Distinctive: line 83
When implementing new Lodgify tools, follow this modular pattern:
- Distinctive: line 87
Create tool registration object with name, category, config, and handler
- Very specific: line 88
Use closure-based getClient() to access the Lodgify orchestrator
- Very specific: line 89
Use flexibleEnhanceResponse() or enhanceResponse() for response formatting
- Distinctive: line 93
Import the new tool module
- Distinctive: line 94
Add tool to the appropriate category registration
- Very specific: line 103
Use flexibleEnhanceResponse() for backward-compatible response building
- Very specific: line 106
Create human-readable summaries with generateSummary()
- Distinctive: line 134
Availability: - Check property availability for date ranges
- Very specific: line 154
Check for Retry-After header (use if present)
- Distinctive: line 162
Never log raw API keys or sensitive data
- Distinctive: line 164
Use structured logging with appropriate levels
- Distinctive: line 165
Document key rotation procedures in README
- Distinctive: line 169
All tools must have Zod validation schemas
- Distinctive: line 181
When testing the MCP server during development:
- Distinctive: line 183
Stop the currently running server process (Ctrl+C).
- Distinctive: line 187
If using an MCP client (e.g., Claude or VS Code), restart the MCP session after code changes.
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Model Context Protocol (MCP) server that exposes Lodgify Public API v2 endpoints as MCP tools, enabling AI assistants to interact with Lodgify's property management system programmatically.
Core Architecture
Technology Stack
- Runtime: Bun ≥ 1.3.13 (or Node.js ≥ 18)
- Language: TypeScript
- Protocol: MCP over stdio
- SDK: @modelcontextprotocol/sdk
- Validation: Zod schemas
- HTTP Client: Native fetch with custom retry logic
Key Components
- MCP Server (
src/server.ts)- Minimal entry point that initializes the modular MCP server
- Coordinates server setup and starts the stdio transport
- Delegates all functionality to modular components
- MCP Modules (
src/mcp/)- Registry Pattern: Central registries for tools and resources
- Tool Modules (
src/mcp/tools/): Organized by category (property, booking, availability, rate, webhook, messaging) - Resource Modules (
src/mcp/resources/): Health check and system monitoring - Error Handling (
src/mcp/errors/): Centralized error processing and sanitization - Server Setup (
src/mcp/server-setup.ts): Server initialization and configuration - Schemas (
src/mcp/schemas/): Shared Zod validation schemas - Utils (
src/mcp/utils/): TypeScript types and response enhancement utilities - Response Enhancement (
src/mcp/utils/response/): Response builder, summary generator, suggestion generator
- Lodgify Orchestrator (
src/lodgify-orchestrator.ts)- Unified API for all Lodgify endpoints (v1 and v2)
- Centralized authentication and configuration
- Read-only mode support for operational safety
- Health monitoring and status reporting
- Core Modules (
src/core/)- HTTP client (
src/core/http/) with retry and rate limiting - Error handling (
src/core/errors/) with structured error types - Rate limiter (
src/core/rate-limiter/) with sliding window implementation - Retry logic (
src/core/retry/) with exponential backoff
- HTTP client (
- API Modules (
src/api/v1/,src/api/v2/)- Modular API client implementations
- TypeScript interfaces for all endpoints
- Specialized clients for bookings, properties, rates, webhooks, etc.
Development Commands
# Initial setup
bun install
cp .env.example .env # Configure LODGIFY_API_KEY
# Development
bun dev # Run TypeScript directly (Bun has built-in TS support)
bun run build # Compile TypeScript to dist/
bun run test # Run unit tests (isolated per file; plain `bun test` can leak mocks)
bun test --watch # Run tests in watch mode
bun run lint # Run ESLint
bun run typecheck # Run TypeScript type checking
# Production
bun start # Run compiled server from dist/Environment Configuration
Required environment variables in .env:
LODGIFY_API_KEY: Your Lodgify API key (required)LOG_LEVEL: Logging level (error|warn|info|debug, default: info)DEBUG_HTTP: Set to "1" for verbose HTTP debugging (optional)
Tool Implementation Pattern
When implementing new Lodgify tools, follow this modular pattern:
- Tool Module Creation in appropriate category file (
src/mcp/tools/[category]-tools.ts):- Define Zod schema for input validation
- Create tool registration object with name, category, config, and handler
- Use closure-based
getClient()to access the Lodgify orchestrator - Use
flexibleEnhanceResponse()orenhanceResponse()for response formatting - Export tool registration for the registry
- Registry Integration in
src/mcp/tools/register-all.ts:- Import the new tool module
- Add tool to the appropriate category registration
- Tools are automatically registered when server starts
- Client Method in
lodgify-orchestrator.ts:- Build URL with path parameters
- Pass query parameters through bracket notation flattener
- Handle response and errors consistently
- Response Enhancement:
- Use
flexibleEnhanceResponse()for backward-compatible response building - Extract entity-specific details with
extractEntityDetails() - Generate contextual suggestions with
generateSuggestions() - Create human-readable summaries with
generateSummary() - Errors are automatically processed with enhanced context and suggestions
- Use
- Error Handling:
- Errors are automatically processed through centralized error handler
- Enhanced errors include suggestions for resolution
- Sanitization removes sensitive data before returning to user
- McpError codes are applied based on error type
Testing Strategy
- Unit Tests: Focus on HTTP client retry logic, query flattening, error formatting
- Integration Tests: Mock or live test each tool with sample inputs
- Contract Tests: Validate tool outputs against expected shapes
- Smoke Tests: Sequential execution of all tools with test credentials
MCP Tool Catalog
For a complete reference of all available Lodgify MCP tools with detailed parameters and examples, see: @docs/TOOL_CATALOG.md
Tool Categories Summary
The server implements 30+ MCP tools across these categories:
- Property Management - List, get, search properties and rooms
- Booking & Reservation - Full CRUD operations for bookings, check-in/out, payment links
- Rates & Pricing - View and update rates, get pricing quotes
- Availability - Check property availability for date ranges
- Messaging - Thread management for guest communications
- Webhooks - Event subscription management
- Resources - Health check and system status
Query Parameter Handling
The client supports bracket notation for complex nested parameters:
// Example: roomTypes[0].Id=123&guest_breakdown[adults]=2
params = {
"roomTypes[0].Id": 123,
"guest_breakdown[adults]": 2
}Rate Limiting Strategy
- Detect 429 responses
- Check for
Retry-Afterheader (use if present) - Otherwise use exponential backoff: 2^attempt seconds (max 30s)
- Maximum 5 retry attempts
- Log retry attempts with timing information
Security Considerations
- API keys are loaded from environment variables only
- Never log raw API keys or sensitive data
- Mask PII fields in error messages and logs
- Use structured logging with appropriate levels
- Document key rotation procedures in README
Code Quality Standards
- All tools must have Zod validation schemas
- TypeScript strict mode enabled
- Comprehensive error handling with typed errors and enhanced responses
- Response enhancement utilities provide consistent user experience
- Unit test coverage target: ≥90% for client code
- Integration tests for all MCP tools with enhanced response validation
- Clear separation between MCP server and HTTP client layers
- Type-safe response building with
EnhancedResponseinterface - Contextual suggestions and summaries for better user guidance
Debugging
When testing the MCP server during development:
- Stop the currently running server process (Ctrl+C).
- Restart locally via:
bun dev(hot re-run) orbun run build && bun start(fromdist/).
- If using an MCP client (e.g., Claude or VS Code), restart the MCP session after code changes. Hot-reload is not supported.
- For CLI testing, re-run
node dist/server.jsafter each change.
Task Master AI Instructions
Import Task Master's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file. @./.taskmaster/CLAUDE.md
- The owner of the repository is mikerobgit. the repository name is lodgify-mcp (package: @mikerob/lodgify-mcp)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

