kaggle-mcp
Kaggle MCP(模型上下文协议)服务器
此代码库包含一个使用fastmcp库构建的 MCP(模型上下文协议)服务器 ( server.py )。它与 Kaggle API 交互,提供用于搜索和下载数据集的工具,以及生成 EDA 笔记本的提示。
项目结构
server.py:FastMCP 服务器应用程序。它定义了与 Kaggle 交互的资源、工具和提示。.env.example:环境变量(Kaggle API 凭证)的示例文件。重命名为.env并填写您的详细信息。requirements.txt:列出必要的 Python 包。pyproject.toml&uv.lock:uv包管理器的项目元数据和锁定依赖项。datasets/:下载的 Kaggle 数据集的默认存储目录。
Related MCP server: Kaggle-MCP
设置
克隆存储库:
git clone <repository-url> cd <repository-directory>创建虚拟环境(推荐):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` # Or use uv: uv venv**安装依赖项:**使用 pip:
pip install -r requirements.txt或者使用 uv:
uv sync设置 Kaggle API 凭证:
方法 1(推荐):环境变量
创建
.env文件打开
.env文件并添加您的 Kaggle 用户名和 API 密钥:KAGGLE_USERNAME=your_kaggle_username KAGGLE_KEY=your_kaggle_api_key您可以从 Kaggle 帐户页面(
Account>API>Create New API Token)获取 API 密钥。这将下载一个包含您的用户名和密钥的kaggle.json文件。
方法二:
kaggle.json文件从您的 Kaggle 帐户下载您的
kaggle.json文件。将
kaggle.json文件放置在预期位置(Linux/macOS 上通常为~/.kaggle/kaggle.json,Windows 上通常C:\Users\<Your User Name>\.kaggle\kaggle.json)。如果未设置环境变量,kaggle库将自动检测此文件。
运行服务器
确保您的虚拟环境处于活动状态。
运行 MCP 服务器:
uv run kaggle-mcp服务器将启动并注册其资源、工具和提示。您可以使用 MCP 客户端或兼容工具与其交互。
运行 Docker 容器
1. 设置 Kaggle API 凭证
该项目需要 Kaggle API 凭证来访问 Kaggle 数据集。
转到https://www.kaggle.com/settings并单击“创建新 API 令牌”以下载您的
kaggle.json文件。打开
kaggle.json文件并将您的用户名和密钥复制到项目根目录中的新.env文件中:
KAGGLE_USERNAME=your_username
KAGGLE_KEY=your_key2.构建Docker镜像
docker build -t kaggle-mcp-test .3. 使用 .env 文件运行 Docker 容器
docker run --rm -it --env-file .env kaggle-mcp-test这将自动将您的 Kaggle 凭据作为容器内的环境变量加载。
服务器功能
服务器通过模型上下文协议公开以下功能:
工具
search_kaggle_datasets(query: str):在 Kaggle 上搜索与提供的查询字符串匹配的数据集。
返回前 10 个匹配数据集的 JSON 列表,其中包含参考、标题、下载次数和上次更新日期等详细信息。
download_kaggle_dataset(dataset_ref: str, download_path: str | None = None):下载并解压特定 Kaggle 数据集的文件。
dataset_ref:格式为username/dataset-slug数据集标识符(例如,kaggle/titanic)。download_path(可选):指定数据集的下载位置。如果省略,则默认为相对于服务器脚本位置的./datasets/<dataset_slug>/。
提示
generate_eda_notebook(dataset_ref: str):生成适合 AI 模型(如 Gemini)的提示消息,为指定的 Kaggle 数据集参考创建基本的探索性数据分析 (EDA) 笔记本。
提示要求提供涵盖数据加载、缺失值检查、可视化和基本统计的 Python 代码。
连接到 Claude Desktop
转到 Claude > 设置 > 开发人员 > 编辑配置 > claude_desktop_config.json 以包含以下内容:
{
"mcpServers": {
"kaggle-mcp": {
"command": "kaggle-mcp",
"cwd": "<path-to-their-cloned-repo>/kaggle-mcp"
}
}
}使用示例
AI 代理或 MCP 客户端可以像这样与该服务器交互:
代理: “在 Kaggle 上搜索关于‘心脏病’的数据集”
服务器执行
search_kaggle_datasets(query='heart disease')
代理: “下载数据集‘user/heart-disease-dataset’”
服务器执行
download_kaggle_dataset(dataset_ref='user/heart-disease-dataset')
代理: “为‘用户/心脏病数据集’生成 EDA 笔记本提示”
服务器执行
generate_eda_notebook(dataset_ref='user/heart-disease-dataset')服务器返回结构化的提示信息。
**代理:(**将提示发送到代码生成模型)->接收 EDA Python 代码。
Available Tools
2 toolsdownload_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/'.
| Name | Required | Description | Default |
|---|---|---|---|
| dataset_ref | Yes | ||
| download_path | No |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
TDQS
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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
Machine-readable utilities and datasets for AI agents.
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
The all-in-one data stack for agents. Upload files, run SQL, evolve tables, and render charts.
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with the Hugging Face Dataset Viewer API, allowing users to browse, search, filter, and analyze datasets hosted on the Hugging Face Hub.831MIT
- AlicenseNot gradedqualityDmaintenanceConnects 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
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Kaggle competitions, including listing competitions, downloading files, submitting predictions, and viewing submission history.10
- AlicenseNot gradedqualityDmaintenanceA full-featured MCP server with 96 tools for the Kaggle API, enabling users to manage competitions, datasets, notebooks, models, discussions, and workflows via natural language.MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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