AI Stock Scanner MCP

Last updated November 3, 2026

Connect Claude or another MCP client to StashGamma and ask for stock scans in your own words. Your assistant writes the query, runs it against end-of-day data, and reads the matches back. It uses the same scan language as the AI Stock Scan Builder.

Get your API key

How it works

All of these tools are read-only. They can't read or change saved scans, reach another user's data, or place trades. The server doesn't use AI to write queries; your assistant does that.

Connect your client

You need a Data API key. Sign in and open Profile, Developer API to get one. Treat a URL with your key in it like a password, and rotate the key from the same page if it leaks.

Claude Code

claude mcp add --transport http stashgamma-scanner "https://www.stashgamma.com/api/dataapi/mcp?toolset=scanner" --header "X-Api-Key: sg_live_YOUR_KEY"

Claude Desktop and Claude.ai

Go to Settings, then Connectors, then Add custom connector. That form takes a single URL, so the key goes in the path:

https://www.stashgamma.com/api/dataapi/mcp/sg_live_YOUR_KEY?toolset=scanner

The Claude and ChatGPT setup guide walks through connector setup click by click, with your own key filled in. Use the URL above to get only the scanner tools.

Other MCP clients

Any client that supports the Streamable HTTP transport can connect. Send the key as an X-Api-Key header or Authorization: Bearer, or put it in the URL as above. The server is stateless: each POST gets one JSON response, and a GET returns 405 because there is no event stream to open. You can test your key with curl:

curl -X POST "https://www.stashgamma.com/api/dataapi/mcp?toolset=scanner" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "X-Api-Key: sg_live_YOUR_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Leaving out ?toolset=scanner connects to the full Data API server, which adds the price data, options analyzer and portfolio tools. The portfolio tools can change your account's position list, so those tools aren't read-only.

Tools

ToolArgumentsReturnsQuota
run_stock_scanquery, universe?, sort?, limit?Date of the data, match count, truncated flag, and the matching symbols with their close and the fields the query uses.Counts as 1 request. A rejected query does not count.
validate_scan_queryquery, universe?Whether the query compiles. If it does, the universe and the fields it can sort by. If not, the reason and position.Free
get_scan_syntaxnoneThe scan language: timeframes, comparators, universes, every indicator with its allowed periods, every fundamentals field, and examples of what gets rejected.Free
get_example_scansnoneReady-made scan queries by category, each of which compiles as written.Free
get_api_usagenoneYour plan, and the requests used and remaining per hour, day and week.Free

universe is one of ALL, SP500, NQ100 or DOW30. sort takes a field, which is close or a field the query uses such as daily.rsi14, and a direction of asc or desc. Without a sort, rows are in symbol order.

Example prompts

Ask in your own words. These are prompts you could use, each with a query your assistant could write for it.

“Find S&P 500 stocks with RSI under 30 that are still above their 200-day average, lowest RSI first.”

[Daily RSI(14) < 30]
AND [Daily Close > Daily SMA(200)]
AND [universe = SP500]

“Which Nasdaq 100 stocks are within 5% of their 52-week high?”

[Daily Close >= Daily Week52High * 0.95]
AND [universe = NQ100]

“Show me stocks where the 50-day EMA just crossed above the 200-day EMA.”

[Daily EMA(50) crosses_above Daily EMA(200)]

“Screen for a P/E under 15, ROE over 10 and debt to equity under 0.5.”

[Fundamentals PE < 15]
AND [Fundamentals ROE > 10]
AND [Fundamentals DebtEquity < 0.5]

“Which stocks have both daily and weekly RSI above 50?”

[Daily RSI(14) > 50]
AND [Weekly RSI(14) > 50]

“Find stocks trading at more than 1.5 times their 20-day average volume.”

[Daily Volume > Daily SMA(20, Volume) * 1.5]

Limits

Frequently asked questions

What is the AI Stock Scanner MCP?

It is a Model Context Protocol server that lets an AI assistant such as Claude run stock scans for you. It uses the same scan language and the same end-of-day data as the AI Stock Scan Builder on the website.

Does the server write the query?

No. Your assistant writes it. It reads the language reference from get_scan_syntax, writes a query, and fixes it from the error message if the query is rejected. The server only compiles and runs what it receives.

Do I need an API key?

Yes. It uses your StashGamma Data API key, and scans draw from the same hourly, daily and weekly quota as the data tools. The AI Stock Scan Builder on the website can run scans without a key or an account.

Can it see my saved scans or place trades?

No. These tools can only run a scan, check a query, and read the reference. They cannot read or change saved scans, reach another user's data, or place trades.

Is the data real-time?

No. Scans run on end-of-day data rebuilt at 5:15 PM Eastern on weekdays. Every result includes the date of the data.

What happens if there are more matches than I asked for?

The result gives the true match count and sets truncated to true. Pass a larger limit, up to 500, or a sort so the rows you get are the ones you want. Without a sort, rows are in symbol order.

Is a scan result a recommendation to buy a stock?

No. A scan only lists symbols that meet the conditions you set. StashGamma is for educational purposes and nothing here is investment advice.

Learn more

Related reading

Ready to try it? Get your free API key — no card required.