CTFd MCP Server
A lightweight MCP server for interacting with CTFd instances, enabling AI tools to authenticate, retrieve challenges, and submit flags.
README
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 a stable API layer.
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 FastAPI endpoints for debugging and 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
- Clean and extensible Python codebase
Installation
Install the MCP server using Python:
git clone https://github.com/YourUser/ctfd-mcp-server.git
cd ctfd-mcp-server
pip install -r requirements.txt
Create your environment configuration:
cp .env.example .env
Edit .env as needed:
BASE_URL=https://demo.ctfd.id
CTFD_TOKEN=
CTFD_COOKIE=
Running the MCP Server
Start the server with Python:
python mcp_server.py
The default FastAPI server runs at:
http://127.0.0.1:8000
Example MCP Configuration
If you are using a client such as Claude Desktop or a compatible MCP host, configure it as follows:
{
"mcpServers": {
"ctfd-mcp": {
"command": "python",
"args": ["mcp_server.py"],
"env": {
"BASE_URL": "https://demo.ctfd.io"
}
}
}
}
Usage/Examples
Set Token
{
"method": "set_token",
"params": { "token": "your_token_here" }
}
Get Challanges
{
"method": "challenges",
"params": {}
}
Sumbit Flag
{
"method": "submit_flag",
"params": {
"challenge_id": 3,
"flag": "flag{example_payload}"
}
}
API Endpoints (FastAPI)
| Method | Path | Description |
|---|---|---|
| POST | /set_token | Set authentication token |
| POST | /set_cookie | Set session cookie |
| POST | /login | Login with credentials |
| GET | /api/v1/challenges | Retrieve challenges |
| POST | /api/v1/flags | Submit a flag |
Support
For support, email jamescotid@gmail.com or open an issue through the GitHub repository. Community contributions and improvements are always welcome.
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.