Skip to main content
Glama
tasks.md11.9 kB
# Implementation Plan - [x] 1. Set up project structure and dependencies - Create main server file `bestpractices_mcp_server.py` - Create `requirements.txt` with FastMCP and dependencies - Set up basic FastMCP server initialization - Configure logging - _Requirements: 9.4_ - [x] 2. Implement Data Manager module - [x] 2.1 Create data manager with file loading functionality - Implement `load_best_practices()` function to read JSON file dynamically - Add JSON validation logic - Implement error handling for missing/corrupted files - _Requirements: 9.1, 9.2, 9.3, 9.5_ - [x] 2.2 Write property test for dynamic file reloading - **Property 11: Dynamic database reloading** - **Validates: Requirements 3.4, 9.2** - [x] 2.3 Write property test for JSON validation - **Property 28: JSON validation before processing** - **Validates: Requirements 9.5** - [x] 2.4 Implement search functionality - Create `search_practices(keyword)` function - Implement keyword matching across descriptions, examples, and topic names - Add result organization by category - _Requirements: 1.1, 1.4_ - [x] 2.5 Write property test for search completeness - **Property 1: Search completeness** - **Validates: Requirements 1.1** - [x] 2.6 Write property test for search result structure - **Property 2: Search result structure** - **Validates: Requirements 1.2** - [x] 2.7 Implement fuzzy matching for suggestions - Create `find_similar_topics(query)` function using fuzzy string matching - Implement suggestion logic for failed searches - _Requirements: 1.3, 2.3, 4.3_ - [x] 2.8 Write property test for search fallback suggestions - **Property 3: Search fallback suggestions** - **Validates: Requirements 1.3** - [x] 2.9 Implement category retrieval - Create `get_category(category, topic)` function - Implement hierarchical structure preservation - Add invalid category handling with suggestions - _Requirements: 2.1, 2.2, 2.3, 2.5_ - [x] 2.10 Write property test for category completeness - **Property 5: Category completeness** - **Validates: Requirements 2.1** - [x] 2.11 Write property test for hierarchical structure preservation - **Property 8: Hierarchical structure preservation** - **Validates: Requirements 2.5** - [x] 2.12 Implement category listing - Create `list_all_categories()` function - Add category descriptions and topic counts - _Requirements: 3.1, 3.2, 3.3_ - [x] 2.13 Write property test for category list completeness - **Property 9: Category list completeness** - **Validates: Requirements 3.1** - [x] 2.14 Implement example retrieval - Create `get_examples(topic)` function - Add code formatting with syntax highlighting markers - Implement fallback suggestions for topics without examples - _Requirements: 4.1, 4.2, 4.3, 4.4_ - [x] 2.15 Write property test for example completeness - **Property 12: Example completeness** - **Validates: Requirements 4.1** - [x] 2.16 Write property test for example formatting - **Property 15: Example formatting** - **Validates: Requirements 4.4** - [x] 3. Implement MCP Tools - [x] 3.1 Implement search_best_practices tool - Create tool with keyword parameter - Integrate with data manager search function - Format response with descriptions, examples, and related topics - Handle empty/invalid keywords - _Requirements: 1.1, 1.2, 1.3, 1.4, 1.5_ - [x] 3.2 Write property test for search result organization - **Property 4: Search result organization** - **Validates: Requirements 1.4** - [x] 3.3 Implement get_practice_by_category tool - Create tool with category and optional topic parameters - Integrate with data manager category function - Format response with all required fields - _Requirements: 2.1, 2.2, 2.3, 2.4, 2.5_ - [x] 3.4 Write property test for category response structure - **Property 6: Category response structure** - **Validates: Requirements 2.2** - [x] 3.5 Write property test for invalid category suggestions - **Property 7: Invalid category suggestions** - **Validates: Requirements 2.3** - [x] 3.6 Implement list_categories tool - Create tool with no parameters - Integrate with data manager list function - Format response with descriptions and counts - _Requirements: 3.1, 3.2, 3.3, 3.4, 3.5_ - [x] 3.7 Write property test for category list structure - **Property 10: Category list structure** - **Validates: Requirements 3.2, 3.3** - [x] 3.8 Implement get_examples tool - Create tool with topic parameter - Integrate with data manager examples function - Format code examples with context - _Requirements: 4.1, 4.2, 4.3, 4.4, 4.5_ - [x] 3.9 Write property test for example structure - **Property 13: Example structure** - **Validates: Requirements 4.2** - [x] 3.10 Write property test for example fallback suggestions - **Property 14: Example fallback suggestions** - **Validates: Requirements 4.3** - [x] 4. Implement code analysis tools - [x] 4.1 Implement review_code tool - Create tool with code and context parameters - Implement code analysis logic against best practices - Detect code context (Python vs FastAPI) - Generate violations, recommendations, and good patterns - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5_ - [x] 4.2 Write property test for code review database references - **Property 16: Code review references database** - **Validates: Requirements 5.1** - [x] 4.3 Write property test for context detection - **Property 17: Context detection accuracy** - **Validates: Requirements 5.3** - [x] 4.4 Write property test for review feedback actionability - **Property 18: Review feedback actionability** - **Validates: Requirements 5.5** - [x] 4.5 Implement suggest_improvements tool - Create tool with code and optional focus_area parameters - Generate prioritized improvement suggestions - Include before/after examples and trade-offs - Handle optimal code cases - _Requirements: 6.1, 6.2, 6.3, 6.4, 6.5_ - [x] 4.6 Write property test for improvement concreteness - **Property 19: Improvement concreteness** - **Validates: Requirements 6.1** - [x] 4.7 Write property test for improvement prioritization - **Property 20: Improvement prioritization** - **Validates: Requirements 6.2** - [x] 4.8 Write property test for improvement examples - **Property 21: Improvement examples** - **Validates: Requirements 6.3** - [x] 4.9 Write property test for improvement trade-offs - **Property 22: Improvement trade-offs** - **Validates: Requirements 6.5** - [x] 5. Implement MCP Resources - [x] 5.1 Create resource URI parser - Implement URI pattern matching for bestpractices:// scheme - Parse category and topic from URI - Validate URI format - _Requirements: 7.1, 7.5_ - [x] 5.2 Implement resource handlers - Create handler for general topic resources (bestpractices://general/*) - Create handler for FastAPI topic resources (bestpractices://fastapi/*) - Create handler for performance resources (bestpractices://performance/*) - Create handler for code quality resources (bestpractices://code_quality/*) - Create handler for complete guide (bestpractices://all) - Format responses as markdown - _Requirements: 7.1, 7.2, 7.3, 7.4_ - [x] 5.3 Write property test for resource URI mapping - **Property 23: Resource URI mapping** - **Validates: Requirements 7.1** - [x] 5.4 Write property test for general resource routing - **Property 24: General resource routing** - **Validates: Requirements 7.2** - [x] 5.5 Write property test for FastAPI resource routing - **Property 25: FastAPI resource routing** - **Validates: Requirements 7.3** - [x] 5.6 Write property test for complete guide resource - **Property 26: Complete guide resource** - **Validates: Requirements 7.4** - [x] 5.7 Implement invalid resource error handling - Add error handling for invalid URIs - Generate suggestions for valid URIs - _Requirements: 7.5_ - [x] 5.8 Write property test for invalid resource error handling - **Property 27: Invalid resource error handling** - **Validates: Requirements 7.5** - [x] 6. Implement MCP Prompts - [x] 6.1 Create review_python_code prompt - Define prompt template for general Python code review - Request user code input - Invoke review_code tool with general context - _Requirements: 8.1, 8.2_ - [x] 6.2 Create review_fastapi_endpoint prompt - Define prompt template for FastAPI-specific review - Request FastAPI code input - Invoke review_code tool with FastAPI context - _Requirements: 8.1, 8.3_ - [x] 6.3 Create suggest_code_improvements prompt - Define prompt template for improvement suggestions - Request code and optional focus area - Invoke suggest_improvements tool - _Requirements: 8.1, 8.4_ - [x] 6.4 Create show_examples prompt - Define prompt template for example retrieval - Request topic name - Invoke get_examples tool - _Requirements: 8.1, 8.5_ - [x] 7. Implement comprehensive error handling - [x] 7.1 Add input validation for all tools - Validate parameters for each tool - Return descriptive error messages with expected formats - _Requirements: 10.1_ - [x] 7.2 Write property test for invalid parameter error messages - **Property 29: Invalid parameter error messages** - **Validates: Requirements 10.1** - [x] 7.3 Implement global exception handler - Catch all unexpected exceptions - Return generic errors without exposing internals - Log errors for debugging - _Requirements: 10.3_ - [x] 7.4 Write property test for exception safety - **Property 30: Exception safety** - **Validates: Requirements 10.3** - [x] 7.5 Add error resolution suggestions - Implement suggestion logic for common errors - Include suggestions in error responses - _Requirements: 10.4_ - [x] 7.6 Write property test for error resolution suggestions - **Property 31: Error resolution suggestions** - **Validates: Requirements 10.4** - [x] 7.7 Implement file system error handling - Handle missing file errors - Handle permission errors - Handle corrupted file errors - Provide fallback guidance - _Requirements: 9.3, 9.4, 10.2_ - [x] 7.8 Add resource constraint error handling - Handle rate limits - Handle memory constraints - Communicate clearly to users - _Requirements: 10.5_ - [x] 8. Add configuration and environment support - [x] 8.1 Implement configuration management - Add support for BEST_PRACTICES_FILE environment variable - Add support for LOG_LEVEL environment variable - Set sensible defaults - _Requirements: 9.1_ - [x] 8.2 Add logging configuration - Configure structured logging - Log file operations - Log errors and warnings - _Requirements: 9.4, 10.2_ - [x] 9. Create documentation and examples - [x] 9.1 Create README.md - Document installation instructions - Document configuration options - Provide usage examples - Include troubleshooting guide - [x] 9.2 Add inline code documentation - Add docstrings to all functions - Document parameters and return types - Include usage examples in docstrings - [x] 9.3 Create example usage scripts - Create example for searching best practices - Create example for code review - Create example for resource access - [x] 10. Final checkpoint - Ensure all tests pass - Ensure all tests pass, ask the user if questions arise

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/n-ochs/best-practice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server