
How to add LeetCode MCP Server to Claude Desktop
Integrate LeetCode problems, solutions, contests, and user data into MCP clients, supporting leetcode.com and leetcode.cn. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.
Last updated June 14, 2026 ยท 118โ ยท stdio ยท apikey
Claude Desktop config for LeetCode MCP Server
npm install @jinzcdev/leetcode-mcp-server -g{
"mcpServers": {
"leetcode-mcp-server": {
"command": "npx",
"args": [
"-y",
"@jinzcdev/leetcode-mcp-server"
],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": "<YOUR_LEETCODE_SESSION_COOKIE>"
}
}
}
}Setup steps
- 1Open Claude Desktop โ Settings โ Developer โ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
- 2Paste the LeetCode MCP Server config below under the top-level "mcpServers" key.
- 3Fill in any placeholder secrets (API keys, paths) in the snippet.
- 4Save the file, then fully quit and reopen Claude Desktop.
- 5Open a chat and confirm LeetCode MCP Server's tools appear under the ๐ tools menu.
Before you start
- Node.js (v20.x or above)
- (Optional) LeetCode session cookie for authenticated API access
What LeetCode MCP Server can do in Claude Desktop
get_daily_challengeRetrieves today's LeetCode Daily Challenge problem with complete details. No parameters required.
get_problemRetrieves details for a specific LeetCode problem by its titleSlug (URL identifier).
search_problemsSearches for LeetCode problems with multiple filter criteria: category, tags, difficulty (EASY/MEDIUM/HARD), searchKeywords, limit, and offset.
get_user_profileRetrieves profile information for a LeetCode user by username.
get_user_contest_rankingObtains contest ranking statistics for a user by username, with an optional 'attended' filter.
get_recent_ac_submissionsRetrieves a user's recent accepted submissions by username, with an optional limit.
get_recent_submissionsRetrieves a user's recent submissions history (Global only) by username, with an optional limit.
get_user_statusRetrieves the current authenticated user's status. Requires authentication. No parameters required.
Security
Authenticated (private) data access requires a LeetCode session cookie. Log in to LeetCode (Global or China), extract the LEETCODE_SESSION cookie from browser developer tools, and pass it via the --session flag or the LEETCODE_SESSION environment variable. Without it, only public data is accessible. Treat the session cookie as a secret credential.
LeetCode MCP Server + Claude Desktop FAQ
Where is the Claude Desktop config file?
Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the LeetCode MCP Server config there under the "mcpServers" key and restart the client.
Is LeetCode MCP Server safe to use with Claude Desktop?
Authenticated (private) data access requires a LeetCode session cookie. Log in to LeetCode (Global or China), extract the LEETCODE_SESSION cookie from browser developer tools, and pass it via the --session flag or the LEETCODE_SESSION environment variable. Without it, only public data is accessible. Treat the session cookie as a secret credential.
Do I need a LeetCode account to use this server?
No. Public tools such as daily challenge, problem details, search, community solutions, user profiles, and contest rankings work without authentication. Only user-specific/private features (status, submission reports, progress, notes, running/submitting code) require a LeetCode session cookie.
How do I enable authenticated access?
Log in to LeetCode (Global or China site), extract the LEETCODE_SESSION cookie from your browser's developer tools, and configure the server with the --session flag or the LEETCODE_SESSION environment variable.
Does it support both the global and Chinese LeetCode sites?
Yes. Set the site via the LEETCODE_SITE environment variable ('global' or 'cn', default 'global') or the --site command-line argument. Some tools (e.g. notes) are CN-only and some (e.g. get_recent_submissions) are Global-only.