# torproxy MCP server

> Enables AI agents to manage Tor circuits, rotate exit nodes, and execute anonymized web requests through a built-in MCP server.

- Repository: https://github.com/hapheus/torproxy
- Page: https://hostedmcp.org/servers/hapheus/torproxy
- Transport: stdio
- Stars: 7
- License: MIT
- Latest version: 2.7.7

## Install

### Claude Code

```sh
claude mcp add --env TORPROXY_API_TOKEN=<YOUR_TORPROXY_API_TOKEN> torproxy -- docker run -i --rm docker.io/hapheus/torproxy:2.7.7
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "torproxy": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/hapheus/torproxy:2.7.7"
      ],
      "env": {
        "TORPROXY_API_TOKEN": "<YOUR_TORPROXY_API_TOKEN>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "torproxy": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/hapheus/torproxy:2.7.7"
      ],
      "env": {
        "TORPROXY_API_TOKEN": "<YOUR_TORPROXY_API_TOKEN>"
      }
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "torproxy": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/hapheus/torproxy:2.7.7"
      ],
      "env": {
        "TORPROXY_API_TOKEN": "<YOUR_TORPROXY_API_TOKEN>"
      }
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.torproxy]
command = "docker"
args = ["run", "-i", "--rm", "docker.io/hapheus/torproxy:2.7.7"]

[mcp_servers.torproxy.env]
TORPROXY_API_TOKEN = "<YOUR_TORPROXY_API_TOKEN>"
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "torproxy": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "docker.io/hapheus/torproxy:2.7.7"
      ],
      "env": {
        "TORPROXY_API_TOKEN": "<YOUR_TORPROXY_API_TOKEN>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `TORPROXY_API_TOKEN` | no | yes | Optional secret token for authenticating REST and MCP requests. |
| `TORPROXY_COUNTRY` | no | no |  |
| `TORPROXY_GEOIP_AUTO_UPDATE` | no | no |  |

## Tools (4)

- `torproxy_fetch`
- `torproxy_status`
- `torproxy_get_ip`
- `torproxy_reconnect`

## FAQ

### How can I use torproxy with Claude Desktop?

You can connect Claude Desktop to the running container via Stdio by adding a configuration to your claude_desktop_config.json using the docker exec command.

### Can I change the exit country for my Tor connection?

Yes, you can dynamically switch the exit country using the REST API reconnect endpoint or by setting the TORPROXY_COUNTRY environment variable.

### Does torproxy prevent DNS leaks?

Yes, in Transparent Gateway mode, all DNS requests on port 53 are automatically resolved via Tor.
