Petros Trading Scanner MCP

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.

Category
访问服务器

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)

  1. Finviz — futures, breadth, snapshot, earnings API
  2. Finnhub — optional primary quotes when FINNHUB_API_KEY is set
  3. Alpha Vantage — optional quotes when ALPHA_VANTAGE_API_KEY is set
  4. Nasdaq — quote provider (price, change %, volume)
  5. Yahoo Finance — spark batch only when not rate-limited (30 min cooldown after HTTP 429)
  6. MarketWatch — premarket movers (often blocked on cloud hosts with HTTP 401)
  7. 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

  1. Deploy the server (Heroku or another HTTPS host).
  2. In ChatGPT → Settings → Connectors / Developer Mode, add a custom MCP server.
  3. Use your public MCP URL, for example:
    • https://petros-trading-scanner.herokuapp.com/mcp
  4. 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) alongside marketBias
  • news[] with impact (high | medium | low) and sentiment
  • portfolioNotes[] with thesis status per position
  • semiconductorStrength summary 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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选