lodgify-mcp
Copilot instructions4 starsChanged 16 months agoMITView on GitHub
This project is a Model Context Protocol (MCP) server that exposes Lodgify Public API v1/v2 as MCP tools for AI agents. It is designed for modularity, testability, and safe automation. Minimal Example: - Schema: const S = z.object({ propertyId: z.string().min(1) }) - Handler: const res = await getClient().properties.getProperty(args.propertyId) - Register: export in file and include in register-all.ts
- Reads credentials
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .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
We split this copilot-instructions.md into the rules it gives an agent
12 rules. About 0 are common, 3 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Dependency Injection: Always use getClient() from server setup for orchestrator access—never import singletons.
- Very specific: line 25
HTTP Layer: All requests go through BaseApiClient.request() (enforces HTTPS, sliding window rate limiting, up to 5 retries, honors …
- Very specific: line 26
Read-Only Mode: All write operations (POST/PUT/PATCH/DELETE) throw ReadOnlyModeError if LODGIFY_READ_ONLY=1 is set.
- Very specific: line 27
Parameter Notation: Use Lodgify bracket notation for complex params (e.g., { "roomTypes[0].Id": 123 }).
- Very specific: line 28
Validation: All tool inputs must use Zod schemas, with shared shapes in src/mcp/schemas/ and .describe() for fields.
- Very specific: line 29
Logging: Use safeLogger (never log secrets).
- Distinctive: line 31
Module Size: Keep modules ≤250 LOC and single-responsibility.
- Very specific: line 42
Create tool in src/mcp/tools/[category]-tools.ts with Zod inputSchema and clear description.
- Very specific: line 45
If orchestrator lacks a method, add it in src/lodgify-orchestrator.ts (delegate to src/api/v1|v2/).
- Very specific: line 46
Add/modify tests in tests/mcp/tools/ and update docs/TOOL_CATALOG.md if user-facing.
- Distinctive: line 68
All errors are processed through centralized handlers and sanitized.
- Distinctive: line 76
If any section is unclear or incomplete, please provide feedback for further refinement.
≈ “Common” is an estimate: at least 1 in 5 of the 3,894 Copilot instructions 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
Copilot Instructions for lodgify-mcp
This project is a Model Context Protocol (MCP) server that exposes Lodgify Public API v1/v2 as MCP tools for AI agents. It is designed for modularity, testability, and safe automation.
Architecture Overview
- Entrypoints:
src/server.ts(stdio MCP server)src/server-http.ts(HTTP transport)
- Server Setup:
src/mcp/server-setup.tsregisters all tools/resources and providesgetClient()for orchestrator access (closure DI, no globals).
- Orchestrator:
src/lodgify-orchestrator.tsunifies v1/v2 API modules, enforces read-only mode, and provides aggregate endpoints (e.g., vacant inventory).
- Core Infrastructure:
src/core/http/(fetch wrapper, retry, rate limiter)src/core/errors/,src/core/retry/(centralized error handling)
- Tools & Resources:
- Grouped by domain in
src/mcp/tools/andsrc/mcp/resources/ - Shared Zod schemas in
src/mcp/schemas/
- Grouped by domain in
- Testing:
- Tests mirror source structure in
tests/(seetests/mcp/tools/for tool tests)
- Tests mirror source structure in
Key Patterns & Conventions
- Dependency Injection: Always use
getClient()from server setup for orchestrator access—never import singletons. - HTTP Layer: All requests go through
BaseApiClient.request()(enforces HTTPS, sliding window rate limiting, up to 5 retries, honorsRetry-After). - Read-Only Mode: All write operations (POST/PUT/PATCH/DELETE) throw
ReadOnlyModeErrorifLODGIFY_READ_ONLY=1is set. - Parameter Notation: Use Lodgify bracket notation for complex params (e.g.,
{ "roomTypes[0].Id": 123 }). - Validation: All tool inputs must use Zod schemas, with shared shapes in
src/mcp/schemas/and.describe()for fields. - Logging: Use
safeLogger(never log secrets). Errors are sanitized before returning to clients. - Date Handling: Tools may return
dateValidationfeedback (warning/error/info) instead of auto-fixing dates. - Module Size: Keep modules ≤250 LOC and single-responsibility.
Developer Workflow
- Install:
bun install - Environment: Copy
.env.example→.env, setLODGIFY_API_KEY. Optional:LOG_LEVEL,DEBUG_HTTP=1,LODGIFY_READ_ONLY=1. - Run (stdio):
bun dev(dev) orbun run build && bun start(from dist) - Run (HTTP):
bun run start:http(requiresMCP_TOKEN), prod:bun run start:http:prod - Quality Gate:
bun run check(lint + format + typecheck + build + test) - Tests:
bun run test(watch:bun run test:watch, coverage:bun run test:coverage)
Tool Implementation Example
- Create tool in
src/mcp/tools/[category]-tools.tswith ZodinputSchemaand cleardescription. - In handler:
const client = getClient(); call orchestrator methods (e.g.,client.properties.listProperties). - Register tool in
src/mcp/tools/register-all.ts. - If orchestrator lacks a method, add it in
src/lodgify-orchestrator.ts(delegate tosrc/api/v1|v2/**). - Add/modify tests in
tests/mcp/tools/and updatedocs/TOOL_CATALOG.mdif user-facing.
Minimal Example:
- Schema:
const S = z.object({ propertyId: z.string().min(1) }) - Handler:
const res = await getClient().properties.getProperty(args.propertyId) - Register: export in file and include in
register-all.ts
Integration Points
- API Base:
https://api.lodgify.com(HTTPS enforced) - Tool Categories: properties, bookings, availability, rates, quotes, messaging, webhooks, helpers (see
docs/TOOL_CATALOG.md) - Resource:
lodgify://health(system status) - HTTP Transport:
POST /mcpwithAuthorization: Bearer <MCP_TOKEN>; session TTL ~30m
Critical Files & References
src/mcp/server-setup.ts— tool/resource registration, orchestrator DIsrc/mcp/tools/register-all.ts— tool registrysrc/lodgify-orchestrator.ts— unified API, read-only, aggregatessrc/core/http/— fetch/retry/rate-limitdocs/TOOL_CATALOG.md— tool parameters/examplestests/— test strategy and coverage
Error Handling & Rate Limiting
- All errors are processed through centralized handlers and sanitized.
- Rate limiting uses a sliding window; 429s honor
Retry-Afteror exponential backoff (max 30s, 5 attempts).
Security
- API keys only from environment variables; never log secrets or PII.
- Mask sensitive fields in logs/errors.
If any section is unclear or incomplete, please provide feedback for further refinement.
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.

