MCP HubMCP Hub
lenwood

cfbd-mcp-server

by: lenwood

An MCP server enabling CFBD API queries within Claude Desktop.

9created 20/12/2024
Visit
API
Desktop

πŸ“ŒOverview

Purpose: This framework serves as an MCP server to enable AI assistants and applications to query and analyze college football statistics effectively.

Overview: The College Football Data MCP Server provides comprehensive access to a variety of college football data, allowing users to retrieve game results, team records, player statistics, and more. It supports natural language queries for user-friendly interactions with the data.

Key Features:

  • Comprehensive Data Access: Retrieve detailed statistics including game scores, team records, and player performance metrics to inform analyses and decisions.

  • Natural Language Queries: Users can input questions in plain language, making it easier to interact with the data without requiring technical knowledge.


College Football Data MCP Server

An MCP server implementation providing access to college football statistics sourced from the College Football Data API within Claude Desktop.

Overview

This Model Context Protocol (MCP) server enables AI assistants and applications to:

  • Query comprehensive college football statistics and data
  • Access game results, team records, and player statistics
  • Analyze play-by-play data and drive summaries
  • View rankings and win probability metrics
  • Compare team performances and generate insights

Users can run queries using natural language.

Sample Output

Q. What was the largest upset among FCS games during the 2014 season?

A. The biggest FCS upset from 2014 was Eastern Washington defeating Washington 52-59 on September 6th, 2014. Key points:

  1. Washington was an FBS team from the Pac-12 conference
  2. The game was played at Washington's home stadium (Husky Stadium)
  3. Eastern Washington's win probability was only 1.4% post-game
  4. The 59 points scored was the most ever by an FCS team against a Pac-12 opponent
  5. Washington had been favored by multiple scores going into the game

Other notable FCS upsets that season included North Dakota State defeating Iowa State 34-14, Bethune-Cookman defeating FIU 14-12, and Northern Iowa nearly upsetting Iowa (lost 31-23).

Eastern Washington over Washington stands out as the largest upset due to the division difference, caliber of opponent, scoring margin, historical significance, and the hostile away environment.

Prerequisites

Installation

Installing via Smithery

To install College Football Data Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install cfbd --client claude

Manual Installation

  1. Clone this repository:
git clone https://github.com/yourusername/cfbd-mcp-server
cd cfbd-mcp-server
  1. Create and activate a virtual environment:
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
uv pip install -e .
  1. Create a .env file in the project root and add your API key:
CFB_API_KEY=your_api_key_here

Usage

Running the Server

Start the server:

uv run cfbd-mcp-server

Connecting with Claude Desktop

  1. Open your Claude Desktop configuration at:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the server configuration:

{
    "mcpServers": {
        "cfbd-mcp-server": {
            "command": "uv",
            "args": [
                "--directory",
                "/full/path/to/cfbd-mcp-server",
                "run",
                "cfbd-mcp-server"
            ],
            "env": {
                "CFB_API_KEY": "xxx",
                "PATH": "/full/path/to/python"
            }
        }
    }
}
  1. Close then restart Claude Desktop.

Upon restart, a small hammer icon will appear in the lower right corner of the textbox, indicating MCP tools are available.

Updating After Install

  1. Download the updated files:
cd cfbd-mcp-server
git pull
  1. Uninstall the existing package:
uv pip uninstall cfbd-mcp-server
  1. Delete existing build artifacts and metadata:

Windows:

rmdir /s /q build dist
del /s /q *.egg-info

macOS/Linux:

rm -rf build dist *.egg-info
  1. Install the revised package and dependencies:
uv pip install -e .
uv sync --dev --all-extras
  1. Run the server:
uv run cfbd-mcp-server
  1. Close and restart Claude Desktop.

Features

Resources

Access schema documentation for all endpoints:

  • schema://games - Game information and scores
  • schema://records - Team season records
  • schema://games/teams - Detailed team game data
  • schema://plays - Play-by-play information
  • schema://drives - Drive summaries and results
  • schema://play/stats - Individual play statistics
  • schema://rankings - Team rankings across polls
  • schema://metrics/wp/pregame - Pregame win probabilities
  • schema://game/box/advanced - Advanced box score statistics

Tools

Query endpoints directly:

  • get-games - Retrieve game data
  • get-records - Get team records
  • get-games-teams - Access team game statistics
  • get-plays - Query play-by-play data
  • get-drives - Analyze drive information
  • get-play-stats - View play statistics
  • get-rankings - Check team rankings
  • get-pregame-win-probability - See win probabilities
  • get-advanced-box-score - Access detailed game statistics and analytics

Prompts

Pre-built analysis templates:

  • analyze-game - Get detailed analysis of a specific game
  • analyze-team - Comprehensive single team analysis
  • analyze-trends - Analyze trends over a season
  • compare-teams - Compare performance of two teams
  • analyze-rivalry - Analyze historical rivalry matchups

API Limits

The College Football Data API is free with rate limits:

  • Free tier: Limited requests per minute
  • Patreon subscribers get higher rate limits: https://www.patreon.com/collegefootballdata
  • Use efficient querying patterns to avoid hitting limits
  • Handle rate limit errors gracefully

Development

Project Structure

cfbd-mcp-server/
β”œβ”€β”€ README.md
β”œβ”€β”€ pyproject.toml
└── src/
    └── cfbd_mcp_server/
        β”œβ”€β”€ .env
        β”œβ”€β”€ __init__.py
        β”œβ”€β”€ cfbd_schema.py
        β”œβ”€β”€ schema_helpers.py
        └── server.py

Setting Up for Development

  1. Clone the repository
  2. Install development dependencies:
uv pip install -e ".[dev]"
  1. Run tests:
pytest

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to your fork
  5. Submit a pull request

Troubleshooting

Common Issues

  1. API Key Errors

    • Verify your API key is correctly set in both .env and claude_desktop_config.json
    • Check key validity at collegefootballdata.com
  2. Rate Limiting

    • Space out requests
    • Consider Patreon subscription for higher limits
    • Implement caching
  3. Connection Issues

    • Verify internet connectivity
    • Check API status at collegefootballdata.com
    • Ensure proper error handling

Getting Help

License

This project is licensed under the MIT License.

Acknowledgments