lodgify-mcp / rules
Cursor rule4 starsChanged 16 months agoMITView on GitHub
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,373 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.
- AGENTS.mdAGENTS.md
- 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/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 mcp-development.mdc into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 56
Create Tool: Add to appropriate category file in src/mcp/tools/
- Very specific: line 57
Register Tool: Add to register-all.ts
- Distinctive: line 59
Add Tests: Create tests in tests/ mirroring the structure
- Distinctive: line 134
Parameters: All input parameters with types and constraints
- Distinctive: line 146
Lazy Loading: Only load what's needed
- Distinctive: line 152
Module Size: Keep tools under 250 lines
≈ “Common” is an estimate: at least 1 in 5 of the 7,324 Cursor rule 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
# MCP Development Guidelines
## MCP Architecture Overview
The MCP server uses a modular registry pattern with the following structure:
### Core MCP Components
- **Server Setup**: [src/mcp/server-setup.ts](mdc:src/mcp/server-setup.ts) - Server initialization
- **Tool Registry**: [src/mcp/tools/registry.ts](mdc:src/mcp/tools/registry.ts) - Central tool management
- **Resource Registry**: [src/mcp/resources/](mdc:src/mcp/resources/) - System resources
- **Error Handler**: [src/mcp/errors/](mdc:src/mcp/errors/) - Centralized error processing
- **Schemas**: [src/mcp/schemas/](mdc:src/mcp/schemas/) - Shared validation schemas
## Tool Implementation Pattern
### 1. Tool Categories
Tools are organized by category in [src/mcp/tools/](mdc:src/mcp/tools/):
- **Property Tools**: [property-tools.ts](mdc:src/mcp/tools/property-tools.ts) - Property management
- **Booking Tools**: [booking-tools.ts](mdc:src/mcp/tools/booking-tools.ts) - Booking operations
- **Availability Tools**: [availability-tools.ts](mdc:src/mcp/tools/availability-tools.ts) - Availability checking
- **Rate Tools**: [rate-tools.ts](mdc:src/mcp/tools/rate-tools.ts) - Rate management
- **Webhook Tools**: [webhook-tools.ts](mdc:src/mcp/tools/webhook-tools.ts) - Webhook operations
- **Messaging Tools**: [messaging-tools.ts](mdc:src/mcp/tools/messaging-tools.ts) - Messaging features
- **Helper Tools**: [helper-tools.ts](mdc:src/mcp/tools/helper-tools.ts) - Utility functions
### 2. Tool Registration Pattern
```typescript
import { z } from 'zod';
import { getClient } from '../utils/client';
// 1. Define input schema with Zod
const toolInputSchema = z.object({
propertyId: z.string().min(1, 'Property ID is required'),
// Add other parameters as needed
});
// 2. Create tool registration object
export const myTool = {
name: 'lodgify_my_tool',
description: 'Clear description of what this tool does',
inputSchema: toolInputSchema,
handler: async (params) => {
try {
const client = getClient();
// Implementation using the client
const result = await client.someMethod(params);
return result;
} catch (error) {
// Errors are automatically handled by the error handler
throw error;
}
}
};
```
### 3. Tool Registration Process
1. **Create Tool**: Add to appropriate category file in [src/mcp/tools/](mdc:src/mcp/tools/)
2. **Register Tool**: Add to [register-all.ts](mdc:src/mcp/tools/register-all.ts)
3. **Add Client Method**: Implement in [src/lodgify-orchestrator.ts](mdc:src/lodgify-orchestrator.ts)
4. **Add Tests**: Create tests in [tests/](mdc:tests/) mirroring the structure
## Error Handling
### Error Processing Flow
1. **Tool Handler**: Throws error with context
2. **Error Handler**: [src/mcp/errors/](mdc:src/mcp/errors/) processes and sanitizes
3. **MCP Response**: Returns structured error to client
### Error Types
- **Validation Errors**: Invalid input parameters
- **API Errors**: Lodgify API errors (4xx, 5xx)
- **Network Errors**: Connection issues
- **Rate Limit Errors**: 429 responses with retry logic
## Resource Implementation
### Health Check Resource
```typescript
// Example from resources/health.ts
export const healthResource = {
uri: 'lodgify://health',
name: 'Health Check',
description: 'Check the health status of the Lodgify MCP server',
mimeType: 'application/json',
handler: async () => {
// Return health status
}
};
```
## Dependency Injection Pattern
### Client Access Pattern
```typescript
// Use closure-based getClient() pattern
import { getClient } from '../utils/client';
export const myTool = {
// ... tool definition
handler: async (params) => {
const client = getClient(); // Gets the configured client
return await client.someMethod(params);
}
};
```
## Testing MCP Tools
### Test Structure
```typescript
// tests/mcp/tools/my-tool.test.ts
import { describe, it, expect, beforeEach } from 'bun:test';
import { myTool } from '../../../src/mcp/tools/my-tool';
describe('myTool', () => {
it('should handle valid input', async () => {
const result = await myTool.handler({
propertyId: 'test-id'
});
expect(result).toBeDefined();
});
it('should validate input schema', async () => {
await expect(myTool.handler({}))
.rejects.toThrow('Property ID is required');
});
});
```
## Tool Documentation
### Required Documentation
- **Tool Name**: Clear, descriptive name
- **Description**: What the tool does and when to use it
- **Parameters**: All input parameters with types and constraints
- **Examples**: Usage examples for common scenarios
- **Error Cases**: What errors might occur and why
### Documentation Location
- **Tool Catalog**: [docs/TOOL_CATALOG.md](mdc:docs/TOOL_CATALOG.md)
- **README**: [README.md](mdc:README.md) with examples
- **Examples**: [examples/](mdc:examples/) directory
## Performance Considerations
### Tool Optimization
- **Lazy Loading**: Only load what's needed
- **Caching**: Cache frequently accessed data
- **Batch Operations**: Combine multiple API calls when possible
- **Rate Limiting**: Respect Lodgify API rate limits
### Memory Management
- **Module Size**: Keep tools under 250 lines
- **Resource Cleanup**: Properly clean up resources
- **Error Boundaries**: Prevent memory leaks from errors
description:
globs:
alwaysApply: true
---
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.

