
Codeforces Tool is a command-line interface tool for Codeforces.
This is a fork of the original cf-tool with browser mode support to bypass Cloudflare protection.
中文
Installation
Clone the repository and build with make (go >= 1.12):
# Clone the repository
git clone https://github.com/NetWilliam/cf-tool.git
cd cf-tool
# Build with make
make build
# (Optional) Install to ~/go/bin
make install
The compiled binary will be at ./bin/cf. You can move it to anywhere you like or add it to your PATH.
Step 2: Install Browser Mode Components
⚠️ IMPORTANT: Browser Mode is REQUIRED for all network operations (parse, submit, list, watch, race, pull, clone).
cf-tool uses Browser Mode to bypass Cloudflare protection on Codeforces. You need to install:
-
mcp-chrome - Chrome extension that exposes Chrome DevTools Protocol via MCP
-
mcp-chrome-bridge - Node.js bridge service
Quick Installation
# Install mcp-chrome-bridge
npm install -g @hangwin/mcp-chrome-bridge
# Or using pnpm
pnpm add -g @hangwin/mcp-chrome-bridge
Then:
- Download mcp-chrome extension
- Extract to a folder
- Open Chrome and go to
chrome://extensions/
- Enable "Developer mode"
- Click "Load unpacked" and select the extension folder
- Run
mcp-chrome-bridge in a terminal (it runs on http://127.0.0.1:12306/mcp)
Verify Installation
# Test MCP connection
cf mcp-ping
# Test browser automation
cf mocka
Important: Make sure both commands succeed before using cf-tool!
For more details about mcp-chrome, visit: https://github.com/hangwin/mcp-chrome/
New Commands
This fork adds two new commands for browser mode testing:
cf mcp-ping
Test the connection to MCP Chrome Server.
cf mcp-ping
Expected output:
✅ MCP Chrome Server is running
cf mocka
Test browser automation capabilities. Opens Chrome, navigates to Google and searches for "billboard quarterly chart", then returns page content to verify browser automation is working correctly.
cf mocka
This command is used to verify that cf-tool can correctly control your browser.
Verified Commands
The following commands have been tested and verified to work with browser mode:
-
cf parse - Fetch problem samples
-
cf gen - Generate code from template
-
cf test - Compile and test locally
-
cf submit - Submit code to Codeforces
-
cf open - Open problems in browser
-
cf sid - Open submission page
-
cf race - Contest countdown and parsing
-
cf clone - Clone user submissions (partially working, behavior unclear)
Original Documentation
For detailed usage of all cf-tool commands (parse, submit, race, etc.), please refer to the original repository.
All original commands are supported in this fork with browser mode enabled by default for network operations.
FAQ
Browser mode is required?
Yes. Due to Cloudflare protection on Codeforces, all network-dependent commands now require browser mode.
How to check if browser mode is working?
Run cf mcp-ping. If it shows "✅ MCP Chrome Server is running", browser mode is ready.
Can I use the old HTTP mode?
No. The old HTTP mode cannot bypass Cloudflare protection and is no longer supported.
License
MIT License - Same as the original cf-tool