luogu-mcp-server
A read-only MCP server for discovering and fetching Luogu problems, training sets, and user profiles.
README
luogu-mcp-server
A small stdio MCP server for Luogu problem discovery. It exposes a LeetCode-MCP-style Luogu route for problem search, problem fetch, URL/id resolution, related practice discovery, training set search, training set fetch, public user profiles, and explicit capability reporting.
Why
This server is designed for AI tutoring and practice agents. The model can find a problem by topic, fetch the exact statement and samples, or ask for a bounded recommendation from a known topic or student pain point.
Tools
| Tool | Purpose |
|---|---|
luogu_search_problems |
Search Luogu problems by keyword, topic, title fragment, problem id, and optional Luogu tag ids. |
luogu_fetch_problem |
Fetch one Luogu problem statement, formats, samples, tags, difficulty, and URL by pid. |
luogu_resolve_problem |
Resolve a Luogu URL, problem id, or title fragment, then fetch the problem. |
luogu_find_related_problems |
Mix topic/pain-point recommendations with live keyword search to find related practice. |
luogu_list_algorithm_topics |
List canonical algorithm topics, aliases, and known tag ids. |
luogu_find_topic_problems |
Find topic practice problems using aliases, tag ids, deduplication, and match reasons. |
luogu_search_problem_sets |
Search Luogu training/problem sets by keyword. |
luogu_fetch_problem_set |
Fetch one Luogu training/problem set and problem summaries by id. |
luogu_recommend_problems |
Return seed recommendations from a topic or student pain point. |
luogu_get_user_profile |
Fetch public Luogu user profile data by uid. |
luogu_get_capabilities |
Report which LeetCode-style route features are available, auth-required, or planned. |
All tools are read-only.
Install From Source
git clone https://github.com/kaiserunix/luogu-mcp-server.git
cd luogu-mcp-server
cmd /c npm install
cmd /c npm run build
Use From npm
The package is published on npm as luogu-mcp-server.
npx -y luogu-mcp-server
For stdio MCP clients, use:
{
"mcpServers": {
"luogu": {
"command": "npx",
"args": ["-y", "luogu-mcp-server"]
}
}
}
MCP Client Config From Source
Use node directly as the stdio command:
{
"mcpServers": {
"luogu": {
"command": "node",
"args": [
"C:\\Users\\qwerf\\Desktop\\luogu-mcp-server\\dist\\index.js"
],
"cwd": "C:\\Users\\qwerf\\Desktop\\luogu-mcp-server"
}
}
}
Hosted Cloudflare Worker
A public read-only Streamable HTTP deployment is available at:
- Health:
https://luogu-mcp-server.lantangtang54.workers.dev/health - MCP endpoint:
https://luogu-mcp-server.lantangtang54.workers.dev/mcp
For Streamable HTTP MCP clients, use:
{
"mcpServers": {
"luogu": {
"url": "https://luogu-mcp-server.lantangtang54.workers.dev/mcp"
}
}
}
Example Calls
Search problems:
{
"keyword": "二叉树",
"page": 1,
"limit": 5
}
Search problems with a Luogu tag filter:
{
"keyword": "二叉树",
"tagIds": [11],
"limit": 5
}
Fetch a problem:
{
"pid": "P1305",
"maxStatementChars": 5000
}
Recommend from a pain point:
{
"topic": "binary_tree",
"painPoint": "traversal_order_confusion",
"limit": 3
}
Resolve a pasted URL:
{
"query": "https://www.luogu.com.cn/problem/P1305",
"maxStatementChars": 5000
}
Find related practice:
{
"topic": "binary_tree",
"painPoint": "traversal_order_confusion",
"query": "二叉树 遍历",
"limit": 5
}
Find topic practice with alias expansion:
{
"topic": "Treap",
"limit": 5,
"excludeProblemIds": ["P3369"]
}
Fetch a public user profile:
{
"uid": 1
}
Luogu Route Parity
This project mirrors the useful shape of richer LeetCode MCP servers while respecting what Luogu exposes publicly:
- Available now: problem search, problem fetch, URL/id/title resolution, related problem discovery, training set search/fetch, public user profile fetch.
- Auth-required in live probes: recent submissions, public solution pages, and discussion pages.
- Planned but intentionally not enabled: solution submission/run-code tools. Those require authenticated session handling and explicit write-tool safety gates.
Development
cmd /c npm test
cmd /c npm run build
Cloudflare Worker Deployment
This package also includes a stateless Streamable HTTP MCP entrypoint for Cloudflare Workers.
cmd /c npm test
cmd /c npm run smoke:cf
cmd /c npx wrangler login
cmd /c npm run deploy:cf:dry
cmd /c npm run deploy:cf
The Worker exposes the same read-only tools at /mcp, with a health endpoint at / or /health.
{
"mcpServers": {
"luogu": {
"url": "https://<your-worker-name>.<your-workers-subdomain>.workers.dev/mcp"
}
}
}
Verify a deployed Worker:
cmd /c npm run smoke:cf -- https://<your-worker-name>.<your-workers-subdomain>.workers.dev
For private deployments, set LUOGU_MCP_TOKEN with wrangler secret put and configure your MCP client to send an Authorization: Bearer <token> header where supported. Browser Origin requests are rejected by default; set LUOGU_MCP_ALLOWED_ORIGINS to a comma-separated origin list if browser access is needed.
See docs/cloudflare-deployment.md for the full release checklist.
Run broad live checks against Luogu's current website responses:
cmd /c npm run smoke:live
The live smoke starts the MCP server through a real stdio client, then compares problem fetches, problem searches, training searches, training fetches, URL/id resolution, related recommendations, public user profiles, and route capabilities against Luogu content-only page responses. It is intentionally separate from unit tests because it depends on Luogu network availability and current site behavior.
Run the 100-topic algorithm coverage smoke:
cmd /c npm run smoke:topics
The topic smoke starts the real MCP server and probes 100 algorithm categories across high-level topic search and training-set search. It fails if fewer than 98 topic searches return Luogu results.
Download one representative problem per catalog topic into a local ignored folder:
cmd /c npm run download:topics
Test a MiMo agent loop that asks the model to choose MCP tools, then executes those calls through the local stdio MCP server:
cmd /c npm run smoke:mimo
smoke:mimo reads MIMO_API_KEY from the environment, or from C:\Users\qwerf\.continue\.env on this machine.
Notes
- Luogu endpoints used here are content-only web endpoints, not a formal stability contract.
- The server keeps outputs compact and structured for model context control.
- Browser automation is intentionally not the default path. A Playwright fallback can be added later for pages that cannot be read through lightweight HTTP.
- For broad topic discovery, Luogu training-set search is often cleaner than raw problem title search; raw keyword search follows Luogu's website ordering and can include title-level noise.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。