stock-scanner-mcp 1.2.0 → 1.3.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 +104 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1374,12 +1374,45 @@ async function getAnalystRecommendations(apiKey, symbol) {
1374
1374
  cache3.set(cacheKey, data);
1375
1375
  return data;
1376
1376
  }
1377
- async function getPriceTarget(apiKey, symbol) {
1378
- const cacheKey = `price-target:${symbol}`;
1377
+ async function getCompanyProfile(apiKey, symbol) {
1378
+ const cacheKey = `profile:${symbol}`;
1379
1379
  const cached = cache3.get(cacheKey);
1380
1380
  if (cached) return cached;
1381
1381
  const data = await httpGet(
1382
- `${BASE_URL2}/stock/price-target?symbol=${encodeURIComponent(symbol)}`,
1382
+ `${BASE_URL2}/stock/profile2?symbol=${encodeURIComponent(symbol)}`,
1383
+ { headers: { "X-Finnhub-Token": apiKey } }
1384
+ );
1385
+ cache3.set(cacheKey, data);
1386
+ return data;
1387
+ }
1388
+ async function getPeers(apiKey, symbol) {
1389
+ const cacheKey = `peers:${symbol}`;
1390
+ const cached = cache3.get(cacheKey);
1391
+ if (cached) return cached;
1392
+ const data = await httpGet(
1393
+ `${BASE_URL2}/stock/peers?symbol=${encodeURIComponent(symbol)}`,
1394
+ { headers: { "X-Finnhub-Token": apiKey } }
1395
+ );
1396
+ cache3.set(cacheKey, data);
1397
+ return data;
1398
+ }
1399
+ async function getMarketStatus(apiKey, exchange) {
1400
+ const cacheKey = `market-status:${exchange}`;
1401
+ const cached = cache3.get(cacheKey);
1402
+ if (cached) return cached;
1403
+ const data = await httpGet(
1404
+ `${BASE_URL2}/stock/market-status?exchange=${encodeURIComponent(exchange)}`,
1405
+ { headers: { "X-Finnhub-Token": apiKey } }
1406
+ );
1407
+ cache3.set(cacheKey, data);
1408
+ return data;
1409
+ }
1410
+ async function getQuote(apiKey, symbol) {
1411
+ const cacheKey = `quote:${symbol}`;
1412
+ const cached = cache3.get(cacheKey);
1413
+ if (cached) return cached;
1414
+ const data = await httpGet(
1415
+ `${BASE_URL2}/quote?symbol=${encodeURIComponent(symbol)}`,
1383
1416
  { headers: { "X-Finnhub-Token": apiKey } }
1384
1417
  );
1385
1418
  cache3.set(cacheKey, data);
@@ -1471,24 +1504,77 @@ function createFinnhubModule(apiKey) {
1471
1504
  };
1472
1505
  const analystRatingsTool = {
1473
1506
  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.",
1507
+ description: "Get analyst consensus recommendations for a stock.",
1475
1508
  inputSchema: z5.object({
1476
1509
  symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1477
1510
  }),
1478
1511
  handler: withMetadata(async (params) => {
1479
1512
  const symbol = resolveTicker(params.symbol).ticker;
1480
- const [recs, target] = await Promise.all([
1481
- getAnalystRecommendations(apiKey, symbol),
1482
- getPriceTarget(apiKey, symbol)
1483
- ]);
1513
+ const recs = await getAnalystRecommendations(apiKey, symbol);
1484
1514
  return successResult(JSON.stringify({
1485
1515
  symbol,
1486
1516
  currentConsensus: recs[0] || null,
1487
- priceTarget: target,
1488
1517
  recommendationHistory: recs.slice(0, 4)
1489
1518
  }, null, 2));
1490
1519
  }, metadata2)
1491
1520
  };
1521
+ const companyProfileTool = {
1522
+ name: "finnhub_company_profile",
1523
+ description: "Get company profile: name, industry, market cap, IPO date, logo, website, share count, and exchange.",
1524
+ inputSchema: z5.object({
1525
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1526
+ }),
1527
+ handler: withMetadata(async (params) => {
1528
+ const symbol = resolveTicker(params.symbol).ticker;
1529
+ const profile = await getCompanyProfile(apiKey, symbol);
1530
+ return successResult(JSON.stringify(profile, null, 2));
1531
+ }, metadata2)
1532
+ };
1533
+ const peersTool = {
1534
+ name: "finnhub_peers",
1535
+ description: "Get a list of peer/comparable companies in the same industry for a given stock.",
1536
+ inputSchema: z5.object({
1537
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1538
+ }),
1539
+ handler: withMetadata(async (params) => {
1540
+ const symbol = resolveTicker(params.symbol).ticker;
1541
+ const peers = await getPeers(apiKey, symbol);
1542
+ return successResult(JSON.stringify({ symbol, peers }, null, 2));
1543
+ }, metadata2)
1544
+ };
1545
+ const marketStatusTool = {
1546
+ name: "finnhub_market_status",
1547
+ description: "Check if a stock exchange is currently open, and what session it is in (pre-market, regular, post-market).",
1548
+ inputSchema: z5.object({
1549
+ exchange: z5.string().default("US").describe("Exchange code. Examples: US, L (London), T (Tokyo), HK")
1550
+ }),
1551
+ handler: withMetadata(async (params) => {
1552
+ const exchange = params.exchange;
1553
+ const status = await getMarketStatus(apiKey, exchange);
1554
+ return successResult(JSON.stringify(status, null, 2));
1555
+ }, metadata2)
1556
+ };
1557
+ const quoteTool = {
1558
+ name: "finnhub_quote",
1559
+ description: "Get a real-time stock quote from Finnhub (requires API key): current price, change, percent change, day high/low, open, and previous close. Use tradingview_quote for a keyless alternative.",
1560
+ inputSchema: z5.object({
1561
+ symbol: z5.string().describe("Stock symbol (e.g. 'AAPL')")
1562
+ }),
1563
+ handler: withMetadata(async (params) => {
1564
+ const symbol = resolveTicker(params.symbol).ticker;
1565
+ const q = await getQuote(apiKey, symbol);
1566
+ return successResult(JSON.stringify({
1567
+ symbol,
1568
+ price: q.c,
1569
+ change: q.d,
1570
+ changePercent: q.dp,
1571
+ dayHigh: q.h,
1572
+ dayLow: q.l,
1573
+ open: q.o,
1574
+ previousClose: q.pc
1575
+ }, null, 2));
1576
+ }, metadata2)
1577
+ };
1492
1578
  const shortInterestTool = {
1493
1579
  name: "finnhub_short_interest",
1494
1580
  description: "Get short interest and other key financial metrics for a stock.",
@@ -1503,9 +1589,13 @@ function createFinnhubModule(apiKey) {
1503
1589
  };
1504
1590
  return {
1505
1591
  name: "finnhub",
1506
- description: "Finnhub market and company news, plus earnings calendar, analyst ratings and short interest",
1592
+ description: "Finnhub market data: quotes, company profiles, peers, news, earnings, analyst ratings, short interest, and market status",
1507
1593
  requiredEnvVars: ["FINNHUB_API_KEY"],
1508
1594
  tools: [
1595
+ quoteTool,
1596
+ companyProfileTool,
1597
+ peersTool,
1598
+ marketStatusTool,
1509
1599
  marketNewsTool,
1510
1600
  companyNewsTool,
1511
1601
  earningsCalendarTool,
@@ -1536,7 +1626,7 @@ function checkAvResponse(data) {
1536
1626
  throw new Error(`Alpha Vantage Error: ${data["Error Message"]}`);
1537
1627
  }
1538
1628
  }
1539
- async function getQuote(apiKey, symbol) {
1629
+ async function getQuote2(apiKey, symbol) {
1540
1630
  const cacheKey = `quote:${symbol}`;
1541
1631
  const cached = cache4.get(cacheKey);
1542
1632
  if (cached) return cached;
@@ -1665,7 +1755,7 @@ function createAlphaVantageModule(apiKey) {
1665
1755
  }),
1666
1756
  handler: withMetadata(async (params) => {
1667
1757
  const symbol = resolveTicker(params.symbol).ticker;
1668
- const quote = await getQuote(apiKey, symbol);
1758
+ const quote = await getQuote2(apiKey, symbol);
1669
1759
  return successResult(JSON.stringify(quote, null, 2));
1670
1760
  }, metadata2)
1671
1761
  };
@@ -2233,14 +2323,14 @@ OPTIONS
2233
2323
  --modules <list> Comma-separated modules to enable (default: all available)
2234
2324
  --default-exchange <ex> Default exchange for symbol resolution (default: NASDAQ)
2235
2325
 
2236
- MODULES (35 tools total)
2326
+ MODULES (39 tools total)
2237
2327
  tradingview 7 tools Stock scanning, quotes, technicals (no key)
2238
2328
  tradingview-crypto 4 tools Crypto pair scanning and technicals (no key)
2239
2329
  sec-edgar 6 tools SEC filings, insider trades, holdings (no key)
2240
2330
  coingecko 3 tools Crypto market data and trending (no key)
2241
2331
  options 4 tools Options chains, Greeks, unusual activity (no key)
2242
2332
  options-cboe 1 tool CBOE put/call ratio sentiment (no key)
2243
- finnhub 5 tools Market news, earnings, short interest (FINNHUB_API_KEY)
2333
+ finnhub 9 tools Quotes, profiles, peers, news, earnings (FINNHUB_API_KEY)
2244
2334
  alpha-vantage 5 tools Stock quotes, fundamentals, dividends (ALPHA_VANTAGE_API_KEY)
2245
2335
 
2246
2336
  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.3.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": {