
Cloud Armor WAF Patrol MCP
io.github.shigechika由 GitHub 帳號 shigechika 發布v0.7.0更新於 Oct 24, 2026
MCP server for Google Cloud Armor WAF log patrol: deny summaries and false-positive checks
概覽
唯讀的 MCP 伺服器,用來巡檢 Google Cloud Armor WAF 日誌,彙總已生效與預覽規則的 DENY 數量並標示本地區誤擋。
- 可以做什麼
- 依規則優先級彙總已生效的 DENY 數量,並統計預覽(試運行)規則的 DENY 數量
- 一次呼叫產生每日簡報,合併已生效 DENY、本地區誤擋視角與預覽 DENY
- 列出來源 IP 歸屬本地區的已生效 DENY,並排除標記為已知正常的優先級
- 檢查版本、設定是否存在,並對 Cloud Logging 做最小探測
- 透過命令列把某一天的 DENY 紀錄或抽樣後的全部請求匯出為 JSON
- 適用情境
- 適合日常的「WAF 是否健康」巡檢:查看 Cloud Armor 擋下了什麼、是否有本地區的正常使用者或爬蟲被誤擋,以及預覽規則是否適合轉為正式生效。
- 執行需求
- 以 Python 套件形式在本機透過 stdio 執行(pip 或 uv tool install)。需要 CLOUDARMOR_PROJECT 提供 GCP 專案 ID,CLOUDARMOR_APPLICATION_CREDENTIALS 指向服務帳戶金鑰檔,該帳戶需具備 roles/logging.viewer。選用設定包括後端服務篩選、本地區、規則 INI 與最大筆數。Claude Code 外掛要求 PATH 中有 uvx。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Cloud Armor WAF Patrol MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
cloudarmor-mcp
English | 日本語
MCP server for Google Cloud Armor WAF log patrol — deny summaries per rule, home-region false-positive checks, and preview (dry-run) rule review, straight from Cloud Logging.
Built for a daily "is the WAF healthy?" patrol: one daily_brief call answers what did we block, did we block anyone we shouldn't have, and are the preview rules ready to promote.
Documentation: https://shigechika.github.io/cloudarmor-mcp/
Tools
All tools are read-only. Counts are hard-capped (default 2000 entries per query) and a capped result is reported as >= N (capped), never as an exact total.
Setup
1. Least-privilege service account
Create a service account with roles/logging.viewer only and download a key. Unlike human accounts, service accounts are not subject to organization re-authentication policies, so an unattended patrol never silently expires.
2. Install
3. Environment variables
4. Optional rules INI
Keep your rule numbering out of prompts and give the reports human-readable labels:
5. Claude Code (plugin)
This repository doubles as a single-plugin marketplace, so Claude Code can install the server for you:
The plugin launches uvx cloudarmor-mcp and reads the same environment variables
described in Environment variables above; export them
before starting Claude Code. GOOGLE_APPLICATION_CREDENTIALS still has to point at
a service-account key file that exists on your own machine — the plugin can't ship
or fetch that file for you, so this server can't be fully configured through the
plugin's own settings alone.
uvx must be on the PATH of the process that runs Claude Code — a login
shell usually has it, but a GUI-launched app may not; install
uv system-wide if the plugin fails to start.
6. Claude Code (manual)
with the environment variables above in the server's env.
7. Codex
Pass the environment variables above with --env KEY=VALUE (before --).
Any other MCP client that launches stdio servers works the same way: give it
cloudarmor-mcp as the command and set the environment variables above in its
environment.
CLI
Exporting one day of DENY entries (batch)
Writes one JSON document to stdout with one record per DENY log entry of that
calendar day ([00:00, 24:00) in --tz, default UTC): the enforced and preview
policy verdicts (policy, priority, action, outcome, rule_ids), source IP,
region code and ASN as Cloud Armor logged them, method, host, path (query string
dropped — only its length is kept), status, User-Agent (200 chars) and backend.
--kind both (default) fetches entries where either policy says DENY in a single
query, so a request that matched a preview rule and was denied appears once with
both sections filled. --backend a,b overrides CLOUDARMOR_BACKEND_SERVICES.
This and traffic-export (below) are the only outputs of the package that contain per-request log data; it is
meant for an operator batch on the same host that aggregates the day itself. The
document ends with count, fetched, malformed and capped: when capped is
true the export stopped at --max-entries (default 200000; CLOUDARMOR_MAX_ENTRIES
does not apply) and is a prefix of the day, oldest first. Records are streamed, so
memory does not grow with the day, and pages are fetched at most one per 1.2 s to stay
under the Cloud Logging read quota (60 requests per minute), so a day with 200,000 entries
takes a few minutes. A day that has not ended yet is refused. Run it
some minutes after local midnight — Cloud Logging entries arrive with a delay — and
write to a temporary file first: on a query failure the exit code is 1 and stdout may
hold an unterminated document.
Exporting a sampled day of all requests (batch)
Same document layout and record fields as deny-export, but for every
load-balancer request of the day — allowed, denied and served from the CDN cache —
thinned by Cloud Logging's sample(insertId, RATE) (--sample, default 0.01).
The sample is a hash of each entry's insertId, so it is spread evenly over the day
and the same rate selects the same entries on every run; scale counts by
1 / sample to estimate the day — but not when capped is true: entries are read
oldest first, so a capped export covers only the early part of the day (lower
--sample or raise --max-entries instead). Each record adds cache_hit. When no
backend security policy evaluated a request (a CDN cache hit, for example) it has
enforced: null and no region code or ASN; use cache_hit, not enforced, to tell
cache hits apart.
The header carries sample instead of kind. Use it to see who visits — browsers,
crawlers, AI agents — which the DENY logs cannot show. The per-request caveats of
deny-export apply: the records include legitimate visitors' addresses.
Reading the report
- Enforced DENY by rule — your normal blocking volume. Sudden shifts in the mix are worth a look.
- Home-region DENY — requests from your own country/region that were blocked. Legitimate users and legitimate crawlers being denied show up here; scanner traffic that happens to originate locally will too, so the
known_normal_prioritieslist keeps expected rules (e.g. an AutoDiscover block) out of the suspicious list. - Preview DENY — rules in dry-run. A preview rule that stays free of home-region hits over time is a candidate for promotion to enforce.
License
MIT
來源:README.md,提交 9b19e45
工具
0版本歷史
6- v0.7.0最新Oct 7, 2026
- v0.6.0Sep 29, 2026
- v0.5.2Sep 25, 2026
- v0.5.1Sep 24, 2026
- v0.5.0Sep 23, 2026
- v0.4.0Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分