TryHackMe MCP Server
Provides tools for interacting with TryHackMe, including searching rooms, paths, and modules; reading room tasks and questions; accessing profiles, leaderboards, stats, progress, recommendations, and weekly missions; and, with authentication and writes enabled, starting, extending, or terminating lab machines and managing room votes and membership.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TryHackMe MCP Server Find a beginner Nmap room and start its lab machine"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TryHackMe MCP Server
An unofficial Model Context Protocol server for TryHackMe. Search rooms, study tasks with an AI tutor, follow learning paths, check your progress and leaderboard rank, and start or stop lab machines, all from Claude or any MCP client.
You: What should I study next? Start the machine for it.
Claude: โ thm_my_next_rooms()
โ thm_start_machine(room_code="furthernmap")
Next in your Jr Penetration Tester path is "Nmap" (90 min). The machine is
booting; I'll check its IP in a minute...Not affiliated with TryHackMe. TryHackMe has no official public API. This server uses the same
tryhackme.com/api/v2endpoints the website calls in your browser. They're undocumented and can change. See Disclaimer.
Documentation
๐ Full docs: Getting started ยท Authentication ยท Tools reference ยท Recipes ยท Troubleshooting ยท FAQ
Related MCP server: tutor-mcp-python
Contents
Features
34 tools and 3 prompts covering rooms, tasks, modules, paths, search, leaderboards, profiles, your stats and progress, recommendations, weekly missions, and lab machines.
Zero setup for public content. Add your session cookie for personal data.
Safe by default. The 28 read-only tools carry
readOnlyHint. The 6 tools that change your account only exist when you setTHM_ALLOW_WRITES=1, and they're marked so your client asks before running them.Privacy-filtered. Your email, phone number and tokens are stripped before anything reaches the model.
Teaching-first. It explains room content and gives hints; it never fetches or submits answers.
Clean Markdown with code blocks preserved, so commands copy straight into a terminal.
stdio, SSE and streamable-HTTP transports.
Quick start
You need uv (brew install uv on macOS).
Option 1: Claude Desktop extension (one click)
Download tryhackme-mcp-vX.Y.Z.mcpb from the latest release and double-click it. Claude Desktop asks for your (optional) session cookie and stores it in your OS keychain.
Option 2: Any MCP client (from PyPI)
Add this to your client's MCP config. For Claude Desktop that's ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.
{
"mcpServers": {
"tryhackme": {
"command": "uvx",
"args": ["tryhackme-mcp"],
"env": {
"THM_SESSION": "your_connect_sid_here",
"THM_ALLOW_WRITES": "0"
}
}
}
}Replace your_connect_sid_here with your cookie (how), or leave it as is for public content only. Quit Claude Desktop fully (Cmd+Q) and reopen it.
Claude Code
claude mcp add tryhackme -e THM_SESSION=your_connect_sid_here -- uvx tryhackme-mcpCursor (~/.cursor/mcp.json), Windsurf, VS Code (.vscode/mcp.json, under "servers"): use the same command, args and env as above.
Option 3: From source
git clone https://github.com/realarmaansidhu/tryhackme-mcp.git
cd tryhackme-mcp
uv syncThen point your client at it. See examples/claude_desktop_config.local-dev.json.
Claude Desktop can't find
uv/uvx? Use the absolute path fromwhich uvx(often/opt/homebrew/bin/uvx).
Authentication
Public tools need nothing. For thm_my_* tools, premium rooms your subscription covers, and machine control:
Log in at tryhackme.com.
Open DevTools (F12 or Cmd+Opt+I) โ Application (Chrome, Brave, Edge) or Storage (Firefox) โ Cookies โ
https://tryhackme.com.Copy the value of
connect.sid(it starts withs%3A).Paste it as
THM_SESSIONin your config, in place ofyour_connect_sid_here.
Steps for Firefox and Safari, the THM_COOKIE fallback, and the .mcpb keychain flow are in docs/authentication.md.
Variable | Default | Purpose |
| โ | Your |
| โ | Alternative: the full |
|
|
|
The cookie is a full login. Never commit it or share it. If it leaks, log out of all sessions on TryHackMe. Use thm_check_auth to see whether it's still valid.
Tools
Any room_code / path_code / module_code / username argument also accepts a full tryhackme.com URL.
Public (no login)
Tool | What it does |
| Search rooms, paths, modules or networks ( |
| Room metadata, upvotes and task list |
| One task as Markdown: content, commands, questions, hints |
| The whole room as one Markdown document |
| Every question and hint in a room, with no answers (for revision) |
| A module's rooms, in order |
| A learning path's modules and rooms |
| Top 50 monthly or all-time, worldwide or by country |
| Any user's level, rank, points, streak and path |
| Two users side by side |
| Rooms a user has completed |
| Badges with rarity |
| Public certificates |
| Top tools and this year's activity |
Your account (needs THM_SESSION)
Tool | What it does |
| Is your login valid? (safe fields only) |
| Level, rank, points (total and this month), rooms, badges, streak, league |
| Enrolled path, % done, hours, estimated finish |
| The next unfinished rooms in your path |
| The module you're working through |
| Your joined rooms: all, in-progress or completed |
| % complete for up to 50 rooms |
| Rooms TryHackMe recommends for you |
| Capability score components and trends |
| Weekly targets vs. your progress |
| Notifications (doesn't mark them read) |
| Followers and following |
| Running machines with IP, state, expiry and id |
| Streak progression |
Account changes (needs THM_SESSION and THM_ALLOW_WRITES=1)
Tool | What it does | |
| Start a room's target machine (first task with a VM, or | |
| Add 1 hour to a running machine | |
| Terminate a running machine | destructive |
| Recommend a room, or withdraw your recommendation | |
| Join a room | experimental |
| Leave a room | destructive, experimental |
There's deliberately no answer-submission tool. Submitting answers should be you, not your AI.
Endpoints behind every tool are documented in docs/API.md.
Prompts
These appear in your client's prompt menu (Claude Desktop: + โ tryhackme).
Prompt | What it does |
| Tutor mode: explains a room task by task, asks its questions, hints instead of answers |
| Writes 8 fresh questions to check real understanding |
| A day-by-day plan from your path, next rooms and weekly missions |
Usage examples
"Find free, easy rooms about privilege escalation."
"Teach me task 4 of
linuxfundamentalspart1, then quiz me. No answers.""What should I do next in my path? Plan my week around 6 hours."
"Start the machine for
furthernmapand tell me its IP when it's up.""Add an hour to my machine." / "Terminate my machine."
"Show the Canadian monthly leaderboard. Where do I rank?"
"Compare my profile with
tryhackme's.""List the rooms in the
linux-fundamentalsmodule."
How it works
Claude โโMCP (stdio)โโ> tryhackme-mcp โโHTTPS + your cookieโโ> tryhackme.com/api/v2/*Reads are plain
GETs to the same JSON endpoints the website uses.Module pages have no JSON endpoint, so their room list is read from the schema.org JSON-LD embedded in the page.
Writes follow the website's own flow: fetch a CSRF token from
/api/v2/auth/csrf, thenPOSTwith acsrf-tokenheader.Rooms have a URL slug and an internal code, which sometimes differ. Machine and vote calls resolve the internal code first.
Security & privacy
Your cookie is sent only to
https://tryhackme.com. Redirects aren't followed./users/selfcontains your email, phone number and Discord token. Onlyusername,isPremium,accountType,dateSignUp,verified,rolesand 2FA status get through, and tests enforce that.Your own past answers are hidden unless you pass
include_my_answers=true.Account-changing tools don't exist unless
THM_ALLOW_WRITES=1. When they do, they're annotated non-read-only, and destructive where relevant.No telemetry. Nothing is contacted except tryhackme.com.
See SECURITY.md.
Troubleshooting
Symptom | Fix |
Server missing in Claude Desktop | Check |
| Copy a fresh |
| Premium room without login, or a wrong code. Try |
| TryHackMe challenged the request. Wait and retry, and don't hammer it |
| Set |
| TryHackMe changed its API. Open an issue |
Inspect tools interactively:
npx @modelcontextprotocol/inspector uvx tryhackme-mcpDevelopment
uv sync --extra dev
uv run pytest -q # fully offline; every HTTP call is mockedsrc/tryhackme_mcp/
client.py HTTP client: cookies, CSRF, write gate, error mapping
formatting.py JSON/HTML โ Markdown, privacy whitelist
server.py MCP tools, prompts, CLI
tests/ offline tests (respx)
docs/API.md endpoint reference
manifest.json Claude Desktop extension (.mcpb) manifest
server.json MCP Registry metadataSee CONTRIBUTING.md for adding tools and cutting releases.
Disclaimer
This is an independent community project. It is not affiliated with, endorsed by or supported by TryHackMe Ltd. It relies on undocumented endpoints that may change without notice. Use it with your own account, at a human pace, and in line with TryHackMe's Terms of Service. It's for studying and managing your own learning, not for bulk scraping, redistributing premium content, or automating answers.
License
MIT. See LICENSE.
Available Tools
28 toolsthm_check_authARead-onlyIdempotent
Check whether a TryHackMe login is configured and still valid.
Inputs: no named parameters. Returns: result
thm_compare_profilesARead-onlyIdempotent
Compare two users' public profiles side by side (level, rank, points, rooms, badges, streak).
Inputs: username_a (required), username_b (required). Returns: result
thm_get_taskARead-onlyIdempotent
Get one task of a room as Markdown: the teaching content, commands, and questions.
include_hints: show the hints TryHackMe attaches to questions. include_my_answers: show answers YOU already submitted (needs login). Off by default.
Inputs: task_no (required), room_code (required), include_hints, include_my_answers. Returns: result
thm_leaderboardBRead-onlyIdempotent
TryHackMe's points leaderboard (top 50), worldwide or for one country.
country: two-letter code, e.g. 'ca', 'us', 'in'. Empty = worldwide. With login, also shows your own rank on that board.
Inputs: limit, period, country. Returns: result
thm_moduleARead-onlyIdempotent
Get a module (a themed group of rooms, e.g. 'linux-fundamentals') and its rooms in order.
module_code: e.g. 'linux-fundamentals' or a tryhackme.com/module/... URL. Find codes with thm_search(kind='modules').
Inputs: module_code (required). Returns: result
thm_my_capability_scoreBRead-onlyIdempotent
Your TryHackMe capability score and its components (foundation, activity, specialism...), with trends.
Inputs: no named parameters. Returns: result
thm_my_current_moduleBRead-onlyIdempotent
The module you're currently working through, with your progress.
Inputs: no named parameters. Returns: result
thm_my_current_pathBRead-onlyIdempotent
Your enrolled learning path, completion %, hours done and estimated finish date.
Inputs: no named parameters. Returns: result
thm_my_next_roomsBRead-onlyIdempotent
What to study next: the first unfinished rooms in your enrolled learning path, in order.
Inputs: limit. Returns: result
thm_my_notificationsARead-onlyIdempotent
Your TryHackMe notifications (read-only: this does not mark them as read).
Inputs: limit, unread_only. Returns: result
thm_my_recommendationsCRead-onlyIdempotent
Rooms TryHackMe recommends for you, with difficulty and time.
Inputs: limit. Returns: result
thm_my_room_progressBRead-onlyIdempotent
Your completion % for one or more rooms (max 50).
Inputs: room_codes (required). Returns: result
thm_my_roomsCRead-onlyIdempotent
Rooms you've joined, optionally only in-progress or completed ones.
Inputs: page, limit, search, status. Returns: result
thm_my_running_machinesARead-onlyIdempotent
List your currently running TryHackMe machines (VMs): id, room, state, private IP, expiry.
Inputs: no named parameters. Returns: result
thm_my_socialCRead-onlyIdempotent
Your followers / people you follow on TryHackMe, with their points and streaks.
Inputs: page, list_type. Returns: result
thm_my_statsARead-onlyIdempotent
Your own stats: level, rank, points (total + this month), rooms, modules, badges, streak, league.
Inputs: no named parameters. Returns: result
thm_my_streakCRead-onlyIdempotent
Your streak and weekly mission progression.
Inputs: no named parameters. Returns: result
thm_my_weekly_missionsARead-onlyIdempotent
This week's missions (rooms, questions, streak days): your progress vs. the targets.
Inputs: no named parameters. Returns: result
thm_path_outlineARead-onlyIdempotent
Get a learning path's modules and rooms in order, with time estimates.
With login, rooms show your progress percentage. path_code: e.g. 'jrpenetrationtester', 'beginner', 'presecurity', or a path URL.
Inputs: path_code (required). Returns: result
thm_profile_badgesCRead-onlyIdempotent
List a user's earned badges with rarity.
Inputs: username (required), page, limit. Returns: result
thm_profile_certificatesARead-onlyIdempotent
List a user's public TryHackMe certificates (path completions, SAL1, etc.).
Inputs: username (required). Returns: result
thm_profile_completed_roomsBRead-onlyIdempotent
List the rooms a user has completed (public profile data).
Inputs: username (required), page, limit. Returns: result
thm_profile_skillsCRead-onlyIdempotent
Show a user's top tools and yearly activity summary.
Inputs: username (required). Returns: result
thm_public_profileBRead-onlyIdempotent
Get any user's public TryHackMe profile: level, rank, points, rooms, badges, streak, path.
Inputs: username (required). Returns: result
thm_room_fullBRead-onlyIdempotent
Export a whole room (overview + every task + questions) as one Markdown document.
Inputs: room_code (required), include_hints. Returns: result
thm_room_overviewBRead-onlyIdempotent
Get a room's metadata (difficulty, type, creators, tags, paths) and its task list.
room_code: e.g. 'linuxfundamentalspart1' or a full tryhackme.com/room/... URL.
Inputs: room_code (required). Returns: result
thm_room_questionsARead-onlyIdempotent
Only the questions (and hints) of every task in a room, for revision or quizzing.
No teaching content and no answers. Pair with thm_get_task to study a task first.
Inputs: room_code (required), include_hints. Returns: result
thm_searchARead-onlyIdempotent
Search TryHackMe rooms, learning paths, modules or networks by keyword.
Returns titles, codes, difficulty, free/premium and estimated time. Use the returned code with thm_room_overview / thm_path_outline.
Inputs: kind, page, limit, order, +2 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 28 tools
The thm_my_*, thm_profile_*, thm_room_*, and thm_path_* prefixes give an agent a reliable first-cut mental model, and descriptions explicitly explain when to use e.g. thm_room_overview vs thm_room_full vs thm_room_questions. A handful of pairs still require careful reading: thm_my_stats vs thm_my_capability_score vs thm_my_streak, and thm_my_current_path vs thm_my_current_module vs thm_my_next_rooms.
All 28 tools use snake_case with a uniform thm_ prefix, which is highly predictable. The only deviation is style rather than convention: some names are verb-led (thm_search, thm_get_task, thm_check_auth) while others are noun-led (thm_room_overview, thm_profile_badges, thm_module), though each remains readable and consistent within its prefix family.
28 tools is on the heavy side, and the thm_my_* family alone accounts for 15 narrow slices that could be consolidated (stats, streak, capability score, weekly missions, and recommendations are all 'my progress' views). The breadth of the domainโrooms, tasks, paths, modules, profiles, leaderboard, machinesโpartly justifies the count, but it sits at the borderline where an agent must scan a lot of names to pick correctly.
Coverage is strong for a read-only knowledge/progress server: discovery, room content, tasks, paths, modules, public and private profile views, progress tracking, machines, leaderboard, and social are all present. Minor gaps remainโno way to start/stop running machines despite thm_my_running_machines existing, and no badge/certificate detail lookup by identifier.
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Official EduBase MCP server: training, exams, competencies and results from your AI assistant
Quality-ranked, cross-platform directory of AI coding skills, plugins and MCP servers.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP server that bridges ChatGPT Plus/Pro to Claude Code, enabling chat, deep research, and image generation via your own account.52 PyPI51MIT
- AlicenseNot gradedqualityDmaintenanceAn AI tutoring system that runs as an MCP server, allowing Claude to access and interact with your local educational materials to provide personalized tutoring based on your actual course content.MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that transforms course syllabi into structured, queryable data โ accessible directly from Claude.ai.1-
- AlicenseNot gradedqualityCmaintenanceMCP server that gives Claude Desktop access to school data from Studie+ (Danish school platform), enabling queries about schedules, homework, assignments, and files directly in chat.MIT