An automated stock screener runs market-wide screening criteria on a schedule and delivers structured results without manual intervention. With MCP, the screening logic is a natural language prompt, not code.
This guide walks through building one end to end. You connect Shibui Finance to Claude via MCP, write a screening prompt, make it reliable enough for unattended execution, schedule it, and control the output format. Every step includes the actual commands and config you need.
Shibui's MCP server gives Claude read access to a pre-built financial database: 10,000+ US equities with 64 years of daily prices, quarterly financials, 56 technical indicators, and SEC insider transactions. For the full data inventory, see the data sources page. For why MCP works better than REST APIs for this, see the workflows hub.
Step 1: How to connect Shibui Finance via MCP
The MCP endpoint is https://mcp.shibui.finance/mcp. How you
connect depends on your client.
Claude Code
claude mcp add shibui-finance --transport streamable-http https://mcp.shibui.finance/mcp
This registers the server. It persists across sessions. You can verify
with claude mcp list.
Claude (web)
Customize > Connectors > Add custom connector. Paste
https://mcp.shibui.finance/mcp as the URL. The connector
appears in every new conversation. Full walkthrough:
How to Get Stock Data into Claude.
ChatGPT
Settings > Connected apps > Add app. Enter
https://mcp.shibui.finance/mcp. Full walkthrough:
How to Get Stock Data into ChatGPT.
Any MCP-compatible client
Connect via streamable HTTP transport to
https://mcp.shibui.finance/mcp. No API key required. The
server exposes 12 tools including query (run SQL against the
database), get_database_schema (load the schema), and
workflow loaders for screening, fundamentals, technicals, and more.
Step 2: Write and iterate on the screen
Start with a natural language description of what you want to find. Claude translates it into SQL, runs it against the database, and returns the results. You can automate any screening methodology available on Shibui, from VCP setups to CAN SLIM criteria to insider buying patterns.
"Find stocks where insider buying exceeded $1M in the last 30 days, the stock is above its 200-day SMA, and market cap is over $500M. Exclude financials and REITs. Show symbol, company name, insider purchase total, current price, 200-day SMA, and trailing P/E."
This screen joins three data domains in one pass: SEC insider transactions, technical indicators, and daily valuations. The results come back as a table with the columns you specified.
Iterate by adding or changing conditions. Each change is an edit to the English prompt, not a code change.
"Same screen, but require positive operating cash flow for the last 4 consecutive quarters, and only include stocks where at least 2 different insiders bought in the last 30 days."
Keep iterating until the results are consistent and useful across multiple runs. When the screen returns a list you would actually review, save the prompt. That prompt is the input to your automated workflow. For more screening approaches, see the AI stock screener overview or the methodology guides.
Free, no API key, works on all Claude plans.
Connect now →Step 3: Make the prompt reliable for unattended runs
A prompt that works in conversation may behave unpredictably when scheduled. The model might change column names, switch between Markdown and prose, or silently drop a filter. For unattended execution, pin the output contract.
Pin column names and order
List the exact columns you want in the prompt. "Show symbol, name, market_cap, trailing_pe, insider_buy_total, sma_200" is deterministic. "Show relevant metrics" is not.
Request a specific output format
For downstream parsing, request JSON explicitly:
"Run the insider buying screen. Return results as a JSON array. Each object should have keys: symbol, name, market_cap, trailing_pe, insider_buy_total, sma_200, price. No commentary, no explanation, just the JSON array."
When this runs unattended via Claude Code, the output is a clean JSON
array you can pipe to jq, write to a file, or feed into
another script.
Add guard rails for edge cases
Add instructions for what to do when the screen returns unexpected results:
- "If the query returns zero rows, output exactly:
NO_RESULTS" - "If any column is NULL for more than half the rows, add a warning line at the top"
- "Limit output to the top 25 results sorted by insider_buy_total descending"
These instructions prevent the model from generating explanatory prose when the screen comes up empty, which would break a downstream parser.
Version the prompt
Save the finalized prompt in a file (e.g., screens/insider-buying-v3.txt).
When you change criteria, increment the version. This gives you a history
of what ran and when, which matters when you are reviewing results from
a screen that ran a week ago.
Step 4: How to schedule a daily stock screener
Three paths to recurring execution, depending on your setup.
Claude Code: /schedule
Claude Code's /schedule command creates a recurring cloud
agent that runs your prompt on a cron schedule. The agent connects to
Shibui via MCP, runs the screen, and saves the output.
# Inside Claude Code:
/schedule "Run the insider buying screen from screens/insider-buying-v3.txt
and save results to screens/output/insider-buying-$(date +%Y-%m-%d).json"
--cron "30 10 * * 1-5"
This runs at 10:30 UTC on weekdays (before US market open). The output file includes the date so results accumulate without overwriting.
System cron with Claude CLI
For local control, use system cron with the Claude CLI's print mode:
# crontab entry
30 10 * * 1-5 claude -p "$(cat ~/screens/insider-buying-v3.txt)" \
--allowedTools 'mcp__shibui-finance__*' \
> ~/screens/output/insider-buying-$(date +\%Y-\%m-\%d).json 2>&1
The -p flag runs Claude in non-interactive mode.
--allowedTools restricts which tools can execute without
confirmation. Standard cron error handling (mail, logging) applies if
the command fails.
Programmatic MCP clients
Any MCP-compatible client can connect to
https://mcp.shibui.finance/mcp via streamable HTTP transport.
Codex, custom agent frameworks, and ChatGPT's connected apps all use the
same endpoint. If you are building a Python pipeline, use an MCP client
library to connect and call the query tool directly.
Step 5: Control the output format
The output format depends on what you ask for in the prompt.
Default: Markdown table
Without format instructions, Claude returns a Markdown table with a brief explanation. This is readable but hard to parse programmatically.
JSON for downstream processing
Add "Return results as a JSON array, no commentary" to your prompt. Example output:
[
{"symbol": "ACME.NYSE", "name": "Acme Corp", "market_cap": 12400000000,
"trailing_pe": 18.3, "insider_buy_total": 2850000, "sma_200": 142.50, "price": 156.20},
{"symbol": "WIDG.NASDAQ", "name": "Widget Inc", "market_cap": 8700000000,
"trailing_pe": 22.1, "insider_buy_total": 1920000, "sma_200": 88.30, "price": 95.70}
]
This pipes cleanly to jq, Python's json.load(),
or any downstream tool. Use jq '.[] | .symbol' to extract
just the ticker list.
CSV for spreadsheets
"Return results as CSV with a header row, no commentary" produces output
you can redirect to a .csv file and open in Excel or Google
Sheets.
Multi-step workflows
A single prompt can chain multiple steps. This is where automated screens become workflows: screen the market, then deep-dive on the results, then produce a formatted report.
"Step 1: Run the insider buying screen (insider purchases > $1M in 30 days, above 200-day SMA, market cap > $500M, exclude financials, require 4 consecutive quarters of positive operating cash flow). Step 2: For the top 5 results by insider purchase total, pull the last 4 quarterly earnings reports showing revenue, EPS, and operating margin. Step 3: Format a summary report as JSON with two keys: 'screen_results' (the full screen output) and 'deep_dives' (one object per company with the quarterly data)."
Claude executes each step sequentially against the same MCP connection. The screen runs first, then the deep-dives query the database for each company, then the output is assembled into the requested format. One prompt, one scheduled run, structured output at the end.
For even more complex pipelines, split into separate prompts and chain them with shell scripting. Run the screen, save the output, parse the ticker list, then run a second Claude call with those tickers as input.
Error handling
Unattended runs fail silently unless you plan for it. Common failure modes and how to handle them:
-
MCP server unreachable. The Claude CLI exits with a
non-zero status. Cron captures this in stderr. Add
|| echo "SCREEN_FAILED" >> ~/screens/errors.logto your crontab line. - Query returns zero rows. Add "If zero results, output exactly NO_RESULTS" to the prompt. Your downstream parser checks for this string before attempting to parse JSON.
- Data lag. Shibui data updates daily with roughly a one-day lag. If your screen runs before the daily refresh, yesterday's data is still current. Schedule runs after 10:00 UTC to ensure the latest data is loaded.
-
Model changes output format. Even with pinned columns,
model updates can shift formatting. Validate the output before acting
on it. A simple
jq . output.json > /dev/nullcheck catches malformed JSON.
How automated MCP screening compares
| Approach | Setup | Maintenance | Multi-table queries | Scheduling |
|---|---|---|---|---|
| MCP-based (Shibui) | 2 minutes | None (server-managed) | Built-in (31M rows pre-joined) | Claude Code /schedule or cron |
| REST API script (yfinance) | Days to weeks | API changes break scripts | Manual joins across endpoints | Custom cron + error handling |
| Finviz Elite | Account setup | None | Single-table filters only | Email alerts, no custom logic |
| TradingView Pine Script | Hours (learn Pine) | Script maintenance | Limited to Pine data | Built-in alerts |
Each approach has strengths. Finviz and TradingView offer real-time alerts that Shibui cannot (Shibui is end-of-day only). Pine Script gives you custom indicator logic. yfinance is free and flexible if you are comfortable writing Python. MCP is the fastest path from criteria to automated results if you want multi-table screens without code. For more on how Shibui compares to specific tools, see the Finviz comparison and the TradingView comparison.
What users have built
Automated screens are already running on Shibui daily:
- Sector-level daily screens. Breaking the market into sector groups, applying different criteria to each, producing a bucketed report covering the full US market.
- Insider buying alerts. Screening for stocks where multiple insiders bought within the same window, combining Form 4 data with fundamental and technical overlays.
- Technical pattern scanners. Running setups like volatility contraction patterns across large watchlists daily, flagging stocks approaching breakout conditions.
Each started as a prompt, was refined through iteration, and now runs on a schedule.
Limitations: Shibui provides end-of-day US equity and ETF data with roughly a one-day lag. No intraday, no real-time, no international markets. Full coverage details on the data sources page. This is a data tool, not financial advice.
Frequently asked questions
What output format does an automated screen produce?
By default, Claude returns a Markdown table with commentary. For machine-readable output, add "Return results as a JSON array with keys: symbol, name, market_cap, trailing_pe" to your prompt. Claude Code can pipe the JSON to a file with stdout redirection. See controlling the output format above for examples.
How do I handle failures in a scheduled stock screen?
Add validation instructions to the prompt: "If the query returns zero rows, output exactly NO_RESULTS." The Claude CLI exits with a non-zero status on connection failures, so standard cron error handling applies. See error handling above for the full list of failure modes.
Can I chain multiple screens into one workflow?
Yes. A single prompt can run a broad screen, deep-dive on the top results, and format a report. Describe the full pipeline in numbered steps within one prompt. Claude executes each step sequentially against the same MCP connection. See multi-step workflows above for an example.
Does this work with ChatGPT or only Claude?
It works with any MCP-compatible client, including ChatGPT, Claude,
Claude Code, Codex, and custom agents. Connect via streamable HTTP
transport to mcp.shibui.finance/mcp. The same screening
prompts work across all clients. See
connection options above for setup instructions
per client.
How often is Shibui data updated?
Daily. Prices, technicals, and valuations update after US market close. Fundamentals update within days of earnings releases. SEC filings update every 5 minutes from the EDGAR feed. Schedule your automated screens after 10:00 UTC to ensure the latest data is loaded.
Can I build an automated screener without writing code?
Yes. Claude Code's /schedule command and Claude Desktop
Projects both let you automate screens without writing code. Describe
criteria in English, schedule the prompt, and results arrive on the
schedule you set. See scheduling options above
for the details. For an overview of interactive (non-automated)
screening, see the AI stock screener
page or the features overview.