# PhishStats for AI agents

You are an AI agent (Claude, Cursor, Codex, or similar). Your user wants to use PhishStats,
a phishing database and real-time feed run since 2014, for phishing investigations. This
file tells you how to connect, which tools exist, and how to run the common workflows.
Read it all, then help your user with the setup steps below and ask what they want to
investigate.

- Website: https://phishstats.info
- MCP server (recommended): `https://mcp.phishstats.info/mcp` (Streamable HTTP)
- REST API: `https://api.phishstats.info/api/phishing`
- API docs: https://phishstats.info/api-docs
- Create an API key: https://phishstats.info/settings/api-keys
- Plans and quotas: https://phishstats.info/pricing

## 1. Setup (walk your user through this)

1. **Get a free API key.** The user signs in at https://phishstats.info and creates a key at
   https://phishstats.info/settings/api-keys. Keys look like `psk_<prefix>_<48 hex chars>`.
   Ask the user to keep the key in an environment variable (for example
   `PHISHSTATS_API_KEY`). Do not ask them to paste it into the chat, and never write it into
   files that get committed.
2. **Connect the MCP server.** Auth is a static API key sent as
   `Authorization: Bearer psk_...`. There is no OAuth flow, so clients that only support
   OAuth connectors need the `mcp-remote` bridge shown below.

   Claude Code:

   ```bash
   claude mcp add --transport http phishstats https://mcp.phishstats.info/mcp \
     --header "Authorization: Bearer $PHISHSTATS_API_KEY"
   ```

   Project-scoped `.mcp.json` (Claude Code; the key comes from the environment):

   ```json
   {
     "mcpServers": {
       "phishstats": {
         "type": "http",
         "url": "https://mcp.phishstats.info/mcp",
         "headers": { "Authorization": "Bearer ${PHISHSTATS_API_KEY}" }
       }
     }
   }
   ```

   Cursor (`~/.cursor/mcp.json`) and other clients that accept headers:

   ```json
   {
     "mcpServers": {
       "phishstats": {
         "url": "https://mcp.phishstats.info/mcp",
         "headers": { "Authorization": "Bearer ${env:PHISHSTATS_API_KEY}" }
       }
     }
   }
   ```

   Claude Desktop and other stdio-only clients (bridge through `mcp-remote`):

   ```json
   {
     "mcpServers": {
       "phishstats": {
         "command": "npx",
         "args": ["-y", "mcp-remote", "https://mcp.phishstats.info/mcp",
                  "--header", "Authorization:${AUTH_HEADER}"],
         "env": { "AUTH_HEADER": "Bearer psk_..." }
       }
     }
   }
   ```

3. **Check that it works.** Call `get_latest` with `size: 3`. A 401 means the key is
   missing or wrong. A 429 means a quota was hit (see section 5).
4. **No MCP support?** Use the REST API with `curl` (section 4). It needs the same key.

## 2. MCP tools

All tools take `size` (max 100) and a 1-based `page` where paging applies. Dates are
`YYYY-MM-DD`. Filters inside one call are ANDed.

| Tool | Use it for |
|---|---|
| `get_latest(size)` | Newest records in the feed |
| `search_phishing(url, ip, title, country_code, tld, asn, host, domain, min_score, max_score, date_from, date_to, sort, size, page)` | General structured search; `url`/`title` are substring matches |
| `search_by_url` / `search_by_host` / `search_by_domain` / `search_by_ip` | One-field lookups (IOC checks) |
| `get_record_by_id(record_id)` / `get_record_by_hash(hash)` | One full record; `hash` is the SHA-256 of the URL |
| `count_phishing(...)` | How many records match (same filters as `search_phishing`) |
| `get_top_stats(group_by, size, date_from, date_to)` | Top `countryname`, `ip`, `tld`, `asn`, `isp` or `host` by count |
| `search_phishing_details(hash, gtm_id, google_analytics_id, facebook_pixel_id, favicon_hash, body_hash, exclude_hash)` | Campaign pivots: pages sharing trackers, favicon or page body |
| `search_phishing_requests(url_hash, host, content_hash, request_url_hash, resource_type)` | Sub-resources a page loaded (scripts, css, images, XHR); find pages loading the same kit file |

Resources: `phishstats://fields` (field descriptions) and `phishstats://operators`.

Key record fields: `id`, `url`, `hash`, `title`, `ip`, `asn`, `isp`, `bgp`, `countrycode`,
`host`, `domain`, `tld`, `domain_registered_n_days_ago`, `score` (0 to 10, higher means more
likely phishing), `date` (first seen, UTC), `http_code`, `ssl_issuer`, `abuse_contact`,
`n_times_seen_ip`, `n_times_seen_host`, `n_times_seen_domain`.

Every record has a human-readable page at `https://phishstats.info/search/<hash>`. Link
your user there when you cite a record.

## 3. Workflows

### IOC enrichment (incident response)

The user has a suspicious URL, domain, host or IP from an alert, email or ticket.

1. Look it up exactly: `search_by_url`, `search_by_host`, `search_by_domain` or `search_by_ip`.
2. If there is a hit, report first seen date, score, title (impersonated brand), hosting
   (IP, ASN, ISP, country) and `abuse_contact`, plus the record link.
3. Widen: other phishing on the same IP (`search_by_ip`), same domain, and how often the IP
   or host has been seen (`n_times_seen_*`).
4. No hit does not mean safe. Say so, and suggest submitting it (section 3, "Submitting").

### Phishing research (shared infrastructure)

Start from one record and find the rest of the campaign.

1. Get the record (`get_record_by_hash`) and its details (`search_phishing_details(hash=...)`).
2. Pivot on each tracker, `favicon_hash` and `body_hash` with `search_phishing_details`
   and `exclude_hash` set to the start page. Same GTM / GA / Facebook pixel ID or the same
   body hash usually means the same operator or phishing kit.
3. Pivot on kit files: `search_phishing_requests(url_hash=...)` lists what the page
   loaded; search each distinctive `content_hash` to find other pages loading the same file.
4. Pivot on hosting: same IP, ASN, and `title` patterns over a date range.
5. Summarize as a table: hash, URL (defanged), first seen, IP/ASN, shared indicator.
   Use `get_top_stats` and `count_phishing` for trends ("top ASNs for this brand this month").

For a visual, interactive graph of these pivots, the open-source
[phishstats-api-network](https://github.com/eschultze/phishstats-api-network) tool runs
locally and draws the relationships.

### Monitoring your own network (ISPs, hosting providers)

1. List the user's ASNs, IP ranges, or domains they host.
2. Query recent phishing on them: `search_phishing(asn="AS64500", date_from=...)`,
   `get_top_stats(group_by="host", ...)` filtered by date, `count_phishing` for trend lines.
3. For each hit, give the URL (defanged), host, IP, first seen and record link so the abuse
   team can act.
4. For continuous coverage, tell the user to create monitoring rules at
   https://phishstats.info/settings/monitoring (match on `ip`, `domain`, `host`, `url`,
   `title`, `keyword`, `score`, `countrycode` or `tld`). Alerts go to Slack, Microsoft
   Teams, Discord, Google Chat, Telegram or a webhook, so nobody has to poll the API.
   Monitoring needs a paid plan; see https://phishstats.info/pricing.

### Brand protection and takedown teams

1. Per customer brand, search titles and URLs: `search_phishing(title="examplebank")`,
   `search_phishing(url="examplebank")`, sorted newest first, with a date window.
2. Watch for lookalike domains: `search_phishing(domain=...)`, `tld` filters, and young
   domains (`domain_registered_n_days_ago` low).
3. Build the takedown list: URL, host, IP, ASN, `abuse_contact`, `ssl_issuer` (for the
   certificate authority) and registrar details where present.
4. Set monitoring rules per brand (see above) so new pages alert the team in real time.
5. Submit the phishing URLs your team finds that PhishStats does not have yet (next
   section). Every URL in PhishStats reaches the security community, browser and email
   filtering researchers and other defenders, so submitting helps your takedowns.

### Other good uses

- **Email triage:** extract URLs from a reported phishing email, check each, and submit
  the unknown ones.
- **Threat intel reports:** weekly top brands, countries, ASNs and TLDs from
  `get_top_stats` and `count_phishing`.
- **Detection engineering:** pull recent high-score URLs and titles to test or tune mail
  and proxy rules.
- **SIEM/SOAR enrichment:** write a small script around the REST API that tags alerts with
  PhishStats hits.
- **Academic research:** trends over time and infrastructure reuse. Contact
  contact@phishstats.info for historical datasets.

### Submitting phishing URLs

PhishStats gets better with every URL the community sends in. When the user confirms a URL
is phishing and the database does not have it, offer to submit it:

```bash
curl -X POST https://phishstats.info/api/submit \
  -H "X-API-Key: $PHISHSTATS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://phishing.example/login", "notes": "Reported by a customer, impersonates Example Bank"}'
```

- `url` must start with `http://` or `https://` (max 2048 characters). `notes` is optional
  (max 500 characters): brand, source, why it is phishing.
- The response has `success`, `id` and `status` (`pending`, or `duplicate` if PhishStats
  already has the URL). Submissions are reviewed before they enter the feed.
- Free accounts can submit 10 URLs per day; paid plans have higher limits.
- Only submit URLs the user has reviewed and believes are phishing. Never submit
  legitimate sites, and ask before submitting in bulk.
- A record PhishStats has wrong (a false positive) can be reported at
  https://phishstats.info/report-false-positive.

## 4. REST API (when MCP is not available)

```bash
curl -H "X-API-Key: $PHISHSTATS_API_KEY" \
  "https://api.phishstats.info/api/phishing?_where=(ip,eq,203.0.113.24)&_sort=-id&_size=20"
```

- Filter: `_where=(field,op,value)`, operators `eq`, `ne`, `gt`, `lt`, `like`; join
  conditions with `~and` / `~or`, e.g. `(countrycode,eq,BR)~and(score,gt,4)`.
- Sort: `_sort=-id` (newest first). Page: `_p` starts at **0**. `_size` max 100.
- Values containing `,` `(` `)` or `~` break `_where`. Use a `like` on a shorter substring
  instead.
- Campaign tables: `https://api.phishstats.info/api/phishing_details` and
  `https://api.phishstats.info/api/phishing_requests` take the same parameters.
- Full reference: https://phishstats.info/api-docs.

## 5. Quotas

| Tier | API requests / day |
|---|---|
| Anonymous (no key) | 50 per IP |
| Free (registered, API key) | 150 |
| Premium | 1,000 |
| Enterprise | 10,000 |

Every MCP tool call counts as one API request. Quotas reset at UTC midnight. A 429 says
which limit was hit and when it resets. Plan your queries: use `count_phishing` and
`get_top_stats` before pulling large result sets, and do not loop over pages you do not
need. Paid plans: https://phishstats.info/pricing.

## 6. Rules for agents

- **Never open, fetch or browse phishing URLs.** They are live attack pages. Work from
  PhishStats data only.
- **Defang URLs** when you show them: `hxxps://login-example[.]com/verify`. Link to the
  PhishStats record page instead of the phishing site.
- Data comes from community feeds and user submissions. False positives happen; check
  `score` and the evidence before telling a user something is malicious.
- No result is not proof that a URL is safe.
- Keep the user's API key out of chat logs, code and commits.
- Questions or partnerships: contact@phishstats.info.
