kenpom-mcp

kenpom-mcp

Provides access to KenPom basketball analytics through MCP tools. Enables querying ratings, efficiency, player stats, and more using natural language.

Category
Visit Server

README

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

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured