Onion Search

io.github.farbodghasemlu由 GitHub 账号 farbodghasemlu 发布v1.0.1更新于 Oct 24, 2026

Local, read-only onion search and text retrieval over Tor with content filtering.

概览

AI 生成的概览

一个本地、只读的 MCP 服务器,通过 Tor 搜索洋葱服务并抓取页面文本,默认启用内容过滤。

可以做什么
在八个已配置引擎上搜索洋葱服务,返回排序结果、引擎一致性和各引擎失败信息。将页面抓取为 Markdown 文本,含标题、链接和响应元数据,或检查可达性、HTTP 状态和延迟。列出页面中的洋葱链接及可选的明网链接,但不自动跟随。检查 Tor 健康状态:SOCKS 握手、引导百分比和版本。读取两个内存资源,分别列出已启用引擎和本进程最近 100 条查询。
适用场景
适合需要让 AI 助手通过 Tor 查询和阅读洋葱站点、且只要文本检索与过滤的研究场景。适合能运行 Docker 或带 Tor 的本地 Python 环境,并愿意承担此类搜索的法律与隐私责任的用户。
运行要求
以本地 stdio 进程运行,通常通过带 Tor 边车的 Docker Compose、内置容器,或安装 Tor 与 libseccomp2 的本地 Python 环境。Tor 需提供 SOCKS 与控制端口,可能需要 TOR_CONTROL_PASSWORD 或 TOR_COOKIE_FILE。可选配置包括 TOR_BRIDGES、ENGINES、CONTENT_FILTER 以及缓存和超时变量。Tor 首次引导可能需数分钟。
安装前请注意
查询和抓取内容可能经 MCP 客户端发送到云端模型;README 建议敏感搜索使用本地模型。使用者需自行负责合法合规,作者声明不承担责任。内容过滤默认开启,可按进程或按调用关闭,关闭后不再应用域名黑名单和关键词规则。黑名单是快照,无法识别所有滥用内容,包裹不可信文本也不能证明页面没有提示注入。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Onion Search,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

darkweb-mcp (onion-search-mcp)

A local Python stdio MCP server for searching onion services and reading pages through Tor. It provides five tools, eight search adapters, memory caches, and two MCP resources.

[!IMPORTANT] Privacy: Use a local model for sensitive searches. Cloud models may receive your queries and fetched content through the MCP client. Check the client's logging, telemetry, and cloud fallback settings.

[!WARNING] User responsibility: You are responsible for your actions and compliance with applicable laws. The authors and contributors disclaim liability for use or misuse of this software to the extent permitted by law.

Run

The two-container setup gives the MCP process an internal Docker network. Only the Tor container has an external route.

sh
docker compose builddocker compose up -d tordocker compose run --rm --no-deps -T server

Wait for docker compose ps to show Tor as healthy before starting the server. The server uses stdin and stdout for MCP messages. Keep stdout attached to the client. For a single container with Tor included:

sh
docker run -i --rm --read-only --cap-drop ALL --security-opt no-new-privileges:true --tmpfs /tmp:rw,noexec,nosuid,size=96m,uid=10001,gid=10001,mode=1770 --memory 768m --cpus 2 onion-search-mcp:local

The bundled container has an external route because Tor needs one. Use Compose for network isolation between the server and Tor. Initial Tor bootstrap can take several minutes. For a local Python installation on Linux, install Tor and libseccomp2, then:

sh
uv sync --frozenuv run onion-search-mcp --bundled-tor

To use an existing Tor process, configure SocksPort 9050 IsolateSOCKSAuth, ControlPort 9051, and control authentication, then run uv run onion-search-mcp. Set TOR_CONTROL_PASSWORD or TOR_COOKIE_FILE if needed.

Content filtering switch

Filtering is enabled by default. Turn it off or on for the process with either environment configuration or CLI options:

sh
CONTENT_FILTER=false uv run onion-search-mcpuv run onion-search-mcp --no-content-filteruv run onion-search-mcp --content-filterCONTENT_FILTER=false docker compose run --rm --no-deps -T server

Each content tool also accepts content_filter. Pass false to disable filtering for that call, true to enable it, or omit it to use the process setting.

json
{"name":"onion_fetch","arguments":{"url":"http://YOUR_56_CHARACTER_ADDRESS.onion/","content_filter":false}}

The switch controls domain blocklists and keyword rules. Tor routing, URL validation, text-only retrieval, parser limits, and untrusted-content wrapping always apply. Search engines may apply their own filtering. Cache entries are separated by filter setting.

MCP client configuration

Start the Tor sidecar with docker compose up -d tor, then configure a stdio client:

json
{  "mcpServers": {    "onion-search": {      "command": "docker",      "args": ["compose", "--project-directory", "/absolute/path/to/onion", "run", "--rm", "--no-deps", "-T", "server"]    }  }}

For the bundled image, use docker run -i --rm onion-search-mcp:local as the command and arguments. For Python, use uv --directory /absolute/path/to/onion run --frozen onion-search-mcp. Tool approval is configured in the client.

Tools

ToolArgumentsOutput
onion_searchquery, engines, limit=20, page=1, content_filterRanked results, agreement, source records, failed engines
onion_fetchurl, max_chars=20000, include_links=true, content_filterMarkdown text, title, links, response metadata
onion_statusurl, timeout_s=30, content_filterReachability, HTTP status, latency, error code
onion_linksurl, onion_only=true, content_filterOnion and optional clearnet links, without following them
tor_healthnoneSOCKS handshake, bootstrap percentage, Tor version
onion://engines lists enabled adapters, addresses, verification state, and latest observed health. onion://history contains the last 100 queries in this process. Both are memory resources.
Sources include the engine, URL, UTC fetch time, and circuit ID when Tor reports one. A missing circuit ID is null. Cached sources retain the original fetch time. up=true means an HTTP response was received, including 4xx and 5xx responses. exit_check=false means no clearnet exit check was performed; onion services use no exit relay.
Search queries are trimmed and capped at 256 characters. Limits are 1 to 50 results, pages 1 to 10000, fetch text 1 to 200000 characters, and status timeout 1 to 120 seconds. Only HTTP(S) URLs with a 56-character base32 onion host are accepted. Credentials, v2 hosts, IP hosts, other schemes, and clearnet redirects are rejected.
Non-text responses return metadata and UNSUPPORTED_CONTENT without consuming their body. Blocked fetches return blocked=true and empty content. Blocked results and outbound links are omitted. Required keyword matches suppress a whole page. Known blocked domains inside returned text are redacted.

Configuration

VariableDefaultPurpose
TOR_SOCKS127.0.0.1:9050Numeric proxy IP and port; no local DNS
TOR_CONTROL127.0.0.1:9051Numeric control IP and port
TOR_CONTROL_PASSWORDunsetControl password; Compose provides a local default
TOR_COOKIE_FILEunsetSAFECOOKIE authentication file
TOR_BRIDGESemptyBridge lines separated by newlines or semicolons
ENGINESallComma-separated configured engine identifiers
ENGINES_FILEengines.yamlEngine configuration, with packaged fallback
BLOCKLIST_PATHSblocklists/csam.txtComma-separated plain-domain or MD5 blocklists
CONTENT_FILTERtrueDefault for all content tools
TERMS_FILEblocklists/terms.txtRequired term list, with packaged fallback
KEYWORD_FILTERfalseEnable additional keyword rules
FILTER_KEYWORDSemptyAdditional comma-separated literal terms
MAX_FETCH_BYTES5242880Limit on raw and decompressed response bytes
CACHE_TTL_S900Search TTL; zero disables both caches
FETCH_CACHE_TTL_S600Fetch TTL
CACHE_MAX_ENTRIES128Maximum entries per cache
CACHE_MAX_BYTES33554432Maximum serialized bytes per cache
ENGINE_RATE_LIMIT_S3Minimum interval per engine
JITTER_S2Maximum randomized fan-out delay
ENGINE_TIMEOUT_S25Per-engine deadline
SEARCH_TIMEOUT_S40Whole fan-out deadline
REQUEST_TIMEOUT_S40Total request deadline
LOG_QUERIESfalsetrue is rejected; no disk history
All eight adapters are enabled: ahmia, torch, haystak, onionland, tor66, excavator, deep_search, onion_search_engine. Addresses and request parameters live in YAML. Edit that file and rebuild the image to change container defaults; no host directories are mounted.
Verify current addresses against each operator's published address before use. --verify-engines checks reachability through Tor. It cannot establish operator identity. See engine verification for the evidence and current limitations.
The blocklist is a snapshot. There are no automatic downloads or update checks. See blocklist provenance for its source and refresh procedure.
Bridges are configured in the Tor container through TOR_BRIDGES. obfs4 and Snowflake executables are included. Supply current bridge lines from a trusted source, then recreate the sidecar.

Privacy and limits

All HTTP requests use remote DNS through SOCKS, with credentials derived from a random process session and each destination. Tor must use IsolateSOCKSAuth. A SOCKS credential separates streams but does not guarantee a new physical circuit for every request. NEWNYM is requested at shutdown; Tor may rate limit that signal. The HTTP client stores no cookies and sends no Referer. It performs GET requests only. It does not execute JavaScript, submit forms, follow links automatically, render images, or decode media. Responses are streamed with byte limits and read and total deadlines. Redirect targets are validated before a request is made. HTML parsing runs in a separate Linux process with a 384 MiB address-space limit, 8 seconds of CPU, a 10-second deadline, and seccomp rules that deny network syscalls. Scripts, styles, comments, embedded objects, and hidden elements are removed. Untrusted text is wrapped with a fresh delimiter. These measures do not prove that a page contains no prompt injection or that a link is legitimate. Query history and caches stay in memory and are cleared on shutdown. No telemetry, query logging, disk cache, or runtime update checks are implemented. The MCP client and model runtime have their own storage and network behavior; see the privacy notice above. Blocklists and literal keywords do not detect all abusive content. Links are research leads; engine agreement is a ranking signal.

Development

sh
uv sync --frozenuv run ruff check .uv run pytest -q -m 'not integration'docker compose config --quietuv build

The unit suite uses saved parser fixtures and a local SOCKS simulator. The leak test stops the proxy and asserts that connections target only the local proxy, with no destination DNS or direct HTTP connection. CI runs integration on a private local Tor network. The test publishes a temporary onion service containing only fixtures. It never queries public search engines or reads third-party onion pages.

sh
uv run python tests/integration/run.py

An existing test Tor instance can be supplied with TEST_TOR_SOCKS and TEST_TOR_CONTROL. Integration requires a usable Tor circuit and can fail when the network is unavailable. See testing. Stable errors include TOR_UNAVAILABLE, INVALID_ONION, BLOCKED, TIMEOUT, ALL_ENGINES_FAILED, UNSUPPORTED_CONTENT, INVALID_QUERY, INVALID_ENGINE, INVALID_INPUT, CONFIG_ERROR, RESPONSE_TOO_LARGE, REDIRECT_LIMIT, PARSE_FAILED, and PARSE_TIMEOUT. Tool errors contain scrubbed code and message JSON. Partial searches include per-engine codes and return completed results.

License

MIT. See LICENSE.

来源:README.md,提交 eff821c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Oct 15, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分