luogu-mcp
Provides tools for retrieving Luogu problem information within GitHub Copilot Chat in VS Code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@luogu-mcpget details for problem P1001"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
洛谷题目 MCP 服务
洛谷题目 MCP(Model Context Protocol)服务,用于抓取和结构化洛谷编程题目信息,可与 Claude Desktop、Cursor、VS Code 等 AI 工具无缝集成。
MCP 安装指南
本服务基于 Streamable HTTP 传输(JSON-RPC 2.0 over HTTP POST)运行,无需本地进程,直接配置远端 URL 即可使用。
MCP 端点地址:
https://workers-playground-steep-brook-cdfb.alphazhang689.workers.dev/mcpClaude Desktop
编辑配置文件,加入以下内容:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"luogu": {
"url": "https://workers-playground-steep-brook-cdfb.alphazhang689.workers.dev/mcp"
}
}
}保存后重启 Claude Desktop,在对话中即可直接让 Claude 查询洛谷题目。
Cursor
打开 Settings(
Ctrl+,/Cmd+,)→ 搜索 MCP点击 Add new MCP server
填写:
Name:
luoguType:
httpURL:
https://workers-playground-steep-brook-cdfb.alphazhang689.workers.dev/mcp
VS Code(GitHub Copilot Chat)
在 .vscode/mcp.json 中添加:
{
"servers": {
"luogu": {
"url": "https://workers-playground-steep-brook-cdfb.alphazhang689.workers.dev/mcp"
}
}
}其他 MCP 客户端(Cline、Continue 等)
所有支持 Streamable HTTP 或 HTTP transport 的 MCP 客户端均可直接配置上方 URL。
Related MCP server: Online Judge MCP Server
可用工具
工具名 | 说明 | 参数 |
| 获取洛谷题目完整信息(题面、格式、样例、难度、标签) |
|
支持的题目编号格式:P(普通)、B(入门)、CF(Codeforces)、AT(AtCoder)、SP(SPOJ)、UVA 等。
REST API
除 MCP 外,还提供 REST API 接口:
方法 | 路径 | 说明 |
|
| 通过题号获取题目,如 |
|
| 通过完整 URL 获取题目 |
返回数据格式
{
"id": "P1001",
"url": "https://www.luogu.com.cn/problem/P1001",
"title": "A+B Problem",
"difficultyNum": 1,
"difficulty": "入门",
"tags": ["模拟", "数学"],
"description": "输入两个整数 a, b,输出它们的和",
"inputFormat": "两个用空格分开的整数",
"outputFormat": "一个整数",
"samples": [
{ "input": "1 2", "output": "3" }
],
"limit": "时间限制:1.0s 内存限制:128MB"
}MCP 协议参考
本服务遵循 MCP 规范 2025-11-25,使用 JSON-RPC 2.0 格式:
// 初始化
{ "jsonrpc": "2.0", "id": 1, "method": "initialize",
"params": { "protocolVersion": "2025-11-25", "capabilities": {} } }
// 列出工具
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }
// 调用工具
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call",
"params": { "name": "get_problem", "arguments": { "problem_id": "P1001" } } }本地开发 & 部署
# 安装依赖
npm install
# 本地开发(访问 http://localhost:8787)
npm run dev
# 运行测试
npm test
# 部署到 Cloudflare Workers
npm run deploy许可证
本项目基于 MIT 许可证开源。
This server cannot be deployed
Maintenance
Related MCP Connectors
FineData web scraping MCP — JavaScript rendering, captcha solving, markdown for AI agents
Zenrows MCP server — Fetch, Extract, Batch, and Browser Sessions for AI coding assistants
Web Content Extract Mcp connects AI agents to real public APIs via MCP. Tools include
Web search, page reading and structured extraction for AI agents, with strong RU coverage
Related MCP Servers
- FlicenseBqualityDmaintenanceEnhances large language models with competitive programming knowledge by leveraging OI-Wiki content through vector search, allowing models to retrieve relevant algorithms and techniques.124-
- AlicenseAqualityDmaintenanceProvides tools for AI agents to interact with the Orange Juice Online Judge API by managing problems and code submissions. Users can list problems, retrieve detailed descriptions, submit source code, and track submission status through natural language.51MIT
- AlicenseAqualityBmaintenanceA read-only MCP server for discovering and fetching Luogu problems, training sets, and user profiles.114 npm2MIT
- AlicenseNot gradedqualityAmaintenanceEnables interaction with public NowCoder ACM problem pages. Supports fetching problem data and checking health status.MIT