PersonalLeetcodeMCP
LeetCode MCP 连接器 for Claude.ai
一个远程 MCP 服务器,让 Claude 访问您的 LeetCode 提交历史记录和薄弱环节分析。
提供的工具
工具 | 描述 |
| 最近的提交记录,包含状态、语言和多尝试检测 |
| 按主题逐项分析最强与最薄弱环节,并提供建议 |
| 总体通过/提交次数、连续天数及排名百分位 |
| 今日的每日挑战题目 |
Related MCP server: Interactive LeetCode MCP
设置
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)
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
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.
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Related MCP Servers
- AlicenseAqualityAmaintenanceA Model Context Protocol server that provides integration with LeetCode APIs, enabling automated interaction with programming problems, contests, solutions, and user data across both leetcode.com and leetcode.cn platforms.9196 npm151MIT
- AlicenseAqualityAmaintenanceEnables interactive LeetCode practice with AI-guided authentication, problem solving, solution submission, and learning mode.24147 npm12MIT
- FlicenseNot gradedqualityDmaintenanceLets Claude read your Trello boards, lists, and cards via a remote MCP server.-
- FlicenseNot gradedqualityDmaintenanceA tutorial and working MCP server that connects to your LeetCode profile, enabling AI assistants to check solved problems and recommend new ones by topic and difficulty.1-