{
  "openapi": "3.1.0",
  "info": {
    "title": "Agent Shield for AI agents",
    "version": "1.0.0",
    "description": "Pay-per-call safety checks for AI agents: MCP tool-poisoning and rug-pull scanner, x402 payment checker and prompt-injection scanner.",
    "x-guidance": "POST JSON to a tool path. First 3 calls/day free automatically, then x402 payment in USDC on Base. See /llms.txt"
  },
  "servers": [
    {
      "url": "https://agent-shield.ameeras-official.workers.dev"
    }
  ],
  "paths": {
    "/scan-mcp": {
      "post": {
        "operationId": "scanMcp",
        "summary": "Scan a remote MCP server for tool poisoning, hidden instructions, risky capabilities and rug pulls before your agent connects",
        "description": "Connects to a Streamable HTTP MCP server like a client would, lists its tools, prompts and resources, and checks every description and input schema for tool poisoning: hidden <IMPORTANT> blocks, orders aimed at the model, requests to read secret files (SSH keys, .env, mcp.json), side-channel parameters that ask for private data, tool shadowing, secrecy from the user, invisible Unicode and encoded payloads. Lists sensitive capabilities (runs commands, changes files, moves money, sends messages) per tool. Returns a grade A-F, risk score, findings with exact locations, and a fingerprint of the tool definitions; re-scans report which tools changed (rug-pull detection). Not charged if the server cannot be reached or needs auth.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "MCP server URL (Streamable HTTP), e.g. https://example.com/mcp"
                  },
                  "headers": {
                    "type": "object",
                    "description": "Optional auth header for your own server, e.g. {\"authorization\": \"Bearer ...\"} (used once, never stored)"
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://web-reader.ameeras-official.workers.dev/mcp"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "grade": "A",
                  "risk_score": 0,
                  "safe_to_use": true,
                  "tool_count": 11,
                  "findings": [],
                  "sensitive_capabilities": {
                    "web_access": {
                      "tools": [
                        "read_url"
                      ]
                    }
                  },
                  "fingerprint": "3f9a...",
                  "history": {
                    "changed_since_last_scan": false
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/scan-tools": {
      "post": {
        "operationId": "scanTools",
        "summary": "Check tool definitions you already have (MCP tools/list, OpenAI or Anthropic function schemas) for poisoning and risky capabilities",
        "description": "For local (stdio) MCP servers or any tool list your agent already loaded. Send the tools array; get the same poisoning, capability and fingerprint analysis as /scan-mcp. Accepts MCP tools ({name, description, inputSchema}), OpenAI function tools ({type:\"function\", function:{...}}) and Anthropic tools ({name, description, input_schema}).",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.003000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "tools": {
                    "type": "array",
                    "description": "Array of tool definitions"
                  },
                  "instructions": {
                    "type": "string",
                    "description": "Optional server instructions text to scan too"
                  }
                },
                "required": [
                  "tools"
                ]
              },
              "example": {
                "tools": [
                  {
                    "name": "add",
                    "description": "Adds two numbers and returns the sum.",
                    "inputSchema": {
                      "type": "object",
                      "properties": {
                        "a": {
                          "type": "number"
                        },
                        "b": {
                          "type": "number"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "grade": "A",
                  "risk_score": 0,
                  "safe_to_use": true,
                  "findings": []
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/scan-x402": {
      "post": {
        "operationId": "scanX402",
        "summary": "Check a paid x402 API before paying: real USDC contract, sane price, valid wallet, same site, no injected instructions",
        "description": "Calls the endpoint without paying, reads its HTTP 402 x402 offer (v1 body or v2 PAYMENT-REQUIRED header) and checks each payment option: is the asset the official USDC contract for that network, is the price reasonable, is payTo a valid (non-zero) address, does the payment resource match the site, and do descriptions contain prompt injection. Returns price in USD, grade A-F and findings. Never pays.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The paid endpoint URL"
                  },
                  "method": {
                    "type": "string",
                    "description": "HTTP method to probe with (default POST)",
                    "enum": [
                      "POST",
                      "GET"
                    ]
                  },
                  "body": {
                    "type": "object",
                    "description": "Optional JSON body to send when probing"
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://web-reader.ameeras-official.workers.dev/read"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "grade": "A",
                  "safe_to_pay": true,
                  "cheapest_usd": 0.002,
                  "payment_options": [
                    {
                      "network": "base",
                      "asset_is_official_usdc": true,
                      "price_usd": 0.002
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/scan-leaks": {
      "post": {
        "operationId": "scanLeaks",
        "summary": "Leak Guard: check text BEFORE your agent sends or stores it for API keys, passwords, private keys, card numbers and personal data, and get a redacted copy",
        "description": "Detects secrets (AWS, GitHub, OpenAI, Anthropic, Google, Slack and Stripe keys, private keys, JWTs, database connection strings, bearer tokens, password assignments, crypto private keys, high-entropy tokens next to key/secret words) and personal data (emails, phone numbers, Luhn-valid card numbers, checksum-valid IBANs, US SSNs, IP addresses). Returns risk level, masked findings with line numbers and a redacted_text that is safe to send. include=secrets checks only secrets. Nothing is stored or logged.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Outgoing message, email, post, code or document (max 300,000 chars)"
                  },
                  "include": {
                    "type": "string",
                    "description": "all (default) or secrets only",
                    "enum": [
                      "all",
                      "secrets"
                    ]
                  },
                  "allow_contact_info": {
                    "type": "boolean",
                    "description": "Treat emails/phone numbers alone as acceptable (safe_to_send stays true)"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Hi Sam, prod DB is postgres://admin:S3cret!@db.example.com:5432/app and my key is sk-proj-abcdefghijklmnopqrstuvwxyz123456. Call me on +44 20 7946 0958."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "safe_to_send": false,
                  "risk_level": "critical",
                  "secret_count": 2,
                  "personal_data_count": 1,
                  "redacted_text": "Hi Sam, prod DB is [REDACTED:CONNECTION_STRING] and my key is [REDACTED:OPENAI_KEY]. Call me on [REDACTED:PHONE]."
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/check-domain": {
      "post": {
        "operationId": "checkDomain",
        "summary": "Website trust check before your agent shops, logs in, pays or follows a link: domain age, lookalike brands, DNS and email setup, redirects",
        "description": "Looks up a domain or URL: registration date and registrar (RDAP), lookalike/typosquat of 100+ major brands (character swaps like paypa1, extra words like paypal-secure-login, punycode), risky endings, login-lure subdomains, DNS records (A, MX, nameservers), SPF and DMARC email protection, and whether the site answers over HTTPS or redirects elsewhere. Returns trust_score 0-100, risk level and plain-language signals. Not charged if the domain does not exist.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.003000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "Domain like example.com (or pass url instead)"
                  },
                  "url": {
                    "type": "string",
                    "description": "Any URL on the site"
                  }
                },
                "required": []
              },
              "example": {
                "url": "https://paypa1-secure-login.com/verify"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "trust_score": 5,
                  "risk_level": "high",
                  "safe_to_trust": false,
                  "lookalike_of": [
                    "paypal"
                  ],
                  "signals": [
                    {
                      "kind": "risk",
                      "detail": "Looks like paypal (character swap (e.g. 0 for o, rn for m)) but is not paypal's domain"
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/scan-github": {
      "post": {
        "operationId": "scanGithub",
        "summary": "Scan a GitHub repository (MCP server, agent tool or package) BEFORE installing it: risky install scripts, secret stealing, hidden code, poisoned tool descriptions",
        "description": "Reads the repository's manifests and up to 25 main source files and flags: install scripts that download or run code, reading SSH keys/.env/credential files, dumping all environment variables, sending data to webhooks or paste sites, hard-coded IPs, eval of decoded code, large encoded blobs, recursive deletes, and MCP tool descriptions with prompt injection or tool poisoning. Adds repo age, stars, license and archive status. Returns grade A-F, capabilities and findings with file:line. Not charged if the repo is private, missing or GitHub is busy.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "repo": {
                    "type": "string",
                    "description": "owner/name or https://github.com/owner/name (optionally /tree/branch)"
                  }
                },
                "required": [
                  "repo"
                ]
              },
              "example": {
                "repo": "modelcontextprotocol/servers"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "grade": "B",
                  "safe_to_install": true,
                  "files_scanned": 25,
                  "capabilities": [
                    "Runs system commands"
                  ],
                  "findings": []
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/sanctions": {
      "post": {
        "operationId": "sanctions",
        "summary": "Sanctions screening: check a person, company, vessel or aircraft name against the US Consolidated Screening List (OFAC SDN, Commerce Entity List and more) and the UN sanctions list",
        "description": "Fuzzy name matching (accents, word order, spelling variants, aliases) against official public lists: the US Consolidated Screening List (Treasury OFAC SDN and non-SDN lists, Commerce Entity List, Denied Persons, Unverified and Military End User lists, State Department lists) and the UN Security Council Consolidated List, refreshed every few days. Returns match / possible_match / clear with score, matched name or alias, list, programmes and list ID. Up to 20 names per call. Not legal advice; matches need human review.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Person, company, vessel or aircraft name"
                  },
                  "names": {
                    "type": "array",
                    "description": "Or up to 20 names"
                  },
                  "type": {
                    "type": "string",
                    "description": "Optional filter",
                    "enum": [
                      "any",
                      "individual",
                      "entity",
                      "vessel",
                      "aircraft"
                    ]
                  },
                  "threshold": {
                    "type": "number",
                    "description": "Match threshold 0.75-1 (default 0.86)"
                  }
                },
                "required": []
              },
              "example": {
                "name": "Bank Melli Iran"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "result": "match",
                  "highest_score": 1,
                  "matches": [
                    {
                      "name": "BANK MELLI IRAN",
                      "list": "US OFAC SDN list",
                      "programs": "IRAN",
                      "type": "entity",
                      "score": 1
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/business-check": {
      "post": {
        "operationId": "businessCheck",
        "summary": "\"Is this business real?\" report: domain age and lookalikes, email security, website contents, AI traps and sanctions screening in one call",
        "description": "One call before your agent pays, signs up, shares data or partners with a company: checks the domain (age, registrar, lookalike/typosquat of big brands, DNS, SPF/DMARC, redirects), reads the home page (contact details, privacy/terms/about pages, social profiles, copyright year, scam money wording), scans it for hidden instructions aimed at AI agents and screens the company name against OFAC and UN sanctions lists. Returns verdict looks_legitimate / be_careful / do_not_trust with a 0-100 trust score and every signal. Not charged if the domain does not exist.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.250000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "Domain like example.com"
                  },
                  "url": {
                    "type": "string",
                    "description": "Or any URL on the site"
                  },
                  "company_name": {
                    "type": "string",
                    "description": "Optional legal/company name to screen (default: taken from the website)"
                  }
                },
                "required": []
              },
              "example": {
                "domain": "stripe.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "verdict": "looks_legitimate",
                  "trust_score": 96,
                  "domain_check": {
                    "age_days": 10000
                  },
                  "sanctions": {
                    "result": "clear"
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/code-report": {
      "post": {
        "operationId": "codeReport",
        "summary": "Full code safety report for a GitHub repo: risky code + poisoned MCP tools + known vulnerable dependencies, with one overall grade and a to-do list",
        "description": "Runs the GitHub code scan (install scripts, secret stealing, env dumps, webhooks, hidden/encoded code, poisoned MCP tool descriptions) AND finds up to 3 lockfiles in the repo (npm, yarn, pnpm, pip, poetry, uv, Go, Cargo, Composer, Bundler) and checks every dependency version against OSV.dev for known CVEs and typosquats. Returns code grade, dependency grade, overall grade A-F, safe_to_install and an action list. Not charged if the repo is private or missing.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "repo": {
                    "type": "string",
                    "description": "owner/name or https://github.com/owner/name"
                  }
                },
                "required": [
                  "repo"
                ]
              },
              "example": {
                "repo": "modelcontextprotocol/servers"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "overall_grade": "B",
                  "code_grade": "A",
                  "dependency_grade": "B",
                  "safe_to_install": true,
                  "action_list": []
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/preflight": {
      "post": {
        "operationId": "preflight",
        "summary": "Robot Safety Pass: one call before your agent visits, pays or sends - checks the website, the x402 payment offer and the outgoing message",
        "description": "Give any of: url (site the agent will visit, log in to or buy from), payment_url (x402 endpoint it is about to pay) and message (text it is about to send). Runs the website trust check, the x402 offer check and Leak Guard in parallel and returns one decision: go, caution or stop, with reasons and a redacted message if needed.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Website the agent is about to use"
                  },
                  "payment_url": {
                    "type": "string",
                    "description": "x402 endpoint the agent is about to pay"
                  },
                  "payment_method": {
                    "type": "string",
                    "description": "Method for the payment endpoint (default POST)",
                    "enum": [
                      "POST",
                      "GET"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "description": "Text the agent is about to send or post"
                  }
                },
                "required": []
              },
              "example": {
                "url": "https://paypa1-secure-login.com",
                "message": "my api key is sk-proj-abcdefghijklmnopqrstuvwxyz123456"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "decision": "stop",
                  "reasons": [
                    "Website looks unsafe (trust 5/100), imitates paypal",
                    "Message contains 1 secret(s) and 0 personal data item(s); send redacted_text instead"
                  ]
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    },
    "/scan-text": {
      "post": {
        "operationId": "scanText",
        "summary": "Scan any text, email, web page HTML or document for prompt injection before your agent reads it",
        "description": "Detects hidden or suspicious instructions aimed at AI agents in text or HTML: hidden HTML, invisible Unicode (tag-character smuggling), encoded payloads, fake system messages, data-exfiltration, payment-redirect and command-execution orders. Returns risk score, findings and a cleaned version that is safer to pass to an LLM. deep=true adds an AI review.",
        "tags": [
          "Web"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.002000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text or HTML to scan (max 200,000 chars)"
                  },
                  "mode": {
                    "type": "string",
                    "description": "strip (default) removes risky lines; flag keeps them",
                    "enum": [
                      "strip",
                      "flag"
                    ]
                  },
                  "deep": {
                    "type": "boolean",
                    "description": "Also run an AI review"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Thanks for the quick delivery. Contact support at help@example.com for returns."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "risk_score": 0,
                  "risk_level": "none",
                  "safe_to_use": true,
                  "cleaned_text": "Thanks for the quick delivery. Contact support at help@example.com for returns."
                }
              }
            }
          },
          "402": {
            "description": "Payment Required (free daily sample used up)"
          }
        }
      }
    }
  }
}