lodgify-mcp
AGENTS.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
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.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 AGENTS.md into the rules it gives an agent
16 rules. About 1 is common, 13 are distinctive, and 2 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Read-only mode support for operational safety
- Distinctive: line 82
When implementing new Lodgify tools, follow this modular pattern:
- Distinctive: line 86
Create tool registration object with name, category, config, and handler
- Very specific: line 87
Use closure-based getClient() to access the Lodgify orchestrator
- Distinctive: line 91
Import the new tool module
- Distinctive: line 92
Add tool to the appropriate category registration
- Distinctive: line 124
Availability: - Check property availability for date ranges
- Very specific: line 144
Check for Retry-After header (use if present)
- Common: line 152
Never log raw API keys or sensitive data
- Distinctive: line 154
Use structured logging with appropriate levels
- Distinctive: line 155
Document key rotation procedures in README
- Distinctive: line 159
All tools must have Zod validation schemas
- Distinctive: line 168
When testing the MCP server during development:
- Distinctive: line 170
Stop the currently running server process (Ctrl+C).
- Distinctive: line 174
If using an MCP client (e.g., your AI agent or VS Code), restart the MCP session after code changes.
- Distinctive: line 179
Import Task Master's development workflow commands and guidelines, treat as if import is in the main AGENTS.md file.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.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
AGENTS.md
This file provides guidance to AI coding agents (e.g., Claude, Gemini, and other code assistants) 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 interfaces
- 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)
bun run 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 - 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
- Error Handling:
- Errors are automatically processed through centralized error handler
- 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
- Unit test coverage target: ≥90% for client code
- Integration tests for all MCP tools
- Clear separation between MCP server and HTTP client layers
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., your AI agent 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 AGENTS.md file.
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.

