MCP Directory

How to add LeetCode MCP Server to Windsurf

Integrate LeetCode problems, solutions, contests, and user data into MCP clients, supporting leetcode.com and leetcode.cn. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.

Last updated June 14, 2026 · 118 · stdio · apikey

Windsurf 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

  1. 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
  2. 2Paste the LeetCode MCP Server config below.
  3. 3Fill in placeholder secrets, then save.
  4. 4Click Refresh in the MCP panel.
  5. 5LeetCode MCP Server's tools become available to Cascade.

Before you start

  • Node.js (v20.x or above)
  • (Optional) LeetCode session cookie for authenticated API access

What LeetCode MCP Server can do in Windsurf

get_daily_challenge

Retrieves today's LeetCode Daily Challenge problem with complete details. No parameters required.

get_problem

Retrieves details for a specific LeetCode problem by its titleSlug (URL identifier).

search_problems

Searches for LeetCode problems with multiple filter criteria: category, tags, difficulty (EASY/MEDIUM/HARD), searchKeywords, limit, and offset.

get_user_profile

Retrieves profile information for a LeetCode user by username.

get_user_contest_ranking

Obtains contest ranking statistics for a user by username, with an optional 'attended' filter.

get_recent_ac_submissions

Retrieves a user's recent accepted submissions by username, with an optional limit.

get_recent_submissions

Retrieves a user's recent submissions history (Global only) by username, with an optional limit.

get_user_status

Retrieves 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 + Windsurf FAQ

Where is the Windsurf config file?

Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_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 Windsurf?

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.

View repo Full LeetCode MCP Server page