Petros Trading Scanner MCP
Read-only MCP server for short-term stock and ETF market research, providing tools for futures, premarket movers, market breadth, earnings, watchlist signals, and daily briefings.
README
Petros Trading Scanner MCP
Read-only Model Context Protocol (MCP) server for short-term stock and ETF market research. It helps ChatGPT analyze futures, premarket movers, market breadth, sector strength, earnings, watchlist signals, and daily briefings.
This server does not place trades. Trade execution is handled separately (e.g. Robinhood). It does not store personal data or broker credentials.
Features
| Tool | Description |
|---|---|
get_futures |
Nasdaq 100, S&P 500, Dow, Russell 2000, crude, gold, Bitcoin |
get_premarket_movers |
Leaders, laggards, most active (MarketWatch → Yahoo → Finviz fallback) |
get_market_breadth |
Finviz advancing/declining, highs/lows, SMA50/SMA200 |
get_finviz_snapshot |
Homepage-style snapshot: movers, news, headlines, breadth, futures |
get_earnings_calendar |
Upcoming earnings (Finviz API) |
get_watchlist_signals |
Transparent 0–10 scores, bias, reasons, risk flags |
get_semiconductor_strength |
Sector score, bias, confidence, leaders/laggards for 11 semi names (SOXL workflow) |
get_position_review |
Single-position review for any symbol: action, confidence, thesis, strengths, risks |
get_daily_briefing |
Full briefing with source attribution, confidence, news severity, portfolio notes |
Data sources (free/public)
- Finviz — futures, breadth, snapshot, earnings API
- Finnhub — optional primary quotes when
FINNHUB_API_KEYis set - Alpha Vantage — optional quotes when
ALPHA_VANTAGE_API_KEYis set - Nasdaq — quote provider (price, change %, volume)
- Yahoo Finance — spark batch only when not rate-limited (30 min cooldown after HTTP 429)
- MarketWatch — premarket movers (often blocked on cloud hosts with HTTP 401)
- Yahoo Finance screeners — day gainers/losers/actives when MarketWatch is blocked
Caching: 5 minutes for market data, 15 minutes for daily briefings.
Watchlist quotes resolve in order: Finnhub → Alpha Vantage → Nasdaq → Yahoo (if not rate-limited) → Finviz. Yahoo is skipped for 30 minutes after HTTP 429. Check quoteDiagnostics.rateLimitedSources to see active blocks.
Note: MarketWatch frequently returns HTTP 401 from Heroku and other cloud servers due to bot protection. The server automatically falls back to Yahoo Finance, then Finviz. To skip MarketWatch entirely, set MARKETWATCH_ENABLED=false in Heroku config vars.
Local development
Prerequisites
- Node.js 20+
- npm
Setup
git clone <your-repo-url>
cd mcp-trading
cp .env.example .env
npm install
npm run dev
Server starts on http://localhost:3000 by default.
- Health:
GET /health - MCP:
POST /mcp(Streamable HTTP)
Scripts
| Script | Purpose |
|---|---|
npm run dev |
Development with hot reload (tsx watch) |
npm run build |
Compile TypeScript to dist/ |
npm start |
Run production build |
Optional API key
Set MCP_SERVER_API_KEY in .env. When set, all /mcp routes require:
Authorization: Bearer <your-key>
Deploy to Heroku
heroku create petros-trading-scanner
heroku config:set MCP_SERVER_API_KEY=your-secret-key
git push heroku main
Heroku sets PORT automatically. The app binds to 0.0.0.0 and uses process.env.PORT.
Verify deployment:
curl https://petros-trading-scanner.herokuapp.com/health
Connect to ChatGPT Developer Mode
- Deploy the server (Heroku or another HTTPS host).
- In ChatGPT → Settings → Connectors / Developer Mode, add a custom MCP server.
- Use your public MCP URL, for example:
https://petros-trading-scanner.herokuapp.com/mcp
- If you configured
MCP_SERVER_API_KEY, add the Bearer token in the connector auth settings.
The server implements Streamable HTTP (POST /mcp) compatible with ChatGPT Apps / Developer Mode.
Example prompts
- "Use my Trading Scanner MCP to get today's daily briefing."
- "Check futures and premarket movers."
- "Analyze SOXL based on semiconductor strength."
- "Give me a market bias for today."
- "Run semiconductor strength for my SOXL workflow."
- "Run watchlist signals for SOXL, MU, NVDA, AMD, AVGO, INTC, MRVL, WDC."
- "Review my SOXL position — cost basis $50, current value $51.17."
- "Review my AAPL position — cost basis $180, current value $195."
Example: position review tool input
Works for any stock or ETF (SOXL, NVDA, AAPL, TQQQ, etc.):
{
"symbol": "SOXL",
"costBasis": 50,
"currentValue": 51.17
}
Expected shape (values vary with live market data):
{
"action": "hold",
"confidence": 76,
"thesis": "Semiconductor sector remains strong despite weak futures.",
"strengths": ["..."],
"risks": ["..."]
}
Example: daily briefing tool input
{
"focusSymbols": ["SOXL", "MU", "NVDA", "AMD", "AVGO", "INTC", "MRVL", "WDC"],
"portfolioContext": "Holding SOXL from starter account",
"positions": [
{
"symbol": "SOXL",
"costBasis": 50,
"currentValue": 51.17
}
]
}
The briefing now includes:
sources.futuresSource,sources.premarketSource,sources.breadthSource, etc.confidence(0–100) alongsidemarketBiasnews[]withimpact(high|medium|low) andsentimentportfolioNotes[]with thesis status per positionsemiconductorStrengthsummary block
Scoring (transparent, not advice)
Market bias uses:
- Nasdaq 100 futures ±0.5%
- S&P 500 futures ±0.3%
- Advancing/declining breadth above 55%
Confidence (0–100) increases as the bias score moves away from neutral and more signals agree. Example: marketBias: "bearish" with confidence: 72 = moderately-to-strongly bearish, not a mild lean.
Semiconductor strength tracks NVDA, AMD, MU, AVGO, INTC, MRVL, WDC, TSM, AMAT, LRCX, SMCI. Strong if 5+ are positive premarket or in major news.
SOXL scoring considers semiconductor strength + Nasdaq futures direction. Leveraged ETF risk flags are always included.
Quote verification
Watchlist signals and semiconductor strength include extra fields so you can sanity-check prices:
| Field | Meaning |
|---|---|
price |
Last regular (or premarket) sale from Yahoo/Nasdaq |
previousClose |
Prior session close used to compute change % |
changePercent |
Derived from price vs previousClose (or source-reported) |
asOf |
ISO timestamp of the quote (when available) |
quoteSource |
e.g. Yahoo Finance, Nasdaq, Finviz topGainers |
quoteValidated |
true when price, change, and % are internally consistent |
dataFreshness |
"fresh", "delayed", "stale", or "closed_session" — session-aware (premarket/regular/after-hours/weekend/holiday) |
marketSession |
Current US session: premarket, regular, after_hours, overnight, weekend, holiday |
freshnessAgeMinutes |
Minutes between asOf and server time |
freshnessReason |
Human-readable explanation of the freshness classification |
providerTimestamps |
Per-provider debug: finnhub.t, nasdaq.lastTradeTimestamp, etc. |
sourceQuality |
"multi_source_agreement", "multi_source_partial", "finnhub_only", "nasdaq_only", "finviz_only", etc. |
confidence |
Primary+Nasdaq agreement=95, partial agreement=85, Nasdaq only=70, Finviz only=55 |
isDelayed |
true for Finviz-only fallback quotes (change % only) |
Parser note: Nasdaq quotes use primaryData.lastSalePrice — not market cap, 52-week high, or volume. If a price looks wrong, check previousClose and asOf: when change % looks realistic but the level seems off, the upstream feed (Yahoo/Nasdaq) may be reporting a different session or a forward-dated close. Cross-check with your broker.
Daily briefings also include top-level dataFreshness — aggregated from futures, premarket, breadth, and watchlist quotes (stale if any quote is stale; closed_session when all quotes reflect the last completed session).
get_watchlist_signals returns overall confidence, quoteDiagnostics (including rateLimitedSources and providersAttempted).
The tools return data, scores, and reasons only — not buy/sell recommendations. ChatGPT interprets the output; you make your own decisions.
Project structure
src/
index.ts
server.ts
mcp/
tools.ts
schemas.ts
services/
finviz.ts
marketwatch.ts
yahoo.ts
scoring.ts
marketData.ts
cache.ts
http.ts
types/
market.ts
utils/
parseNumber.ts
logger.ts
quoteValidation.ts
newsAnalysis.ts
dataFreshness.ts
quoteConfidence.ts
Disclaimer
Development note: This is a research assistant only. It does not provide financial advice and does not place trades. Market data may be delayed or incomplete. Always verify quotes and consult your own judgment before trading.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.