MODEL CONTEXT PROTOCOL
Practice from Claude Code and Cursor
Add the CSWork MCP server and your AI editor can read problems, run the examples, submit and read verdicts: the same problems and judge as the site, with progress on your account.
Create an access token
Sign in, open your account, find Practice from your AI editor (MCP), name a token and create it. It is shown only once, so copy it; revoke it whenever you stop using it.
Download the server
One file that uses only what ships with Node 18 or newer, no dependencies. Read the source first
Terminal mkdir -p ~/.cswork && curl -fsSL https://cswork.org/mcp/cswork-mcp.mjs -o ~/.cswork/cswork-mcp.mjsConnect your editor
Claude Code
Terminal claude mcp add --transport stdio cswork --scope user \ --env CSWORK_TOKEN=cswork_pat_your_token \ -- node ~/.cswork/cswork-mcp.mjsReplace cswork_pat_your_token with your token. --scope user makes it available in every project; /mcp inside Claude Code shows cswork as connected.
Cursor
~/.cursor/mcp.json { "mcpServers": { "cswork": { "command": "node", "args": [ "/Users/you/.cswork/cswork-mcp.mjs" ], "env": { "CSWORK_TOKEN": "cswork_pat_your_token" } } } }Use an absolute path (echo ~ in a terminal prints your home directory). For one project only, put it in that project’s .cursor/mcp.json. Then turn cswork on under MCP in Cursor’s settings.
Other MCP clients
Any client with stdio servers works: the command is node, the argument is the script path, and CSWORK_TOKEN holds the token. Add CSWORK_LANG=zh for Chinese statements.
Ask for a problem
- “Give me today’s cswork daily problem.”
- “Find a few sliding-window Amazon OA problems on cswork.”
- “Run my code on the examples, and submit it if they pass.”
The server asks the model to let you write the solution yourself; ask outright when you want a hint or an answer.
Tools
get_daily_problem- Today's daily problem with its full statement and examples.
search_problems- Search judgeable algorithm and company OA problems by title, number, difficulty or company.
get_problem- One problem's statement, limits, examples and LeetCode-mode template.
run_code- Run code on the public examples or custom input. It isn't a formal submission.
submit_code- Formal submission against every test case, hidden ones included. Counts toward progress and streaks.
get_submission- Verdict and per-case results of a run or submission; waits up to 30 s while judging.
Token safety and limits
- A token can only read problems, run and submit code and read your own results. It cannot read notes or lists, change your account or create tokens.
- The server keeps only a SHA-256 hash of each token. If one leaks, revoke it on your account page and it stops working at once.
- Each token gets 60 requests a minute. Runs and submissions through tokens are capped at 120 an hour, on top of the site’s usual per-minute limits.
- The script talks to cswork.org over HTTPS only; if you point CSWORK_BASE_URL elsewhere, it must be HTTPS unless it is localhost.