chatgpt-context-mcp
Imports private ChatGPT conversation context, fetching remote conversations via the ChatGPT web backend API and caching them locally for use in MCP clients.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@chatgpt-context-mcpimport conversation https://chatgpt.com/c/abc123"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ChatGPT Context MCP
A local stdio MCP server for importing private ChatGPT conversation context into Codex, Claude Code, and other MCP clients.
Disclaimer
This is an unofficial project. It is not maintained, endorsed, or supported by OpenAI.
This tool uses private, non-public ChatGPT web backend APIs. The behavior was inferred from web traffic and may change, break, or return incomplete data at any time. This project is provided only for technical research, personal context migration, and local MCP experimentation.
No guarantees are made about correctness, reliability, stability, completeness, legality, compliance, or fitness for any purpose. You are responsible for your own use, including token handling, data privacy, local laws, organization policy, and relevant service terms. Bearer tokens are sensitive temporary credentials and should be handled like passwords. Use at your own risk.
Related MCP server: ChatCrystal
Features
Imports private ChatGPT conversation URLs into MCP clients.
Refreshes remote conversation content by default before returning context.
Caches JSON, Markdown, messages, and metadata locally.
Supports cache-only reads for previously imported conversations.
Provides MCP tools and cache-backed resources.
Documents setup for Codex and Claude Code.
Supported Scope
Supported:
https://chatgpt.com/c/{conversation_id}
https://chat.openai.com/c/{conversation_id}Not supported:
Shared links such as
https://chatgpt.com/share/{share_id}ChatGPT Projects
Bulk history export
Attachment, image, or Canvas downloads
Browser automation or cookie extraction
How It Works
import_chatgpt_url parses a private ChatGPT conversation URL, fetches the full remote conversation through ChatGPT's web backend API, compares a stable content hash with local metadata, updates the cache when content changed, and returns bounded Markdown/messages/JSON to the MCP client.
get_chatgpt_context reads local cache only. It does not check the remote conversation.
Install From Source
Requirements:
Node.js 20+
npm
git clone https://github.com/OWNER/chatgpt-context-mcp.git
cd chatgpt-context-mcp
npm install
npm run buildRun checks:
npm run checkToken Setup
Get a fresh ChatGPT web bearer token from your browser DevTools. Do not paste tokens into agent chat or commit them to config files.
You can provide credentials through the current process environment:
export CHATGPT_BEARER_TOKEN="<chatgpt-bearer-token>"
export CHATGPT_ACCOUNT_ID=""For desktop apps, use the wrapper script with a private fallback env file:
mkdir -p "$HOME/.config/chatgpt-context-mcp"
chmod 700 "$HOME/.config/chatgpt-context-mcp"
cat > "$HOME/.config/chatgpt-context-mcp/env" <<'EOF'
export CHATGPT_BEARER_TOKEN="<chatgpt-bearer-token>"
export CHATGPT_ACCOUNT_ID=""
EOF
chmod 600 "$HOME/.config/chatgpt-context-mcp/env"The wrapper uses this precedence:
Existing process environment variables.
Values from
$HOME/.config/chatgpt-context-mcp/env.
Set CHATGPT_CODEX_MCP_ENV_FILE to point at a different env file.
Codex Configuration
Built mode:
[mcp_servers.chatgpt_context]
command = "<repo-path>/scripts/start-mcp.sh"
args = []
env_vars = ["CHATGPT_BEARER_TOKEN", "CHATGPT_ACCOUNT_ID", "CHATGPT_CODEX_MCP_CACHE_DIR", "CHATGPT_CODEX_MCP_ENV_FILE"]
startup_timeout_sec = 10
tool_timeout_sec = 120
default_tools_approval_mode = "auto"Development mode:
[mcp_servers.chatgpt_context]
command = "npm"
args = ["run", "start:mcp", "--prefix", "<repo-path>"]
env_vars = ["CHATGPT_BEARER_TOKEN", "CHATGPT_ACCOUNT_ID", "CHATGPT_CODEX_MCP_CACHE_DIR"]
startup_timeout_sec = 10
tool_timeout_sec = 120
default_tools_approval_mode = "auto"Restart Codex or open a new session after changing MCP configuration.
Claude Code Configuration
Configure this as a stdio MCP server:
{
"mcpServers": {
"chatgpt_context": {
"command": "<repo-path>/scripts/start-mcp.sh",
"args": [],
"env": {
"CHATGPT_CODEX_MCP_ENV_FILE": "$HOME/.config/chatgpt-context-mcp/env"
}
}
}
}Client-specific UI and config locations may vary. The server itself is a standard stdio MCP server.
MCP Tools
import_chatgpt_url: Fetches a private ChatGPT conversation URL from the remote API by default, updates cache when content changed, and returns bounded context.get_chatgpt_context: Reads a cached conversation. Does not access the network.list_chatgpt_imports: Lists locally cached imports.verify_chatgpt_auth: Checks token presence, expiration, account id detection, and lightweight API access.
MCP Resources
Cache-backed resources:
chatgpt://conversation/{conversation_id}/metadata
chatgpt://conversation/{conversation_id}/markdown
chatgpt://conversation/{conversation_id}/messages
chatgpt://conversation/{conversation_id}/jsonResource reads are cache-only and do not refresh remote content.
Cache and Privacy
Imported conversations are cached as plaintext under:
$HOME/.cache/chatgpt-context-mcp/Override the cache location:
export CHATGPT_CODEX_MCP_CACHE_DIR="/path/to/cache"Cache files may contain private prompts, assistant replies, code, and other sensitive content. The server does not write bearer tokens to disk.
Troubleshooting
If verify_chatgpt_auth fails:
Confirm
CHATGPT_BEARER_TOKENis available to the MCP server.Refresh the bearer token if it expired.
For Team or Enterprise accounts, set
CHATGPT_ACCOUNT_IDif auto-detection fails.Restart the MCP client after changing config or environment variables.
If import_chatgpt_url returns UNSUPPORTED_URL, use a private /c/{conversation_id} URL rather than a /share/{share_id} URL.
If remote access fails but cache exists, the error includes cache_available: true. Use get_chatgpt_context only when stale cached context is acceptable.
Development
npm install
npm test
npm run typecheck
npm run build
npm run checkRun the server locally:
npm run start:mcpLicense
MIT
Available Tools
4 toolsget_chatgpt_contextGet Cached ChatGPT ContextA
Read an already imported ChatGPT conversation from local cache. This does not check the remote conversation.
| Name | Required | Description | Default |
|---|---|---|---|
| conversation_id | Yes | ||
| format | No | ||
| max_chars | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description indicates a read-only operation from local cache with no side effects, which is adequate. But it does not disclose behavior on missing conversation IDs, error conditions, or any potential hazards, leaving some uncertainty.
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 extremely concise, consisting of two short sentences that convey the core purpose and a key constraint, with no redundant information.
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 absence of an output schema and the presence of three parameters, the description is too brief. It fails to describe return values, the effect of the format parameter, or how max_chars interacts with the output, leaving significant gaps.
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?
With 0% schema description coverage, the description adds no information about the three parameters (conversation_id, format, max_chars). The agent must infer their meaning only from the schema's property names and types, which is insufficient.
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 verb 'Read' and the resource 'an already imported ChatGPT conversation from local cache', distinguishing it from siblings that may involve remote operations.
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?
The description specifies that the tool reads from local cache and does not check remote, implying it should be used when the conversation is already imported. However, it does not explicitly state when not to use it or name alternative tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
import_chatgpt_urlImport ChatGPT URLC
Refresh and import a private ChatGPT /c/{conversation_id} URL into local cache and return bounded context.
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| format | No | ||
| max_chars | No | ||
| cache_policy | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description should fully disclose behavior. It mentions 'refresh and import' but does not clarify if it overwrites existing cache, whether it requires prior authentication, or what 'bounded context' entails. Critical side effects are omitted.
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 sentence, which is concise, but at the expense of necessary details. It front-loads the core action but omits supporting information.
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 four parameters, no output schema, and no annotations, the description is grossly inadequate. It fails to explain the return format, parameter semantics, usage context, or behavioral traits, leaving the agent with insufficient information.
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 has 0% description coverage; the description only partially explains the 'url' parameter by noting the format. It does not explain 'format', 'max_chars', or 'cache_policy' enums, leaving the agent to guess their meanings.
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 (refresh and import), the resource (private ChatGPT /c/{conversation_id} URL), and the outcome (into local cache, return bounded context). It distinguishes from siblings like list_chatgpt_imports and verify_chatgpt_auth.
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 on when to use this tool versus alternatives like get_chatgpt_context or what prerequisites are needed (e.g., authentication verified by sibling). The description does not describe when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_chatgpt_importsList ChatGPT ImportsA
List locally cached ChatGPT conversation imports, optionally filtered by a simple text query.
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| limit | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the burden. It notes the data is 'locally cached' and filtering is 'simple text query', but does not disclose behavior on empty cache, pagination, or non-destructive nature in enough detail.
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?
A single sentence that is direct and free of superfluous content. Every word earns its place.
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?
For a simple list tool with two parameters and no output schema, the description covers the core functionality (what is listed, optional filter, local cache). Minor gaps like limit behavior or return format do not significantly impair understanding.
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?
With 0% schema coverage, the description compensates partially by explaining the 'query' parameter as optional text filter, but omits the 'limit' parameter entirely, leaving its meaning unaddressed.
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 verb 'List' and the resource 'locally cached ChatGPT conversation imports', and distinguishes from siblings which deal with context, URL imports, and auth.
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?
The description implies usage when listing imports, but provides no explicit context for when to use this tool vs siblings like 'get_chatgpt_context' or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
verify_chatgpt_authVerify ChatGPT AuthA
Check whether CHATGPT_BEARER_TOKEN is present, unexpired, and accepted by the ChatGPT backend.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of disclosing behavioral traits. It states the verification action but does not indicate whether the tool is read-only, what side effects exist (if any), or what happens on failure (e.g., error vs. false). The description provides minimal behavioral context.
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, front-loaded sentence that efficiently conveys the tool's function without extraneous words. Every word is necessary and contributes to clarity.
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 simplicity (no parameters, no output schema, no annotations), the description is somewhat complete but lacks specification of the return value or result format. An agent would need to infer whether the tool returns a boolean, throws an error, or provides details. A slightly more complete description (e.g., 'Returns true if valid, false otherwise') would improve usability.
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 tool has zero parameters and the schema coverage is 100% (trivially). Baseline for 0 parameters is 4. The description adds no parameter-specific information, which is acceptable since there are none. It correctly describes the purpose without needing to elaborate on parameters.
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 tool's action: checking whether CHATGPT_BEARER_TOKEN is present, unexpired, and accepted by the backend. It uses a specific verb ('verify') and resource ('ChatGPT auth'), and distinguishes itself from sibling tools (get_chatgpt_context, import_chatgpt_url, list_chatgpt_imports) which have different purposes.
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?
The description provides no guidance on when to use this tool versus alternatives, nor does it specify prerequisites or when not to use it. It only states what the tool does, leaving the agent to infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
get_chatgpt_context - First observed
import_chatgpt_url - First observed
list_chatgpt_imports - First observed
verify_chatgpt_auth
TDQS
Scored across 4 tools
Each tool serves a distinct function: fetching cached context, importing/refreshing from URL, listing imports, and verifying authentication. No overlap in purpose.
All tools follow a consistent verb_noun pattern with snake_case and a 'chatgpt_' prefix, making the API predictable and easy to understand.
Four tools cover the core operations for managing ChatGPT context (auth, import, retrieve, list) without being excessive or insufficient for the domain.
The set covers the main workflows (auth, import, read cached, list), but lacks a delete or remote fetch tool, which could be minor gaps in advanced usage.
Maintenance
Related MCP Connectors
Share one project context across ChatGPT, Claude, Telegram and any MCP client.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Convert files, URLs, and documents to clean, AI-ready Markdown via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSyncs AI conversations from multiple platforms to local Markdown files for your second brain, and provides browser automation tools via MCP for agentic workflows.AGPL 3.0
- AlicenseAqualityAmaintenanceLocal-first AI PKM memory server for coding conversations. Imports Claude Code, Cursor, Codex CLI, Trae, and GitHub Copilot chats into notes, semantic search, tag graphs, Markdown exports, and MCP memory tools.7121 npm58Apache 2.0
- AlicenseNot gradedqualityBmaintenanceCapture, index, and search your Claude Code conversation history. Provides an MCP server for Claude Code to query its own past conversations.6 npm1MIT
- AlicenseNot gradedqualityBmaintenanceRemote MCP coding bridge that gives ChatGPT/Codex secure local workspace access, including file retrieval, semantic code intelligence, Git, diagnostics, and guarded shell execution.18 npmMIT