Skip to main content
Glama

MCP 服务器 LeetCode

npm 版本 GitHub 许可证 版本

LeetCode 的模型上下文协议 (MCP) 服务器,使 AI 助手能够访问 LeetCode 问题、用户信息和竞赛数据。

特征

  • 🚀 快速访问 LeetCode API

  • 🔍 搜索问题、检索每日挑战并查看用户资料

  • 🏆 查询比赛数据和排名

  • 🧩 全面支持 MCP 工具和资源

  • 📦提供 CLI 和可编程 API

Related MCP server: LeetCode MCP Server

安装

全局安装

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 { LeetCodeService } from '@mcpfun/mcp-server-leetcode'; // Initialize the service const leetcodeService = new LeetCodeService(); // Get daily challenge const dailyChallenge = await leetcodeService.getDailyChallenge(); // Search problems const problems = await leetcodeService.searchProblems({ difficulty: 'MEDIUM', tags: 'array+dynamic-programming' });

可用工具

问题相关工具

工具名称

描述

参数

get-daily-challenge

接受每日挑战

没有任何

get-problem

获取特定问题的详细信息

titleSlug

(字符串)

search-problems

根据标准搜索问题

tags

(可选)、

difficulty

(可选)、

limit

(默认 20)、

skip

(默认 0)

用户相关工具

工具名称

描述

参数

get-user-profile

获取用户信息

username

(字符串)

get-user-submissions

获取用户提交历史记录

username

(字符串),

limit

(可选,默认 20)

get-user-contest-ranking

获取用户竞赛排名

username

(字符串)

比赛相关工具

工具名称

描述

参数

get-contest-details

获取比赛详情

contestSlug

(字符串)

可用资源

问题资源

  • leetcode://daily-challenge :每日挑战

  • leetcode://problem/{titleSlug} :问题详情

  • leetcode://problems{?tags,difficulty,limit,skip} :问题列表

用户资源

  • leetcode://user/{username}/profile :用户个人资料

  • leetcode://user/{username}/submissions{?limit} :用户提交

  • leetcode://user/{username}/contest-ranking :用户竞赛排名

本地开发

克隆存储库并安装依赖项:

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

以开发模式运行:

npm run dev

构建项目:

npm run build

执照

麻省理工学院

相关项目

致谢

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/doggybee/mcp-server-leetcode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server