Skip to main content
Glama

🧑‍💻 vnoi-mcp

Let AI read problems, write code, and submit on VNOI Online Judge.

An MCP server that connects Claude, LM Studio, Cursor, and other MCP clients to VNOJ: read statements, submit solutions, and get per-test verdicts, all without leaving the chat.

Python MCP uv License: MIT


✨ What it does

One prompt is all it takes:

"Solve contest vnoicup25_r1: read each problem, write a C++17 solution, submit it, and if it fails, read the verdict, fix it, and resubmit."

The model then loops on its own:

list_problems ─► get_problem ─► write code ─► submit
                                    ▲            │
                                    └─ WA/TLE ◄──┘

It's especially handy for problem setters: have the AI solve your problems independently and submit, to surface weak tests, wrong tests, or ambiguous statements.

Related MCP server: cf-mcp-orange

🧰 Tools

Tool

Arguments

Returns

vnoi_list_problems

contest_id

Problems in a contest: code, name, time limit, memory limit, points

vnoi_get_problem

problem_code

Full statement as Markdown: limits, description, I/O format, subtasks, samples

vnoi_submit

problem_code, code, language

Submits, waits for judging to finish, returns per-test results (grouped by batch if any)

vnoi_get_result

submission_id

Results of an existing submission

Example vnoi_submit output:

Submission ID: 1234567
Batch #1 (25/25 points)
  Test 1: AC | 0.009s | 680.00 KB
  Test 2: AC | 0.010s | 672.00 KB
Batch #2 (0/25 points)
  Test 1: TLE | >1.000s | 660.00 KB

Language

ID

Language

ID

C++17 (default)

4

Python 3

9

C++20

14

PyPy 3

17

C++23

23

Java 25

18

C

5

Rust

22

🚀 Quick start

Requirements: Python 3.12+ and uv.

git clone https://github.com/RMQuan/vnoi-mcp.git
cd vnoi-mcp
uv sync
cp .env.example .env
  1. Log in to oj.vnoi.info in your browser.

  2. Open DevTools (Cmd + Option + I / F12) → Application → Cookies → https://oj.vnoi.info.

  3. Copy the value of sessionid into .env:

VNOI_SESSION=paste_your_sessionid_here
WARNING

sessionid grants full access to your VNOI account, just like a password. Never share or commit it. .env is already in .gitignore.

2. Test it

uv run mcp dev server.py

The MCP Inspector opens in your browser → Connect → Tools → try vnoi_get_problem with problem_code = post.

3. Connect a client

Claude Code

claude mcp add vnoi -- uv --directory /path/to/vnoi-mcp run server.py

LM Studio / Cursor / Claude Desktop (mcp.json)

{
  "mcpServers": {
    "vnoi": {
      "command": "uv",
      "args": ["--directory", "/path/to/vnoi-mcp", "run", "server.py"]
    }
  }
}
TIP

If a macOS app can't finduv, replace "uv" with its full path from which uv (e.g. /opt/homebrew/bin/uv).

⚙️ How it works

VNOJ (a fork of DMOJ) has no submission API, so the server acts like a browser:

GET  /problem/<code>/submit  → grab csrfmiddlewaretoken (HTML) + csrftoken cookie
POST /problem/<code>/submit  → source, language, token → 302 → /submission/<id>
GET  /submission/<id>        → poll until grading ends, then parse the results table

File

Role

server.py

Declares the MCP tools and turns errors into readable messages for the model

vnoi_session.py

Logged-in session (cookie from .env) and CSRF token handling

vnoi_read_problem.py

Lists problems in a contest

vnoi_read_statement.py

Converts a problem statement to Markdown

vnoi_submit.py

Submits, waits for judging, parses results (with or without batches)

🩺 Troubleshooting

Error

Fix

Chưa có VNOI_SESSION trong .env (no session cookie)

Create .env and fill in your cookie (step 1)

Cookie expired / redirected to the login page

Log in again in your browser and copy the new sessionid

Không thấy danh sách bài của contest… (contest problems not found)

Check the contest code and make sure you have joined the contest

Submit thất bại, status_code=403 (submit failed)

Possibly blocked by Cloudflare; retry later or refresh your cookie

Hết …s mà bài … vẫn đang chấm (still judging after timeout)

The judge queue is busy; call vnoi_get_result with that ID a bit later

🔒 Limitations

The server acts as your VNOI account, so it can only see and do what you can in your browser:

  • Contests: you must have joined a contest before vnoi_list_problems and vnoi_get_problem can read its problems. Contests that haven't started, or whose problems are hidden from you, return an error.

  • Hidden / private problems: only accessible if your account has author, tester, or curator permissions on them.

  • Submissions: subject to the same rules as manual submissions: per-problem submission limits, allowed languages, and the contest's time window.

  • Results: vnoi_get_result can only read submissions your account is allowed to view.

  • Session lifetime: the cookie expires when you log out or after a period of inactivity; you'll need to refresh VNOI_SESSION then.

  • One account: the server uses a single cookie from .env; there is no multi-account support.

  • No official API: results come from parsing VNOJ's HTML. Compile-error output and unusual verdict layouts are handled on a best-effort basis.

⚠️ Use responsibly

  • Do not use this in live rated contests. Letting an AI solve problems for you is cheating and violates VNOI's rules.

  • Intended for practice, virtual contests, and testing problem sets as a setter.

  • Don't spam submissions: VNOI's judges are a shared community resource.

  • The tool parses HTML, so it may break if VNOI changes its layout. Please open an issue if it does.

📄 License

MIT © 2026 RMQuan. Provided "as is", without warranty of any kind; use at your own risk.


Available Tools

4 tools
vnoi_get_problemA

Lấy đề bài đầy đủ (bao gồm Points, Time limit, Memory limit, loại INPUT (stdin, file), kiểu OUTPUT (stdout, file), đề bài, định dạng Input, định dạng Output, subtask, test mẫu, giải thích) dạng Markdown. problem_code: mã bài, ví dụ "vnoicup25_r1_a".

Inputs: problem_code (required). Returns: result

vnoi_get_resultA

Xem lại kết quả của một bài đã nộp (dùng khi vnoi_submit báo hết thời gian chờ). submission_id: ID của submission, ví dụ "1234567".

Inputs: submission_id (required). Returns: result

vnoi_list_problemsA

Liệt kê các bài trong một contest VNOI (mã bài, tên, time limit, memory limit, điểm). contest_id: mã contest, ví dụ "vnoicup25_r1".

Inputs: contest_id (required). Returns: result

vnoi_submitA

Nộp code lên VNOI, đợi chấm xong rồi trả về kết quả từng test (batch, trạng thái AC/WA/TLE/..., thời gian, bộ nhớ). problem_code: mã bài, ví dụ "vnoicup25_r1_a". code: mã nguồn. language: mã ngôn ngữ — 4 = C++17 (mặc định), 14 = C++20, 23 = C++23, 9 = Python 3, 17 = PyPy 3.

Inputs: code (required), problem_code (required), language. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool targets a distinct step: listing problems in a contest, fetching a full problem statement, submitting code, and retrieving a past submission. The only potential overlap is vnoi_submit vs vnoi_get_result, since both return judging results, but the descriptions explicitly state get_result is the fallback when submit times out. That clarification makes misselection unlikely.

    Naming Consistency5/5

    All four tools use a uniform vnoi_ prefix with snake_case verb_noun structure (list_problems, get_problem, submit, get_result). vnoi_submit drops the object noun, but the verb is unambiguous and the pattern reads consistently across the set.

    Tool Count5/5

    Four tools map cleanly onto the four steps of the judge workflow (enumerate → read → submit → verify), with no redundant or speculative tools. The surface is minimal but every tool earns its place for the competitive-programming-judge domain.

    Completeness3/5

    The core solve-a-problem loop is covered end to end, but there is no way to discover contest IDs (no list_contests) or browse a problem archive, so an agent must already know a contest code. There is also no submission-history or user-status tool, which leaves notable gaps beyond the happy path.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A complete, all-in-one MCP server for Codeforces, enabling AI assistants to access user profiles, compare users, search problems, get practice recommendations, and more.
      8
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to fetch and analyze your public LeetCode submission history, weak areas, and daily challenge via a remote MCP server.
      -
    • F
      license
      A
      quality
      C
      maintenance
      Enables coding agents to discover unsolved Codeforces practice problems, analyze tag performance, and inspect submissions, profiles, rating history, and upcoming contests through MCP-compatible clients.
      6
      -