agentleFS
MikeRobGITMikeRobGIT/lodgify-mcp/.github/copilot-instructions.md

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

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
  1. Very specific:

    Dependency Injection: Always use getClient() from server setup for orchestrator access—never import singletons.

    line 24
  2. Very specific:

    HTTP Layer: All requests go through BaseApiClient.request() (enforces HTTPS, sliding window rate limiting, up to 5 retries, honors …

    line 25
  3. Very specific:

    Read-Only Mode: All write operations (POST/PUT/PATCH/DELETE) throw ReadOnlyModeError if LODGIFY_READ_ONLY=1 is set.

    line 26
  4. Very specific:

    Parameter Notation: Use Lodgify bracket notation for complex params (e.g., { "roomTypes[0].Id": 123 }).

    line 27
  5. Very specific:

    Validation: All tool inputs must use Zod schemas, with shared shapes in src/mcp/schemas/ and .describe() for fields.

    line 28
  6. Very specific:

    Logging: Use safeLogger (never log secrets).

    line 29
  7. Distinctive:

    Module Size: Keep modules ≤250 LOC and single-responsibility.

    line 31
  8. Very specific:

    Create tool in src/mcp/tools/[category]-tools.ts with Zod inputSchema and clear description.

    line 42
  9. Very specific:

    If orchestrator lacks a method, add it in src/lodgify-orchestrator.ts (delegate to src/api/v1|v2/).

    line 45
  10. Very specific:

    Add/modify tests in tests/mcp/tools/ and update docs/TOOL_CATALOG.md if user-facing.

    line 46
  11. Distinctive:

    All errors are processed through centralized handlers and sanitized.

    line 68
  12. Distinctive:

    If any section is unclear or incomplete, please provide feedback for further refinement.

    line 76

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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.ts registers all tools/resources and provides getClient() for orchestrator access (closure DI, no globals).
  • Orchestrator:
    • src/lodgify-orchestrator.ts unifies 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/ and src/mcp/resources/
    • Shared Zod schemas in src/mcp/schemas/
  • Testing:
    • Tests mirror source structure in tests/ (see tests/mcp/tools/ for tool tests)

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, honors Retry-After).
  • Read-Only Mode: All write operations (POST/PUT/PATCH/DELETE) throw ReadOnlyModeError if LODGIFY_READ_ONLY=1 is 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 dateValidation feedback (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, set LODGIFY_API_KEY. Optional: LOG_LEVEL, DEBUG_HTTP=1, LODGIFY_READ_ONLY=1.
  • Run (stdio): bun dev (dev) or bun run build && bun start (from dist)
  • Run (HTTP): bun run start:http (requires MCP_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

  1. Create tool in src/mcp/tools/[category]-tools.ts with Zod inputSchema and clear description.
  2. In handler: const client = getClient(); call orchestrator methods (e.g., client.properties.listProperties).
  3. Register tool in src/mcp/tools/register-all.ts.
  4. If orchestrator lacks a method, add it in src/lodgify-orchestrator.ts (delegate to src/api/v1|v2/**).
  5. Add/modify tests in tests/mcp/tools/ and update docs/TOOL_CATALOG.md if 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 /mcp with Authorization: Bearer <MCP_TOKEN>; session TTL ~30m

Critical Files & References

  • src/mcp/server-setup.ts — tool/resource registration, orchestrator DI
  • src/mcp/tools/register-all.ts — tool registry
  • src/lodgify-orchestrator.ts — unified API, read-only, aggregates
  • src/core/http/ — fetch/retry/rate-limit
  • docs/TOOL_CATALOG.md — tool parameters/examples
  • tests/ — 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-After or 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.