This repository contains an MCP (Model Context Protocol) server (server.py) built using the fastmcp library. It interacts with the Kaggle API to provide tools for searching and downloading datasets, and a prompt for generating EDA notebooks. - server.py: The FastMCP server application. It defines resources, tools, and prompts for interacting with Kaggle. - .env.example: An example file for environ
Add this skill
npx mdskills install arrismo/kaggle-mcpWell-documented MCP server for Kaggle dataset search, download, and EDA prompt generation
1[](https://smithery.ai/server/@arrismo/kaggle-mcp)2<a href="https://glama.ai/mcp/servers/arwswog1el"><img width="380" height="200" src="https://glama.ai/mcp/servers/arwswog1el/badge" alt="Kaggle MCP Server" /></a>34# Kaggle MCP (Model Context Protocol) Server5This repository contains an MCP (Model Context Protocol) server (`server.py`) built using the `fastmcp` library. It interacts with the Kaggle API to provide tools for searching and downloading datasets, and a prompt for generating EDA notebooks.67## Project Structure89- `server.py`: The FastMCP server application. It defines resources, tools, and prompts for interacting with Kaggle.10- `.env.example`: An example file for environment variables (Kaggle API credentials). Rename to `.env` and fill in your details.11- `requirements.txt`: Lists the necessary Python packages.12- `pyproject.toml` & `uv.lock`: Project metadata and locked dependencies for `uv` package manager.13- `datasets/`: Default directory where downloaded Kaggle datasets will be stored.1415## Setup16171. **Clone the repository:**18 ```bash19 git clone <repository-url>20 cd <repository-directory>21 ```22232. **Create a virtual environment (recommended):**24 ```bash25 python -m venv venv26 source venv/bin/activate # On Windows use `venv\Scripts\activate`27 # Or use uv: uv venv28 ```29303. **Install dependencies:**31 Using pip:32 ```bash33 pip install -r requirements.txt34 ```35 Or using uv:36 ```bash37 uv sync38 ```39404. **Set up Kaggle API credentials:**41 - **Method 1 (Recommended): Environment Variables**42 - Create `.env` file43 - Open the `.env` file and add your Kaggle username and API key:44 ```dotenv45 KAGGLE_USERNAME=your_kaggle_username46 KAGGLE_KEY=your_kaggle_api_key47 ```48 - You can obtain your API key from your Kaggle account page (`Account` > `API` > `Create New API Token`). This will download a `kaggle.json` file containing your username and key.49 - **Method 2: `kaggle.json` file**50 - Download your `kaggle.json` file from your Kaggle account.51 - Place the `kaggle.json` file in the expected location (usually `~/.kaggle/kaggle.json` on Linux/macOS or `C:\Users\<Your User Name>\.kaggle\kaggle.json` on Windows). The `kaggle` library will automatically detect this file if the environment variables are not set.5253## Running the Server54551. **Ensure your virtual environment is active.**562. **Run the MCP server:**57 ```bash58 uv run kaggle-mcp59 ```60 The server will start and register its resources, tools, and prompts. You can interact with it using an MCP client or compatible tools.6162## Running the Docker Container6364### 1. Set up Kaggle API credentials6566This project requires Kaggle API credentials to access Kaggle datasets.6768- Go to https://www.kaggle.com/settings and click "Create New API Token" to download your `kaggle.json` file.69- Open the `kaggle.json` file and copy your username and key into a new `.env` file in the project root:7071```72KAGGLE_USERNAME=your_username73KAGGLE_KEY=your_key74```7576### 2. Build the Docker image7778```sh79docker build -t kaggle-mcp-test .80```8182### 3. Run the Docker container using your .env file8384```sh85docker run --rm -it --env-file .env kaggle-mcp-test86```8788This will automatically load your Kaggle credentials as environment variables inside the container.8990---919293## Server Features9495The server exposes the following capabilities through the Model Context Protocol:96### Tools9798* **`search_kaggle_datasets(query: str)`**:99 * Searches for datasets on Kaggle matching the provided query string.100 * Returns a JSON list of the top 10 matching datasets with details like reference, title, download count, and last updated date.101* **`download_kaggle_dataset(dataset_ref: str, download_path: str | None = None)`**:102 * Downloads and unzips files for a specific Kaggle dataset.103 * `dataset_ref`: The dataset identifier in the format `username/dataset-slug` (e.g., `kaggle/titanic`).104 * `download_path` (Optional): Specifies where to download the dataset. If omitted, it defaults to `./datasets/<dataset_slug>/` relative to the server script's location.105106### Prompts107108* **`generate_eda_notebook(dataset_ref: str)`**:109 * Generates a prompt message suitable for an AI model (like Gemini) to create a basic Exploratory Data Analysis (EDA) notebook for the specified Kaggle dataset reference.110 * The prompt asks for Python code covering data loading, missing value checks, visualizations, and basic statistics.111112## Connecting to Claude Desktop113Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json to include the following:114115```116{117 "mcpServers": {118 "kaggle-mcp": {119 "command": "kaggle-mcp",120 "cwd": "<path-to-their-cloned-repo>/kaggle-mcp"121 }122 }123}124```125126## Usage Example127128An AI agent or MCP client could interact with this server like this:1291301. **Agent:** "Search Kaggle for datasets about 'heart disease'"131 * *Server executes `search_kaggle_datasets(query='heart disease')`*1322. **Agent:** "Download the dataset 'user/heart-disease-dataset'"133 * *Server executes `download_kaggle_dataset(dataset_ref='user/heart-disease-dataset')`*1343. **Agent:** "Generate an EDA notebook prompt for 'user/heart-disease-dataset'"135 * *Server executes `generate_eda_notebook(dataset_ref='user/heart-disease-dataset')`*136 * *Server returns a structured prompt message.*1374. **Agent:** (Sends the prompt to a code-generating model) -> Receives EDA Python code.138
Full transparency — inspect the skill content before installing.