How to Import Claude Code Conversations into Cursor: Chats, Rules, MCP Servers and Skills
Yes, Cursor can import Claude Code conversations, but the switch is easy to miss. In Cursor 3’s Agents Window, open Settings, go to Agents › Third-Party Imports and turn on Import Claude Code Conversations (“Sync chats and continue them in Cursor”). Cursor then reads Claude Code’s local session files for the project you have open, lists them next to your Cursor chats, and lets you continue any of them as a Cursor agent. It is one-way, off by default, not in Cursor’s documentation yet, and sits behind a feature flag, so not every account sees it.
If you don’t see it, export the session to Markdown with the script below and @-mention the file in Cursor. Most of your setup carries over on its own: Cursor already reads CLAUDE.md, .claude/skills, .claude/agents, .claude/commands and Claude Code hooks. The two things you have to convert are .claude/rules/ and your MCP servers, and there’s a second script for those.
- Chat history
- Built-in import (Cursor 3)
- CLAUDE.md, skills, subagents
- Read as-is
- .claude/rules
- Convert to .mdc
- MCP servers
- Copy to .cursor/mcp.json
What carries over, at a glance
Checked against Cursor 3.30.14 and Claude Code 2.1.302 in November 2026.
| In Claude Code | What Cursor does with it | What to do |
|---|---|---|
Sessions ~/.claude/projects/<project>/*.jsonl | Built-in import in the Agents Window, off by default | Turn it on, or export to Markdown |
CLAUDE.md, CLAUDE.local.md | Read and applied to every chat | Nothing, or move to AGENTS.md |
.claude/rules/*.md | Not read | Convert to .cursor/rules/*.mdc |
.claude/skills/<name>/SKILL.md | Read | Nothing |
.claude/agents/*.md | Read | Check the fields |
.claude/commands/*.md | Read as slash commands | Optional: /migrate-to-skills |
Hooks in .claude/settings.json | Read, event names mapped | Nothing |
MCP servers in .mcp.json or ~/.claude.json | Not read | Copy to .cursor/mcp.json |
permissions.deny read rules | Cursor uses .cursorignore for this | Add the same paths to .cursorignore |
Auto memory ~/.claude/projects/<project>/memory/ | Not read | Copy what matters into a rule |
Every “Read” row depends on Include Third-Party Plugins, Skills, and Other Configs, the other switch under Agents › Third-Party Imports. Cursor turns it on by default. If your team turned it off, those files are ignored too.
Option 1: Cursor’s built-in Claude Code import
The importer has been in Cursor since at least 3.15 (August 2026) and is still there in 3.30.14, the build we checked. It only appears in the Agents Window, Cursor’s agent-first interface that shipped with Cursor 3.
- Update Cursor and open the Agents Window: Cmd+Shift+P (Ctrl+Shift+P on Windows and Linux) › Open Agents Window.
- Open Settings › Agents › Third-Party Imports and turn on Import Claude Code Conversations. If the row isn’t there, the feature flag isn’t on for your account yet; use Option 2.
- Open the same folder you ran Claude Code in. Cursor looks for sessions under
~/.claude/projects/using the folder path, so a different checkout or a subfolder won’t match. - Pick a session. Imported chats are titled from Claude Code’s generated title, or from your first prompt.
- Send a follow-up to continue. Cursor starts a Cursor agent with the Claude Code history as context.
What to expect once it’s on:
- Text carries over, tools don’t. You get the prompts, replies and the record of what Claude Code ran. Cursor adds a note telling the model that tool calls in the imported history belonged to Claude Code and aren’t available, so it only uses Cursor’s own tools.
- It keeps syncing. While the switch is on, new Claude Code sessions for that folder show up too.
- It’s one-way and local. Nothing goes back to Claude Code, and sessions on another computer don’t appear.
- MCP sign-ins and permissions don’t move. Set up MCP servers in Cursor separately (see below).
Windows note: in September 2026, users reported that the import found nothing on Windows (Cursor 3.21 and 3.22) because of how drive-letter paths were turned into folder names. Cursor staff said it was a known issue. In 3.30.14 Cursor builds the folder name the same way Claude Code does, but we only checked on macOS. If nothing shows up on Windows, use Option 2.
Where the two tools keep chats
Claude Code
Claude Code saves every session as a JSONL file:
~/.claude/projects/<project>/<session-id>.jsonl
/Users/you/dev/shop-api › ~/.claude/projects/-Users-you-dev-shop-api/<project> is the working directory with every character that isn’t a letter or digit replaced by a dash. Names longer than 200 characters are cut and get a hash added. CLAUDE_CONFIG_DIR moves the whole folder, and Claude Code deletes sessions older than 30 days unless you raise cleanupPeriodDays in ~/.claude/settings.json, so convert anything you want to keep.
Path under ~/.claude/projects/<project>/ | What it holds |
|---|---|
<session-id>.jsonl | The conversation: one JSON object per line |
<session-id>/subagents/agent-*.jsonl | Subagent transcripts, same format |
<session-id>/tool-results/ | Large tool outputs stored outside the transcript |
memory/MEMORY.md | Auto memory for the project |
We looked at the key structure (not the content) of the Claude Code 2.1.302 sessions on our own machine. Each line has a type. Only two matter for an export:
{"type": "user", "uuid": "…", "parentUuid": null, "sessionId": "…", "timestamp": "2026-11-19T09:00:01.000Z",
"cwd": "/Users/you/dev/shop-api", "gitBranch": "fix/upload-retries", "isSidechain": false,
"message": {"role": "user", "content": "Uploads to S3 fail on large files. Add retries with backoff."}}
{"type": "assistant", "uuid": "…", "parentUuid": "…", "message": {"role": "assistant", "model": "claude-opus-5-5",
"content": [{"type": "text", "text": "I'll start by reading the upload client."},
{"type": "tool_use", "id": "toolu_…", "name": "Read", "input": {"file_path": "src/upload/client.ts"}}]}}
{"type": "user", "uuid": "…", "parentUuid": "…",
"message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": "toolu_…", "content": "export async function upload…"}]}}
{"type": "custom-title", "customTitle": "Upload retries with backoff", "sessionId": "…"}userlines are your prompts, but also tool results (tool_resultblocks), slash commands and!shell lines wrapped in tags, and injected context markedisMeta.assistantlines hold Claude’stext,thinkingandtool_useblocks, often one block per line.- About 20 other types (titles, attachments, hook summaries, compaction markers, request records, file snapshots) are bookkeeping.
Anthropic’s docs say this format is internal and changes between versions. That’s why the script below reads it defensively, and why Anthropic points people to /export for a human-readable copy.
Cursor
Cursor logs agent runs as JSONL under ~/.cursor/projects/<slug>/agent-transcripts/, and keeps its chat index and settings in a SQLite file, state.vscdb (on macOS in ~/Library/Application Support/Cursor/User/globalStorage/). Our state.vscdb export guide covers the schema. On the November 2026 build we tested for our Cursor-to-Claude Code guide, conversation records carried a blobEncryptionKey, so writing Claude Code chats into state.vscdb by hand is not a realistic option: it’s undocumented, and a bad write can break Cursor’s history. Use the built-in import or a Markdown file instead.
Option 2: Export a session to Markdown
The quick way: inside a running Claude Code session, /export copies the conversation to the clipboard or saves it as a plain-text file. Pass a filename to skip the menu:
/export docs/agent-history/upload-retries.txtThe script: /export works on the session you’re in. To convert any past session without opening it, get Markdown with headings Cursor can scan, and control how much tool output comes along, save this as claude_session_to_md.py. It needs Python 3.9 or newer and nothing else.
#!/usr/bin/env python3
"""Turn a Claude Code session (.jsonl) into a readable Markdown file for Cursor.
python3 claude_session_to_md.py --list # sessions for this folder
python3 claude_session_to_md.py --latest -o docs/agent-history/last-session.md
python3 claude_session_to_md.py <session-id or file.jsonl> --tools full -o out.md
Reads ~/.claude/projects/<folder>/<session-id>.jsonl (or $CLAUDE_CONFIG_DIR) and
never changes it. Python 3.9+, standard library only, no network calls.
"""
from __future__ import annotations
import argparse
import json
import os
import re
import sys
from datetime import datetime
from pathlib import Path
CLAUDE_DIR = Path(os.environ.get("CLAUDE_CONFIG_DIR", Path.home() / ".claude")).expanduser()
UUID_RE = re.compile(r"^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$")
REMINDER_RE = re.compile(r"<system-reminder>.*?</system-reminder>", re.S)
SKIP_PREFIXES = ("<local-command-caveat>", "<local-command-stdout>", "<local-command-stderr>",
"<task-notification>", "<bash-stdout>", "<bash-stderr>")
SECRETS = [re.compile(p) for p in (
r"sk-[A-Za-z0-9_-]{20,}", r"gh[pousr]_[A-Za-z0-9]{20,}", r"github_pat_[A-Za-z0-9_]{20,}",
r"AKIA[0-9A-Z]{16}", r"xox[abpr]-[A-Za-z0-9-]{10,}",
r"eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{8,}")]
DETAIL_KEYS = ("command", "file_path", "path", "pattern", "url", "query", "description", "skill", "prompt")
def project_dir(cwd: Path) -> Path:
"""Claude Code's folder for a working directory: every non-alphanumeric character becomes '-'."""
name = re.sub(r"[^a-zA-Z0-9]", "-", str(cwd))
base = CLAUDE_DIR / "projects"
if len(name) > 200: # long paths are cut to 200 characters plus a hash
hits = sorted(base.glob(name[:200] + "-*"))
return hits[0] if hits else base / name
return base / name
def sessions_in(folder: Path) -> list[Path]:
return sorted(folder.glob("*.jsonl"), key=lambda p: p.stat().st_mtime, reverse=True)
def find_session(arg: str | None, cwd: Path, latest: bool) -> Path:
if latest:
found = sessions_in(project_dir(cwd))
if not found:
sys.exit(f"No Claude Code sessions in {project_dir(cwd)}")
return found[0]
path = Path(arg).expanduser()
if path.is_file():
return path
if UUID_RE.match(arg):
hits = sorted((CLAUDE_DIR / "projects").glob(f"*/{arg}.jsonl"))
if hits:
return hits[0]
sys.exit(f"Session not found: {arg}")
def records(path: Path):
"""Yield each JSON line once, in file order (the format is internal to Claude Code)."""
seen = set()
with path.open(encoding="utf-8", errors="replace") as fh:
for line in fh:
try:
row = json.loads(line)
except ValueError:
continue
uid = row.get("uuid")
if uid and uid in seen:
continue
seen.add(uid)
yield row
def stamp(ts) -> str:
try:
return datetime.fromisoformat(ts.replace("Z", "+00:00")).astimezone().strftime("%Y-%m-%d %H:%M")
except (AttributeError, ValueError):
return ""
def fence(text: str) -> str:
ticks = "`" * (max([len(t) for t in re.findall(r"`+", text)] + [2]) + 1)
return f"{ticks}text\n{text}\n{ticks}"
def user_text(content) -> str | None:
"""A typed prompt, a /command or a !shell line; None for tool results and internal notes."""
if isinstance(content, list):
if any(isinstance(b, dict) and b.get("type") == "tool_result" for b in content):
return None
content = "\n".join(b.get("text", "") if b.get("type") == "text" else "[image]"
for b in content if isinstance(b, dict) and b.get("type") in ("text", "image"))
text = REMINDER_RE.sub("", str(content or "")).strip()
if not text or text.startswith(SKIP_PREFIXES):
return None
cmd = re.search(r"<command-name>(.*?)</command-name>", text, re.S)
if cmd:
args = re.search(r"<command-args>(.*?)</command-args>", text, re.S)
return f"{cmd.group(1).strip()} {args.group(1).strip() if args else ''}".strip()
bash = re.search(r"<bash-input>(.*?)</bash-input>", text, re.S)
return f"! {bash.group(1).strip()}" if bash else text
def tool_note(block: dict) -> str:
inp = block.get("input") or {}
detail = next((str(inp[k]) for k in DETAIL_KEYS if inp.get(k)), "")
detail = " ".join(detail.split()).replace("`", "'")[:160]
return f"- Tool `{block.get('name', 'tool')}`" + (f": `{detail}`" if detail else "")
def result_text(block: dict, max_chars: int) -> str:
c = block.get("content")
if isinstance(c, list):
c = "\n".join(b.get("text", "") for b in c if isinstance(b, dict) and b.get("type") == "text")
text = str(c or "").strip()
if len(text) > max_chars:
text = text[:max_chars] + f"\n... [{len(text) - max_chars} more characters]"
return text
def to_markdown(path: Path, tools: str = "brief", thinking: bool = False, max_chars: int = 2000) -> tuple[str, int]:
titles, meta, body, speaker, prompts, times = {}, {}, [], None, 0, []
first_prompt = ""
for r in records(path):
kind = r.get("type")
if kind in ("custom-title", "ai-title", "summary"):
titles[kind] = r.get("customTitle") or r.get("aiTitle") or r.get("summary")
continue
if kind not in ("user", "assistant") or r.get("isSidechain") or r.get("isMeta"):
continue # skips subagent turns, injected context and bookkeeping rows
for key, field in (("session", "sessionId"), ("cwd", "cwd"), ("branch", "gitBranch")):
meta.setdefault(key, r.get(field))
if r.get("timestamp"):
times.append(r["timestamp"])
content = (r.get("message") or {}).get("content")
if kind == "user":
text = user_text(content)
if text is None:
if tools == "full" and isinstance(content, list):
body += [fence(t) for t in (result_text(b, max_chars) for b in content
if isinstance(b, dict) and b.get("type") == "tool_result") if t]
continue
label = "Summary of earlier messages (/compact)" if r.get("isCompactSummary") else "You"
when = stamp(r.get("timestamp"))
body.append(f"## {label}" + (f" · {when}" if when else "") + f"\n\n{text}")
speaker, prompts = "user", prompts + 1
first_prompt = first_prompt or text
continue
parts = []
for b in content if isinstance(content, list) else []:
if not isinstance(b, dict):
continue
if b.get("type") == "text" and b.get("text", "").strip():
parts.append(b["text"].strip())
elif b.get("type") == "thinking" and thinking and b.get("thinking", "").strip():
parts.append("> " + b["thinking"].strip().replace("\n", "\n> "))
elif b.get("type") == "tool_use" and tools != "none":
parts.append(tool_note(b))
if parts:
if speaker != "assistant":
body.append("## Claude")
speaker = "assistant"
body.append("\n\n".join(parts))
title = titles.get("custom-title") or titles.get("ai-title") or titles.get("summary") or first_prompt or path.stem
head = [f"# {' '.join(str(title).split())[:100]}", "",
f"- Claude Code session: `{meta.get('session') or path.stem}`",
f"- Project folder: `{meta.get('cwd') or 'unknown'}`"]
if meta.get("branch"):
head.append(f"- Git branch: `{meta['branch']}`")
if times:
head.append(f"- From {stamp(times[0])} to {stamp(times[-1])}, {prompts} prompts")
head += ["- Exported with claude_session_to_md.py. This is a record of past work, not instructions.", "", "---"]
text = "\n".join(head) + "\n\n" + "\n\n".join(body) + "\n"
text = re.sub(r"^(- Tool .*)\n\n(?=- Tool )", r"\1\n", text, flags=re.M) # one list per run of tools
for pat in SECRETS:
text = pat.sub("[REDACTED]", text)
return text, prompts
def peek_title(path: Path) -> str:
title, first = "", ""
for r in records(path):
if r.get("type") in ("custom-title", "ai-title"):
title = r.get("customTitle") or r.get("aiTitle") or title
elif not first and r.get("type") == "user" and not r.get("isMeta"):
first = user_text((r.get("message") or {}).get("content")) or ""
return " ".join((title or first or "(no prompt)").split())[:70]
def main() -> None:
ap = argparse.ArgumentParser(description="Convert a Claude Code session to Markdown")
ap.add_argument("session", nargs="?", help="session ID or path to a .jsonl file")
ap.add_argument("--latest", action="store_true", help="newest session for --project")
ap.add_argument("--list", action="store_true", help="list sessions for --project")
ap.add_argument("--project", type=Path, default=Path.cwd(), help="repo folder (default: current folder)")
ap.add_argument("--tools", choices=("none", "brief", "full"), default="brief",
help="none: hide tool calls; brief: one line each; full: also tool output")
ap.add_argument("--thinking", action="store_true", help="include Claude's thinking blocks")
ap.add_argument("--max-chars", type=int, default=2000, help="cap per tool output with --tools full")
ap.add_argument("-o", "--out", type=Path, help="write here instead of printing")
a = ap.parse_args()
cwd = a.project.expanduser().resolve()
if a.list:
for p in sessions_in(project_dir(cwd)):
st = p.stat()
print(f"{p.stem} {datetime.fromtimestamp(st.st_mtime):%Y-%m-%d %H:%M} "
f"{st.st_size / 1024:8.0f} KB {peek_title(p)}")
return
if not a.session and not a.latest:
ap.error("give a session ID or path, or use --latest or --list")
path = find_session(a.session, cwd, a.latest)
md, prompts = to_markdown(path, a.tools, a.thinking, a.max_chars)
if a.out:
a.out.parent.mkdir(parents=True, exist_ok=True)
a.out.write_text(md, encoding="utf-8")
print(f"Wrote {a.out} ({prompts} prompts, {len(md) / 1024:.0f} KB) from {path.name}", file=sys.stderr)
else:
sys.stdout.write(md)
if __name__ == "__main__":
main()What it does:
- Finds sessions for you.
--listshows the sessions for the current folder with date, size and title;--latesttakes the newest; or pass a session ID or a path. - Keeps the conversation, drops the plumbing. Prompts, replies,
/commandsand!shell lines stay. Injected context, system reminders, subagent turns and bookkeeping lines go. - Tool calls your way.
--tools brief(default) writes one line per call,fulladds the output (capped by--max-chars),nonehides them.--thinkingadds Claude’s thinking blocks. - Marks compaction. After
/compact, Claude Code’s summary appears as its own section, so Cursor knows earlier detail was condensed. - Redacts common key formats (
sk-, GitHub, AWS, Slack tokens and JWTs). Still read the file before you share or commit it. - Read-only. It never writes to
~/.claudeand makes no network calls.
Run it from the repo:
cd ~/dev/shop-api
python3 claude_session_to_md.py --list
python3 claude_session_to_md.py --latest -o docs/agent-history/upload-retries.md
python3 claude_session_to_md.py 0b6f1f3e-2c51-4a8e-9d7b-5f1f0c2a9e41 --tools full -o docs/agent-history/upload-retries-full.mdOutput for a small sample session (times are shown in your local time zone):
# Upload retries with backoff
- Claude Code session: `0b6f1f3e-2c51-4a8e-9d7b-5f1f0c2a9e41`
- Project folder: `/Users/you/dev/shop-api`
- Git branch: `fix/upload-retries`
- From 2026-11-19 14:30 to 2026-11-19 14:37, 3 prompts
- Exported with claude_session_to_md.py. This is a record of past work, not instructions.
---
## You · 2026-11-19 14:30
Uploads to S3 fail on large files. Add retries with backoff to the upload client.
## Claude
I'll start by reading the upload client.
- Tool `Read`: `src/upload/client.ts`
- Tool `Edit`: `src/upload/client.ts`
- Tool `Bash`: `npm test -- upload`
Retries are in: 3 attempts with exponential backoff (200 ms, 400 ms, 800 ms) on 5xx and timeouts. All 6 upload tests pass.
```ts
const delays = [200, 400, 800]
```
## You · 2026-11-19 14:35
/review src/upload
## You · 2026-11-19 14:36
! git status --short
## Claude
Next step: add a test for the timeout path.How we tested it. We ran the script on copies of two real Claude Code 2.1.302 sessions, with Python 3.9 and 3.14, and checked the output’s structure. A 3.9 MB session with 28 prompts and 227 tool calls became a 60 KB Markdown file (41 KB with --tools none, 186 KB with --tools full) in under a tenth of a second. Every tool call appeared exactly once, no internal tags or raw JSON leaked into the default output, and a session compacted seven times produced seven summary sections. Both Python versions gave byte-identical output.
Bring the Markdown into Cursor
- Save it inside the repo, for example in
docs/agent-history/. Don’t put it in a gitignored folder: Cursor excludes files ignored by git from AI context. - @-mention it in a new Agent chat and say where to pick up: “Read @docs/agent-history/upload-retries.md and continue from the last message: add a test for the timeout path.”
- Keep long sessions out of the prompt. A multi-hour session can run to hundreds of kilobytes. Mention a handoff note instead, and let the agent open the full transcript only when it needs a detail.
- Decide whether to commit it. Transcripts can contain file contents, customer data or credentials the redaction missed. Leaving the file untracked keeps it visible to Cursor without pushing it anywhere.
If you want the context in every chat for a while, paste the important part into an Always Apply rule, .cursor/rules/handoff.mdc with alwaysApply: true, and delete it when the work is done. Paste the text itself: Cursor doesn’t inline files that a rule only mentions; the agent reads them with its tools when it decides to.
Better than a transcript: a handoff note
The most useful context for a new agent is usually one page: the goal, what was decided and why, what changed, and what’s next. Ask Claude Code to write it from the session itself. --fork-session leaves the original session unchanged:
claude -p --resume 0b6f1f3e-2c51-4a8e-9d7b-5f1f0c2a9e41 --fork-session \
"Write a handoff note for another coding agent: goal, decisions and why, files changed, \
how to build and test, open problems, next steps. Markdown, under 80 lines." \
> docs/agent-history/handoff.mdThen start in Cursor with “Read @docs/agent-history/handoff.md and do the first next step.” Keep the full transcript next to it for when a detail matters.
CLAUDE.md and .claude/rules
CLAUDE.md works as it is. Cursor reads it the same way as AGENTS.md and applies it to every conversation, along with CLAUDE.local.md. Two differences matter:
@pathimports may not be expanded. Claude Code pulls an imported file into context. Cursor’s docs say a file mentioned in a rule isn’t inlined; the agent reads it only when it decides it needs it. Expect the same inCLAUDE.md, and move must-follow instructions into the file itself.- One file for both tools. If your team uses both, put the instructions in
AGENTS.mdand makeCLAUDE.mda single line,@AGENTS.md. Claude Code imports it and Cursor readsAGENTS.mdnatively. A symlink fromCLAUDE.mdtoAGENTS.mdworks too: since 3.26, Cursor sends the instructions once instead of twice.
.claude/rules/ needs converting. Cursor staff confirmed in April 2026 that it isn’t a supported rules location, and it still isn’t read in 3.30.14. Cursor rules live in .cursor/rules/ and must use the .mdc extension (a plain .md file there is ignored). The mapping:
| Claude Code rule | Cursor rule |
|---|---|
No paths: (loads every session) | alwaysApply: true (Always Apply) |
paths: list | globs: as one comma-separated line, alwaysApply: false (Apply to Specific Files) |
src/**/*.{ts,tsx} | src/**/*.ts, src/**/*.tsx, because Cursor splits globs on commas |
<!-- .claude/rules/frontend/react.md -->
---
paths:
- "src/**/*.{ts,tsx}"
- "tests/**/*.test.ts"
---
# React conventions
- Function components only.
<!-- .cursor/rules/frontend/react.mdc (generated) -->
---
globs: src/**/*.ts, src/**/*.tsx, tests/**/*.test.ts
alwaysApply: false
---
# React conventions
- Function components only.This second script converts rules and MCP servers in one go. It previews by default, never overwrites an existing Cursor rule or server, and prints a warning for anything it had to drop. Save it as claude_config_to_cursor.py:
#!/usr/bin/env python3
"""Copy a repo's Claude Code rules and MCP servers into Cursor's formats.
python3 claude_config_to_cursor.py ~/dev/my-app # preview only
python3 claude_config_to_cursor.py ~/dev/my-app --write
.claude/rules/**/*.md -> .cursor/rules/**/*.mdc (paths: list -> globs:)
.mcp.json -> .cursor/mcp.json (${VAR} -> ${env:VAR})
Existing Cursor rules and servers with the same name are left alone.
"""
from __future__ import annotations
import argparse
import json
import re
from pathlib import Path
VAR_RE = re.compile(r"\$\{([A-Za-z_][A-Za-z0-9_]*)(:-[^}]*)?\}")
KEEP = ("command", "args", "env", "url", "headers")
def expand_braces(pattern: str) -> list[str]:
"""Cursor separates globs with commas, so src/*.{ts,tsx} must become two globs."""
m = re.search(r"\{([^{}]*)\}", pattern)
if not m:
return [pattern]
return [g for alt in m.group(1).split(",")
for g in expand_braces(pattern[:m.start()] + alt + pattern[m.end():])]
def rule_to_mdc(text: str) -> tuple[str, str]:
paths, body = [], text
if text.startswith("---\n") and "\n---" in text[4:]:
end = text.index("\n---", 4)
in_paths = False
for line in text[4:end].splitlines():
if re.match(r"paths\s*:", line):
inline = line.split(":", 1)[1].strip().strip("[]")
paths += [p.strip().strip("'\"") for p in inline.split(",") if p.strip()]
in_paths = True
elif in_paths and re.match(r"\s*-\s", line):
paths.append(line.strip()[1:].strip().strip("'\""))
else:
in_paths = False
body = text[end + 4:].lstrip("\n")
globs = [g for p in paths for g in expand_braces(p)]
if globs:
return f"---\nglobs: {', '.join(globs)}\nalwaysApply: false\n---\n\n{body}", "files: " + ", ".join(globs)
return f"---\nalwaysApply: true\n---\n\n{body}", "always"
def to_cursor_server(name: str, cfg: dict, warn) -> dict | None:
kind = cfg.get("type", "stdio")
if kind not in ("stdio", "http", "streamable-http", "sse"):
warn(f"{name}: transport '{kind}' is not listed in Cursor's MCP docs, skipped")
return None
out = {k: cfg[k] for k in KEEP if k in cfg}
if kind == "stdio":
out = {"type": "stdio", **out}
dropped = sorted(set(cfg) - set(KEEP) - {"type"})
if dropped:
warn(f"{name}: dropped {', '.join(dropped)} (set these up in Cursor by hand)")
def swap(m: re.Match) -> str:
if m.group(1) == "CLAUDE_PROJECT_DIR":
return "${workspaceFolder}"
if m.group(2):
warn(f"{name}: default in ${{{m.group(1)}{m.group(2)}}} dropped; Cursor's docs show no default syntax")
return "${env:%s}" % m.group(1)
return json.loads(VAR_RE.sub(swap, json.dumps(out)))
def main() -> None:
ap = argparse.ArgumentParser(description="Convert Claude Code rules and MCP servers for Cursor")
ap.add_argument("repo", type=Path)
ap.add_argument("--write", action="store_true", help="write files (default: preview only)")
a = ap.parse_args()
repo = a.repo.expanduser().resolve()
notes: list[str] = []
warn = lambda msg: notes.append(" ! " + msg)
rules_dir = repo / ".claude/rules"
for src in sorted(rules_dir.rglob("*.md")) if rules_dir.is_dir() else []:
dest = repo / ".cursor/rules" / src.relative_to(rules_dir).with_suffix(".mdc")
mdc, kind = rule_to_mdc(src.read_text(encoding="utf-8"))
state = "exists, skipped" if dest.exists() else kind
print(f"rule {src.relative_to(repo)} -> {dest.relative_to(repo)} ({state})")
if a.write and not dest.exists():
dest.parent.mkdir(parents=True, exist_ok=True)
dest.write_text(mdc, encoding="utf-8")
src = repo / ".mcp.json"
if src.is_file():
dest = repo / ".cursor/mcp.json"
merged = json.loads(dest.read_text(encoding="utf-8")) if dest.is_file() else {}
servers = merged.setdefault("mcpServers", {})
added = 0
for name, cfg in json.loads(src.read_text(encoding="utf-8")).get("mcpServers", {}).items():
if name in servers:
print(f"mcp {name}: already in .cursor/mcp.json, skipped")
continue
conv = to_cursor_server(name, cfg, warn)
if conv is not None:
servers[name] = conv
added += 1
print(f"mcp {name} -> .cursor/mcp.json ({'remote' if 'url' in conv else 'stdio'})")
if a.write and added:
dest.parent.mkdir(parents=True, exist_ok=True)
dest.write_text(json.dumps(merged, indent=2) + "\n", encoding="utf-8")
for note in notes:
print(note)
print("Done." if a.write else "Preview only. Add --write to create the files.")
if __name__ == "__main__":
main()python3 claude_config_to_cursor.py ~/dev/shop-api # preview
python3 claude_config_to_cursor.py ~/dev/shop-api --write # create the filesPreview on a test repo with three rules and four MCP servers:
rule .claude/rules/api.md -> .cursor/rules/api.mdc (files: src/api/**/*.ts)
rule .claude/rules/frontend/react.md -> .cursor/rules/frontend/react.mdc (files: src/**/*.ts, src/**/*.tsx, tests/**/*.test.ts)
rule .claude/rules/testing.md -> .cursor/rules/testing.mdc (always)
mcp github -> .cursor/mcp.json (remote)
mcp postgres -> .cursor/mcp.json (stdio)
mcp files -> .cursor/mcp.json (stdio)
! postgres: dropped timeout (set these up in Cursor by hand)
! postgres: default in ${DATABASE_URL:-postgresql://localhost/dev} dropped; Cursor's docs show no default syntax
! live: transport 'ws' is not listed in Cursor's MCP docs, skipped
Preview only. Add --write to create the files.Rules that Cursor should pull in only when relevant (its “Apply Intelligently” type) need a description: instead of globs. Claude Code has no equivalent, so add descriptions by hand where they help. For when a rule should become a skill instead, see skills vs rules in Claude Code and Cursor.
MCP servers
Cursor reads MCP servers from .cursor/mcp.json in the project and ~/.cursor/mcp.json for every project. It doesn’t read Claude Code’s .mcp.json or ~/.claude.json. The mcpServers shape is the same; the details aren’t:
| Claude Code | Cursor | |
|---|---|---|
| Project file | .mcp.json | .cursor/mcp.json |
| Your own servers | ~/.claude.json (user and local scope) | ~/.cursor/mcp.json |
| Environment variable | ${VAR} or ${VAR:-default} | ${env:VAR} |
| Project root | ${CLAUDE_PROJECT_DIR:-.} | ${workspaceFolder} |
| Remote server | "type": "http" (or sse) is required with url | url and headers |
| Local server | command, args, env | Same, with "type": "stdio" |
| Transports | stdio, HTTP, SSE, WebSocket | stdio, SSE, Streamable HTTP |
The script above writes this .cursor/mcp.json from the test repo’s .mcp.json:
{
"mcpServers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${env:GITHUB_TOKEN}"
}
},
"postgres": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"${env:DATABASE_URL}"
]
},
"files": {
"type": "stdio",
"command": "node",
"args": [
"${workspaceFolder}/tools/mcp.js"
]
}
}
}- Servers you added with
claude mcp addlive in~/.claude.json, not the repo. Runclaude mcp listto see them and copy the ones you want into~/.cursor/mcp.json. - Sign in again. OAuth sign-ins don’t transfer; Cursor runs its own sign-in for servers that need it.
- Keep secrets in environment variables. Cursor also accepts an
envFilefor local (stdio) servers.
Skills, commands, subagents and hooks
| Claude Code | In Cursor | Watch out for |
|---|---|---|
Skills .claude/skills/<name>/SKILL.md and ~/.claude/skills/ | Loaded from those folders for compatibility; used automatically or with /skill-name | name must be lowercase letters, numbers and hyphens and match the folder |
Custom commands .claude/commands/*.md | Loaded as slash commands | Cursor’s docs now steer to skills: /migrate-to-skills turns commands into skills with disable-model-invocation: true. Cursor doesn’t document $ARGUMENTS, so write “use the text after the command” instead. |
Subagents .claude/agents/*.md and ~/.claude/agents/ | Loaded; invoked automatically, by name or with /name | Cursor’s fields are name, description, model, readonly and is_background. Claude Code’s tools, permissionMode, hooks and mcpServers aren’t among them. For a read-only reviewer, copy it to .cursor/agents/ with readonly: true; .cursor/ wins when names clash. |
Hooks in .claude/settings.json, .claude/settings.local.json, ~/.claude/settings.json | Loaded and mapped: PreToolUse › preToolUse, UserPromptSubmit › beforeSubmitPrompt, Stop › stop and so on | Notification and PermissionRequest hooks aren’t supported, and neither are matchers on Glob. Tool names are mapped too (Bash › Shell, Edit › Write), so check matchers. |
| Plugins | Imported with the same third-party setting | MCP servers that come with plugins are imported too, and the setting is all-or-nothing |
If you’re choosing which tool to standardise on rather than moving everything, our Claude Code vs Codex vs Cursor vs Copilot comparison covers adoption and which tool fits which task.
What stays behind
- Checkpoints. Claude Code’s rewind snapshots (
~/.claude/file-history/) don’t move. Commit before you switch. - Auto memory.
MEMORY.mdand its topic files aren’t read by Cursor. Copy the lines that still matter intoAGENTS.mdor a rule. - Permission settings. Cursor documents loading only the hooks from Claude Code’s settings files, so set up Cursor’s run mode and
.cursorignorerather than relying on your Claude Code allow and deny lists. - Subagent transcripts. The script skips them; the parent session already contains each subagent’s result.
Nothing here changes Claude Code, so you can keep both tools on the same repo. Going back the other way? Our free Cursor to Claude Code app and script turns Cursor agent chats into sessions you can open with claude --resume.
FAQ
Can Cursor import Claude Code conversations?
Yes, in Cursor 3. In the Agents Window, open Settings, go to Agents › Third-Party Imports and turn on Import Claude Code Conversations. Cursor then lists your local Claude Code sessions for the open folder and lets you continue them. It is off by default, not yet in Cursor’s docs, and may not appear on every account.
Where does Claude Code store conversations?
As JSONL files under ~/.claude/projects/: one folder per project, named after the working directory with every character that isn’t a letter or digit replaced by a dash, and one .jsonl file per session. Claude Code deletes sessions after 30 days unless you raise cleanupPeriodDays.
Can I add Claude Code chats to Cursor’s state.vscdb?
Don’t. state.vscdb is Cursor’s internal SQLite store, its format is undocumented, and recent builds encrypt conversation data. Use Cursor’s built-in import, or export the session to Markdown and @-mention the file.
Does Cursor read CLAUDE.md?
Yes. Cursor applies CLAUDE.md to every conversation while Include Third-Party Plugins, Skills, and Other Configs is on, which is the default. It does not read .claude/rules/, so convert those to .cursor/rules/*.mdc files.
Does Cursor use my Claude Code MCP servers?
Not from .mcp.json or ~/.claude.json. Copy them into .cursor/mcp.json or ~/.cursor/mcp.json, change ${VAR} to ${env:VAR}, and give remote servers just a url and headers.
Can I move Cursor chats back into Claude Code?
Cursor’s import is one-way. To go from Cursor to Claude Code, use stackcone’s free Cursor to Claude Code app or script, which turns Cursor agent chats into sessions you can open with claude --resume.
Sources
Checked in November 2026. The built-in importer isn’t in Cursor’s documentation; its location and behaviour come from the Cursor forum report and article below, and from our own check of Cursor 3.30.14 on macOS. Claude Code’s file layout was checked against Anthropic’s docs and the key structure of our own Claude Code 2.1.302 sessions.
- Cursor forum: “Import Claude Code Conversations” never shows any sessions on Windows (September 2026)
- Zenn: Continuing Claude Code sessions in Cursor (tested on Cursor 3.15)
- Cursor docs: Agents Window
- Cursor docs: Third-party hooks (Third-Party Imports setting, hook mapping)
- Cursor help: Rules (CLAUDE.md, AGENTS.md, .cursorrules)
- Cursor docs: Rules (.mdc files, frontmatter, globs)
- Cursor forum: .claude project rules not loaded (staff reply, April 2026)
- Cursor docs: Agent Skills
- Cursor help: Skills and /migrate-to-skills
- Cursor docs: Subagents
- Cursor forum: third-party Claude Code config loading (commands, agents, skills, hooks)
- Cursor forum: imported third-party plugins and their MCP servers
- Cursor docs: Model Context Protocol (mcp.json, interpolation, transports)
- Cursor help: Ignore files (.gitignore and .cursorignore)
- Cursor help: @ mentions and context
- Cursor release notes (3.26 CLAUDE.md and AGENTS.md deduplication)
- Claude Code docs: Manage sessions (/export, where transcripts are stored)
- Claude Code docs: Explore the .claude directory
- Claude Code docs: CLAUDE.md, AGENTS.md, .claude/rules and auto memory
- Claude Code docs: MCP (scopes, variable expansion, transports)
- Claude Code docs: Skills and custom commands
- Claude Code docs: Subagents
- Claude Code docs: CLI reference (--resume, --fork-session, -p)
