Doggybee_mcp Server Leetcode

Doggybee_mcp Server Leetcode

🚀 LeetCode MCP 服务器

一个专为 LeetCode 设计的模型上下文协议 (MCP) 服务器,它能让 AI 助手轻松访问 LeetCode 的问题、用户信息以及比赛数据,为开发者和使用者带来极大便利。

npm 版本 GitHub 许可证 版本 smithery 徽章

✨ 主要特性

  • 🚀 能够快速访问 LeetCode API,提升数据获取效率。
  • 🔍 支持搜索问题、获取每日挑战以及查看用户资料等功能。
  • 🏆 可查询比赛数据和排名,满足竞赛相关需求。
  • 🧩 完全支持 MCP 工具和资源,具有良好的兼容性。
  • 📦 提供 CLI 和可编程 API,方便不同场景下的使用。

📦 安装指南

通过 Smithery 安装

若要为 Claude Desktop 自动安装 mcp-server-leetcode,可访问 Smithery,并执行以下命令:

npx -y @smithery/cli install @doggybee/mcp-server-leetcode --client claude

全局安装

npm install -g @mcpfun/mcp-server-leetcode

安装完成后,可直接从命令行运行:

mcp-server-leetcode

本地安装

npm install @mcpfun/mcp-server-leetcode

💻 使用示例

集成到 Claude for Desktop

在你的 Claude for Desktop claude_desktop_config.json 文件中添加以下内容:

{
"mcpServers": {
"leetcode": {
"command": "mcp-server-leetcode"
}
}
}

对于本地开发:

{
"mcpServers": {
"leetcode": {
"command": "node",
"args": ["/path/to/dist/index.js"]
}
}
}

作为库使用

import { MCPLeetCodeServer } from '@mcpfun/mcp-server-leetcode';

// 初始化服务器
const server = new MCPLeetCodeServer();

// 启动服务器
server.start().then(() => {
console.log('服务器已启动');
});

📚 详细文档

可用工具

以下是可以使用的工具及其参数:

工具名称 描述 参数
mcp-server-leetcode LeetCode 的 MCP 服务器 -p, --port

资源

以下资源可以被访问:

问题相关的资源

资源路径 描述 查询参数
/problems 获取所有问题列表 page (页码), per_page (每页数量)
/problem/{id} 获取特定问题 include_solutions (是否包含解答)

用户相关的资源

资源路径 描述 查询参数
/users 获取所有用户列表 page, per_page
/user/{id} 获取特定用户 include_activities (是否包含活动)

比赛相关的资源

资源路径 描述 查询参数
/contests 获取所有比赛列表 page, per_page
/contest/{id} 获取特定比赛 include_problems (是否包含问题)

本地开发

克隆仓库

git clone https://github.com/doggybee/mcp-server-leetcode.git
cd mcp-server-leetcode

安装依赖

npm install

启动服务器

npm start

📄 许可证

项目使用 MIT 许可证,具体内容请查看 LICENSE 文件。

🌟 相关项目

🙏 致谢

这个项目受到了 alfa-leetcode-api 的启发。

  • 0 关注
  • 0 收藏,32 浏览
  • system 提出于 2025-10-02 19:24

相似服务问题

相关AI产品