Labsco
tomek7667 logo

CTFd MCP Server

from tomek7667

Connect to CTFd instance, download tasks and submit flags

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

CTFd MCP Server

A lightweight and extensible Model Context Protocol (MCP) server for interacting with any CTFd instance. This project enables AI tools and automation to authenticate, retrieve challenges, and submit flags through MCP tools.

Overview

This project acts as a bridge between CTFd and AI-driven systems by providing a unified interface. It supports multiple authentication modes, dynamic base URL control, and direct MCP tool integration.

The server is validated using the official demo instance at https://demo.ctfd.io.

Features

  • Dynamic BASE_URL configuration
  • Token and cookie authentication
  • Username/password login
  • List challenges with optional filtering
  • Submit flags programmatically
  • Compatible with MCP-based AI tools (Claude, Codex, Amp, Gemini)
  • Clean and extensible TypeScript codebase

Tools

ToolDescription
set_base_url(url)Set the base URL for the CTFd instance
set_token(token)Set authentication token
set_cookie(cookie)Set session cookie
login(username, password)Login with credentials
challenges(category?)List challenges, optionally filtered by category
challenge(identifier)Get challenge details by name or ID
submit_flag(challenge_name?, challenge_id?, flag)Submit a flag
scoreboard()Get the CTFd scoreboard
progress()Get current user's progress
health()Check connection health

Docker

docker build -t ctfd-mcp-server .
docker run -i ctfd-mcp-server

For clients that support Docker-based MCP servers:

{
	"mcpServers": {
		"ctfd": {
			"command": "docker",
			"args": ["run", "-i", "--rm", "ctfd-mcp-server"]
		}
	}
}

Compatibility

FeatureSupported
Transportstdio
Node.js>=18.0.0
PlatformsmacOS, Linux, Windows

Tested Clients

ClientStatus
Claude Desktopโœ… Verified
OpenAI Codex CLIโœ… Verified
Ampโœ… Verified
Gemini CLIโœ… Verified

Environment Variables

VariableDescriptionDefault
BASE_URLCTFd instance base URLhttps://demo.ctfd.io

Development

# Clone and install
git clone https://github.com/tomek7667/ctfd-mcp-server.git
cd ctfd-mcp-server
pnpm install

# Build
pnpm run build

# Run
pnpm start

# Watch mode (auto-rebuild)
pnpm run watch

Support

For support, email jamescotid@gmail.com or open an issue through the GitHub repository. Community contributions and improvements are always welcome.