# LeetCode MCP server

> Lets an AI client browse LeetCode problems, solutions, contests and user data, and run or submit code with a session cookie.

- Repository: https://github.com/jinzcdev/leetcode-mcp-server
- Page: https://hostedmcp.org/servers/jinzcdev/leetcode-mcp-server
- Transport: —
- Stars: 158
- License: MIT

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `LEETCODE_SESSION` | no | no |  |
| `LEETCODE_SITE` | no | no |  |

## Tools (26)

- `get_daily_challenge`
- `get_problem`
- `search_problems`
- `get_user_profile`
- `get_user_contest_ranking`
- `get_recent_submissions`
- `get_recent_ac_submissions`
- `get_user_status`
- `get_problem_submission_report`
- `get_problem_progress`
- `get_all_submissions`
- `run_code`
- `submit_solution`
- `search_notes`
- `get_note`
- `create_note`
- `update_note`
- `list_problem_lists`
- `get_problem_list`
- `create_problem_list`
- `update_problem_list`
- `add_problems_to_list`
- `remove_problems_from_list`
- `reorder_problem_list`
- `list_problem_solutions`
- `get_problem_solution`

## FAQ

### Does the LeetCode MCP server require authentication?

No, most problem and public user tools work without auth; a LeetCode session cookie is only needed for private data like notes, problem lists, progress, and code submission.

### Which LeetCode sites does the server support?

It supports both the global leetcode.com site and the Chinese leetcode.cn site, selected via the --site option.

### How do I run the LeetCode MCP server with my session cookie?

Pass the cookie with the --session flag or set the LEETCODE_SESSION environment variable when starting the server.

### Can the server run or submit code solutions?

Yes, with authentication it can run code and submit solutions for problems, polling until the result is ready.

### Can I search LeetCode problems by tag or difficulty?

Yes, the search_problems tool filters problems by tags, difficulty levels, categories, and keywords.
