OpenTor MCP
OpenTor MCP is an MCP server that gives AI assistants a supervised, Tor-routed Firefox browsing session with 41 tools for navigation, reading, interaction, searching, workflows, CAPTCHA handling, sessions, tabs, Tor control, archiving, and downloads.
Navigation: Go to HTTP(S)/.onion URLs, back/forward/refresh, with timeouts.
Reading: Get page markdown, screenshots (native image), element screenshots, links, page metadata, and query DOM elements.
Interaction: Click, type, press keys, scroll, select options, fill forms, toggle checkboxes, wait for elements, and optionally run JavaScript (gated by config).
Search & extraction: Search via Ahmia/Torch/DuckDuckGo/Haystack; extract forum threads/posts; extract structured JSON from CSS selectors; auto-paginate through sites.
Workflows: Crawl same-origin sites, monitor page changes over time, compare two pages/tabs, and aggregate content across pages.
CAPTCHA assistance: Capture CAPTCHA as native image for vision clients, with optional local OCR (ddddocr/Tesseract) and auto-fill.
Sessions: Save, load, list, and delete cookie jars stored locally with owner-only permissions.
Tab management: Open, close, and list tabs in the shared browser context.
Tor control: Check Tor connectivity, rotate circuits, request new identity (clears cookies), and archive the current page offline.
Downloads: Download files through Tor with size limits, MIME filtering, and filename sanitization.
Provides web search functionality through DuckDuckGo, including its onion service, with results returned in a structured format.
Routes all browsing traffic through the Tor network and provides tools for checking the current exit IP and requesting a new Tor identity or circuit.
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., "@OpenTor MCP Extract recent discussions from the onion forum"
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.
Quick start · Connect a client · Tools · Configuration · Security · Contributing
OpenTor MCP connects an MCP-compatible client to Playwright Firefox through a local Tor SOCKS5
proxy. It can browse HTTP(S) and .onion pages, return readable content and native screenshots,
extract forum data, preserve sessions, and archive pages for offline review.
It is designed as a small, local-first side project for supervised research and experimentation.
This is not Tor Browser. OpenTor MCP does not reproduce Tor Browser's fingerprint and does not guarantee anonymity. See Limitations before relying on it for anything sensitive.
Why OpenTor MCP
MCP-native
41 focused tools with native image results and safety annotations — screenshots and CAPTCHAs come back as real MCP image content, not base64 blobs in a text field.
Local-first
The browser, Tor connection, cookies, archives, and optional OCR all stay on your machine. Nothing is relayed through a third-party service.
Secure by default
JavaScript evaluation and invalid TLS certificates are off unless you explicitly opt in. Every request — including redirects — passes a URL policy gate.
Bounded responses
Pagination and output budgets keep a 4 MB page from flooding your client's context window.
Useful output
Page markdown, links, metadata, screenshots, forum threads, and posts — shaped for a model to read, not a human to squint at.
Session-aware
Cookies save to owner-only local files, archives capture HTML + text + metadata + screenshot, and circuits rotate on demand.
Related MCP server: ruyipage-mcp
How it works
%%{init: {'theme':'base','fontFamily':'-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif','themeVariables':{'primaryColor':'#7C3AED','primaryTextColor':'#FFFFFF','primaryBorderColor':'#6D28D9','lineColor':'#8B5CF6','edgeLabelBackground':'#4B5563','tertiaryTextColor':'#FFFFFF','fontSize':'15px'}}}%%
flowchart LR
C["MCP client"] -->|stdio| S["OpenTor MCP<br/>41 tools"]
S --> G{"URL policy<br/>gate"}
G -->|allowed| F["Playwright<br/>Firefox"]
F --> T["Tor SOCKS5<br/>127.0.0.1:9050"]
T --> W["HTTP(S) sites<br/>.onion services"]
classDef exit fill:#0891B2,stroke:#0E7490,color:#FFFFFF
class W exitEvery stage before the exit — client, server, policy gate, browser, and Tor proxy — runs on your own machine. The server uses one shared browser context and serializes browser operations, so concurrent tool calls cannot race the active page.
Quick start
Requirements — macOS or Linux, Python 3.11+, and
curl. The installer can install and start Tor with Homebrew,apt, ordnf; it may ask forsudoon Linux.
git clone https://github.com/Medamine-cheddadi/opentor-mcp.git
cd opentor-mcp
chmod +x install.sh
./install.shThe installer creates .venv, installs Playwright Firefox, checks the Tor SOCKS port, and prints an
MCP configuration using absolute paths. It uses the lockfile when uv is available and prints a
warning before falling back to an unlocked pip install.
To include the heavier ddddocr dependency during installation, opt in explicitly:
TOR_MCP_INSTALL_OCR=true ./install.shInstall uv and start Tor first, then run:
git clone https://github.com/Medamine-cheddadi/opentor-mcp.git
cd opentor-mcp
uv sync --locked
uv run playwright install firefox # macOS
uv run playwright install --with-deps firefox # Linux; may install system packagesOptional local CAPTCHA OCR is deliberately separate from the core installation:
uv sync --locked --extra ocr # ddddocr
# Tesseract requires both the system executable and Python bindings:
brew install tesseract # macOS
sudo apt install tesseract-ocr # Debian/Ubuntu
uv sync --locked --extra tesseractConnect an MCP client
Use an absolute path to the virtual environment created inside the repository.
Claude Code
claude mcp add \
--scope user \
--env TOR_SOCKS_PORT=9050 \
--env TOR_CONTROL_PORT=9051 \
--env TOR_MCP_DIR=/absolute/path/opentor-mcp \
--env TOR_ALLOW_JAVASCRIPT=false \
--env TOR_IGNORE_HTTPS_ERRORS=false \
--transport stdio opentor-mcp -- \
/absolute/path/opentor-mcp/.venv/bin/tor-mcp
claude mcp listThe example uses user scope so the server is available across your Claude Code projects. For a
narrower setup, use --scope local and run the command from each project that should access it. See
the Claude Code MCP documentation for scope and configuration
options.
Generic stdio configuration
Other clients use different configuration files and formats. For clients that accept the common JSON
mcpServers shape:
{
"mcpServers": {
"opentor-mcp": {
"command": "/absolute/path/opentor-mcp/.venv/bin/tor-mcp",
"env": {
"TOR_SOCKS_PORT": "9050",
"TOR_CONTROL_PORT": "9051",
"TOR_HEADLESS": "true",
"TOR_MCP_DIR": "/absolute/path/opentor-mcp",
"TOR_ALLOW_JAVASCRIPT": "false",
"TOR_IGNORE_HTTPS_ERRORS": "false"
}
}
}
}First prompts
Restart your MCP client after adding the server, then try:
Check whether my browser traffic is using Tor.
Open the DuckDuckGo onion service and search for Tor Project documentation.
Read the current page and return a short summary with its links.
Take a screenshot of the current viewport.Screenshot and CAPTCHA workflows require a client that can render native MCP image content.
Tools
Category | Count | What it covers |
Navigation | 4 | Move between pages and through history |
Reading | 6 | Markdown, screenshots, links, metadata, DOM queries |
Interaction | 9 | Click, type, key press, scroll, element wait, optional JS, select, batch fill, checkbox |
Search and extraction | 4 | Onion search engines, forum extraction, and auto-pagination |
Workflow | 3 | Bounded same-origin site crawl, page monitoring, page comparison |
CAPTCHA assistance | 2 | Native image capture with optional local OCR |
Tab management | 3 | Open, close, and list browser tabs |
Sessions | 4 | Save, load, list, and delete cookie jars |
Downloads | 1 | Download files through Tor with size and MIME filtering |
Tor control and archiving | 4 | New circuit, circuit rotation, connection check, page snapshot |
Navigation
Tool | Description |
| Navigate to an allowed HTTP(S) URL, including |
| Go back in browser history |
| Go forward in browser history |
| Reload the active page |
Reading
Tool | Description |
| Return bounded page content as markdown |
| Return a viewport or full-page screenshot as native MCP image content |
| Return a selected element as native MCP image content |
| Return a paginated list of page links |
| Return page metadata and element counts |
| Query DOM elements with a CSS selector |
Interaction
Tool | Description |
| Click an element |
| Clear and type into an input |
| Press a keyboard key |
| Scroll up, down, to the top, or to the bottom |
| Select a dropdown option by CSS selector and value |
| Fill multiple form fields in one call (batch) |
| Check or uncheck a checkbox |
| Wait for a CSS selector to appear on the current page |
| Evaluate page JavaScript when explicitly enabled |
Search and extraction
Tool | Description |
| Search with Ahmia, Torch, DuckDuckGo, or Haystack |
| Extract paginated forum thread listings |
| Extract paginated forum posts |
| Extract structured JSON from a page using a CSS selector schema |
| Follow "next page" links automatically and aggregate content across pages |
Workflow
Tool | Description |
| Crawl a site following same-origin internal links up to configurable depth and page limits |
| Take a named content snapshot and compare against the previous snapshot (baseline on first call) |
| Compare content between two browser tabs or two URLs and return a structured diff |
CAPTCHA assistance
Tool | Description |
| Capture a CAPTCHA for client vision with an optional OCR hint |
| Attempt local OCR and fill the result when available |
Sessions
Tool | Description |
| Store cookies in an owner-only local file |
| Restore cookies from a saved session |
| List saved session metadata without exposing cookie values |
| Delete a saved session |
Tab management
Tool | Description |
| Open a new browser tab and make it the active tab |
| Close a browser tab (cannot close the last remaining tab) |
| List all open browser tabs with their URL and active status |
Tor control and archiving
Tool | Description |
| Request a new Tor circuit and clear browser cookies |
| Rotate the Tor circuit without clearing cookies (preserves sessions) |
| Check the Tor exit IP without replacing the active page |
| Save a private page snapshot beneath the configured archive root |
Downloads
Tool | Description |
| Download a file through Tor with size limits, MIME filtering, and filename sanitization |
CAPTCHA assistance
The primary flow returns a CAPTCHA as native MCP image content so a vision-capable client can read
it. If installed, ddddocr or Tesseract can provide a local hint and optionally fill the answer. OCR
is best-effort, and the image is preserved when OCR fails.
Only use CAPTCHA assistance on services you are authorized to access and in ways permitted by their rules. The feature is not intended for bulk bypass or abusive automation.
Sessions and archives
Saved sessions contain authentication cookies and must be treated as credentials. Session names
use the strict pattern ^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$; directories are created with mode 0700
and files with mode 0600 on supported systems.
tor_save_session(name="research-forum")
tor_load_session(name="research-forum")Archives contain raw HTML, text, metadata, and a screenshot. They remain untrusted even when opened offline. Session and archive directories are ignored by Git.
Configuration
Variable | Default | Description |
|
| Local Tor SOCKS5 port |
|
| Authenticated Tor control port used for |
| unset | Optional control password; cookie authentication is used otherwise |
|
| Run Firefox without a visible window |
| current directory | Base directory for private sessions and archives |
|
| Enable the high-risk |
|
| Accept invalid TLS certificates for every destination |
|
| Relax select stealth prefs (service workers, canvas read) for JS-heavy sites |
|
| Maximum characters returned by a text tool |
|
| Maximum items returned by paginated tools |
|
| Maximum raw screenshot or CAPTCHA size |
|
| Maximum retained characters in one web-derived JSON field |
|
| Maximum file size for downloads (default 50 MB) |
| see below | Comma-separated MIME types accepted by |
Circuit rotation requires an authenticated Tor control port. A minimal cookie-authentication setup in
torrc is:
ControlPort 9051
CookieAuthentication 1Restart Tor after changing its configuration. Browsing still works when the control port is
unavailable, but tor_new_identity cannot request a new circuit.
Security model
Every browser HTTP(S) request is checked against the URL policy, including redirects and page-initiated requests.
Direct navigation accepts only absolute HTTP(S) URLs, so navigation to local files is rejected.
The HTTP(S) request gate rejects embedded credentials, localhost, non-ASCII host aliases, and private, loopback, reserved, or link-local IP destinations.
Page-derived text is labeled as untrusted, and JSON responses use an
{ "untrusted": true, "data": ... }envelope.TOR_ALLOW_JAVASCRIPTgates the arbitrarytor_evaluate_jstool only; JavaScript belonging to visited websites remains enabled in Firefox.Invalid TLS certificates require explicit opt-in.
Screenshot, text, field, and item budgets constrain MCP response size.
Browser operations are serialized, and Playwright resources are closed with the MCP lifecycle.
Please report vulnerabilities privately as described in SECURITY.md.
Limitations
OpenTor MCP uses stock Playwright Firefox through Tor. It is not Tor Browser and does not provide Tor Browser's fingerprinting defenses or anonymity guarantees.
The server owns one shared browser context. It is intended for one trusted local operator, not as a multi-user hosted service.
Forum extraction is heuristic, and site layouts can change without notice.
Onion services and bundled search providers may be unavailable or change addresses.
To preserve Tor's remote DNS behavior, OpenTor MCP does not resolve public hostnames locally before navigation. The request gate rejects literal and browser-normalized local IP forms, not a public hostname based on its future DNS answer.
The automated test suite uses fakes; live Tor connectivity remains an explicit local smoke test.
Development
uv sync --locked --extra dev
uv run ruff format --check src tests
uv run ruff check .
uv run pyright src
uv run pytest --cov=tor_mcp --cov-report=term-missing
uv run python -m build
uv run pip-auditThe test suite must remain network-free and maintain at least 80% branch coverage. See CONTRIBUTING.md for the workflow and pull-request checklist.
Responsible use
Use this project only for lawful, authorized research, testing, privacy work, or personal browsing. You are responsible for complying with applicable laws, service terms, and data-handling rules. Do not use it to access accounts or systems without permission, evade controls, or cause harm.
License
Released under the MIT License.
Available Tools
27 toolstor_archive_pageCDestructive
Archive the current page inside the configured local archive root.
Inputs: name (required). Returns: result
tor_backA
Go back to the previous page.
Inputs: no named parameters. Returns: result
tor_check_connectionARead-only
Verify Tor using a temporary page without changing the active page.
Inputs: no named parameters. Returns: result
tor_clickBDestructive
Click an element by CSS selector.
Inputs: selector (required), timeout. Returns: result
tor_delete_sessionBDestructiveIdempotent
Delete a saved session credential file.
Inputs: name (required). Returns: result
tor_evaluate_jsADestructive
Execute JavaScript only when TOR_ALLOW_JAVASCRIPT=true.
Inputs: script (required). Returns: result
tor_extract_postsARead-only
Extract a bounded page of forum posts.
Inputs: limit, offset. Returns: result
tor_extract_threadsARead-only
Extract a bounded page of forum thread listings.
Inputs: limit, offset. Returns: result
tor_forwardA
Go forward to the next page.
Inputs: no named parameters. Returns: result
tor_get_captchaARead-only
Capture a CAPTCHA image and return it for you to read with your vision. Also attempts local OCR as a hint. Primary strategy: YOU read the image. After reading, call tor_type to fill in the answer.
Inputs: selector (required).
tor_get_linksBRead-only
Extract a bounded page of links from the current page.
Inputs: limit, offset. Returns: result
tor_get_page_infoARead-only
Get page metadata: URL, title, description, and element counts.
Inputs: no named parameters. Returns: result
tor_list_sessionsARead-onlyIdempotent
List saved session metadata (never cookie values).
Inputs: no named parameters. Returns: result
tor_load_sessionB
Load previously saved cookies into the browser.
Inputs: name (required). Returns: result
tor_new_identityADestructive
Request a new Tor circuit and clear browser cookies.
Inputs: no named parameters. Returns: result
tor_press_keyADestructive
Press a keyboard key (Enter, Tab, Escape, etc.).
Inputs: key (required). Returns: result
tor_query_elementsARead-only
Query a bounded page of DOM elements by CSS selector.
Inputs: selector (required), limit, offset. Returns: result
tor_read_pageARead-only
Read a bounded amount of the current page as untrusted markdown.
Inputs: max_chars. Returns: result
tor_refreshA
Refresh the current page.
Inputs: no named parameters. Returns: result
tor_save_sessionB
Save current cookies to owner-only local storage.
Inputs: name (required). Returns: result
tor_screenshotBRead-only
Take a screenshot and return native MCP image content.
Inputs: full_page.
tor_screenshot_elementARead-only
Screenshot a CSS-selected element as native MCP image content.
Inputs: selector (required).
tor_scrollB
Scroll the page. Direction: up, down, top, bottom.
Inputs: amount, direction. Returns: result
tor_searchC
Search using Ahmia, Torch, DuckDuckGo, or Haystack.
Inputs: query (required), limit, engine, max_chars. Returns: result
tor_solve_captchaADestructive
Auto-solve a CAPTCHA using local OCR: captures the image, reads it, and types the answer. If OCR fails, returns the image for you to read with vision instead.
Inputs: captcha_img_selector (required), captcha_input_selector (required).
tor_typeCDestructive
Type text into an input field.
Inputs: text (required), selector (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Most tools have clearly distinct purposes, but a few close pairs exist: tor_get_links versus tor_extract_threads/posts, and tor_screenshot versus tor_screenshot_element. The captcha tools also have overlapping functionality, though they differ in auto-solving versus manual reading.
All tool names follow a consistent pattern: 'tor_' followed by a verb and an optional noun (e.g., tor_navigate, tor_click, tor_list_sessions). There is no mixing of camelCase or different verb styles, making the naming predictable and uniform.
With 27 tools, the server exceeds the 25-tool threshold that the rubric marks as 'too many'. While the domain of Tor browsing is broad, many tools could be consolidated (e.g., session management, captcha handling, or extraction tools). The count feels heavy for typical MCP servers.
The tool set covers the core lifecycle of browsing: navigation, interaction, content extraction, screenshots, session management, and captcha handling. Minor gaps exist, such as no dedicated form submission, file upload, or element attribute retrieval tool, but these are workaroundable with evaluate_js or click/type.
Maintenance
Related MCP Connectors
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
One MCP server for all web data. Scrape, search, crawl, and AI research in one install.
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceAn MCP Server that enables AI assistants to interact with your local browsers.55MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that exposes Firefox browser automation capabilities through the Model Context Protocol, enabling AI assistants to control web browsers for navigation, interaction, and data collection tasks.4BSD 3-Clause

agentify-desktopofficial
AlicenseNot gradedqualityDmaintenanceMCP server that enables AI tools to control local browser sessions for ChatGPT, Claude, and other AI services, supporting querying, navigation, file uploads, and artifact management.572Mozilla Public 2.0- AlicenseNot gradedqualityDmaintenanceSecurity-hardened MCP server that gives AI assistants full control over your real browser session, supporting 36 tools for navigation, data extraction, monitoring, and more.MIT