kenpom-mcp
Provides access to KenPom basketball analytics through MCP tools. Enables querying ratings, efficiency, player stats, and more using natural language.
README
KenPom MCP Server ๐
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
- KenPom (kenpom.com) - Ken Pomeroy's advanced basketball analytics
- FastMCP (github.com/jlowin/fastmcp) - MCP server framework
- MCP Protocol (modelcontextprotocol.io) - Model Context Protocol specification
๐ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: See SECURITY.md
Made with โค๏ธ for basketball analytics enthusiasts
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.