MCP server for Kaggle
What is arrismo kaggle mcp
*
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 foruv
package manager.datasets/
: Default directory where downloaded Kaggle datasets will be stored.
Setup
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create a virtual environment (recommended):
python -m venv venv source venv`/bin/activate` # On Windows use `venv\Scripts\activate` # Or use uv: uv venv
-
Install dependencies: Using pip:
pip install -r requirements.txt
Or using uv:
uv sync
-
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 akaggle.json
file containing your username and key.
- Create
- 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 orC:\Users\<Your User Name>\.kaggle\kaggle.json
on Windows). Thekaggle
library will automatically detect this file if the environment variables are not set.
- Download your
- Method 1 (Recommended): Environment Variables
Running the Server
- Ensure your virtual environment is active.
- Run the MCP server:
The server will start and register its resources, tools, and prompts. You can interact with it using an MCP client or compatible tools.uv run kaggle-mcp
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 formatusername/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:
- Agent: "Search Kaggle for datasets about 'heart disease'"
- Server executes
search_kaggle_datasets(query='heart disease')
- Server executes
- Agent: "Download the dataset 'user/heart-disease-dataset'"
- Server executes
download_kaggle_dataset(dataset_ref='user/heart-disease-dataset')
- Server executes
- 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.
- Server executes
- Agent: (Sends the prompt to a code-generating model) -> Receives EDA Python code.
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
zhixiaoqiang antd components mcp
An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询
Submit Your MCP Server
Share your MCP server with the community
Submit Now