Listed from the MCP registry; nobody on Odel publishes it.
Tor HTTP and SOCKS5 proxy with REST API and built-in MCP server.
Runs on your machine from its package; the steps are below.
At most: moves money, runs code or commands, deletes data, or sends messages for you.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
docker run -i --rm docker.io/hapheus/torproxy:2.7.11
MCP client config
{
"mcpServers": {
"torproxy": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"docker.io/hapheus/torproxy:2.7.11"
]
}
}
}Quick Start · Transparent Gateway · Model Context Protocol (MCP) · Use Cases · Architecture · REST API · Configuration · Examples · Contributing
A production-grade, leak-proof Tor HTTP and SOCKS5 proxy packaged for Docker. Route entire container stacks without touching application code, equip AI coding assistants (Claude Desktop, Cursor) with native Tor tools via MCP, and rotate circuits dynamically with a single REST call.
network_mode: "service:torproxy" — zero app config changes.SIGNAL NEWNYM) and select exit node countries on the fly via REST.torproxy), with ephemeral cookie authentication for Tor control.Get up and running with a verified Tor circuit in seconds:
Clone and run via Docker Compose:
docker compose up -d
Or launch directly via Docker Run without cloning:
docker run -d --name torproxy --restart unless-stopped \
-p 127.0.0.1:8118:8118 -p 127.0.0.1:9050:9050 -p 127.0.0.1:8080:8080 \
hapheus/torproxy:latest
# Verify HTTP proxy (returns {"IsTor": true, "IP": "..."})
curl -x http://127.0.0.1:8118 https://check.torproject.org/api/ip
# Verify SOCKS5 proxy with remote DNS resolution
curl --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip
# Check live connection status via REST API
curl -s http://127.0.0.1:8080/status | jq .
Important
Leak-Proof Guarantee (Fail-Closed): If Tor disconnects or crashes, Privoxy immediately returns 503 Service Unavailable and the Netfilter kill switch drops outgoing packets. Your real IP will never silently leak to clearnet under network failures.
Security Note: In
docker-compose.yml, all ports bind strictly to127.0.0.1by default. Neither the proxy listeners nor the management API require authentication; do not expose them to untrusted networks.
# Request a fresh Tor identity without restarting the container:
curl -X POST http://127.0.0.1:8080/reconnect
# Switch exit country dynamically on reconnect:
curl -X POST "http://127.0.0.1:8080/reconnect?country=DE"
# Switch with strict exit country enforcement via JSON payload:
curl -X POST http://127.0.0.1:8080/reconnect \
-H "Content-Type: application/json" \
-d '{"country": "AT", "strict_nodes": true}'
# Or launch with a default country at startup:
TORPROXY_COUNTRY=DE docker compose up -d
Understanding where torproxy excels helps you pick the right tool for the job:
.onion pages safely.TORPROXY_COUNTRY=DE,AT,US).Host Client / Dependent Containers
│
├── HTTP Requests ────────► Privoxy (:8118)
│ │ (forward-socks5t)
├── SOCKS5 Requests ──────────┼───────────────► Tor Daemon (:9050)
│ │ │
└── REST Control API ─────► API Server (:8080) │ (Cookie Auth)
│ │
└─ ControlPort ─────┘ (:9051 loopback)
│
▼
Tor Onion Network
▼
Target Website
Route any existing Docker container's entire outbound TCP and DNS traffic automatically through Tor — without modifying your applications or adding proxy flags.
services:
torproxy:
image: hapheus/torproxy:latest
pull_policy: always
cap_add:
- NET_ADMIN
environment:
TORPROXY_GATEWAY_MODE: "true"
TORPROXY_COUNTRY: ${TORPROXY_COUNTRY:-}
restart: unless-stopped
# Attach any application container directly to torproxy's network namespace:
my-app:
image: curlimages/curl:latest
network_mode: "service:torproxy"
depends_on:
torproxy:
condition: service_healthy
command: ["-s", "https://check.torproject.org/api/ip"]
HTTP_PROXY, ALL_PROXY, or browser arguments.tor user may reach the WAN (owner --uid-owner); the API, Privoxy, and attached app containers cannot bypass the kill switch.torproxy includes a built-in, zero-dependency Model Context Protocol (MCP) server on port 2501 (SSE) and via Stdio (torproxy mcp), allowing AI agents (Claude Desktop, Cursor, Antigravity) to manage Tor circuits and execute anonymized web requests directly.
claude_desktop_config.json)Connect Claude Desktop to your running torproxy container via Stdio without exposing host ports:
{
"mcpServers": {
"torproxy": {
"command": "docker",
"args": ["exec", "-i", "torproxy", "torproxy", "mcp"]
}
}
}
.cursor/mcp.json)Connect via HTTP/SSE:
{
"mcpServers": {
"torproxy": {
"url": "http://127.0.0.1:2501/sse"
}
}
}
Or use the root-level .mcp.json manifest auto-detected by Cursor and cursor.directory on workspace open.
smithery.yaml)Install directly with zero configuration via Smithery.ai:
npx -y @smithery/cli install hapheus/torproxy --client claude
torproxy_fetch: Zero-config fetch — execute HTTP/HTTPS or .onion requests strictly routed through Tor (no local curl or host proxy setup needed).torproxy_status: Retrieve live bootstrap progress, egress IP, and GeoIP metadata.torproxy_get_ip: Query the current verified Tor exit IP.torproxy_reconnect: Request a new Tor identity (SIGNAL NEWNYM), optionally changing exit country (country="DE").torproxy_health & torproxy_diagnostics: Automated operational health and circuit diagnostics.See docs/mcp.md for full configuration details, authentication options, and tool schemas.
| Interface | Default Port | Internal Service | Description |
|---|---|---|---|
| HTTP Proxy | 8118 | Privoxy | HTTP/HTTPS forward proxy routing traffic to Tor. Fails closed (500/503) if Tor is disconnected. |
| SOCKS5 Proxy | 9050 | Tor | Direct Tor SOCKS5 listener. Supports remote DNS resolution via socks5h://. |
| REST API | 8080 | Python REST API | JSON management and health endpoint. Circuit rotation and connection management. |
| MCP Server (SSE) | 2501 | Python MCP Server | Model Context Protocol server (SSE) for AI agents (Cursor, Antigravity). |
| TransPort (Gateway Mode) | 9040 | Tor | Transparent TCP proxy redirect listener when TORPROXY_GATEWAY_MODE=true. |
| DNSPort (Gateway Mode) | 9053 | Tor | Transparent DNS resolver listener when TORPROXY_GATEWAY_MODE=true. |
The lightweight API server on port 8080 manages circuits and monitors health without requiring clients to implement the Tor Control Protocol.
| Endpoint | Method | Status Code | Purpose | Example Response |
|---|---|---|---|---|
/status, / | GET, POST | 200 | Connection status and current exit IP. | {"status":"connected","ip":"198.51.100.42"} |
/ip | GET | 200, 503 | Current verified Tor exit IP. Returns 503 while bootstrapping. | {"ip":"198.51.100.42"} |
/health, /v1/health | GET | 200, 503 | Structured diagnostic health state across Tor, proxies, and egress. | {"status":"healthy","tor":{"bootstrapped":true,"progress":100},"proxies":{"socks5":true},"egress":{"verified":true,"ip":"..."}} |
/diagnostics, /v1/diagnostics | GET | 200 | Operational telemetry (uptime, reconnect counts, bootstrap progress). | {"uptime_seconds":120,"reconnect_total":2,"tor":{"bootstrapped":true}} |
/metrics, /v1/metrics | GET | 200 | Prometheus exposition format metrics for scrapers. | Plaintext Prometheus metrics. |
/reconnect | POST (or GET) | 200, 400 | Request new circuit (SIGNAL NEWNYM). Supports ?country=DE or JSON body. Clears IP cache. | {"action":"reconnect","status":"success","exit_country":"DE"} |
/disconnect | POST (or GET) | 200 | Pause Tor network traffic (DisableNetwork=1). Fails closed. | {"action":"disconnect","status":"success"} |
/connect | POST (or GET) | 200, 400 | Resume Tor network traffic (DisableNetwork=0). Supports ?country=DE or JSON body. | {"action":"connect","status":"success"} |
HTTP Methods:
POSTis recommended for state mutations (/reconnect,/disconnect,/connect). LegacyGETcalls remain fully supported for backward compatibility. Mutations presented with a foreign browserOrigin/Refererare rejected with403 Forbidden(CSRF protection);curl/script calls without those headers are unaffected. Authentication (Recommended): Unauthenticated by default for backward compatibility. SettingTORPROXY_API_TOKEN(orTORPROXY_API_KEY) protects all endpoints withAuthorization: Bearer <token>orX-API-Key: <token>. Detailed schema definitions are documented in docs/api.md.
torproxy includes a ready-aware Docker health check (docker/healthcheck.sh). A container reports healthy only when:
bootstrapped=done).IsTor: true).In Docker Compose, dependent services can wait for genuine Tor readiness using service_healthy:
services:
app:
image: my-scraper:latest
depends_on:
torproxy:
condition: service_healthy
Default settings work out-of-the-box with zero configuration. You can customize runtime behavior using environment variables in .env or Docker Compose:
| Variable | Default | Purpose |
|---|---|---|
TORPROXY_COUNTRY | (unset) | Restrict exit nodes to specific countries (e.g. DE, AT, US, DE,AT). |
TORPROXY_STRICT_NODES | 0 | When 1/true, reject circuits if configured country exit nodes are unavailable. |
TORPROXY_GATEWAY_MODE | 0 | Enable Transparent Tor Gateway mode (TransPort, DNSPort, netfilter kill switch). Requires cap_add: [NET_ADMIN]. |
TORPROXY_API_TOKEN | (unset) | Bearer token / API key securing REST API port 8080. Recommended for production. |
TORPROXY_GEOIP_AUTO_UPDATE | 0 | Opt-in: periodically download and refresh Tor's GeoIP database from Tor Project GitLab. |
📖 Full Configuration Reference: See docs/configuration.md for custom listening ports (
TORPROXY_LISTEN_PORT,TORPROXY_SOCKS_PORT,TORPROXY_API_PORT), address binding rules, and GeoIP update parameters.
Ready-to-run use cases with hardened configurations:
| Example | Purpose | Guide |
|---|---|---|
| Transparent Tor Gateway | Route any container's entire TCP & DNS traffic automatically through Tor without proxy settings. | View Example |
| Hardened Production | Read-only rootfs, dropped capabilities, and memory-backed tmpfs. | View Example |
| Browserless Chromium | Headless browser automation and scraping routed through Tor. | View Example |
| CRW Web Scraper | High-performance webpage-to-Markdown scraper via Tor proxy. | View Example |
| SearXNG Metasearch | Private, self-hosted search engine routing upstream queries via Tor. | View Example |
tor, privoxy, torproxy). In gateway mode the netfilter WAN bypass is scoped to the dedicated tor UID, so the API/Privoxy cannot reach the WAN directly (ISSUE-03).127.0.0.1:9051) requires ephemeral filesystem cookie authentication (CookieAuthentication 1).curl --socks5-hostname 127.0.0.1:9050 or socks5h://).We welcome contributions! Please review our Contributing Guidelines and Code of Conduct. All PRs must maintain backward compatibility, include hermetic unit tests, and maintain >= 90% test coverage.
Released under the MIT License.
If you find this project helpful, consider showing some support: