Tor Server
FreeNot checkedEnables secure access to Tor/onion services with content filtering and safety guardrails for AI assistants.
About
Enables secure access to Tor/onion services with content filtering and safety guardrails for AI assistants.
README
A Model Context Protocol (MCP) server that provides secure access to Tor/onion services with built-in content filtering and safety guardrails. This server allows AI assistants like Claude to safely browse .onion sites and access content through the Tor network while maintaining strong safety protections.
🌟 Features
- Tor Network Access: Connect to .onion services and browse through Tor anonymously
- Content Filtering: Configurable keyword and domain filtering with safety guardrails
- Safety First: Built-in protections against harmful content with customizable filters
- JSON Configuration: Easy-to-manage configuration file for all settings
- Connection Testing: Built-in tools to verify Tor connectivity and service status
- Content Redaction: Automatic filtering of sensitive information (emails, SSNs, etc.)
- Flexible Timeouts: Configurable connection and request timeouts
- Real-time Filter Management: Dynamic filter configuration without restart
🛠️ Installation
Prerequisites
Tor Browser or Tor Service must be running on your system
- Download from: https://www.torproject.org/download/
- Default SOCKS proxy runs on
127.0.0.1:9150(Tor Browser) or127.0.0.1:9050(Tor service)
Python 3.8+ is required
Setup
- Clone this repository:
git clone <your-repo-url>
cd tor-mcp-server
- Install dependencies:
pip install -r requirements.txt
Create your configuration file (see Configuration section below)
Run the server:
python tor_mcp_server.py
⚙️ Configuration
Create a tor_config.json file in the same directory as the server script. Here's the default configuration:
{
"tor_settings": {
"socks_port": 9150,
"host": "127.0.0.1",
"timeout_seconds": 60,
"connect_timeout_seconds": 30
},
"content_filtering": {
"enabled": true,
"blocked_keywords": [
"\\bchild abuse\\b",
"\\bdrug dealer\\b",
"\\bhuman trafficking\\b"
],
"warning_keywords": [
"ransomware",
"malware",
"stolen data"
],
"blocked_domains": [],
"blocked_url_patterns": [
".*porn.*",
".*adult.*"
],
"allowed_domains": [],
"enable_content_redaction": true,
"max_content_length": 100000
},
"server_settings": {
"server_name": "tor-access",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0",
"max_redirects": 5
}
}
Configuration Options
Tor Settings
socks_port: Port for Tor SOCKS proxy (9150 for Tor Browser, 9050 for Tor service)host: Host address for Tor proxy (usually 127.0.0.1)timeout_seconds: Total request timeoutconnect_timeout_seconds: Connection establishment timeout
Content Filtering
enabled: Enable/disable content filteringblocked_keywords: Keywords that will block content entirely (supports regex)warning_keywords: Keywords that will show warnings but allow contentblocked_domains: Domain names to block completelyblocked_url_patterns: URL patterns to block (regex supported)allowed_domains: Whitelist of allowed domains (empty = allow all except blocked)enable_content_redaction: Automatically redact sensitive info (emails, SSNs, etc.)max_content_length: Maximum content length to display
🔧 Available Tools
The server provides four main tools:
1. tor_connect
Test your Tor connection and verify it's working properly.
Usage:
{
"tool": "tor_connect",
"arguments": {}
}
Returns: Connection status, your real IP vs Tor exit IP
2. tor_fetch
Fetch content from onion services or regular websites through Tor.
Usage:
{
"tool": "tor_fetch",
"arguments": {
"url": "http://example.onion",
"timeout": 30
}
}
Parameters:
url(required): The onion service URL or regular URL to fetchtimeout(optional): Request timeout in seconds (default: 30)
3. tor_status
Check if Tor service is running and accessible.
Usage:
{
"tool": "tor_status",
"arguments": {}
}
4. tor_configure_filters
Dynamically configure content filtering settings.
Usage:
{
"tool": "tor_configure_filters",
"arguments": {
"action": "add_blocked_keyword",
"value": "malicious_term"
}
}
Actions:
add_blocked_keyword/remove_blocked_keywordadd_warning_keyword/remove_warning_keywordadd_blocked_domain/remove_blocked_domainlist_filters: Show current filter configurationreload_config: Reload configuration from file
🛡️ Safety Features
Content Filtering
- Keyword Filtering: Block or warn on configurable keywords (with regex support)
- Domain Blocking: Block entire domains or URL patterns
- Content Analysis: Heuristic detection of ransomware sites and illegal marketplaces
- Content Redaction: Automatic removal of emails, SSNs, credit cards from displayed content
Built-in Protections
- Blocks harmful content categories by default
- Warns on potentially dangerous content
- Rate limiting and content size limits
- Safe defaults with ability to customize
Responsible Use
This tool is designed for:
- ✅ Security research and education
- ✅ Privacy-focused browsing
- ✅ Accessing legitimate onion services
- ✅ Investigating threats for cybersecurity purposes
Not intended for:
- ❌ Accessing illegal content
- ❌ Bypassing legitimate restrictions
- ❌ Any harmful or illegal activities
🚀 Usage with Claude/MCP
- Start the Tor MCP Server
- Configure your MCP client to connect to the server
- Use natural language commands:
- "Test my Tor connection"
- "Fetch content from [onion-url]"
- "Check if Tor is running"
- "Add 'suspicious-term' to blocked keywords"
📋 Requirements
- Python 3.8+
- Tor Browser or Tor service running
- Dependencies from
requirements.txt:- mcp>=1.0.0
- aiohttp>=3.8.0
- aiohttp-socks>=0.8.0
- pydantic>=2.0.0
- openai>=1.0.0
🔍 Troubleshooting
Common Issues
"Tor connection failed"
- Ensure Tor Browser is running or Tor service is started
- Check if the SOCKS port (9150/9050) is correct
- Verify host/port settings in config
"Content blocked"
- Content triggered safety filters
- Review and adjust
blocked_keywordsorblocked_domainsin config - Use
tor_configure_filtersto modify filters
"Request timed out"
- Increase timeout values in config
- Onion services can be slow - try longer timeouts
- Check if the onion service is online
Debug Mode
Run with verbose logging:
PYTHONPATH=. python tor_mcp_server.py --verbose
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Submit a pull request
⚠️ Disclaimer
This tool is for legitimate security research and privacy purposes only. The authors are not responsible for misuse. Always comply with applicable laws and use responsibly.
Need help? Open an issue on GitHub or check the troubleshooting section above.
Installing Tor Server
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/pjv4yj/tor-mcp-serverFAQ
Is Tor Server MCP free?
Yes, Tor Server MCP is free — one-click install via Unyly at no cost.
Does Tor Server need an API key?
No, Tor Server runs without API keys or environment variables.
Is Tor Server hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Tor Server in Claude Desktop, Claude Code or Cursor?
Open Tor Server on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzCompare Tor Server with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
