ipl-mcp-server

mahekara28/ipl-mcp-server

3.1

If you are the rightful owner of ipl-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.

This project implements an MCP (Model Context Protocol) server that answers natural language questions about IPL cricket matches.

🏏 IPL MCP Server This project implements an MCP (Model Context Protocol) server that answers natural language questions about IPL cricket matches.

Built using: Python Flask SQLite Pandas

📥 Installation Steps 1️⃣ Clone or download the repository git clone cd IPL_pr

2️⃣ Create a virtual environment python -m venv venv

3️⃣ Activate the virtual environment

Windows: powershell .\venv\Scripts\activate

macOS/Linux: source venv/bin/activate

4️⃣ Install dependencies pip install flask pandas

🗄️ Database Setup and Data Loading 1️⃣ Prepare IPL JSON data

Place at least 5 IPL JSON files in the data/ folder (already included in this project).

2️⃣ Create the Deliveries table

From the data folder, run: python create_ipl_db.py

3️⃣ Create the Matches table

Still in the data folder, run: python insertmatches.py

4️⃣ Verify database tables

Go back to the project root and run: python check_db.py

✅ You should see:

📦 Tables in ipl.db:

  • Deliveries
  • Matches

⚡ Running the Server In the project root folder: python main.py ✅ Output:

💬 Sending Queries You can use Postman, curl, or connect via Claude Desktop.

Using Postman Endpoint: POST http://127.0.0.1:5000/ask

Body: raw JSON { "question": "Which team won the most matches?" }

🤖 Claude Desktop Connection Instructions To connect Claude Desktop:

1️⃣ Open Claude Desktop and create a Custom Connector.

2️⃣ Base URL: http://127.0.0.1:5000

3️⃣ Request Configuration:

Method: POST

Path: /ask

Body Template: { "question": "{{prompt}}" }

Response Mapping:

Extract the relevant rows or error from the JSON response.

3️⃣ Save connector and start chatting.

🧪 Test Queries Try these example questions:

~Basic Match Information

.Show me all matches in the dataset

.Which team won the most matches?

.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

Advanced Analytics

.What's the average first innings score?

.Show me the scorecard for match between Chennai Super Kings and Mumbai Indians

🌟 Notes This is a prototype. Speed over perfection!

You can expand queries in query_handler.py.

If you have any trouble with setup, ensure:

ipl.db exists and has both tables.

You restarted main.py after creating tables.