GrindFree Agent Security
v0.11.0Pay-per-call agent security (x402): injection, tools, shell/SQL, memory, leaks, docs, safe reads
MCP server + client snippets for GrindFree’s pay-per-call agent security APIs on Base: Contact: rob@grindfree.net · @grindfreelabs Set the caller’s funded Base USDC key in the MCP host env (never commit it):
Summary extracted from the README.
GrindFree Agent Security
MCP server + client snippets for GrindFree’s pay-per-call agent security APIs on Base:
| Service | Endpoint | Price | What it does |
|---|---|---|---|
| PromptShield | POST https://promptshield.grindfree.net/v1/screen · /v1/clean |
$0.002 | Prompt-injection screen + HTML→LLM clean text |
| CrawlSafe | POST https://crawlsafe.grindfree.net/v1/check |
$0.001 | robots.txt / X-Robots-Tag crawl gate (SSRF-guarded; not malware scanning) |
| ToolGuard | POST https://toolguard.grindfree.net/v1/evaluate |
$0.002 | Pre-tool-call allow | review | deny policy gate |
| CommandGuard | POST https://commandguard.grindfree.net/v1/command · /v1/sql |
$0.001 | Shell command + SQL check before execution: allow | warn | block |
| MemoryGuard | POST https://memoryguard.grindfree.net/v1/screen |
$0.002 | Screen content before it is written to agent memory (planted instructions, persistence, secrets/PII) |
| WireShield | POST https://wireshield.grindfree.net/v1/scan |
$0.002 | Outbound leak check on agent output (zero-click image exfil, URL smuggling, canaries, prompt leakage) |
| DocShield | POST https://docshield.grindfree.net/v1/scan |
$0.004 | Hidden instructions in PDF / DOCX / XLSX / PPTX / HTML / Markdown before the agent reads them |
| SafeRead | POST https://saferead.grindfree.net/v1/read |
$0.002 | Fetch a URL as clean Markdown with hidden text and prompt injections removed or flagged (SSRF-guarded; HTML, text, JSON, PDF). Benchmark |
| SafeRead plain | POST https://saferead.grindfree.net/v1/fetch |
$0.001 | Plain read: URL as clean Markdown, no injection screening |
| SafeRead Watch | POST https://saferead.grindfree.net/v1/watch |
$0.002 / URL | Daily change detection: each page read safely and returned as new / changed / unchanged with only the added sections. Page text never stored. Daily safe digest recipe |
| DocRead | POST https://docread.grindfree.net/v1/convert (also GET ?url=) |
$0.003 | Convert any document (PDF, DOCX, XLSX, PPTX, HTML, text; URL or upload) to clean Markdown for AI, with hidden text and prompt injections stripped and a removal report |
| AskHuman | POST https://askhuman.grindfree.net/v1/request |
$0.03 | Human-in-the-loop approval: one-tap approve/deny/edit link (ntfy, Slack, Discord, webhook); decision by poll, long-poll or signed callback; fails closed |
| ShipCheck | POST https://shipcheck.grindfree.net/v1/check |
$0.01 / run | One CI call for an agent repo: secrets, prompt injection in agent instructions, unpinned/poisoned MCP servers, risky commands; SARIF. GitHub Action |
| TrifectaGate | POST https://trifectagate.grindfree.net/v1/check |
$0.002 | Session exfiltration gate: private data + untrusted content + outbound action → allow / review / block (sticky per-session taint, URL smuggling, secrets in payload) |
Price: per call in USDC (table above) on Base (eip155:8453) via x402 v2.
Wallet: the caller’s Base USDC wallet pays. This repo never ships GrindFree keys.
Spending a budget on GrindFree
- Know the price before paying: every service has a free
/pricing.jsonand a free/quote(POST {"calls":[{"path":"/v1/watch","count":30,"body":{"urls":[...]}}],"budget_usd":1}→ exact total, whether it fits, runs affordable). Every 402 carriesX-Price-USDandX-Max-Charge-USD; paid 200s carryX-Charged-USD. - Price guarantee: prices will not increase without at least 30 days' notice, published in each service's
/pricing.json(price_guarantee: {no_increase_without_notice_days: 30, since: "2026-11-20"}) andllms.txt. - Only success is charged: 4xx/5xx responses are never settled. All prices are fixed per call or per URL, far below the common $1-per-payment client cap.
- What $1 buys: 500 safe page reads, 1,000 plain fetches, 500 watched pages, 100 ShipCheck CI runs, 1,000 shell-command checks, 250 document scans, 33 human approvals.
- Proof: all 16 previously listed GrindFree routes are graded A by SettleWatch (independent settlement and uptime monitor, Nov 19 2026); SafeRead removed 129/129 hidden injections with 0/23 false positives in the open benchmark (rules were tuned on that corpus; 65% and 72% on untuned hold-out sets).
Recipes
- Daily safe digest — watch 10 pages a day for ~$0.60/month; only changes, injections removed.
- ShipCheck on every PR — $0.01 per pull request; annotations + SARIF.
Contact: rob@grindfree.net · @grindfreelabs
Install / run the MCP server (stdio)
MCP 0.10.0 (23 tools) is on npm and the MCP Registry (io.github.ronin93/grindfree-agent-security):
X402_PRIVATE_KEY=0xYOUR_BASE_USDC_PRIVATE_KEY npx -y @grindfree/agent-security-mcp
From source:
git clone https://github.com/ronin93/grindfree-agent-security.git
cd grindfree-agent-security/mcp-server
npm install
Set the caller’s funded Base USDC key in the MCP host env (never commit it):
export X402_PRIVATE_KEY=0xYOUR_BASE_USDC_PRIVATE_KEY
# PRIVATE_KEY is also accepted
node src/index.js
Claude Desktop / Cursor-style config:
{
"mcpServers": {
"grindfree-agent-security": {
"command": "npx",
"args": ["-y", "@grindfree/agent-security-mcp"],
"env": {
"X402_PRIVATE_KEY": "0xYOUR_KEY"
}
}
}
}
MCP tools
promptshield_screen/promptshield_cleancrawlsafe_checktoolguard_evaluate— your agent must enforce allow/review/deny before executing the tool; this API cannot stop a bypasscommandguard_command/commandguard_sql— check shell commands and SQL before running themmemoryguard_screen— check content before saving it to long-term memorywireshield_scan— check agent output before rendering/sending itdocshield_scan— check a local file (path), base64 bytes, or HTML/Markdown for hidden instructions (max 3 MB)saferead_read— fetch a web page as clean Markdown with hidden text and prompt injections removed (honours robots.txt)saferead_fetch— plain read: a web page as clean Markdown for $0.001, no injection screening (usesaferead_readfor untrusted pages)saferead_read_batch— up to 10 web pages as clean Markdown in one call ($0.002 per URL, all-or-nothing)commandguard_check_and_approve— optional add-on: check a command or SQL and, if warned or blocked, get a human approve/deny link via AskHuman ($0.03)saferead_search— search the web without prompt injection ($0.02 per search): ranked sources plus the top 3 pages as clean Markdown, per-page injection flag (search results by You.com)saferead_watch— check pages for changes on a schedule ($0.002 per URL): new / changed / unchanged, only added sections, injections removedshipcheck_scan— agent-repo security check for CI ($0.01 per run): secrets, instruction-file injection, MCP config risks, risky commands; SARIFgrindfree_quote— free price quote and budget fit for planned calls (no wallet needed)docread_convert— convert PDF to Markdown (also DOCX/XLSX/PPTX/HTML;url, localpath, base64 or inline content), injections stripped, with a removal report (max 3 MB)docread_tables— extract tables from PDF/DOCX/XLSX/PPTX/HTML to typed JSON ($0.004)trifectagate_check/askhuman_request/askhuman_status— exfiltration gate and human approvalgrindfree_discovery— unpaid 402 / discovery probe (no spend)
Ward Pass (prepaid, optional) and delivery receipts
Prefer not to sign every call? Buy a Ward Pass: one $1.00 x402 payment = $1 of calls on every Ward at list price (zero markup), debited only on HTTP 200.
# buy once with the wardpass_buy tool (caller wallet), or any x402 client:
curl -i -X POST https://wardpass.grindfree.net/v1/pass -H "Idempotency-Key: $(uuidgen)" # → 402, pay, retry → {"pass":"wp_…"}
# then run the MCP server (0.11.0+) with the pass instead of a wallet key
WARD_PASS=wp_… npx -y @grindfree/agent-security-mcp
- Every paid 200 carries a delivery receipt (x402 #4392): the tool result includes
receipt.delivery_receipt_sha256,delivery_body_sha256and a freereceipt_url. - Every tool call sends an
Idempotency-Key, so a retry after a paid 200 is replayed and never charged twice (x402 #4367). wardpass_balance(free) shows balance, calls and recent receipt IDs. If the pass runs out andX402_PRIVATE_KEYis set, calls fall back to normal x402.
Docker
A root Dockerfile builds the stdio MCP server. The wallet is supplied at runtime, never baked in:
docker build -t grindfree-agent-security .
docker run --rm -i -e X402_PRIVATE_KEY=0xYOUR_BASE_USDC_PRIVATE_KEY grindfree-agent-security
glama.json lists ronin93 as maintainer so the Glama listing can be claimed (requires a one-time GitHub sign-in on glama.ai).
HTTP snippets (no MCP)
examples/typescript-x402-fetch.ts— official@x402/fetch+@x402/evmexamples/python-x402.py— unpaid probes + paid hookexamples/langchain-tool.py— LangChain-style wrappers
Unpaid challenge (no wallet):
curl -sS -D - -o /tmp/ps402.json -X POST https://promptshield.grindfree.net/v1/screen \
-H 'content-type: application/json' \
-d '{"content":"hi","format":"text"}'
# Expect HTTP 402 + PAYMENT-REQUIRED
Honest limits
- Heuristic / policy layers — not a full security program.
- CrawlSafe is not malware, phishing, or legal/ToS advice.
- All guards are deterministic rule packs (no LLM), so they are fast and cheap but can miss novel phrasing; decisions are advisory and your code must enforce block/deny.
- DocShield parses structure and text; it does not OCR images or render pages, and legacy .doc/.xls/.ppt return 415 (not charged).
- SafeRead does not run JavaScript or OCR images; pages that discuss prompt injection may have example blocks removed (use
mode:"flag"). Blocked URLs, failed fetches and unsupported types are not charged. - AskHuman asks; it does not enforce: run the action only when status is
approved(oredited, usingedited_args). Invalid requests and failed notifications are not charged. - ToolGuard returns a decision; the caller/adapter must enforce it before tool execution. Missing policy →
review. Not an exfiltration guarantee. - ToolGuard: always enforce allow|review|deny in your adapter before tool execution (the API cannot stop a bypass). GrindFree has confirmed funded settlement + HTTP 200 delivery on
/v1/evaluatevia a self-funded Base USDC test; still verify with your own wallet in production.
License
MIT — see LICENSE.