stock-scanner-mcp 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +125 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -401,7 +401,7 @@ function createTradingviewModule() {
401
401
  },
402
402
  {
403
403
  name: "tradingview_quote",
404
- description: "Get a real-time quote for one or more stock tickers (e.g. 'AAPL' or 'NASDAQ:AAPL'). Returns price, change, volume, market cap, and pre-market/after-hours data when available. If a ticker returns empty results, retry with the correct exchange prefix (e.g. 'NYSE:CDE', 'AMEX:XYZ').",
404
+ description: "Get a 15-minute delayed quote for one or more stock tickers (e.g. 'AAPL' or 'NASDAQ:AAPL'). Returns price, change, volume, market cap, and pre-market/after-hours data when available. Data is delayed ~15 minutes during market hours \u2014 use finnhub_quote for real-time prices if available. If a ticker returns empty results, retry with the correct exchange prefix (e.g. 'NYSE:CDE', 'AMEX:XYZ').",
405
405
  inputSchema: z.object({
406
406
  tickers: z.array(z.string()).describe("Stock tickers, e.g. ['AAPL', 'MSFT']")
407
407
  }),
@@ -537,6 +537,26 @@ function createTradingviewModule() {
537
537
  return successResult(JSON.stringify(rows, null, 2));
538
538
  }, metadata2)
539
539
  },
540
+ {
541
+ name: "tradingview_market_indices",
542
+ description: "Get real-time values for major market indices: VIX (volatility), S&P 500, NASDAQ Composite, and Dow Jones. Essential for gauging broad market conditions, risk sentiment, and options pricing context.",
543
+ inputSchema: z.object({}),
544
+ handler: withMetadata(async () => {
545
+ const tickers = ["TVC:VIX", "TVC:SPX", "TVC:NDQ", "TVC:DJI"];
546
+ const columns = [
547
+ "close",
548
+ "change",
549
+ "change_abs",
550
+ "high",
551
+ "low",
552
+ "open",
553
+ "name",
554
+ "description"
555
+ ];
556
+ const rows = await scanStocks({ tickers, columns });
557
+ return successResult(JSON.stringify(rows, null, 2));
558
+ }, metadata2)
559
+ },
540
560
  {
541
561
  name: "tradingview_volume_breakout",
542
562
  description: "Find stocks with unusual volume (current volume significantly above average). Defaults to major exchanges.",
@@ -1374,12 +1394,45 @@ async function getAnalystRecommendations(apiKey, symbol) {
1374
1394
  cache3.set(cacheKey, data);
1375
1395
  return data;
1376
1396
  }
1377
- async function getPriceTarget(apiKey, symbol) {
1378
- const cacheKey = `price-target:${symbol}`;
1397
+ async function getCompanyProfile(apiKey, symbol) {
1398
+ const cacheKey = `profile:${symbol}`;
1399
+ const cached = cache3.get(cacheKey);
1400
+ if (cached) return cached;
1401
+ const data = await httpGet(
1402
+ `${BASE_URL2}/stock/profile2?symbol=${encodeURIComponent(symbol)}`,
1403
+ { headers: { "X-Finnhub-Token": apiKey } }
1404
+ );
1405
+ cache3.set(cacheKey, data);
1406
+ return data;
1407
+ }
1408
+ async function getPeers(apiKey, symbol) {
1409
+ const cacheKey = `peers:${symbol}`;
1410
+ const cached = cache3.get(cacheKey);
1411
+ if (cached) return cached;
1412
+ const data = await httpGet(
1413
+ `${BASE_URL2}/stock/peers?symbol=${encodeURIComponent(symbol)}`,
1414
+ { headers: { "X-Finnhub-Token": apiKey } }
1415
+ );
1416
+ cache3.set(cacheKey, data);
1417
+ return data;
1418
+ }
1419
+ async function getMarketStatus(apiKey, exchange) {
1420
+ const cacheKey = `market-status:${exchange}`;
1421
+ const cached = cache3.get(cacheKey);
1422
+ if (cached) return cached;
1423
+ const data = await httpGet(
1424
+ `${BASE_URL2}/stock/market-status?exchange=${encodeURIComponent(exchange)}`,
1425
+ { headers: { "X-Finnhub-Token": apiKey } }
1426
+ );
1427
+ cache3.set(cacheKey, data);
1428
+ return data;
1429
+ }
1430
+ async function getQuote(apiKey, symbol) {
1431
+ const cacheKey = `quote:${symbol}`;
1379
1432
  const cached = cache3.get(cacheKey);
1380
1433
  if (cached) return cached;
1381
1434
  const data = await httpGet(
1382
- `${BASE_URL2}/stock/price-target?symbol=${encodeURIComponent(symbol)}`,
1435
+ `${BASE_URL2}/quote?symbol=${encodeURIComponent(symbol)}`,
1383
1436
  { headers: { "X-Finnhub-Token": apiKey } }
1384
1437
  );
1385
1438
  cache3.set(cacheKey, data);
@@ -1471,24 +1524,77 @@ function createFinnhubModule(apiKey) {
1471
1524
  };
1472
1525
  const analystRatingsTool = {
1473
1526
  name: "finnhub_analyst_ratings",
1474
- description: "Get analyst consensus recommendations and price targets for a stock. Note: Some tickers may return 403 errors on Finnhub free tier plans.",
1527
+ description: "Get analyst consensus recommendations for a stock.",
1475
1528
  inputSchema: z5.object({
1476
1529
  symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1477
1530
  }),
1478
1531
  handler: withMetadata(async (params) => {
1479
1532
  const symbol = resolveTicker(params.symbol).ticker;
1480
- const [recs, target] = await Promise.all([
1481
- getAnalystRecommendations(apiKey, symbol),
1482
- getPriceTarget(apiKey, symbol)
1483
- ]);
1533
+ const recs = await getAnalystRecommendations(apiKey, symbol);
1484
1534
  return successResult(JSON.stringify({
1485
1535
  symbol,
1486
1536
  currentConsensus: recs[0] || null,
1487
- priceTarget: target,
1488
1537
  recommendationHistory: recs.slice(0, 4)
1489
1538
  }, null, 2));
1490
1539
  }, metadata2)
1491
1540
  };
1541
+ const companyProfileTool = {
1542
+ name: "finnhub_company_profile",
1543
+ description: "Get company profile: name, industry, market cap, IPO date, logo, website, share count, and exchange.",
1544
+ inputSchema: z5.object({
1545
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1546
+ }),
1547
+ handler: withMetadata(async (params) => {
1548
+ const symbol = resolveTicker(params.symbol).ticker;
1549
+ const profile = await getCompanyProfile(apiKey, symbol);
1550
+ return successResult(JSON.stringify(profile, null, 2));
1551
+ }, metadata2)
1552
+ };
1553
+ const peersTool = {
1554
+ name: "finnhub_peers",
1555
+ description: "Get a list of peer/comparable companies in the same industry for a given stock.",
1556
+ inputSchema: z5.object({
1557
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1558
+ }),
1559
+ handler: withMetadata(async (params) => {
1560
+ const symbol = resolveTicker(params.symbol).ticker;
1561
+ const peers = await getPeers(apiKey, symbol);
1562
+ return successResult(JSON.stringify({ symbol, peers }, null, 2));
1563
+ }, metadata2)
1564
+ };
1565
+ const marketStatusTool = {
1566
+ name: "finnhub_market_status",
1567
+ description: "Check if a stock exchange is currently open, and what session it is in (pre-market, regular, post-market).",
1568
+ inputSchema: z5.object({
1569
+ exchange: z5.string().default("US").describe("Exchange code. Examples: US, L (London), T (Tokyo), HK")
1570
+ }),
1571
+ handler: withMetadata(async (params) => {
1572
+ const exchange = params.exchange;
1573
+ const status = await getMarketStatus(apiKey, exchange);
1574
+ return successResult(JSON.stringify(status, null, 2));
1575
+ }, metadata2)
1576
+ };
1577
+ const quoteTool = {
1578
+ name: "finnhub_quote",
1579
+ description: "Get a real-time stock quote from Finnhub (requires API key): current price, change, percent change, day high/low, open, and previous close. Preferred over tradingview_quote during market hours for live prices. Use tradingview_quote as a keyless fallback when Finnhub is unavailable.",
1580
+ inputSchema: z5.object({
1581
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1582
+ }),
1583
+ handler: withMetadata(async (params) => {
1584
+ const symbol = resolveTicker(params.symbol).ticker;
1585
+ const q = await getQuote(apiKey, symbol);
1586
+ return successResult(JSON.stringify({
1587
+ symbol,
1588
+ price: q.c,
1589
+ change: q.d,
1590
+ changePercent: q.dp,
1591
+ dayHigh: q.h,
1592
+ dayLow: q.l,
1593
+ open: q.o,
1594
+ previousClose: q.pc
1595
+ }, null, 2));
1596
+ }, metadata2)
1597
+ };
1492
1598
  const shortInterestTool = {
1493
1599
  name: "finnhub_short_interest",
1494
1600
  description: "Get short interest and other key financial metrics for a stock.",
@@ -1503,9 +1609,13 @@ function createFinnhubModule(apiKey) {
1503
1609
  };
1504
1610
  return {
1505
1611
  name: "finnhub",
1506
- description: "Finnhub market and company news, plus earnings calendar, analyst ratings and short interest",
1612
+ description: "Finnhub market data: quotes, company profiles, peers, news, earnings, analyst ratings, short interest, and market status",
1507
1613
  requiredEnvVars: ["FINNHUB_API_KEY"],
1508
1614
  tools: [
1615
+ quoteTool,
1616
+ companyProfileTool,
1617
+ peersTool,
1618
+ marketStatusTool,
1509
1619
  marketNewsTool,
1510
1620
  companyNewsTool,
1511
1621
  earningsCalendarTool,
@@ -1536,7 +1646,7 @@ function checkAvResponse(data) {
1536
1646
  throw new Error(`Alpha Vantage Error: ${data["Error Message"]}`);
1537
1647
  }
1538
1648
  }
1539
- async function getQuote(apiKey, symbol) {
1649
+ async function getQuote2(apiKey, symbol) {
1540
1650
  const cacheKey = `quote:${symbol}`;
1541
1651
  const cached = cache4.get(cacheKey);
1542
1652
  if (cached) return cached;
@@ -1665,7 +1775,7 @@ function createAlphaVantageModule(apiKey) {
1665
1775
  }),
1666
1776
  handler: withMetadata(async (params) => {
1667
1777
  const symbol = resolveTicker(params.symbol).ticker;
1668
- const quote = await getQuote(apiKey, symbol);
1778
+ const quote = await getQuote2(apiKey, symbol);
1669
1779
  return successResult(JSON.stringify(quote, null, 2));
1670
1780
  }, metadata2)
1671
1781
  };
@@ -2233,14 +2343,14 @@ OPTIONS
2233
2343
  --modules <list> Comma-separated modules to enable (default: all available)
2234
2344
  --default-exchange <ex> Default exchange for symbol resolution (default: NASDAQ)
2235
2345
 
2236
- MODULES (35 tools total)
2346
+ MODULES (39 tools total)
2237
2347
  tradingview 7 tools Stock scanning, quotes, technicals (no key)
2238
2348
  tradingview-crypto 4 tools Crypto pair scanning and technicals (no key)
2239
2349
  sec-edgar 6 tools SEC filings, insider trades, holdings (no key)
2240
2350
  coingecko 3 tools Crypto market data and trending (no key)
2241
2351
  options 4 tools Options chains, Greeks, unusual activity (no key)
2242
2352
  options-cboe 1 tool CBOE put/call ratio sentiment (no key)
2243
- finnhub 5 tools Market news, earnings, short interest (FINNHUB_API_KEY)
2353
+ finnhub 9 tools Quotes, profiles, peers, news, earnings (FINNHUB_API_KEY)
2244
2354
  alpha-vantage 5 tools Stock quotes, fundamentals, dividends (ALPHA_VANTAGE_API_KEY)
2245
2355
 
2246
2356
  SETUP (Claude Code)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stock-scanner-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "MCP server providing Claude Code with real-time stock and crypto market data, SEC filings, insider trades, and technical analysis",
5
5
  "type": "module",
6
6
  "bin": {