Production MCP Server Project Structure

src/
  server.py
  config.py
  auth.py
  tools/
    orders.py
    deployments.py
  resources/
    docs.py
  prompts/
    operations.py
  services/
    orders_service.py
    deploy_service.py
  observability.py
tests/
  test_tools.py
  test_auth.py
  test_services.py

Keep protocol adapters thin

Tool functions should validate agent-facing arguments and delegate to domain services. This keeps business logic testable without MCP and lets REST, background workers, and MCP share code.

Group by domain when the project grows

For larger codebases, feature-oriented packages often scale better than one giant tools.py.

Centralize cross-cutting concerns

Authentication, tracing, configuration, retries, and rate limits should not be reimplemented independently inside every tool.