Skip to main content
Glama
kenpom-mcp

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: nba-stats-mcp

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

Available Tools

18 tools
get_arenasA

Get arena information for all teams.

Returns arena names, capacities, and attendance data.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 2010.

Returns: JSON array of arena data.

Inputs: season. Returns: result

get_conference_defenseA

Get conference defensive stats for all teams in a conference.

Returns defensive efficiency, eFG%, TO%, OR%, FTR, 2P%, 3P%, Blk%, and Stl%.

Args: conference: Conference code (required). Examples: 'B12', 'SEC', 'B10', 'ACC'. season: Optional season year (e.g., "2024"). Defaults to current season.

Returns: JSON array of conference defensive stats.

Inputs: conference (required), season. Returns: result

get_conference_offenseA

Get conference offensive stats for all teams in a conference.

Returns offensive efficiency, eFG%, TO%, OR%, FTR, 2P%, 3P%, FT%, and tempo.

Args: conference: Conference code (required). Examples: 'B12', 'SEC', 'B10', 'ACC'. season: Optional season year (e.g., "2024"). Defaults to current season.

Returns: JSON array of conference offensive stats.

Inputs: conference (required), season. Returns: result

get_conference_standingsA

Get conference standings with team records and ratings.

Returns standings with overall/conference records, projected records, net rating, offensive/defensive ratings, tempo, and conference SOS.

Args: conference: Conference code (required). Examples: 'B12', 'SEC', 'B10', 'ACC', 'BE'. season: Optional season year (e.g., "2024"). Defaults to current season.

Returns: JSON array of conference standings.

Inputs: conference (required), season. Returns: result

get_efficiencyA

Get efficiency and tempo stats for all teams.

Returns the summary efficiency table with offensive/defensive efficiency, tempo, and possession length data.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999. Possession length data from 2010.

Returns: JSON array of efficiency data for all teams.

Inputs: season. Returns: result

get_fanmatchA

Get FanMatch game predictions for a specific date.

FanMatch provides predicted scores, spreads, and game information for all games on a given date.

Args: date: Date in "YYYY-MM-DD" format (e.g., "2024-12-23"). Defaults to today's date.

Returns: JSON object with games, predictions, and daily statistics.

Inputs: date. Returns: result

get_four_factorsA

Get Four Factors stats for all teams.

The Four Factors are the key stats that determine team efficiency:

  • eFG% (Effective Field Goal Percentage)

  • TO% (Turnover Percentage)

  • OR% (Offensive Rebound Percentage)

  • FTRate (Free Throw Rate)

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999.

Returns: JSON array of Four Factors data for all teams.

Inputs: season. Returns: result

get_game_attrsA

Get top games ranked by game attributes.

Args: metric: Attribute to rank games by. Options: 'Excitement', 'Tension', 'Dominance', 'ComeBack', 'FanMatch', 'Upsets', 'Busts'. Default: 'Excitement'. ('FanMatch', 'Upsets', 'Busts' only available after 2010) season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 2010.

Returns: JSON array of top games for the specified attribute.

Inputs: metric, season. Returns: result

get_hcaB

Get home court advantage data.

Returns historical home court advantage statistics for all teams.

Returns: JSON array of home court advantage data.

Inputs: no named parameters. Returns: result

get_heightA

Get height and experience data for all teams.

Returns team rosters data including average height, experience, bench minutes, and continuity metrics.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 2007. Continuity data from 2008.

Returns: JSON array of height/experience data for all teams.

Inputs: season. Returns: result

get_kpoyA

Get KenPom Player of the Year standings.

Returns the current KPOY leaderboard and Game MVP leaders.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 2011. Game MVP table from 2013.

Returns: JSON array with KPOY standings (may include multiple tables).

Inputs: season. Returns: result

get_player_statsA

Get player leaders by statistical metric.

Args: metric: Stat to rank players by. Options: 'ORtg', 'Min', 'eFG', 'Poss', 'Shots', 'OR', 'DR', 'TO', 'ARate', 'Blk', 'FTRate', 'Stl', 'TS', 'FC40', 'FD40', '2P', '3P', 'FT'. Default: 'eFG'. season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 2004. conference: Optional conference filter (e.g., 'ACC', 'B10', 'SEC').

Returns: JSON array of player stats ranked by the specified metric.

Inputs: metric, season, conference. Returns: result

get_point_distributionA

Get team point distribution breakdown.

Shows how teams score their points (2-pointers, 3-pointers, free throws) and where their points allowed come from.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999.

Returns: JSON array of point distribution data for all teams.

Inputs: season. Returns: result

get_program_ratingsA

Get historical program ratings.

Returns the all-time program rankings based on historical performance across all available seasons.

Returns: JSON array of program ratings.

Inputs: no named parameters. Returns: result

get_ratingsA

Get Pomeroy College Basketball Ratings for all teams.

Returns team rankings with adjusted efficiency metrics including: rank, team name, conference, record, adjusted offensive/defensive efficiency, adjusted tempo, and more.

Args: season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999.

Returns: JSON array of team ratings data.

Inputs: season. Returns: result

get_scheduleA

Get a team's game schedule and results.

Returns the full schedule with game dates, opponents, results, rankings, locations, and records.

Args: team: Team name (required). Examples: 'BYU', 'Duke', 'North Carolina'. season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999.

Returns: JSON array of scheduled/completed games.

Inputs: team (required), season. Returns: result

get_scouting_reportA

Get detailed scouting report for a team (37 stats with ranks).

Returns offensive and defensive stats with national ranks covering efficiency, tempo, Four Factors, shooting percentages, and point distribution.

Args: team: Team name (required). Examples: 'BYU', 'Duke', 'North Carolina'. season: Optional season year (e.g., "2024"). Defaults to current season. conference_only: If True, returns conference-only stats. Default: False.

Returns: JSON object mapping stat names to {value, rank} objects.

Inputs: team (required), season, conference_only. Returns: result

get_team_statsA

Get miscellaneous team statistics.

Returns detailed team stats including shooting percentages, blocks, steals, assists, and more.

Args: defense: If True, returns defensive stats. If False, returns offensive stats. season: Optional season year (e.g., "2024"). Defaults to current season. Earliest available: 1999.

Returns: JSON array of team stats (offense or defense based on parameter).

Inputs: season, defense. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target a distinct resource (ratings, efficiency, four factors, player stats, arenas, schedule, etc.). However, several team-level stat tools (get_ratings, get_efficiency, get_four_factors, get_team_stats, get_scouting_report) overlap in content, though descriptions clarify their specific focuses.

    Naming Consistency5/5

    All tool names follow a consistent 'get_<noun>' pattern in snake_case, making them highly predictable. Examples include get_ratings, get_schedule, get_scouting_report, and get_conference_standings.

    Tool Count4/5

    With 18 tools, the server is comprehensive but slightly heavy for a niche stats domain. The count is justifiable given the breadth of KenPom data, but it edges into the upper range of ideal scope.

    Completeness4/5

    The surface covers a wide range of college basketball analytics: ratings, efficiency, player stats, schedule, conference stats, and more. Minor gaps exist (e.g., no direct box score or team roster details beyond height), but core use cases are well covered.

    Related MCP Connectors

    • Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned. Separately, TwitterAPI.io also offers x402 pay-per-call HTTP endpoints (tweet search, user info, a user's latest tweets) paid in USDC on Base or Solana with no account or API key; see https://docs.twitterapi.io/x402-pay-per-call. The MCP server itself uses an API key or sign-in.

      https://mcp.twitterapi.io/mcp
    • SmartMoney77 MCP v0.6.0 β€” 14 public tools that turn financial questions into exact numbers and citable links. New: historical_investment_return and compare_investments, which compute "what if I had invested" results from real yearly price data. Also compound interest, FIRE number, credit-card payoff, emergency fund, inflation, latte factor, investment fees, cost of waiting, plus discovery/deep-link/share-pack tools for a catalog of calculators in 6 languages (he/en/ar/es/pt/in). Public, no login. Endpoint: https://smartmoney77.com/mcp

      https://smartmoney77.com/mcp
    • Analytics for MCP servers. Query your tool calls, first-call success, retries and schema cost.

      https://api.getmcpulse.com/mcp
    • Independent statistical feature evaluation for machine learning and forecasting. ML Referee tests up to 1,000 candidate features in one run against a declared baseline, helping researchers and AI agents decide which inputs to pursue, which bounded feature repairs merit further testing, and where more evidence is neededβ€”without a separate ablation run for every feature. Use the MCP tools to discover input schemas, check access and credits, preflight a dataset, obtain a quote, submit an authorized evaluation, and retrieve structured results and reports. Results are scoped to the submitted evidence and evaluation design; they do not guarantee future model performance. Invite-only beta with manual approval. Public tool discovery requires no authentication; account and evaluation tools require OAuth through approved client connections and available evaluation credits. Connect directly to https://api.mlreferee.com/mcp. Website: https://mlreferee.com Request beta access: https://mlreferee.com/beta Agent setup and documentation: https://mlreferee.com/agents

      https://api.mlreferee.com/mcp

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for accessing college basketball statistics through the SportsData.io CBB v3 Stats API, enabling AI agents to retrieve and analyze college basketball data through natural language interactions.
      -
    • A
      license
      B
      quality
      D
      maintenance
      Provides comprehensive NBA statistics via Model Context Protocol, enabling queries for player stats, game scores, team info, and advanced analytics through natural language.
      21
      11
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Exposes the StatsPlus API as tools for MCP-compatible clients, enabling users to query player/team statistics, contracts, ratings, and game history via natural language.
      15
      5
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      A Python MCP server providing 11 tools for querying KenPom basketball analytics, including efficiency ratings, game predictions, four factors, and more through Claude.
      15
      -