Skip to main content
Glama
README.md2.52 kB
# Best Practices MCP Server - Usage Examples This directory contains example scripts demonstrating how to use the Best Practices MCP Server functionality. ## Available Examples ### 1. Search Example (`search_example.py`) Demonstrates how to search for best practices by keyword. **Run:** ```bash python examples/search_example.py ``` **Features demonstrated:** - Searching by keyword across all categories - Viewing search results with descriptions and related topics - Handling searches with no results (suggestions) ### 2. Code Review Example (`code_review_example.py`) Demonstrates how to review code against best practices. **Run:** ```bash python examples/code_review_example.py ``` **Features demonstrated:** - Reviewing code with common issues - Reviewing well-written code - FastAPI-specific code review - Understanding violation severity levels - Viewing good patterns identified ### 3. Resource Access Example (`resource_access_example.py`) Demonstrates how to access best practices via categories and topics. **Run:** ```bash python examples/resource_access_example.py ``` **Features demonstrated:** - Listing all available categories - Getting all topics in a category - Getting specific topic details - Retrieving code examples - Handling invalid categories (suggestions) - Understanding resource URI patterns ## Running All Examples You can run all examples sequentially: ```bash python examples/search_example.py python examples/code_review_example.py python examples/resource_access_example.py ``` ## Prerequisites Make sure you have: 1. Installed dependencies: `pip install -r requirements.txt` 2. The best practices database at `data/python_best_practices.json` ## Using with MCP Client These examples show direct Python usage. When using with an MCP client (like Kiro IDE), the tools are invoked through the MCP protocol: ```python # In Kiro IDE, you would use: search_best_practices(keyword="async") review_code(code="def test(): pass", context="general") get_practice_by_category(category="fastapi_specific", topic="pydantic_models") ``` ## Customization You can modify these examples to: - Test with your own code snippets - Search for different keywords - Explore different categories and topics - Add error handling demonstrations ## Troubleshooting If examples fail to run: 1. Ensure you're in the project root directory 2. Check that `data/python_best_practices.json` exists 3. Verify Python dependencies are installed 4. Check the server logs for detailed error messages

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