PersonalLeetcodeMCP
LeetCode MCP 连接器 for Claude.ai
一个远程 MCP 服务器,让 Claude 访问您的 LeetCode 提交历史记录和薄弱环节分析。
提供的工具
工具 | 描述 |
| 最近的提交记录,包含状态、语言和多尝试检测 |
| 按主题逐项分析最强与最薄弱环节,并提供建议 |
| 总体通过/提交次数、连续天数及排名百分位 |
| 今日的每日挑战题目 |
Related MCP server: LeetCode MCP Server
设置
1. 安装并在本地运行
npm install
npm start
# → Listening on http://localhost:30002. 部署(Claude.ai 需要)
Claude.ai 需要一个可公开访问的 HTTPS URL。请选择一种方式:
选项 A — Railway(最简单,有免费套餐)
将此文件夹推送到 GitHub 仓库
访问 railway.app → 新建项目 → 从 GitHub 部署
Railway 会自动检测 Node.js 并为您提供一个公共 URL,例如
https://leetcode-mcp-xxx.railway.app
选项 B — Render
推送到 GitHub
render.com → 新建 Web 服务 → 连接仓库
构建命令:
npm install,启动命令:node server.js获得一个 URL,例如
https://leetcode-mcp.onrender.com
选项 C — Docker(任意 VPS/云)
docker build -t leetcode-mcp .
docker run -p 3000:3000 leetcode-mcp
# Then point a domain + SSL at port 3000选项 D — Cloudflare Workers(高级)
Cloudflare 内置了 MCP 支持。参见:https://developers.cloudflare.com/mcp/
3. 添加到 Claude.ai
部署完成后:
前往 Claude.ai → 设置 → 连接器
点击 “添加自定义连接器”
输入您的服务器 URL:
https://your-deployment-url.com/mcp点击 添加
就是这样 — Claude 现在即可访问 LeetCode 工具。
示例提示
连接后,尝试向 Claude 提问:
“分析我在 LeetCode 上的薄弱环节 — 我的用户名是 @john_doe”
“显示我最近 20 次提交,并告诉我哪些题目我 struggled 了”
“我的 LeetCode 统计信息是什么?接下来应该重点关注什么?”
“今日的每日挑战是什么?”
关于 LeetCode 的 API 的注意事项
公开数据:
get_submission_history、get_user_stats、analyze_weak_areas和get_daily_challenge均使用公开的个人资料数据 — 无需登录,只要目标资料是公开的即可。私有资料:如果用户设置了私有资料,LeetCode 将返回空数据。用户需要在 LeetCode 设置 → 隐私中将资料设为公开。
LeetCode 没有官方的公开 API。此服务器使用的是 LeetCode 自身前端所用的相同 GraphQL 端点。如果 LeetCode 更改其 API 结构,它可能会失效。
扩展此服务器
要添加更多工具,请遵循 server.js 中的模式:
server.tool("tool_name", "description", { param: z.string() }, async ({ param }) => {
// call lcQuery() and return results
return { content: [{ type: "text", text: "..." }] };
});可添加的有用查询:
按标签/难度搜索题目(使用
problemsetQuestionList查询)公司标签题目(需要 LeetCode Premium 会话 cookie)
竞赛历史(文件中已有查询作为
CONTEST_HISTORY_QUERY)
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Pace is a remote MCP server that exposes wearable and fitness data to Claude via the Model Context Protocol. It connects to Garmin, Oura, Whoop, Polar, Fitbit and 20+ devices and provides 15 tools for querying sleep, activity, recovery, and training data. Hosted on Google Cloud Run, OAuth 2.1 authentication, Streamable HTTP transport. Instructions: First you need to create an account at: https://pacetraining.co and connect your wearables. After that you can connect the remote Server via Custom Connector in Claude and OAuth 2.1 Flow startet.
A hosted LinkedIn MCP server for your own account. Paste one address into Claude, ChatGPT, Cursor or n8n to read your inbox, send messages and invitations, and search people. Free to start. Not made by LinkedIn.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Claude to search and retrieve LeetCode problems, user profiles, and statistics through natural language.-
- AlicenseAqualityCmaintenanceEnables integration with LeetCode APIs to retrieve problems, contests, solutions, and user data, support daily challenges and advanced searches, and perform authenticated actions such as running or submitting code and managing notes.9MIT
- FlicenseNot gradedqualityAmaintenanceEnables automated access to LeetCode problems, solutions, contests, and public or authenticated user data across leetcode.com and leetcode.cn, including problem search, profile and submission retrieval, code execution, and note management.-
- FlicenseNot gradedqualityAmaintenanceEnables automated access to LeetCode problems, solutions, contests, and public or authenticated user data across leetcode.com and leetcode.cn, with search, daily challenges, submissions, notes, and code execution/submission workflows.-