DEV Community

Cover image for How to give Claude an SEC insider-trading tool with the Apify MCP server
Michael
Michael

Posted on • Originally published at scrapers.lat

How to give Claude an SEC insider-trading tool with the Apify MCP server

AI agents are good at reasoning and terrible at facts. Ask Claude whether NVIDIA insiders have been selling stock this year, how much, and at what price, and it will give you a confident answer from its training data that is months stale or simply invented. For anything that moves a position, "probably correct" is not good enough. Insider transactions are a matter of public record, filed on SEC Form 4, and an agent should read them from the filing, not from memory.

In this guide we fix that. We connect Claude to the official Apify MCP server, expose a single Actor that reads SEC Form 4 insider filings, and turn "did insiders buy or sell?" from a guess into a live lookup against the source of record. By the end you will have a working tool that Claude, Cursor, or any MCP client can call mid-conversation, and you will understand exactly where in the run the tool fires and what it returns.

Everything below is a real setup with real output. No mocked responses.

What is the Apify MCP server?

Model Context Protocol (MCP) is an open standard that lets AI clients call external tools. The Apify MCP server (https://mcp.apify.com) implements that standard on top of the Apify platform, which means every one of the thousands of Actors in the Apify Store becomes a tool an agent can invoke.

Why route an Actor through MCP instead of hard-coding an API call?

  • The agent decides when to fetch. Claude reads the conversation, notices it needs a fact it does not have, and calls the tool on its own. You do not write glue code for every question.
  • Structured input and output. The MCP server hands Claude the Actor's input schema, so the model fills in the parameters correctly, and returns a clean dataset it can reason over.
  • One connection, many tools. The same MCP endpoint exposes search-actors, fetch-actor-details, and call-actor, so an agent can discover and run any Actor without new configuration.
  • No infrastructure. The server is hosted. You add a few lines to a config file and you are done.

The Actor we will use

We will expose the SEC Form 4 Insider Trading Transactions Scraper. Give it a ticker (or a CIK) and it returns each insider transaction as one structured record: the insider's name and role (officer, director, ten-percent owner), the transaction code and type (open-market buy, open-market sale, grant, gift, tax withholding), shares, price per share, total transaction value, shares owned after the trade, the resulting percentage change in the insider's stake, whether it ran under a Rule 10b5-1 plan, the filing date, and the accession number.

That field set is exactly what an equity-research or event-driven desk needs to read insider activity: not just "someone sold" but who, how many, at what price, how big a bite it took out of their position, and whether it was a discretionary decision or a pre-scheduled plan.

The SEC Form 4 Insider Trading Transactions Scraper on the Apify Store

Step 1: Get your Apify API token

Sign in to the Apify Console, open Settings → Integrations, and copy your personal API token. The MCP server uses it to authenticate and to bill Actor runs to your account.

📌 Note: the token is a secret. Keep it in the client config only, never in a prompt or a committed file.

Step 2: Point Claude Desktop at the Apify MCP server

Open Claude Desktop's config file (Settings → Developer → Edit Config, or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) and add the Apify server. The tools query parameter is the important part: it tells the server which Actor to expose, so Claude gets one focused tool instead of the entire Store.

{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=scrapers_lat/sec-form4-insider-trades-scraper",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Cursor uses the same JSON in .cursor/mcp.json. If you prefer to run it locally over stdio instead of the hosted endpoint:

{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--tools", "scrapers_lat/sec-form4-insider-trades-scraper"],
      "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart Claude Desktop so it picks up the new server.

Step 3: Confirm the tool is loaded

After the restart, the Actor shows up as a callable tool. If you list the tools the Apify server exposes, you will see the storage helpers plus the Actor itself, named after its Store handle:

get-actor-run, get-dataset-items, get-key-value-store-record,
abort-actor-run, scrapers_lat--sec-form4-insider-trades-scraper
Enter fullscreen mode Exit fullscreen mode

That last entry, scrapers_lat--sec-form4-insider-trades-scraper, is our insider-trading tool. Claude now knows it exists, what it does (from the Actor's README), and what inputs it takes (from the input schema the server passes along).

Step 4: Ask Claude about insider activity

Now the payoff. In a normal chat, ask a question that requires ground truth:

"Have any NVIDIA insiders sold stock this year? Show me the biggest open-market sale by an officer or director, with the price and how much of their stake it was."

Claude recognizes it cannot answer this reliably from memory, selects the Form 4 tool, and fills in the input from your question. Under the hood the client sends a tools/call with the Actor's parameters:

{
  "name": "scrapers_lat--sec-form4-insider-trades-scraper",
  "arguments": {
    "ticker": "NVDA",
    "dateFrom": "2026-01-01",
    "maxTrades": 30
  }
}
Enter fullscreen mode Exit fullscreen mode

The Apify MCP server starts the Actor, waits for it to finish, and returns the dataset. Here is the real run metadata it produced:

{
  "runId": "FAAfMZNumJtSe8rhO",
  "actorName": "scrapers_lat/sec-form4-insider-trades-scraper",
  "status": "SUCCEEDED",
  "startedAt": "2026-07-30T17:44:05.192Z",
  "finishedAt": "2026-07-30T17:44:12.362Z",
  "stats": { "runTimeSecs": 7.0 }
}
Enter fullscreen mode Exit fullscreen mode

Seven seconds, 30 transactions, live from the filings.

Step 5: Read the real output

The dataset the tool returns is one clean record per transaction. This is an actual record from the run, the largest open-market sale in the set (trimmed to the fields that matter for reading insider activity):

{
  "issuerName": "NVIDIA CORP",
  "issuerTicker": "NVDA",
  "insiderName": "STEVENS MARK A",
  "insiderTitle": "Director",
  "isDirector": true,
  "isOfficer": false,
  "transactionDate": "2026-06-02",
  "transactionCode": "S",
  "transactionType": "Open-market sale",
  "shares": 500000,
  "pricePerShare": 222.3774,
  "transactionValue": 111188700,
  "sharesOwnedAfter": 6899771,
  "ownershipChangePercent": -6.76,
  "directOrIndirect": "I",
  "natureOfOwnership": "By Trust",
  "is10b51Plan": false,
  "filingDate": "2026-06-04",
  "accessionNo": "0001199039-26-000005"
}
Enter fullscreen mode Exit fullscreen mode

Claude reads that and answers in plain language: NVIDIA director Mark A. Stevens sold 500,000 shares on 2026-06-02 at a weighted-average $222.38, about $111.2M in proceeds, held indirectly by a family trust. The sale trimmed his position by 6.76% and left him with 6,899,771 shares, and this particular tranche was not filed under a Rule 10b5-1 plan. Every one of those facts is traceable to an official filing, accession 0001199039-26-000005, not the model's memory.

Claude calling the Form 4 tool and answering with live insider-transaction data

The nuance is just as important as the headline. The same dataset also contains code-A grants (restricted stock awards worth $0 in cash), code-F shares surrendered to cover taxes, and code-G gifts to trusts. An analyst who only sees "insider disposed of shares" would misread a routine tax withholding as a bearish signal. Because the tool returns the transaction code and type on every record, the agent can separate a discretionary open-market sale from housekeeping, which is the whole point of reading Form 4 carefully.

Two fields do a lot of the interpretive work. ownershipChangePercent tells you how big the trade was relative to the insider's own stake, so a $111M sale that is 6.76% of a position reads very differently from the same dollar amount that clears out someone's entire holding. And is10b51Plan tells you whether the trade was pre-scheduled: a sale under a Rule 10b5-1 plan was set in motion months earlier and carries little signal, while a discretionary, off-plan sale is a decision the insider made with current information. The agent can weight both automatically instead of asking you to open the filing and read the footnotes.

A real use case: an insider-activity monitor

Put this in context. An event-driven analyst covering a basket of names wants a morning read on insider behaviour: who is buying or selling with their own money, in size, and off-plan. Doing this by hand means opening EDGAR, filtering each issuer's Form 4 feed, opening every filing, and decoding transaction codes one at a time.

With the tool wired into Claude, the analyst pastes the watchlist into the chat and asks the agent to flag anything material. Claude calls the Actor per ticker, filters for open-market buys and sales (codes P and S), ignores grants and tax withholding, sorts by transaction value and by percentage change in the insider's stake, and notes whether each trade ran under a Rule 10b5-1 plan. It comes back with a short list: "Director X sold 6.8% of a nine-figure position, not on a 10b5-1 plan" is a very different line than "CFO received a scheduled RSU grant." The mechanical fetch-and-decode step disappears; the judgment about what the selling means stays with the human.

This is the shape of every good agent tool: it removes the mechanical fetch, not the decision.

Going further: chain a second tool

Insider activity is one input; it gets sharper next to the company's own disclosures. The same MCP connection can expose more Actors by extending the tools parameter:

https://mcp.apify.com?tools=scrapers_lat/sec-form4-insider-trades-scraper,scrapers_lat/sec-edgar-filings-scraper
Enter fullscreen mode Exit fullscreen mode

Now the agent can pull an issuer's Form 4 insider transactions and its SEC EDGAR 10-K, 10-Q and 8-K filings in the same conversation. Ask "did the director's June selling line up with anything the company disclosed that month?" and Claude reads the insider trades from one tool, the 8-K material-events feed from the other, and reasons across both. Because each Actor is a separate tool, the agent picks the right one for each step on its own.

🏹 Troubleshooting: if a run comes back empty, the usual cause is the date window. The Actor defaults to roughly the last 30 days, and a given issuer may simply have no Form 4 filings in that span. Widen it with dateFrom (for example "2026-01-01") or switch to a ticker with heavier insider activity. You can also narrow to one behaviour by passing transactionCode (P for open-market buys, S for open-market sales) so the agent only sees discretionary trades.

📌 Note: each tool call is a real Actor run billed to your Apify account (this Actor is pay-per-result). For one-off research the cost is a fraction of a cent; if you plan to sweep hundreds of tickers on a schedule, run the Actor directly through the Apify API or a scheduled task instead of one call per chat message.

Wrapping up

You now have an AI agent that can read SEC Form 4 insider transactions on demand, mid-conversation, with the code, price, size, and 10b5-1 detail an equity-research read actually needs. The pattern is reusable: pick an Actor that returns authoritative structured data, expose it through the Apify MCP server with the tools parameter, and let the agent decide when to call it.

To take it further:

  • Filter to a single behaviour with transactionCode so the agent only ever sees open-market buys or sells.
  • Add the EDGAR filings, institutional-holdings, or earnings Actors to build a multi-step research agent that cross-checks insider activity against disclosures.
  • Read the Apify MCP server docs for OAuth setup, resource reads, and the search-actors / call-actor tools that let an agent discover Actors it was not preconfigured with.

The Actor used in this guide: SEC Form 4 Insider Trading Transactions Scraper.

Top comments (0)