1+ ---
2+ description: FOLLOW Coolify MCP workflow WHEN implementing new Coolify API endpoints TO ensure consistent and tested MCP tools
3+ globs: src/**/*.{ts,tsx}
4+ alwaysApply: false
5+ ---
6+
7+ # Coolify MCP Development Workflow
8+
9+ ## Context
10+ - When implementing new Coolify API endpoints as MCP tools
11+ - When adding new features from the feature documentation
12+ - When extending the MCP server capabilities
13+
14+ ## Requirements
15+ 1. Start by reviewing feature documentation in docs/features
16+ 2. Verify endpoint exists in openapi.yaml specification
17+ 3. Follow existing implementation patterns:
18+ - Add types to src/types/coolify.ts
19+ - Add client method to src/lib/coolify-client.ts
20+ - Add MCP tool to src/lib/mcp-server.ts
21+ - Add simple test in src/__tests__/mcp-server.test.ts
22+ 4. Maintain strict TypeScript standards:
23+ - Always include explicit return types on functions
24+ - Import and use proper types from coolify.ts
25+ - No implicit any types
26+ - Follow existing type patterns
27+ 5. Keep tests focused and properly mocked:
28+ ```typescript
29+ it('should call client methodName', async () => {
30+ // Mock the method before calling it
31+ const mockResponse = { /* expected shape */ };
32+ const spy = jest.spyOn(server['client'], 'methodName')
33+ .mockResolvedValue(mockResponse);
34+
35+ await server.method_name('test-uuid');
36+ expect(spy).toHaveBeenCalledWith('test-uuid');
37+ });
38+ ```
39+ 6. Follow gitflow as per 801-feature-workflow
40+
41+ ## Examples
42+ <example>
43+ # Good implementation
44+ 1. Review docs/features/003-server-domains.md
45+ 2. Verify /servers/{uuid}/domains in openapi.yaml
46+ 3. Add ServerDomain interface to types
47+ 4. Add getServerDomains() to client with proper types:
48+ ```typescript
49+ async getServerDomains(uuid: string): Promise<ServerDomain[]> {
50+ return this.request<ServerDomain[]>(`/servers/${uuid}/domains`);
51+ }
52+ ```
53+ 5. Add get_server_domains tool to MCP server
54+ 6. Add properly mocked test:
55+ ```typescript
56+ const mockDomains = [{ ip: '1.2.3.4', domains: ['test.com'] }];
57+ const spy = jest.spyOn(client, 'getServerDomains')
58+ .mockResolvedValue(mockDomains);
59+ ```
60+ 7. Follow gitflow for commits and PR
61+ </example>
62+
63+ <example type="invalid">
64+ # Poor implementation
65+ 1. Start coding without checking docs
66+ 2. Add endpoint not in OpenAPI spec
67+ 3. Create new patterns different from existing code
68+ 4. Skip type definitions or use implicit any
69+ 5. Write tests that make real HTTP calls
70+ 6. Skip gitflow process
71+ </example>
72+
73+ <critical>
74+ - ALWAYS verify endpoint exists in OpenAPI spec
75+ - ALWAYS include explicit return types on functions
76+ - ALWAYS mock HTTP calls in tests
77+ - NEVER introduce new patterns - follow existing code
78+ - Keep tests simple and fully mocked
79+ - Follow established file organization
80+ - Fix ALL linting errors before committing
81+ </critical>
0 commit comments