Skip to main content
Glama
dburge86

kenpom-mcp

by dburge86

KenPom MCP Server ๐Ÿ€

CI Python 3.12+ License: MIT Code style: ruff

Production-ready async MCP server for KenPom basketball analytics.

Note: Requires a paid KenPom subscription (kenpom.com) - email/password login, no API key needed.

โœจ Project Status: Production Ready

  • โœ… 100% Test Coverage โ€” 61 tests covering all parsers and scraper

  • โœ… CI/CD Pipeline โ€” GitHub Actions running tests, linting, and formatting

  • โœ… Code Quality โ€” Pre-commit hooks with ruff enforcement

  • โœ… Network Resilience โ€” Retry logic with exponential backoff

  • โœ… Dual Transport โ€” Local (STDIO) and self-hosted HTTP/SSE support

Related MCP server: flaim

Features

  • ๐Ÿš€ Async Architecture โ€” Built with httpx for non-blocking requests

  • โ˜๏ธ Self-Hostable โ€” Optional HTTP/SSE server for remote access

  • ๐Ÿ’พ Smart Caching โ€” KV-based caching to reduce scraping frequency

  • ๐Ÿ”ง Dual Transport โ€” Local (STDIO) and Remote (SSE) support

  • ๐Ÿ“Š 13+ Data Tools โ€” Full coverage of KenPom stats

  • ๐Ÿ”„ Retry Logic โ€” Automatic retry with backoff for network failures

  • ๐Ÿงช Well Tested โ€” Comprehensive unit and integration tests

Quick Start (Local)

cd /path/to/mcp_kenpom
cp .env.example .env  # Add your credentials
uv sync
uv run kenpom-mcp

MCP Client Configuration

Local Mode

{
  "mcpServers": {
    "kenpom": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp_kenpom", "run", "kenpom-mcp"]
    }
  }
}

Remote Mode (Self-Hosted)

If you run the HTTP server on your own infrastructure:

{
  "mcpServers": {
    "kenpom": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-server-url/sse"
      ]
    }
  }
}

Available Tools

Tool

Description

get_ratings

Pomeroy ratings (rank, adj efficiency, tempo)

get_efficiency

Efficiency and tempo stats

get_four_factors

eFG%, TO%, OR%, FTRate

get_team_stats

Miscellaneous team stats (offense/defense)

get_player_stats

Player leaders by metric

get_height

Height/experience data

get_fanmatch

Game predictions by date

get_arenas

Arena information

get_game_attrs

Top games by attribute (excitement, upsets)

get_program_ratings

Historical program rankings

get_kpoy

Player of the Year standings

get_point_distribution

Scoring breakdown by shot type

get_hca

Home court advantage data

Architecture

src/kenpom_mcp/
โ”œโ”€โ”€ server.py          # FastMCP server with 13 tools (STDIO transport)
โ”œโ”€โ”€ http_server.py     # Starlette server (HTTP/SSE transport)
โ”œโ”€โ”€ tools.py           # Unified tool registry (single source of truth)
โ”œโ”€โ”€ scraper.py         # Async httpx scraper with retry logic
โ””โ”€โ”€ parsers/           # HTML parsing modules
    โ”œโ”€โ”€ ratings.py     # Pomeroy ratings
    โ”œโ”€โ”€ efficiency.py  # Efficiency and tempo stats
    โ”œโ”€โ”€ stats.py       # Team and player stats
    โ”œโ”€โ”€ fanmatch.py    # Game predictions
    โ””โ”€โ”€ misc.py        # Arena, HCA, program ratings, KPOY

tests/
โ”œโ”€โ”€ conftest.py        # Pytest fixtures
โ”œโ”€โ”€ fixtures/          # 14 HTML sample files
โ”œโ”€โ”€ test_fixtures.py   # Fixture loading tests
โ”œโ”€โ”€ test_parsers.py    # 33 parser unit tests
โ””โ”€โ”€ test_scraper.py    # 14 scraper integration tests

Development

Setup

# Install dependencies
uv sync

# Copy environment template
cp .env.example .env  # Add your KenPom credentials

# Install pre-commit hooks (optional but recommended)
uv run pre-commit install

Running

# Local dev (STDIO)
uv run kenpom-mcp

# HTTP dev server (port 8000)
uv run uvicorn kenpom_mcp.http_server:app --reload

# Test with MCP inspector
npx @modelcontextprotocol/inspector uv --directory . run kenpom-mcp

Testing & Quality

# Run all tests
uv run pytest tests/

# Run tests with coverage
uv run pytest tests/ --cov=kenpom_mcp

# Run specific test file
uv run pytest tests/test_parsers.py -v

# Lint and format
uv run ruff check src/ tests/
uv run ruff format src/ tests/

# Run pre-commit hooks manually
uv run pre-commit run --all-files

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

This project uses:

  • pytest for testing with async support

  • ruff for linting and formatting

  • pre-commit for automated quality checks

  • GitHub Actions for CI/CD

All PRs must pass tests and linting checks.

๐Ÿ”’ Security

For security issues, please see SECURITY.md for responsible disclosure guidelines.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support


Made with โค๏ธ for basketball analytics enthusiasts

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

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/dburge86/kenpom-mcp'

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