Cover image
Try Now
2025-04-14

Servidor MCP para kaggle

3 years

Works with Finder

4

Github Watches

0

Github Forks

4

Github Stars

smithery badge Kaggle MCP Server

Kaggle MCP (Model Context Protocol) Server

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.

Project Structure

  • server.py: The FastMCP server application. It defines resources, tools, and prompts for interacting with Kaggle.
  • .env.example: An example file for environment variables (Kaggle API credentials). Rename to .env and fill in your details.
  • requirements.txt: Lists the necessary Python packages.
  • pyproject.toml & uv.lock: Project metadata and locked dependencies for uv package manager.
  • datasets/: Default directory where downloaded Kaggle datasets will be stored.

Setup

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-directory>
    
  2. Create a virtual environment (recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    # Or use uv: uv venv
    
  3. Install dependencies: Using pip:

    pip install -r requirements.txt
    

    Or using uv:

    uv sync
    
  4. Set up Kaggle API credentials:

    • Method 1 (Recommended): Environment Variables
      • Create .env file
      • Open the .env file and add your Kaggle username and API key:
        KAGGLE_USERNAME=your_kaggle_username
        KAGGLE_KEY=your_kaggle_api_key
        
      • 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.
    • Method 2: kaggle.json file
      • Download your kaggle.json file from your Kaggle account.
      • 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.

Running the Server

  1. Ensure your virtual environment is active.
  2. Run the MCP server:
    uv run kaggle-mcp
    
    The server will start and register its resources, tools, and prompts. You can interact with it using an MCP client or compatible tools.

Running the Docker Container

1. Set up Kaggle API credentials

This project requires Kaggle API credentials to access Kaggle datasets.

  • Go to https://www.kaggle.com/settings and click "Create New API Token" to download your kaggle.json file.
  • Open the kaggle.json file and copy your username and key into a new .env file in the project root:
KAGGLE_USERNAME=your_username
KAGGLE_KEY=your_key

2. Build the Docker image

docker build -t kaggle-mcp-test .

3. Run the Docker container using your .env file

docker run --rm -it --env-file .env kaggle-mcp-test

This will automatically load your Kaggle credentials as environment variables inside the container.


Server Features

The server exposes the following capabilities through the Model Context Protocol:

Tools

  • search_kaggle_datasets(query: str):
    • Searches for datasets on Kaggle matching the provided query string.
    • Returns a JSON list of the top 10 matching datasets with details like reference, title, download count, and last updated date.
  • download_kaggle_dataset(dataset_ref: str, download_path: str | None = None):
    • Downloads and unzips files for a specific Kaggle dataset.
    • dataset_ref: The dataset identifier in the format username/dataset-slug (e.g., kaggle/titanic).
    • download_path (Optional): Specifies where to download the dataset. If omitted, it defaults to ./datasets/<dataset_slug>/ relative to the server script's location.

Prompts

  • generate_eda_notebook(dataset_ref: str):
    • 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.
    • The prompt asks for Python code covering data loading, missing value checks, visualizations, and basic statistics.

Connecting to Claude Desktop

Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json to include the following:

{
  "mcpServers": {
    "kaggle-mcp": {
      "command": "kaggle-mcp",
      "cwd": "<path-to-their-cloned-repo>/kaggle-mcp"
    }
  }
}

Usage Example

An AI agent or MCP client could interact with this server like this:

  1. Agent: "Search Kaggle for datasets about 'heart disease'"
    • Server executes search_kaggle_datasets(query='heart disease')
  2. Agent: "Download the dataset 'user/heart-disease-dataset'"
    • Server executes download_kaggle_dataset(dataset_ref='user/heart-disease-dataset')
  3. Agent: "Generate an EDA notebook prompt for 'user/heart-disease-dataset'"
    • Server executes generate_eda_notebook(dataset_ref='user/heart-disease-dataset')
    • Server returns a structured prompt message.
  4. Agent: (Sends the prompt to a code-generating model) -> Receives EDA Python code.

相关推荐

  • av
  • Ejecute sin esfuerzo LLM Backends, API, frontends y servicios con un solo comando.

  • 1Panel-dev
  • 🔥 1Panel proporciona una interfaz web intuitiva y un servidor MCP para administrar sitios web, archivos, contenedores, bases de datos y LLM en un servidor de Linux.

  • rulego
  • ⛓️Rulego es un marco de motor de regla de orquestación de componentes de alta generación de alto rendimiento, de alto rendimiento y de alto rendimiento para GO.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.

  • hkr04
  • SDK liviano C ++ MCP (Protocolo de contexto del modelo)

  • sigoden
  • Cree fácilmente herramientas y agentes de LLM utilizando funciones Plain Bash/JavaScript/Python.

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 Qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 DiFy 、 Claude 、 Gemini 、 Xai 、 PPIO 、 Ollama 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 Chatglm 、 SillyTraven 、 MCP 等 LLM 的机器人 / Agente | Plataforma de bots de mensajería instantánea basada en LLM, admite Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack

  • modelscope
  • Iniciar aplicaciones de múltiples agentes empoderadas con Building LLM de manera más fácil.

  • dmayboroda
  • Trapo conversacional local con contenedores configurables

  • paulwing
  • Un repositorio de pruebas creado con el servicio MCP

    Reviews

    2.3 (6)
    Avatar
    user_Sldz0YTj
    2025-04-23

    As a dedicated user of kaggle-mcp created by arrismo, I am thoroughly impressed with its seamless integration and efficiency. The user-friendly interface and comprehensive functionalities have significantly boosted my productivity in machine learning projects. A must-have tool for any Kaggle enthusiast!

    Avatar
    user_K3vZC1IC
    2025-04-23

    As a devoted user of the kaggle-mcp application by arrismo, I must say it exceeds expectations in streamlining my data science projects. The interface is user-friendly and the functionalities are robust, making analysis seamless. It's an essential tool for anyone serious about Kaggle competitions. Highly recommend!

    Avatar
    user_dB91LuTZ
    2025-04-23

    As an avid user of kaggle-mcp by arrismo, I can confidently say this package has been a game-changer for my data science projects. Its intuitive design and user-friendly interface make navigating through complex datasets a breeze. The support and resources provided are exceptional, paving the way for a smoother data analysis process. Highly recommended for anyone serious about their data journey!

    Avatar
    user_xgBUTIcp
    2025-04-23

    As a dedicated user of the kaggle-mcp application by arrismo, I highly recommend it for anyone serious about data science and machine learning. The intuitive design and seamless integration with Kaggle competitions make it incredibly efficient to use. The welcome message is very encouraging and the start URL guides you effectively through the setup process. It's a must-have tool for Kaggle enthusiasts!

    Avatar
    user_5Ul3cvLX
    2025-04-23

    I am absolutely impressed with kaggle-mcp! This tool by arrismo is a game-changer for any data enthusiast. It's intuitive, efficient, and seamlessly integrates with Kaggle. The user-friendly interface and insightful welcome message make it a joy to use from the get-go. Highly recommend it to anyone looking to elevate their data projects!

    Avatar
    user_Dg3Aqp08
    2025-04-23

    As a dedicated user of kaggle-mcp by arrismo, I must say it's an exceptional tool for connecting with the Kaggle community. The intuitive interface and seamless integration enhance my data science projects. Highly recommend it to anyone looking for a robust and user-friendly platform!