Skip to main content

MCP server for an Online Judge

Project description

Online Judge MCP Server

Python Version License

This is a Model Context Protocol (MCP) server that provides AI agents with tools to interact with an Online Judge API.

Features

Provides the following tools:

  • list_problems(offset, limit): List available problems on the OJ.
  • list_my_submissions(offset, limit): List recent submissions made by the authenticated user.
  • get_problem_details(problem_id): Fetch detailed descriptions, samples, limits, and rules of a problem.
  • submit_code(problem_id, code, language): Submit source code to a specific problem.
  • get_submission_status(submission_id): Check the polling status of a code submission.

Requirements

  • Python 3.10 or higher
  • pip

Setup & Running

  1. Install dependencies:

    pip install -e .
    
  2. Run the MCP server locally: Set the following environment variables before running:

    set OJ_URL="http://localhost:8000" # Replace with actual OJ URL
    set OJ_USERNAME="your-username"
    set OJ_PASSWORD="your-password"
    
    oj-mcp-server
    

Installation in MCP Clients

To use this server with an MCP-compatible client like Claude Desktop, Cursor, or Cline, you need to add it to your client's MCP configuration settings.

Claude Desktop

Edit your claude_desktop_config.json:

{
  "mcpServers": {
    "oj-mcp-server": {
      "command": "C:/path/to/venv/Scripts/oj-mcp-server",
      "args": [],
      "env": {
        "OJ_URL": "http://localhost:8000",
        "OJ_USERNAME": "your-username",
        "OJ_PASSWORD": "your-password"
      }
    }
  }
}

Cursor / Cline

In the MCP settings panel, add a new server:

  • Type: command
  • Name: oj-mcp-server
  • Command: C:/path/to/venv/Scripts/oj-mcp-server (or /path/to/venv/bin/oj-mcp-server on macOS/Linux)
  • Environment: Set OJ_URL, OJ_USERNAME, and OJ_PASSWORD

(Make sure to adjust the directory path to wherever you cloned the repository)

OpenCode

To configure the MCP server in the OpenCode IDE, you can edit your opencode.json configuration file (located globally at ~/.config/opencode/opencode.json or in your project directory). Add the server under the mcp key:

{
  "mcp": {
    "oj-mcp-server": {
      "type": "local",
      "command": [
        "C:/path/to/venv/Scripts/oj-mcp-server"
      ],
      "environment": {
        "OJ_URL": "http://localhost:8000",
        "OJ_USERNAME": "your-username",
        "OJ_PASSWORD": "your-password"
      }
    }
  }
}

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

oj_mcp_server-0.1.0.tar.gz (60.1 kB view details)

Uploaded Source

Built Distribution

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

oj_mcp_server-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file oj_mcp_server-0.1.0.tar.gz.

File metadata

  • Download URL: oj_mcp_server-0.1.0.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oj_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 468f6a5a87ca9bf03dea877f3d71bee747a28fc64afc027cc99f1eec92154b2e
MD5 0bb9372f8cd021b569561cbdaa56e0bd
BLAKE2b-256 80daff1b1aa810146dec0f1385927b33cc166a3278a691d8f06bc13b0c4a4793

See more details on using hashes here.

File details

Details for the file oj_mcp_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oj_mcp_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for oj_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c722d02b0fbc71491e266ea46de7a14ae5bf68ed9500e5e94997d710aee4ba09
MD5 5c4ab158e4b6b9a9265f859f5667bc44
BLAKE2b-256 d973be9df78fdcf94951f5bd844ce9bed8572fb5577c1fb77623654a52e936d9

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