gargaman007/IPL-Stats-MCP-Server
If you are the rightful owner of IPL-Stats-MCP-Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The IPL Stats MCP Server is a tool that connects to Claude for Desktop, allowing users to query an IPL cricket database using natural language.
IPL Stats MCP Server π
This project provides an MCP (Model Context Protocol) server that connects to Claude for Desktop, enabling you to ask natural language questions about an Indian Premier League (IPL) cricket database.
Whether youβre a cricket enthusiast, a stats analyst, or just curious about IPL history, this setup allows Claude to act as a powerful stats query tool.
βοΈ Setup Instructions
Follow these steps carefully to get the server running on your local machine.
Prerequisites
Before starting, make sure you have the following:
-
Python 3.10 or higher installed on your machine.
- You can check your Python version by running:
or
python --version
python3 --version
- You can check your Python version by running:
-
Required Files:
data_loader.py
β A script that processes raw IPL JSON data (stored in adata/
folder) and generates theipl.db
SQLite database.- This script uses SQLAlchemy to define the database schema and load match data into structured tables (Teams, Players, Matches, Innings, Deliveries).
- When run, it will:
- Remove any existing
ipl.db
file. - Create all necessary database tables.
- Load match information, player details, team details, innings, and deliveries from JSON files.
- Commit all data to the database.
- Remove any existing
- You can run it with:
Make sure the
python data_loader.py
data/
folder exists and contains the IPL JSON match files before running it.
ipl.db
β SQLite database file containing IPL data (can be generated by runningdata_loader.py
).main.py
β The MCP server script.
-
A working installation of Claude for Desktop (instructions provided later).
-
Google Gemini API Key β Required for AI-powered SQL query generation.
- Get it from Google AI Studio
- In
main.py
, replace the placeholder API key in the line:genai.configure(api_key="YOUR_API_KEY_HERE")
Step 1: Install uv
(A Fast Python Package Installer)
Weβll use uv for efficient dependency management.
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
macOS / Linux (Bash):
curl -LsSf https://astral.sh/uv/install.sh | sh
Note: After installation, restart your terminal to make sure the
uv
command is recognized.
Step 2: Create Your Project Environment
1. Create a new project directory and navigate into it:
uv init topmate
cd topmate
2. Create and activate a virtual environment:
- Windows (PowerShell):
uv venv
.venv\Scripts\activate
- macOS / Linux (Bash):
uv venv
source .venv/bin/activate
The virtual environment ensures that dependencies are installed locally and do not interfere with other projects.
Step 3: Install Dependencies
With the virtual environment active, install the required packages:
uv add "mcp[cli]" "google-generativeai" pandas sqlalchemy httpx
Package explanations:
mcp[cli]
β Core MCP framework.google-generativeai
β Enables AI integration (optional use case).pandas
β For powerful data manipulation.sqlalchemy
β For database querying.httpx
β For making HTTP requests.
Step 4: Add Project Files
Copy ther ipl.db
and main.py
files into the topmate
folder.
Your folder structure should look like this:
/topmate/
βββ .venv/
βββ ipl.db
βββ main.py
π Connect to Claude for Desktop
-
Install & Sign In
- Download Claude for Desktop from the official Anthropic site.
- Install and sign in to your account.
-
Open Developer Settings
- Click your Profile Icon (bottom left) β Settings β Developer.
-
Edit MCP Configuration
- Click Edit Raw MCP Config.
- Paste the following JSON (replace the path with your actual folder path):
{
"mcpServers": {
"ipl_stats": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH\\TO\\YOUR\\topmate",
"run",
"python",
"main.py"
]
}
}
}
Path Tips:
-
Windows:
In your terminal, inside thetopmate
folder, run:cd
Then copy the full path and replace backslashes (
\
) with double backslashes (\\
). -
macOS/Linux:
Run:pwd
and use the output path directly.
- Save and Restart Claude
- Save the configuration.
- Restart Claude for Desktop.
π How to Use
Once Claude restarts, youβll notice a "Search and tools" icon next to the chat input bar.
You can now query IPL statistics in natural language.
Example Queries and Outputs:
-
Show me the scorecard for the match between CSK and MI
-
What's the most successful chase target?
-
Which venue has the highest scoring matches?
π Project Structure Summary
topmate/
β
βββ .venv/ # Virtual environment for dependencies
βββ ipl.db # IPL database (SQLite)
βββ main.py # MCP server script
π Troubleshooting
uv
not recognized: Restart your terminal after installinguv
.- Path issues on Windows: Ensure you use double backslashes in the MCP config.
- Claude not detecting MCP server: Verify the
main.py
script runs without errors:python main.py
- Gemini API key errors: Ensure your API key is correctly set in
main.py
.