#!/usr/bin/env sh # The MCP server as plain JSON-RPC over HTTP (what every MCP client sends). Free calls only; paying over MCP means # signing the PaymentRequired result with an x402 client and calling again with params._meta["x402/payment"]. # site_report and site_report_status are listed only while the service is on sale (the dev shop in dry mode lists them). SHOP="${SHOP:-http://127.0.0.1:4999}" TARGET="${TARGET:-https://lordevo.com}" # 1. Handshake (legacy initialize; 2026-07-28 clients use server/discover instead). curl -s "$SHOP/mcp" -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"agency-kit","version":"1.0.0"}}}' # 2. Tools: site_report (paid) and site_report_status (free) come first. curl -s "$SHOP/mcp" -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' # 3. Missing authorization -> isError, error authorization_required, "charged": false (refused before payment). curl -s "$SHOP/mcp" -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"site_report","arguments":{"url":"'"$TARGET"'"}}}' # 4. A valid call without payment -> isError with the x402 PaymentRequired terms in structuredContent (accepts[]). curl -s "$SHOP/mcp" -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"site_report","arguments":{"url":"'"$TARGET"'","scope":{"max_pages":3,"audience":"agency","brand":{"name":"Your Agency"}},"authorization":{"attested":true,"statement":"I own this website or have written permission from its owner to assess it."}}}}' # 5. Poll a report you paid for (free): pass result_url from the site_report result. curl -s "$SHOP/mcp" -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"site_report_status","arguments":{"result_url":"'"$RESULT_URL"'"}}}'