kaggle-mcp
Provides tools for interacting with the Kaggle public API: searching and reading competitions, datasets, models, notebooks and discussions; creating, updating, running and waiting on notebooks/scripts (with GPU/TPU, internet and privacy settings); downloading competition data and dataset files into a sandboxed workspace; submitting to competitions and code competitions; and publishing private datasets. Also exposes the credential-check status and accelerator quota.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
kaggle-mcp
A lightweight, security-focused Model Context Protocol server for Kaggle. It works with Claude (Desktop, Code, claude.ai, API) and ChatGPT (developer-mode connectors, deep research, OpenAI Responses API).
With it a model can read, write and run Kaggle notebooks, explore competitions, datasets and models, download data, submit to competitions and publish datasets, all through the official Kaggle API with your API token.
Lightweight: three runtime dependencies (
mcp,httpx,uvicorn). It calls the Kaggle REST API directly and does not need thekaggleCLI orkagglesdk.Secure by default: new content is private, delete tools are off, local file access is sandboxed, transfers are size-capped, and HTTP mode requires a token. See SECURITY.md.
Two transports:
stdiofor local clients and Streamable HTTP for remote ones (ChatGPT, claude.ai).Runs in Claude Code cloud sessions with the Kaggle token held outside the VM. See cloud/README.md.
Contents
Connecting clients Claude Desktop · Claude Code · claude.ai / ChatGPT (remote) · OpenAI Responses API · Anthropic Messages API
Related MCP server: kaggle-mcp
Quick start
git clone <this repo> kaggle-mcp && cd kaggle-mcp
uv venv && uv pip install -e . # or: python -m venv .venv && .venv/bin/pip install -e .
export KAGGLE_API_TOKEN=... # see "Kaggle authentication"
.venv/bin/kaggle-mcp # stdio server (what local clients launch)Requires Python 3.10+.
Kaggle authentication
The server uses the Kaggle public API with your personal credentials. It looks for them in this order (the same order as the official CLI) and uses the first it finds:
# | Source | Notes |
1 |
| The token itself, or a path to a file containing it. Recommended. |
2 |
| File containing an API token |
3 |
| Legacy key pair, sent as HTTP Basic auth |
4 |
| Legacy |
To get a token: kaggle.com → Settings → API → Generate New Token. Keep credential files at chmod 600;
the server logs a warning when one is readable by other users. KAGGLE_CONFIG_DIR changes where it
looks for ~/.kaggle.
Credentials are loaded lazily, held in memory only, sent only to https://api.kaggle.com, and never
logged or returned by any tool. Run the kaggle_auth_status tool to check that they work.
Some actions also need consent on kaggle.com first. For example, to download competition data or submit, you must have joined the competition and accepted its rules in the browser.
Connecting clients
Claude Desktop
Edit claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"kaggle": {
"command": "/absolute/path/to/kaggle-mcp/.venv/bin/kaggle-mcp",
"env": {
"KAGGLE_API_TOKEN": "your-kaggle-api-token",
"KAGGLE_MCP_WORKSPACE": "/absolute/path/to/kaggle-workspace"
}
}
}
}Restart Claude Desktop. The Kaggle tools appear in the tools menu.
Claude Code
claude mcp add kaggle --env KAGGLE_API_TOKEN=your-token -- /absolute/path/to/kaggle-mcp/.venv/bin/kaggle-mcpTo use a remote deployment instead:
claude mcp add --transport http kaggle https://mcp.example.com/mcp --header "Authorization: Bearer $KAGGLE_MCP_AUTH_TOKEN"Remote clients (ChatGPT, claude.ai)
ChatGPT and claude.ai connect to a public HTTPS URL, so you need to run the HTTP transport and expose it (see Deployment).
Generate a token and start the server:
export KAGGLE_MCP_AUTH_TOKEN=$(kaggle-mcp generate-token) export KAGGLE_MCP_ALLOW_PATH_TOKEN=true # only for UIs that can't send headers (see below) export KAGGLE_MCP_ALLOWED_HOSTS=mcp.example.com # your public hostname kaggle-mcp --transport http --behind-proxyExpose it over HTTPS with a reverse proxy, Cloudflare Tunnel, ngrok or similar.
Add the connector:
ChatGPT: Settings → Apps & Connectors → Advanced settings → enable Developer mode, then Create a connector. MCP server URL:
https://mcp.example.com/s/<KAGGLE_MCP_AUTH_TOKEN>/mcp, Authentication: No authentication. The server implements thesearchandfetchtools that ChatGPT deep research expects, and every other tool is available in developer mode.claude.ai: Settings → Connectors → Add custom connector, using the same URL.
These connector UIs can do OAuth but cannot send a static Authorization header. The
secret-path URL (/s/<token>/mcp) is the opt-in workaround: whoever has the URL can use the
server, so keep it as private as a password, and rotate the token if it leaks. Clients that can send
headers should use https://mcp.example.com/mcp with Authorization: Bearer <token> and leave
KAGGLE_MCP_ALLOW_PATH_TOKEN off.
OpenAI Responses API
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "kaggle",
"server_url": "https://mcp.example.com/mcp",
"headers": {"Authorization": "Bearer <KAGGLE_MCP_AUTH_TOKEN>"},
"require_approval": "always",
}],
input="Summarize the evaluation metric of the Titanic competition.",
)Anthropic Messages API
Use the MCP connector with
{"type": "url", "url": "https://mcp.example.com/mcp", "name": "kaggle", "authorization_token": "<KAGGLE_MCP_AUTH_TOKEN>"}
in mcp_servers.
Tools
The server registers 36 tools by default (plus 2 delete tools if you enable them). Every tool carries MCP
annotations (readOnlyHint, destructiveHint, ...), which lets clients ask for confirmation before
write actions.
References use owner/slug for notebooks, datasets and models, and the slug alone for competitions
(e.g. titanic). Kaggle URLs work too. For your own notebooks and datasets a bare slug is enough
(notebook_create(ref="titanic-baseline", ...)): the server looks up the username behind your API
token once (via Kaggle's token-introspection endpoint, as the official CLI does) and fills it in.
kaggle_auth_status also reports it.
Notebooks
Tool | What it does |
| Search notebooks. Filter by user, competition, dataset or language; |
| Read a notebook as numbered cells (with outputs), raw |
| Create a notebook or script from |
| Save a new version, either with cell-level |
| Re-run an existing notebook as-is. |
| QUEUED / RUNNING / COMPLETE / ERROR. |
| Poll until the run finishes (up to 15 min per call), reporting progress. |
| Output file list plus the tail of the execution log (stdout/stderr/tracebacks). |
| Download output files into the workspace. |
| Remaining GPU/TPU hours. |
| Off by default; requires |
Competitions
Tool | What it does |
| Search by category, group ( |
| Deadline, metric, submission limits, whether it's code-only. |
| Overview, evaluation, rules and data description text. |
| List data files. |
| Download one file or all data (zip) into the workspace. |
| Public leaderboard. |
| Your submissions with status and scores. |
| Submit a workspace file or inline CSV |
| Submit a notebook's output to a code competition. |
Datasets
Tool | What it does |
| Search datasets and inspect metadata, files and columns. |
| Download a whole dataset or a single file. |
| Publish workspace files as a new (private) dataset or a new version. |
| Processing status after upload. |
| Off by default. |
Models, search and account
Tool | What it does |
| Search models and list their variations, for use as notebook |
| Full-text search across competitions, datasets, notebooks, models, discussions and users. |
| The ChatGPT connector / deep-research pair. Ids look like |
| Checks that the credentials work and shows the server policy. Never shows secrets. |
Local workspace (sandboxed directory)
Tool | What it does |
| Browse downloaded files and read text files (CSV, logs, ...), paged. |
| Write a file, e.g. a submission CSV or a dataset file to upload. |
| Extract a downloaded archive, with zip-slip and zip-bomb protection. |
✏️ = changes your Kaggle account (hidden when KAGGLE_MCP_READ_ONLY=true) · 💾 = writes local workspace files · 🗑️ = irreversible, opt-in
Working with notebooks
A typical edit-and-run loop driven by the model:
notebook_get(ref="me/titanic-baseline")returns cells numbered### Cell 0 [markdown],### Cell 1 [code], ...notebook_update(ref="me/titanic-baseline", edits=[{"op": "replace", "index": 3, "source": "model = RandomForestClassifier(n_estimators=300)"}])saves a new version and starts a run on Kaggle.notebook_wait(ref=...)waits until the run reportsCOMPLETEorERROR.notebook_output(ref=...)returns the log tail (tracebacks included) and output files. Fix the code and repeat.Optionally
competition_submit_notebook(competition="titanic", notebook_ref=..., message="rf 300").
To create a notebook from scratch:
{
"ref": "titanic-baseline",
"title": "Titanic Baseline",
"competition_sources": ["titanic"],
"cells": [
{"cell_type": "markdown", "source": "# Titanic baseline"},
{"cell_type": "code", "source": "import pandas as pd\ndf = pd.read_csv('/kaggle/input/titanic/train.csv')\nprint(df.shape)"}
]
}Notes:
The slug in
refshould match the title (Titanic Baseline→titanic-baseline). Kaggle derives URLs from titles.Notebooks run on Kaggle's infrastructure, not on your machine. Attached data appears under
/kaggle/input/...and files written to/kaggle/workingbecome outputs.Pass
run=falsefor a quick save without executing.machine_shape(e.g.NvidiaTeslaT4,TpuV5E8) orenable_gpuselects accelerators, which count against your weekly quota (accelerator_quota).As with the official CLI, outputs are stripped from pushed notebooks. Kaggle regenerates them when the notebook runs.
Configuration
All settings are environment variables. See .env.example for the full list.
Variable | Default | Purpose |
|
| The only directory the server reads or writes locally. |
|
| Hide every tool that changes Kaggle state. |
|
| Expose the delete tools. |
|
| Per-file download cap (archive extraction is capped at 4×). |
|
| Per-file upload cap. |
|
| Maximum text returned in a single tool result. |
|
| Kaggle API request timeout (seconds). |
|
|
|
|
| HTTP bind address. |
| — | Bearer token for HTTP (≥ 32 chars). Required for HTTP. |
|
| Also serve the endpoint at |
| — | Comma-separated public hostnames for Host-header validation. |
|
| Log level. Logs go to stderr. |
|
| An egress proxy injects the Kaggle credentials (Claude Code cloud network secrets). The server then sends none and needs no local token. Combine with |
CLI flags: --transport, --host, --port, --stateless (no session affinity, good for serverless or
multiple replicas), --behind-proxy (trust X-Forwarded-* from FORWARDED_ALLOW_IPS), and
--insecure-no-auth (local testing only, localhost only).
Deployment (HTTP)
Docker:
docker build -t kaggle-mcp .
docker run -d --name kaggle-mcp -p 127.0.0.1:8000:8000 \
-e KAGGLE_API_TOKEN=... \
-e KAGGLE_MCP_AUTH_TOKEN=$(openssl rand -base64 48 | tr -d '/+=') \
-e KAGGLE_MCP_ALLOWED_HOSTS=mcp.example.com \
-v kaggle-ws:/data/workspace \
kaggle-mcpThen put TLS in front of it, for example with Caddy (mcp.example.com { reverse_proxy 127.0.0.1:8000 })
or cloudflared tunnel --url http://127.0.0.1:8000. The image runs as a non-root user. Endpoints:
POST/GET/DELETE /mcp: MCP Streamable HTTP (Bearer auth)/s/<token>/mcp: the same endpoint via secret path (only if enabled)GET /healthz: unauthenticated liveness check
The server refuses to bind a non-localhost interface without KAGGLE_MCP_AUTH_TOKEN.
Development
uv venv && uv pip install -e ".[dev]"
.venv/bin/pytest -qThe tests run against a fake Kaggle API (httpx.MockTransport) and cover the security properties
(credential isolation on redirects, path traversal, zip slip, size caps, HTTP auth, brute-force
throttling, read-only and delete gating) as well as tool behaviour.
Project layout:
src/kaggle_mcp/
cli.py entry point, transport selection, HTTP hardening
server.py builds the MCPServer and registers tool groups
core.py tool registration policy (read-only/delete gating), error mapping, validators
client.py minimal async Kaggle API client (RPC calls, safe downloads/uploads)
auth.py Kaggle credential discovery (redacted repr)
http_auth.py bearer / secret-path ASGI middleware with throttling
workspace.py filesystem sandbox
notebooks.py .ipynb parsing, rendering, cell edits
tools/ notebooks, competitions, datasets, discovery (search/fetch/models), filesThe Kaggle API is RPC-style: every call is POST https://api.kaggle.com/v1/<service>/<Method> with a camelCase
JSON body, the same protocol kagglesdk uses. To add an endpoint, call app.client.call(service, method, body)
from a function decorated with @app.tool(...).
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Access Pollinations models and API capabilities through agent tools.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Verified, pay-per-use API tools for AI agents through one authenticated connection.
Enable language models to perform advanced AI-powered web scraping with enterprise-grade reliabili…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Claude AI to the Kaggle API through the Model Context Protocol, enabling competition, dataset, and kernel operations through the AI interface.36MIT
- AlicenseBqualityDmaintenanceIt interacts with the Kaggle API to provide tools for searching and downloading datasets, and a prompt for generating EDA notebooks.239MIT
- 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
- AlicenseDqualityCmaintenanceEnables AI assistants to interact with Kaggle competitions, including listing competitions, downloading files, submitting predictions, and viewing submission history.410MIT