mcp_python

davecthomas/mcp_python

3.2

If you are the rightful owner of mcp_python and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A Model Context Protocol (MCP) server that provides Python coding best practices and guidelines to AI assistants.

Tools
5
Resources
0
Prompts
0

Python Best Practices MCP Server

A Model Context Protocol (MCP) server that provides Python coding best practices and guidelines to AI assistants.

Overview

This MCP server exposes interactive tools, resources, and prompts for searching and retrieving curated Python coding standards from a knowledge base covering general Python coding and FastAPI development.

Features

Tools

  • search_practices - Search for best practices by keyword
  • get_topic - Retrieve detailed information about a specific topic
  • list_categories - List all available categories
  • get_category - Get all topics within a category
  • list_all_topics - Get a complete overview of all topics

Resources

  • bestpractices://catalog - Complete best practices catalog
  • bestpractices://category/{category_name} - Category-specific practices
  • bestpractices://topic/{category}/{topic_name} - Specific topic content

Prompts

  • review_code - Review code against best practices
  • suggest_improvements - Suggest specific improvements for code
  • explain_practice - Get detailed explanation of a best practice

Installation

Install via uvx:

uvx bestpractices-mcp-server

Or install from source:

pip install -e .

Configuration

Kiro IDE

Add to .kiro/settings/mcp.json:

{
  "mcpServers": {
    "python-best-practices": {
      "command": "uvx",
      "args": ["bestpractices-mcp-server"],
      "env": {
        "BEST_PRACTICES_JSON_PATH": "data/python_best_practices.json",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Claude Desktop (macOS)

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "python-best-practices": {
      "command": "uvx",
      "args": ["bestpractices-mcp-server"],
      "env": {
        "BEST_PRACTICES_JSON_PATH": "/absolute/path/to/data/python_best_practices.json",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Note: Claude Desktop requires absolute paths for file references.

Environment Variables

  • BEST_PRACTICES_JSON_PATH - Path to JSON file (default: data/python_best_practices.json)
  • MAX_SEARCH_RESULTS - Maximum number of search results (default: 50)
  • LOG_LEVEL - Logging level (default: INFO)
  • ENABLE_CACHING - Enable/disable caching (default: true)

Development

Install development dependencies:

pip install -e ".[dev]"

Run tests:

pytest

Run property-based tests:

pytest tests/test_properties.py

Project Structure

bestpractices_mcp_server/
├── src/
│   └── bestpractices_mcp_server/
│       ├── __init__.py
│       ├── server.py              # Main MCP server
│       ├── data_layer.py          # Data loading and caching
│       ├── business_logic.py      # Search, retrieval, formatting
│       └── models.py              # Data models
├── tests/
│   ├── test_data_layer.py
│   ├── test_business_logic.py
│   ├── test_server.py
│   └── test_properties.py         # Property-based tests
├── data/
│   └── python_best_practices.json
├── config/
│   ├── kiro_mcp.json              # Example Kiro configuration
│   └── claude_desktop_config.json # Example Claude Desktop configuration
├── pyproject.toml
├── README.md
└── .env.example

Troubleshooting

Kiro IDE

  • Ensure the MCP server is listed in .kiro/settings/mcp.json
  • Check the Kiro logs for connection errors
  • Verify the JSON file path is correct

Claude Desktop

  • Ensure you're using absolute paths in the configuration
  • Restart Claude Desktop after configuration changes
  • Check ~/Library/Logs/Claude/mcp*.log for errors

License

MIT