Skip to main content
Glama

insignia de herrería

Servidor MCP (Protocolo de contexto de modelo) de Kaggle

Este repositorio contiene un servidor MCP (Protocolo de Contexto de Modelo) ( server.py ) creado con la biblioteca fastmcp . Interactúa con la API de Kaggle para proporcionar herramientas de búsqueda y descarga de conjuntos de datos, así como un indicador para generar cuadernos EDA.

Estructura del proyecto

  • server.py : La aplicación de servidor FastMCP. Define recursos, herramientas y avisos para interactuar con Kaggle.

  • .env.example : Un archivo de ejemplo para variables de entorno (credenciales de la API de Kaggle). Renómbrelo a .env y complete sus datos.

  • requirements.txt : enumera los paquetes de Python necesarios.

  • pyproject.toml y uv.lock : metadatos del proyecto y dependencias bloqueadas para el administrador de paquetes uv .

  • datasets/ : Directorio predeterminado donde se almacenarán los conjuntos de datos de Kaggle descargados.

Related MCP server: Kaggle-MCP

Configuración

  1. Clonar el repositorio:

    git clone <repository-url>
    cd <repository-directory>
  2. Crear un entorno virtual (recomendado):

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    # Or use uv: uv venv
  3. Instalar dependencias: Usando pip:

    pip install -r requirements.txt

    O usando uv:

    uv sync
  4. Configurar las credenciales de la API de Kaggle:

    • Método 1 (recomendado): variables de entorno

      • Crear archivo .env

      • Abra el archivo .env y agregue su nombre de usuario de Kaggle y su clave API:

        KAGGLE_USERNAME=your_kaggle_username
        KAGGLE_KEY=your_kaggle_api_key
      • Puedes obtener tu clave API desde la página de tu cuenta de Kaggle ( Account > API > Create New API Token ). Esto descargará un archivo kaggle.json con tu nombre de usuario y clave.

    • Método 2: archivo kaggle.json

      • Descargue su archivo kaggle.json desde su cuenta de Kaggle.

      • Coloque el archivo kaggle.json en la ubicación prevista (normalmente ~/.kaggle/kaggle.json en Linux/MacOS o C:\Users\<Your User Name>\.kaggle\kaggle.json en Windows). La biblioteca kaggle detectará automáticamente este archivo si no se configuran las variables de entorno.

Ejecución del servidor

  1. Asegúrese de que su entorno virtual esté activo.

  2. Ejecute el servidor MCP:

    uv run kaggle-mcp

    El servidor se iniciará y registrará sus recursos, herramientas y avisos. Puede interactuar con él mediante un cliente MCP o herramientas compatibles.

Ejecución del contenedor Docker

1. Configurar las credenciales de la API de Kaggle

Este proyecto requiere credenciales de API de Kaggle para acceder a los conjuntos de datos de Kaggle.

  • Vaya a https://www.kaggle.com/settings y haga clic en "Crear nuevo token de API" para descargar su archivo kaggle.json .

  • Abra el archivo kaggle.json y copie su nombre de usuario y clave en un nuevo archivo .env en la raíz del proyecto:

KAGGLE_USERNAME=your_username
KAGGLE_KEY=your_key

2. Construya la imagen de Docker

docker build -t kaggle-mcp-test .

3. Ejecute el contenedor Docker usando su archivo .env

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

Esto cargará automáticamente sus credenciales de Kaggle como variables de entorno dentro del contenedor.


Características del servidor

El servidor expone las siguientes capacidades a través del Protocolo de Contexto de Modelo:

Herramientas

  • search_kaggle_datasets(query: str) :

    • Busca conjuntos de datos en Kaggle que coincidan con la cadena de consulta proporcionada.

    • Devuelve una lista JSON de los 10 principales conjuntos de datos coincidentes con detalles como referencia, título, cantidad de descargas y fecha de última actualización.

  • download_kaggle_dataset(dataset_ref: str, download_path: str | None = None) :

    • Descarga y descomprime archivos para un conjunto de datos específico de Kaggle.

    • dataset_ref : el identificador del conjunto de datos en el formato username/dataset-slug (por ejemplo, kaggle/titanic ).

    • download_path (Opcional): Especifica dónde descargar el conjunto de datos. Si se omite, el valor predeterminado es ./datasets/<dataset_slug>/ <dataset_slug>/, relativo a la ubicación del script del servidor.

Indicaciones

  • generate_eda_notebook(dataset_ref: str) :

    • Genera un mensaje de aviso adecuado para que un modelo de IA (como Gemini) cree un cuaderno de análisis de datos exploratorios (EDA) básico para la referencia del conjunto de datos de Kaggle especificado.

    • El mensaje solicita código Python que cubra la carga de datos, las verificaciones de valores faltantes, las visualizaciones y las estadísticas básicas.

Conexión a Claude Desktop

Vaya a Claude > Configuración > Desarrollador > Editar configuración > claude_desktop_config.json para incluir lo siguiente:

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

Ejemplo de uso

Un agente de IA o un cliente MCP podría interactuar con este servidor de la siguiente manera:

  1. Agente: "Busca en Kaggle conjuntos de datos sobre 'enfermedades cardíacas'"

    • El servidor ejecuta search_kaggle_datasets(query='heart disease')

  2. Agente: "Descargar el conjunto de datos 'usuario/conjunto-de-datos-de-enfermedades-del-corazón'"

    • El servidor ejecuta download_kaggle_dataset(dataset_ref='user/heart-disease-dataset')

  3. Agente: "Generar un mensaje de aviso en el cuaderno EDA para 'usuario/conjunto de datos de enfermedades cardíacas'"

    • El servidor ejecuta generate_eda_notebook(dataset_ref='user/heart-disease-dataset')

    • El servidor devuelve un mensaje de aviso estructurado.

  4. Agente: (envía el mensaje a un modelo generador de código) -> Recibe código Python de EDA.

Available Tools

2 tools
download_kaggle_datasetC

Downloads files for a specific Kaggle dataset. Args: dataset_ref: The reference of the dataset (e.g., 'username/dataset-slug'). download_path: Optional. The path to download the files to. Defaults to '/datasets/'.

ParametersJSON Schema
NameRequiredDescriptionDefault
dataset_refYes
download_pathNo

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but lacks critical details: whether authentication is required (Kaggle typically needs API credentials), what happens if files already exist at the path, error handling, or any rate limits. The description is minimal beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by parameter explanations. It avoids unnecessary fluff, though the formatting with 'Args:' could be more integrated. Every sentence adds value, making it appropriately concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of downloading datasets (which often involves authentication, file management, and error cases), no annotations, and no output schema, the description is insufficient. It misses key contextual details like authentication requirements, response format, or handling of large downloads, leaving significant gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for both parameters: it explains the format of 'dataset_ref' with an example and clarifies the default behavior and path structure for 'download_path'. With 0% schema description coverage, this compensates somewhat, but it doesn't fully detail constraints (e.g., path validity, dataset accessibility).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Downloads files') and resource ('for a specific Kaggle dataset'), making the purpose immediately understandable. It distinguishes from the sibling tool 'search_kaggle_datasets' by focusing on downloading rather than searching, though it doesn't explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. While it's implied this is for downloading after a dataset is identified (versus searching with the sibling tool), there's no explicit mention of prerequisites, dependencies, or when-not-to-use scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_kaggle_datasetsC

Searches for datasets on Kaggle matching the query using the Kaggle API.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions using the Kaggle API but doesn't disclose behavioral traits such as authentication requirements, rate limits, pagination, or what the search returns (e.g., format, fields). This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't cover key aspects like authentication, rate limits, return format, or error handling. For a search tool with no structured support, more context is needed to guide an agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It implies the 'query' parameter is used for searching datasets, but doesn't add meaning beyond what the schema's title ('Query') and type suggest. No details on query syntax, examples, or constraints are provided, resulting in minimal added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Searches for datasets') and target resource ('on Kaggle'), specifying it uses the Kaggle API. It distinguishes from the sibling tool 'download_kaggle_dataset' by focusing on search rather than download, though it doesn't explicitly mention this distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention the sibling tool 'download_kaggle_dataset' or any other search methods, nor does it specify prerequisites like authentication or rate limits.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: one downloads a specific dataset, while the other searches for datasets. There is no overlap in functionality, making it easy for an agent to choose the correct tool for each task without confusion.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern (download_kaggle_dataset and search_kaggle_datasets), using snake_case and clear action verbs. This consistency makes the tool set predictable and easy to understand at a glance.

Tool Count2/5

With only two tools, the server feels thin for a Kaggle integration, lacking essential operations like listing datasets, uploading data, or managing competitions. While the tools are functional, the scope is incomplete for typical Kaggle workflows, making the count too low for the domain.

Completeness2/5

The tool set is severely incomplete for a Kaggle MCP server. It covers downloading and searching datasets but misses critical operations such as uploading datasets, accessing competition data, or interacting with notebooks. This creates significant gaps that will hinder agents from performing common Kaggle tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects Claude AI to the Kaggle API through the Model Context Protocol, enabling users to browse competitions, search and download datasets, analyze kernels, and access pre-trained models through natural language interactions.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with Kaggle competitions, including listing competitions, downloading files, submitting predictions, and viewing submission history.
    10

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arrismo/kaggle-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server