qhung-cses-mcp

v0.1.0
qhung-cses-mcp Checked 3 days ago Published 5 months ago

An MCP server for browsing CSES problems, submissions, and submitting solutions

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

fetch_categories Fetch Categories

List every problem category name on the CSES problem set page. This scrapes https://cses.fi/problemset/ (or the configured CSES_BASE_URL) and returns the section headings (e.g. "Introductory Problems", "Sorting and Searching", "Graph Algorithms") in page order, excluding the "General" section (site info, not a problem category). This is public data — no session cookie is required. Use this to look up the exact category string to pass as the `category` filter on the `fetch_problems` tool, since that filter requires an exact (case/whitespace-insensitive) match.

fetch_problems Fetch Problems

Fetch every problem listed on the CSES problem set page, grouped by category. This scrapes https://cses.fi/problemset/ (or the configured CSES_BASE_URL) and returns each problem's name, link, category, and the current user's completion status for it. Use this tool when the user wants to browse/list CSES problems, find problems in a specific category (e.g. "Sorting and Searching", "Graph Algorithms"), or check which problems they have/haven't solved yet.

ParameterTypeDescription
categoryOptional category name to filter by, e.g. "Sorting and Searching" or "Graph Algorithms". Matching is case-insensitive and ignores surrounding whitespace. If omitted, problems from all categories are r…
statusOptional completion status to filter by. Must be one of "completed", "not accepted", or "not completed" (case-insensitive). If omitted, problems with any status are returned.

fetch_problem_statement Fetch Problem Statement

Fetch a single CSES problem's statement, given its problem page URL. This scrapes a problem page (e.g. one of the links returned by `fetch_problems`, such as https://cses.fi/problemset/task/1068) and returns its title, time/memory limits, narrative description, and the Input, Output, Constraints, and Example sections. This is public data — no session cookie is required. Math notation in the description/sections is returned as its raw LaTeX source (e.g. "n \le 10^6"), not rendered.

ParameterTypeDescription
url *stringAbsolute URL to a CSES problem page, e.g. "https://cses.fi/problemset/task/1068".

submit_code Submit Code

Submit a solution to a CSES problem for judging. Scrapes the task's submit page for a fresh CSRF token and hidden form fields, then uploads the given source code (in-memory, no filesystem access) to CSES for judging. The language is inferred from `filename`'s extension.

ParameterTypeDescription
code *stringThe full source code to submit, as a string.
filename *stringA filename for the source, used only to infer the language, e.g. "solution.py". Supported extensions: .asm, .c, .cpp/.cc, .hs, .java, .js, .pas, .py, .rb, .rs, .scala.
task_id *stringThe CSES task id, e.g. "1068" (from a problem's URL .../problemset/task/1068).

fetch_submission Fetch Submission

Fetch a past submission's details, per-test verdicts, and submitted code. Scrapes https://cses.fi/problemset/result/{submission_id}/ — this only works for your own submissions, since CSES only exposes submitted source code to the submission's owner. Use this after `submit_code` to check whether a submission has been judged yet and what the verdict was, or to review a past attempt.

ParameterTypeDescription
submission_id *stringThe submission id, e.g. the "submission_id" returned by `submit_code`, or the id in a result URL like https://cses.fi/problemset/result/17833364/.

fetch_submission_list Fetch Submission List

Fetch your submission history for a CSES task. Scrapes https://cses.fi/problemset/view/{task_id}/ (the task's "Results" tab) and returns every past submission you've made for that task, most recent first — each with a submission id (usable with `fetch_submission` to get full details/code/test verdicts), timestamp, language, runtime, code size, and result. Only the first page of results is fetched.

ParameterTypeDescription
task_id *stringThe CSES task id, e.g. "2134" (from a problem's URL .../problemset/task/2134).