playwright-mcp-guarded
Enables LibreChat assistants to browse and fetch web content only from an allowlisted set of domains, with the allowed origins made visible to the model. It runs as a streamable-HTTP Docker service that enforces domain restrictions and supports sites like GitHub, Wikipedia, and Google.
README
playwright-mcp-guarded
A domain-guarded, non-user-bound wrapper around Microsoft's
playwright-mcp — a general
web-fetch/browse replacement for LibreChat assistants (GitHub, Wikipedia,
Google, Google Scholar, ...), scoped to an allowlist of domains, extensible
by editing one environment variable. Deployed as a plain streamable-HTTP
Docker service (no ports: exposed, no per-user OAuth) alongside sibling
projects time-mcp-http and
ews-mcp's multi-user mode, which follow the same shape.
Why not just run @playwright/mcp directly
It already has --allowed-origins/--blocked-origins for exactly this,
and this project does not reimplement that enforcement — it's still
what actually blocks a disallowed navigation. Two things are missing from
running it bare:
- Its own docs call
--allowed-origins"not a security boundary" — a known gap is that Service Worker and WebSocket traffic bypass thecontext.route()interception it's built on.--block-service-workers(also set here, unconditionally) closes one of those gaps; there isn't a flag for the other. - The allowlist never appears anywhere the calling model can see it —
not in
initialize'sinstructions, not in any tool'sdescription. A model has no way to know upfront which domains are reachable, so it finds out by trying, once per blocked domain, every time.
How it works
One container, one process tree, one config value (ALLOWED_ORIGINS):
LibreChat --(streamable-http, /mcp)--> guardian (Python, PID 1)
|
| spawns as child process,
| on loopback only
v
@playwright/mcp (Node, --allowed-origins)
guardian/app.py spawns the real @playwright/mcp CLI, unmodified, as a
child process bound to localhost only, connects to it as an MCP
client, and re-exposes it as an MCP server on the container's public
port: tools/list and initialize get the domain list appended for
visibility, tools/call is forwarded verbatim — no tool logic of its own,
no changed behavior beyond those two text edits. ALLOWED_ORIGINS is read
once, at startup, and handed to both: the spawned process (as
--allowed-origins, the actual enforcement) and the two response
rewrites (visibility only). Extending the list later is a one-line change
to that single env var, not two configs to keep in sync.
Run
docker build -t playwright-mcp-guarded .
docker run --rm -p 8080:8080 \
-e ALLOWED_ORIGINS="github.com;raw.githubusercontent.com;wikipedia.org;en.wikipedia.org;google.com;scholar.google.com" \
playwright-mcp-guarded
ALLOWED_ORIGINS is semicolon-separated — same format @playwright/mcp
itself uses for PLAYWRIGHT_MCP_ALLOWED_ORIGINS. An empty value blocks
every domain (logged as a warning at startup, not a silent bypass).
EXTRA_INSTRUCTIONS (optional, free text) is appended verbatim to the
initialize instructions the model sees. The allowlist only says which
domains are reachable, not how to use what's behind them — e.g. a
self-hosted search engine's query syntax. Deliberately not hardcoded here:
this wrapper stays domain-agnostic, and the deployer supplies whatever
operating knowledge their specific allowlist needs, in their own words:
-e EXTRA_INSTRUCTIONS="Search: http://searxng:8080/search?q=<term> (general), add &categories=science for Google Scholar results."
No MCP_API_KEY, no auth gate on the MCP connection itself — deliberately,
same reasoning as ews-mcp/time-mcp-http: a 401 from any gate makes
LibreChat's non-OAuth MCP client try (and get stuck on) OAuth. Docker
network isolation is the boundary. No credentials of any kind pass through
this server; it only ever reads public pages.
Accepted trade-off, not an oversight: this keeps enforcement at the
Playwright application layer (now with --block-service-workers), not an
independent network-level boundary (e.g. an egress proxy). That's a
deliberate simplicity choice — one deployable unit, one config value — not
a claim that this is airtight. A network-level backstop can be layered on
later without touching any of this logic.
Verify
curl -s http://127.0.0.1:8080/readyz # "ok" once the upstream browser is up
Logs should show the upstream's own startup line
(Listening on http://localhost:<internal-port>) followed by
playwright-mcp-guarded up, allowed origins=... — that second line is the
actual list currently enforced, not just what was configured.
Test
pip install -e '.[dev]'
ALLOWED_ORIGINS="github.com;wikipedia.org" pytest
Unit tests only (description/instructions rewriting, arg passthrough) —
they don't spin up Chromium or Docker. The Docker image was verified
end-to-end manually: built, run, a real MCP client connected and listed
tools (allowlist visible in both initialize.instructions and
browser_navigate's description), navigated successfully to an allowed
domain (en.wikipedia.org), and got net::ERR_BLOCKED_BY_CLIENT on a
disallowed one (example.com) — enforcement and visibility both
confirmed live, not just asserted.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。