Lc MCP Server
leetcode mcp server written in golang
Installation
npx lc-mcp-serverAsk AI about Lc MCP Server
Powered by Claude · Grounded in docs
I know everything about Lc MCP Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
lc-mcp-server
leetcode mcp server written in golang.
LeetCode Cookie Authentication
This utility provides a robust way to extract your LeetCode authentication cookies (LEETCODE_SESSION and csrftoken) for use with scripts, bots, or custom clients. It launches a browser, helps you log in manually, and outputs environment variables you can export and use.
Features
- Cloudflare-aware: Handles Cloudflare challenges and waits for human verification.
- Anti-bot evasion: Configures the browser to look less like a bot.
- Manual login: You log in using the real browser, ensuring security and compatibility.
- Environment variable export: Outputs
export LEETCODE_SESSION="..."andexport CSRF_TOKEN="...". - Credential caching: Saves credentials for reuse until they expire.
- Debug output: Shows extracted cookies for troubleshooting.
Usage
-
Install dependencies:
go get -u github.com/chromedp/chromedp -
Run the authentication script:
go run auth.goThis will launch a Chrome window. Complete any Cloudflare or LeetCode login steps manually.
When you reach the main LeetCode page, press Enter in the terminal. -
Export environment variables:
You can either pipe and automatically export with:
eval $(go run auth.go)Or save to a file and source it:
go run auth.go > .leetcode.env source .leetcode.env -
Use in your client/server:
Your environment will now contain:
LEETCODE_SESSIONCSRF_TOKEN
Example in Go:
session := os.Getenv("LEETCODE_SESSION") csrf := os.Getenv("CSRF_TOKEN")
Troubleshooting
- Cloudflare not passing: Try waiting longer or ensure you interact with the page (mouse, scroll).
- Missing cookies: Make sure you have logged in and reached a non-login page.
- 2FA or Captcha: Complete all verification steps before pressing Enter.
- Windows users: Ensure
chromedpcan launch Chrome (you may need to install Chrome).
Security
Your session and csrf tokens are sensitive. Do not share or commit them.
Session cookies expire and may require re-authentication.
