Skip to main content

A complete Codeforces MCP toolset for AI agents

Project description

Codeforces MCP Server

A Model Context Protocol (MCP) server that provides a comprehensive set of tools for interacting with the Codeforces competitive programming platform. Built with FastMCP and Python.

This server exposes tools that can be used by any MCP-compatible client (e.g., Claude Desktop, Cline, etc.) to fetch user profiles, compare users, search problems, generate practice plans, and more.


Features

Tool Description
get_user Fetch a complete Codeforces profile — rating, titles, contest history, solved problems breakdown by difficulty & category.
compare_user Side-by-side comparison of two Codeforces users across ratings, contests, solved problems, and categories.
get_problemlist Search the Codeforces problemset with filters (rating range, tags, sort order, match type). Returns up to 10 problems.
get_problem Fetch the full problem statement, rating, and tags for a specific problem by contest ID and index.
get_practiceproblems Analyze a user's solved problems to identify their weakest topics and recommend up to 3 practice problems within +300 rating.
get_random_practice Recommend a single random Codeforces problem within ±300 rating of the user's current level.
get_upsolve Analyze the user's last 10 rated contests and recommend unsolved problems within ±300 rating for targeted improvement.
get_status Fetch the last 1000 submissions of a user — AC/WA/TLE summary and details of the 20 most recent submissions.

Installation

Prerequisites

  • Python 3.10+
  • pip (Python package manager)

Setup

# Clone the repository
git clone https://github.com/spr7a/cf-mcp.git
cd cf-mcp

# Install dependencies
pip install fastmcp httpx

Usage

Running the Server

python test.py

The server runs on stdio transport by default, making it compatible with MCP clients.

Configuring with Claude Desktop / Cline

Add the following to your MCP settings configuration file (e.g., ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):

{
  "mcpServers": {
    "codeforces": {
      "command": "python",
      "args": ["/path/to/cf-mcp/test.py"]
    }
  }
}

Example Queries

Once connected, you can ask your MCP client questions like:

  • "What is tourist's Codeforces profile?"
  • "Compare tourist and petr side by side."
  • "Find me DP problems rated 1600-1800."
  • "Get the full statement for problem 4A."
  • "Generate a practice plan for reikc."
  • "Give me a random problem for reikc."
  • "What unsolved problems does reikc have from recent contests?"
  • "What did reikc solve recently?"

Project Structure

cf-mcp/
├── test.py                  # Main MCP server entry point (FastMCP)
├── tools/
│   ├── get_user.py          # Fetch & parse user profile data
│   ├── compare_user.py      # Compare two users side-by-side
│   ├── get_problemlist.py   # Search problemset with filters
│   ├── get_problem.py       # Fetch full problem statement
│   ├── get_practice.py      # Generate practice plan from weak topics
│   ├── get_random_problem.py# Random problem suggestion
│   ├── get_upsolve.py       # Upsolve recommendations from recent contests
│   ├── get_status.py        # Submission status & history
│   └── problems.py          # Shared problem-fetching utilities
└── README.md

How It Works

The entire tool suite is powered by the official Codeforces API, which acts as the backbone for all data operations. To ensure lightning-fast performance, the server uses Python's httpx library to issue asynchronous, non-blocking network calls, allowing multiple requests to run in parallel instead of waiting for each one sequentially.


Dependencies

  • fastmcp — MCP server framework
  • httpx — Async HTTP client

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpmcp_oren-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpmcp_oren-1.0.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file cpmcp_oren-1.0.0.tar.gz.

File metadata

  • Download URL: cpmcp_oren-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for cpmcp_oren-1.0.0.tar.gz
Algorithm Hash digest
SHA256 172f43ef3f4548f10cdad6a35c89cacf819b1f36a885c043a65470e85c4a72bc
MD5 3ff04aa518f9972f47ba729e7d5862fe
BLAKE2b-256 a1967d46bdd95c0b2b023088add1c084c22924619107f1e5c2b53c5f30a70beb

See more details on using hashes here.

File details

Details for the file cpmcp_oren-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cpmcp_oren-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for cpmcp_oren-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 320b01dea6bcc78d5209603f3510a5b63ddc64733442d0c37ed9ea5c2fbd7014
MD5 a60594ecd24d651e2653bd6fc7434fd8
BLAKE2b-256 1bbf4f51d0f1549af93b93713e6825db0ab621148a5c062661306d227b1dca79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page