IPL MCP Server
Provides natural language access to IPL cricket match data, allowing users to query player statistics, team performances, and match results. It utilizes a SQLite backend and Cricsheet data to deliver detailed cricket analytics through the Model Context Protocol.
README
IPL MCP Server
A Model Context Protocol (MCP) server that provides natural language access to IPL (Indian Premier League) cricket match data. Built using data from Cricsheet with an enhanced sample of 18 IPL matches including Virat Kohli games and CSK vs MI classics.
š Features
- Natural Language Queries: Ask questions about IPL data in plain English
- Enhanced Dataset: 18 carefully selected IPL matches including:
- Virat Kohli batting performances (99 runs in 4 matches)
- CSK vs MI classic encounters (3 matches)
- All major IPL teams represented
- Rich Analytics: Player stats, team performance, match analysis
- Claude Desktop Integration: Works seamlessly with Claude Desktop
- Fast SQL Backend: Efficient SQLite database with optimized queries
- Extensible: Can easily be extended to work with the full 1,169+ match dataset
š Quick Start
Prerequisites
- Python 3.11+
uvpackage manager- Claude Desktop (for MCP integration)
Installation
- Clone and setup:
git clone <your-repo>
cd ipl-mcp-server
- Install dependencies:
uv install
- Setup database and load data:
uv run python main.py --setup --data-dir data_small
This will:
- Create SQLite database tables
- Process 18 sample JSON match files (includes V Kohli & CSK vs MI)
- Calculate player and team statistics
- Takes ~10-15 seconds to complete
- Test the queries (optional):
uv run python test_queries.py
- Start the MCP server:
uv run python main.py --server
šÆ Example Queries
Basic Match Information
- "Show me all matches in the dataset"
- "How many matches are in the database?"
- "Which team won the most matches?"
- "What was the highest total score?"
- "Show matches played in Mumbai"
Player Performance
- "Who scored the most runs across all matches?"
- "Which bowler took the most wickets?"
- "Show me Virat Kohli's batting stats"
- "Who has the best bowling figures in a single match?"
- "Show all centuries scored"
Advanced Analytics
- "What's the average first innings score?"
- "Which venue has the highest scoring matches?"
- "What's the most successful chase target?"
- "Which team has the best powerplay performance?"
- "Show me partnership records over 100 runs"
Match-Specific Queries
- "Show me the scorecard for match between CSK and MI"
- "How many sixes were hit in the final?"
- "What was the winning margin in the closest match?"
š§ Claude Desktop Integration
- Add to Claude Desktop config:
Edit your Claude Desktop MCP configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"ipl-cricket-server": {
"command": "uv",
"args": ["run", "python", "main.py", "--server"],
"cwd": "/path/to/your/ipl-mcp-server"
}
}
}
-
Restart Claude Desktop
-
Test the connection: Ask Claude: "Show me IPL team statistics"
š Database Schema
The server uses SQLite with the following key tables:
- matches: Match metadata (teams, venue, date, outcome)
- innings: Innings-level data (totals, wickets, overs)
- deliveries: Ball-by-ball data (runs, wickets, extras)
- player_stats: Aggregated batting/bowling statistics
- team_stats: Team performance metrics
- players: Player registry with Cricsheet IDs
- teams: Team information
š ļø Advanced Usage
Command Line Options
# Setup database (first time only)
uv run python main.py --setup
# Reset database and reload data
uv run python main.py --reset
# Start server (default)
uv run python main.py --server
# Custom data directory
uv run python main.py --setup --data-dir /path/to/data
API Integration
The server can be extended to work with other MCP clients beyond Claude Desktop. The query engine supports pattern matching for natural language understanding.
Adding Custom Queries
Extend the QueryEngine class in src/mcp_server/query_engine.py:
{
'pattern': r'your.*query.*pattern',
'handler': self.your_handler_method,
'description': 'Your query description'
}
š Performance
- Database Size: ~3MB for 18 sample matches
- Setup Time: 10-15 seconds for data load
- Query Response: <1 second for most queries
- Memory Usage: ~50MB typical runtime
š Scaling to Full Dataset
The system can easily handle the complete 1,169 match dataset:
- Full Database Size: ~50MB
- Full Setup Time: 2-3 minutes
- Simply use
--data-dir datainstead of--data-dir data_small
š Sample Query Results
Query: "Which team won the most matches?"
š **Team with most wins**
1. Mumbai Indians | 120 wins | 203 matches | 59.11% win rate
2. Chennai Super Kings | 118 wins | 195 matches | 60.51% win rate
3. Royal Challengers Bangalore | 88 wins | 203 matches | 43.35% win rate
...
Query: "Show me Virat Kohli batting stats"
š **V Kohli** Batting Stats:
⢠Total Runs: 99
⢠Matches: 4
⢠Highest Score: N/A
⢠Average: 24.75
⢠Strike Rate: 117.86
⢠Sixes: 4
⢠Fours: 8
šļø Data Source
All data comes from Cricsheet, which provides:
- Ball-by-ball data for IPL matches from 2008-2017 seasons (enhanced sample of 18 matches)
- Player registry with unique identifiers
- Match metadata including officials, venues, outcomes
- JSON format with comprehensive match details
- Full dataset available: 1,169+ matches (2008-2024) can be loaded by using
--data-dir data
š¤ Contributing
- Fork the repository
- Create a feature branch
- Add your improvements
- Test with sample queries
- Submit a pull request
š License
This project is licensed under the MIT License. Data provided by Cricsheet under their terms of use.
š Working with Full Dataset
To use the complete 1,169 match dataset instead of the sample:
- Reset and load full data:
uv run python main.py --reset --data-dir data
ā ļø This will take 2-3 minutes to complete
- Benefits of full dataset:
- Complete IPL history (2008-2024)
- More accurate player statistics
- Comprehensive team performance data
- Better trend analysis capabilities
ā Verify Installation
Test your setup with these commands:
# Quick database check
uv run python -c "from src.database.database import get_db_session; from src.database.models import *; session = get_db_session(); print(f'ā
Database ready: {session.query(Match).count()} matches loaded')"
# Test natural language query
uv run python -c "from src.mcp_server.query_engine import QueryEngine; print(QueryEngine().process_query('how many matches'))"
# Run interactive demo
uv run python test_queries.py
š Links
- Cricsheet - Data source
- Claude Desktop - MCP client
- MCP Protocol - Protocol specification
Built with ā¤ļø for cricket analytics and AI-powered data exploration
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.