cf-tool

command module
v0.0.0-...-bf34d26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 10 Imported by: 0

README

Codeforces Tool

Build Status Go Report Card Go Version license

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

Step 1: Build cf-tool

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:

  1. mcp-chrome - Chrome extension that exposes Chrome DevTools Protocol via MCP

  2. 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:

  1. Download mcp-chrome extension
  2. Extract to a folder
  3. Open Chrome and go to chrome://extensions/
  4. Enable "Developer mode"
  5. Click "Load unpacked" and select the extension folder
  6. 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
browser
Package browser implements a browser-based HTTP client using MCP Chrome.
Package browser implements a browser-based HTTP client using MCP Chrome.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
pkg
mcp
Package mcp implements a Model Context Protocol (MCP) client for communicating with browser automation servers like MCP-Chrome.
Package mcp implements a Model Context Protocol (MCP) client for communicating with browser automation servers like MCP-Chrome.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL