I started preparing my setup for the CTF four days before the event. When my environment, after several unsuccessful attempts, was finally up and running, the HTB token had expired and the CTF had closed — earlier than announced. Although I finally had to buy Anthropic tokens and, nevertheless, was not able to capture a single flag, I learned a lot about MCP and now have a running Kali MCP machine (and some Anthropic credit) ready for the next project. Roarrrrr!
Below are the steps I took and issues I faced, documented for learning and possible future improvement.
git clone https://github.com/Wh0am123/MCP-Kali-Server.git
cd MCP-Kali-Server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 kali_server.pyThe server ran on 127.0.0.1:5000
Since Cursor was already installed on my machine, and you get a certain amount of free Anthropic tokens in Cursor’s free tier model, I first attempted to set up Cursor for the CTF:
Created ~/.cursor/mcp.json:
{
"mcpServers": {
"htb-mcp-ctf": {
"url": "https://mcp.hackthebox.ai/v1/ctf/mcp/",
"headers": {
"Authorization": "Bearer [MY_HTB_TOKEN]"
},
"isActive": true
},
"kali_mcp": {
"command": "/home/january1073/MCP-Kali-Server/venv/bin/python3",
"args": [
"/home/january1073/MCP-Kali-Server/mcp_server.py",
"--server",
"http://127.0.0.1:5000"
],
"isActive": true
}
}
}In Cursor, this led to JSON parsing errors with my MCP server configuration: “Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)”:
The issue was that my Python MCP server was writing info/error messages to stdout instead of stderr. The server started and connected successfully: “Successfully connected to stdio server”, “CreateClient completed, server stored: true”. But then it was outputting log messages that corrupted the JSON-RPC stream.
I tried to circumvent this by amending the mcp_server.py. The key change was on line 13 where I replaced sys.stdout with logging.StreamHandler(sys.stderr). This should have ensured that all logging output goes to stderr, leaving stdout clean for the MCP JSON-RPC protocol. However, after this change, Cursor could not load the Python MCP tools anymore.
Since I only have mediocre Python skills, and no MCP experience at all, I decided to research another, if possible free-of-charge approach.
I found this article by Jie Liau: https://jieliau.medium.com/let-mcp-help-your-offensive-security-6d8906423cac
Although this guide was written for a macOS host, I thought 5ire might be a good, free-of-charge alternative, particularly when using it with Google Gemini 2.0 Flash. I installed 5ire-0.14.1-x86_64.AppImage from https://5ire.app. The same JSON configuration that worked for Claude to connect with the Kali and HTB MCP servers (see above, Step 3) also worked for ~/.config/5ire/mcp.json.
Then I set up the Google Gemini API key and Gemini 2.0 Flash as default for 5ire, because this is free tier, only to learn that Gemini does not support MCP. As I said, I’m an MCP noob. Now I know.
Since I saw no other possible free options to participate in the CTF anymore, I bought $15 Anthropic credit, created an API key, saved it in my password manager, and turned back to 5ire. I set up the Anthropic API key and Claude Sonnet 4 (claude-sonnet-4–20250514) as default for 5ire and restarted it.
5ire was set to Claude Sonnet 4, but “thought” that it is 3.5 Sonnet:
Me: “hello, can you confirm you’re claude sonnet 4?”
5ire: “Hello! I’m Claude, an AI assistant created by Anthropic. I’m not Claude Sonnet 4 specifically — I’m Claude 3.5 Sonnet. There isn’t a “Claude Sonnet 4” model that I’m aware of.”
5ire connected Claude with Kali and HTB MCP servers, but could not properly interact:
5ire: “I can see that I have access to various cybersecurity tools through Hack The Box CTF functions and Kali Linux penetration testing tools. Is there something specific you’d like help with regarding CTF challenges or penetration testing?”
Me: “Please list all the MCP tools you have access to. Show me: 1. all HTB CTF tools and their functions, 2. all Kali Linux tools and their functions”
5ire (outputs all tools and functions)
Me: “use your kali tools to execute: nmap — version”
5ire (displays no output in the UI, only in the developer console): “error: text content blocks must be non-empty”
Me: “use your HTB tools to list all available CTF events”
5ire: (displays no output in the UI, only in the developer console): “error: text content blocks must be non-empty”
The tools worked but the UI couldn’t render responses. Working with the developer console, however, was not a practical option. Since I already bought Anthropic credits, I finally switched to Claude Code. (Claude Desktop is — still — not available for Linux.)
Claude Code finally worked. I followed its official documentation here (https://code.claude.com/docs/en/mcp) and also got a little help by Claude itself.
It was already Sunday night and I decided to take a nap so that I could use this running setup on Monday morning to capture at least 1 flag. According to the CTF info page, it would run until 12 AM UTC (1 PM locally). Enough time for 1 flag. I thought …
Monday morning, at around 9 AM UTC, I started fresh with the following steps:
Me: “What MCP tools do you have access to? List all tools from both htb-mcp-ctf and kali_mcp servers.”
Claude Code: “I have access to MCP tools from both servers. Here’s the complete list:
htb-mcp-ctf Server Tools:
CTF Event Management
Team Management
Challenge Management
Flag Submission
kali_mcp Server Tools:
Network & Web Scanning
Vulnerability Detection & Exploitation
Password Cracking & Authentication
Enumeration
System
Total: 13 HTB CTF tools + 11 Kali security tools = 24 MCP tools available
Join Medium for free to get updates from this writer.
Both servers are properly configured and responding. Ready to help you with CTF challenges!”
Me: “I’m participating in the HackTheBox Neurogrid CTF. You have access to:
IMPORTANT TOOLS YOU CAN USE:
WORDLISTS AVAILABLE:
WORKFLOW FOR EACH CHALLENGE:
RULES:
Ready? Let’s start by listing all available Neurogrid challenges.”
Claude Code: “The HTB MCP authentication token in your configuration has expired.”
I was a bit surprised and double-checked: On HTB’s CTF webpage (https://ctf.hackthebox.com/event/details/neurogrid-ctf-the-ultimate-ai-security-showdown-2712) it said that the CTF would end on Nov 24, 2025, 12:00 UTC.
Press enter or click to view image in full size
Me: “what day and time is it (UTC)?”
Claude Code: “It’s currently: Monday, November 24, 2025 at 09:30 AM UTC”
Me: “Is the HTB Neurogrid CTF still running?”
Claude Code: “CTF Status: Likely Ended”
For unknown reasons, the CTF ended already at 1:00 AM UTC — 11 hours earlier than announced.
I was a bit disappointed. After so much effort to set up my machine 😕
This CTF journey, while not resulting in captured flags, became an unexpectedly valuable learning experience about AI-powered security tooling and the MCP ecosystem. Here are my key takeaways:
I severely underestimated the time and complexity required to configure a functional MCP environment. What seemed like a straightforward “install and go” process turned into a multi-day troubleshooting adventure. The interplay between MCP servers, AI clients, and security tools requires careful attention to details like stdout/stderr separation, JSON-RPC protocol cleanliness, and proper authentication flows. Future CTF participants should allocate significant setup time before the event starts.
Coming in as an “absolute MCP noob,” I discovered that MCP documentation, while improving, still assumes a certain baseline knowledge. The error messages were often cryptic (looking at you, “text content blocks must be non-empty”), and debugging required diving into developer consoles and log files. The silver lining: by the end, I understood JSON-RPC communication patterns, the importance of proper logging channels, and how AI agents interact with external tools.
My initial goal of completing the CTF without purchasing tokens proved unrealistic. Free tiers either don’t support MCP (Gemini) or have limitations that make serious security work impractical. The $15 Anthropic investment was necessary and, in retrospect, reasonable for the learning value gained. Future participants should budget for API costs from the start.
I attempted to use three different AI interfaces (Cursor IDE, 5ire, Claude Code) before finding one that worked properly. Each had different configuration formats, different limitations, and different failure modes. The lack of standardization in MCP client implementations added unnecessary friction to an already complex setup. Claude Code eventually worked well, but the journey to get there was exhausting.
Balancing a full-time job with CTF preparation meant working in fragmented evening sessions. This made it difficult to maintain context across troubleshooting sessions and led to some repeated mistakes. The “just a couple of hours in the evening” approach proved insufficient for both setup and actual challenge solving.
The most frustrating moment was discovering that the CTF ended 11 hours earlier than advertised. After days of setup struggles, I finally had a working environment — only to find the door already closed. This taught me to always verify event timings from multiple sources and to join events early rather than waiting until the last minute.
What I’d Do Differently Next Time
Despite the zero-flag outcome, I now have a battle-tested Kali MCP environment, practical MCP knowledge, and war stories to share. The next CTF won’t catch me unprepared. Bring it on!
Official documentation
Tools & repos
Community resources
My Setup Files
Special thanks to the HTB team for organizing this innovative CTF, and to the Anthropic team for creating the MCP protocol. Looking forward to the next AI-powered security challenge!
Reach out: https://guns.lol/january1073