Skip to content
MCP server
RegistryRemote

Luogu MCP Server

Search Luogu problems, fetch statements, explore problem sets and get practice recommendations.

Luogu MCP Server scores 69 (Good), licensed MIT and written in TypeScript. It can be reached as a remote MCP endpoint. It declares 11 tools. Filed under Search. GitHub shows 6 stars. Install configs are generated for 12 clients. Being listed in the registry is not the same as being vendor-official.

by kaiserunixMITTypeScript6 stars
Trust score
69Good
Trust score 69 of 100, Good

Good trust

69 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: mit.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 69 comes from

22 + 20 + 3 + 10 + 4 + 10 = 69. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity3 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 3 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs10 / 10

A real summary, a README with depth, listed tools.

Docs: 10 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "kaiserunix-luogu-mcp-server": {      "url": "https://luogu-mcp-server.lantangtang54.workers.dev/mcp"    }  }}

Environment variables

This server does not declare environment variables.

Tools11Tool docs quality grade B

All capabilities
  • Fetch one Luogu problem statement, input/output formats, samples, tags, difficulty, and URL by pid.

  • Fetch one Luogu training/problem set and its problem summaries by ID.

  • Combine topic/pain-point recommendations with live keyword search to find related practice.

  • Primary 100-topic discovery engine: finds topic practice using bilingual aliases, Luogu tag IDs, template prioritization, deduplication, and match reasons.

  • Report which LeetCode-style route features are available, auth-required, or intentionally not enabled.

  • Fetch public Luogu user profile data by uid.

  • List all 100 canonical algorithm topics, aliases, and known Luogu tag IDs.

  • Return curated beginner seed recommendations for 6 targeted pain-point buckets (binarytree, treedistance, recursion, outputorder, outputformat, matrix).

  • Resolve a Luogu URL, problem ID, or title fragment, then fetch the problem (for B-prefix problems like B2002, call luogufetchproblem directly with pid).

  • Search Luogu training/problem sets (题单) by keyword. Supports type: "all"

  • Search Luogu problems by keyword, topic, title fragment, problem ID, and optional Luogu tag IDs.

About

Luogu MCP Server | 洛谷 MCP Server

简体中文 | Product Strategy & Roadmap | Multi-OJ Monorepo (ketherworks)

The 11-tool Luogu Deep Pedagogy & Topic-Discovery MCP Server — search Luogu problems, read context-safe statements and samples, explore 100 algorithm topics with bilingual alias expansion & 【模板】 template prioritization, search official + user-shared training sets (题单), and get beginner pain-point recommendations. Runs zero-install over Streamable HTTP or locally via npm (npx -y luogu-mcp-server).

All 11 tools are strictly read-only (public Luogu problems, training sets, recommendations, and public user profiles; no account login or code submission).


Which Luogu / OJ MCP Repo Should I Use?

RepositoryEdition & ToolsBest ForConnection
Kaiserunix/luogu-mcp-server (this repo)Luogu Deep Pedagogy Edition (luogu-v0.2, 11 luogu_* tools)100-topic bilingual alias catalog, official + selected training sets (题单), pain-point practice recommendations, public user profiles, and offline Markdown topic-pack exportHosted HTTP https://luogu-mcp.ksrnyx.top/mcp or npx -y luogu-mcp-server
ketherworks/competitive-programming-mcpUnified Multi-OJ Contract Suite (OJ v1, 4 oj_* read tools per hosted OJ + NowCoder local runner)Multi-platform agents needing one typed oj_* schema across Codeforces (metadata), AtCoder (statements), Luogu (https://api.ksrnyx.top/oj-mcp/luogu/mcp), NowCoder (local stdio run & confirmed submit), and LeetCodeHosted HTTP + local stdio for NowCoder

Quick Start

Option 1: Zero-Install Hosted Streamable HTTP

Cursor / Windsurf / Clients using "mcpServers":

{
  "mcpServers": {
    "luogu": {
      "url": "https://luogu-mcp.ksrnyx.top/mcp"
    }
  }
}

VS Code (.vscode/mcp.json, uses "servers" + "type": "http"):

{
  "servers": {
    "luogu": {
      "type": "http",
      "url": "https://luogu-mcp.ksrnyx.top/mcp"
    }
  }
}

Option 2: Local stdio via npm (Recommended for Claude Desktop or Avoiding Remote Egress Limits)

Requires Node.js >= 20. Uses the published luogu-mcp-server package:

macOS / Linux:

{
  "mcpServers": {
    "luogu": {
      "command": "npx",
      "args": ["-y", "luogu-mcp-server"]
    }
  }
}

Windows (wrap npx via cmd /c if your MCP host reports spawn npx ENOENT):

{
  "mcpServers": {
    "luogu": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "luogu-mcp-server"]
    }
  }
}

Try Asking Your AI Client

Search Luogu for five beginner binary-tree problems.
Fetch Luogu P1305 with its statement and samples.
Find Treap topic practice problems excluding P3369.
Search Luogu training sets for 网络流.
Find related practice for traversal-order confusion.

Why This Server Stands Out

  • 100-Topic Bilingual Alias & Template-Prioritized Discovery (luogu_find_topic_problems): Expands OI shorthand (Treap, SPFA, 状压, 割边) into canonical topics & Luogu tag IDs, boosts 【模板】 template problems and approachable difficulties, and is verified by a 100-topic live smoke test (>=98/100 hit threshold).
  • Hybrid Official + Community Training-Set Search (luogu_search_problem_sets): Fetches Luogu's official training index and community select sets in parallel, normalizes title filtering across both, and deduplicates results under type: "all".
  • Context-Safe Statement Trimming: Normalizes Luogu's multi-schema content payloads and bounds long stories via maxStatementChars (default 5000) so LLM context windows stay clean.
  • Offline 100-Topic Markdown Pack: Run npm run download:topics to export one representative problem per algorithm topic as clean local Markdown cards.

Tools (11 Read-Only Tools)

ToolPurpose
luogu_find_topic_problemsPrimary 100-topic discovery engine: finds topic practice using bilingual aliases, Luogu tag IDs, template prioritization, deduplication, and match reasons.
luogu_list_algorithm_topicsList all 100 canonical algorithm topics, aliases, and known Luogu tag IDs.
luogu_search_problemsSearch Luogu problems by keyword, topic, title fragment, problem ID, and optional Luogu tag IDs.
luogu_fetch_problemFetch one Luogu problem statement, input/output formats, samples, tags, difficulty, and URL by pid.
luogu_resolve_problemResolve a Luogu URL, problem ID, or title fragment, then fetch the problem (for B-prefix problems like B2002, call luogu_fetch_problem directly with pid).
luogu_search_problem_setsSearch Luogu training/problem sets (题单) by keyword. Supports `type: "all"
luogu_fetch_problem_setFetch one Luogu training/problem set and its problem summaries by ID.
luogu_find_related_problemsCombine topic/pain-point recommendations with live keyword search to find related practice.
luogu_recommend_problemsReturn curated beginner seed recommendations for 6 targeted pain-point buckets (binary_tree, tree_distance, recursion, output_order, output_format, matrix).
luogu_get_user_profileFetch public Luogu user profile data by uid.
luogu_get_capabilitiesReport which LeetCode-style route features are available, auth-required, or intentionally not enabled.

Availability

  • Hosted MCP: https://luogu-mcp.ksrnyx.top/mcp
  • Health Check: https://luogu-mcp.ksrnyx.top/health
  • npm Package: luogu-mcp-server
  • Official MCP Registry: io.github.Kaiserunix/luogu-mcp-server, described by server.json

Other Ways To Run (From Source)

git clone https://github.com/Kaiserunix/luogu-mcp-server.git
cd luogu-mcp-server
npm install
npm run build

Use node directly from a source checkout:

{
  "mcpServers": {
    "luogu": {
      "command": "node",
      "args": [
        "C:\\path\\to\\luogu-mcp-server\\dist\\index.js"
      ],
      "cwd": "C:\\path\\to\\luogu-mcp-server"
    }
  }
}

Example Tool Payloads

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
}

Resolve a pasted URL:

{
  "query": "https://www.luogu.com.cn/problem/P1305",
  "maxStatementChars": 5000
}

Find topic practice with alias expansion:

{
  "topic": "Treap",
  "limit": 5,
  "excludeProblemIds": ["P3369"]
}

Recommend from a beginner pain point:

{
  "topic": "binary_tree",
  "painPoint": "traversal_order_confusion",
  "limit": 3
}

Find related practice:

{
  "topic": "binary_tree",
  "painPoint": "traversal_order_confusion",
  "query": "二叉树 遍历",
  "limit": 5
}

Fetch a public user profile:

{
  "uid": 1
}

Search training/problem sets (type: "all" is the default; use "official" for official index only or "select" for user-shared sets):

{
  "keyword": "网络流",
  "type": "select",
  "limit": 5
}

Luogu Route Parity & Scope

This project mirrors the useful ergonomics of mature LeetCode MCP servers while strictly respecting what Luogu exposes publicly:

  • Available now: problem search, problem fetch, URL/ID/title resolution, 100-topic & related problem discovery, training-set search/fetch, public user profile fetch.
  • Auth-required in live probes (not enabled): recent submissions, public solution pages, and discussion pages.
  • Intentionally not enabled: solution submission / remote code execution (requires authenticated sessions and explicit write-tool safety gates).

Development & Smoke Verification

npm test
npm run build

Optional live verification scripts (depend on live Luogu network availability):

CommandPurpose
npm run smoke:liveEnd-to-end stdio MCP verification against live Luogu content responses
npm run smoke:topicsProbes all 100 algorithm categories across topic & training-set search (fails if < 98 return results)
npm run download:topicsExports one representative problem per topic into a local gitignored Markdown folder
npm run smoke:mimoRuns an agent tool-calling smoke loop against the local stdio MCP server (reads MIMO_API_KEY from the environment or a local .env file)

Cloudflare Worker Deployment & Egress Caveat

[!WARNING] Upstream Egress Blocking Caveat: Luogu (www.luogu.com.cn) frequently blocks or rate-limits shared Cloudflare Worker egress IPs on real problem/search reads even when /health and MCP handshakes succeed. For reliable self-hosted reads, prefer local npx -y luogu-mcp-server (stdio) or a Node 22 container behind HTTPS / private tunnel (see ketherworks/competitive-programming-mcp).

This package includes a stateless Streamable HTTP MCP Worker entrypoint (src/worker.ts) if your egress route can reach Luogu reliably:

npm test
npm run smoke:cf
npx wrangler login
npm run deploy:cf:dry
npm run deploy:cf

Verify a deployed Worker (be sure to test a real read tool, not only /health):

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 send Authorization: Bearer <token> (or X-Luogu-Mcp-Token). 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 checklist.

Notes

  • Luogu endpoints used here are public content-only web endpoints, not a formal OpenAPI stability contract.
  • Outputs stay compact and structured to preserve model context budget.
  • Browser automation is intentionally not on the default path.
  • For broad topic discovery, Luogu training-set search (luogu_search_problem_sets) and topic discovery (luogu_find_topic_problems) are generally cleaner than raw problem title search.

Frequently asked questions

What is Luogu MCP Server?

Search Luogu problems, fetch statements, explore problem sets and get practice recommendations.

How do I install Luogu MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. Luogu MCP Server connects to the remote endpoint https://luogu-mcp-server.lantangtang54.workers.dev/mcp, so there is nothing to install locally.

Is Luogu MCP Server free and open source?

Yes. Luogu MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does Luogu MCP Server support remote (HTTP) connections?

Yes. Luogu MCP Server offers a hosted endpoint over Streamable HTTP, so HTTP-capable clients can connect to it without running anything locally.

What tools does Luogu MCP Server provide?

Luogu MCP Server provides 11 tools, including luogu_fetch_problem, luogu_fetch_problem_set, luogu_find_related_problems, and luogu_find_topic_problems. See the full tool list for descriptions and parameters.

How is Luogu MCP Server's trust score calculated?

Luogu MCP Server scores 69 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

—Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server