@fre4x/yahoo-finance 1.0.43 → 1.0.45

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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +19 -21
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -12,6 +12,7 @@ Price history, balance sheets, insider moves, analyst upgrades, options flow —
12
12
 
13
13
  | Tool | What it tracks |
14
14
  |------|---------------|
15
+ | `yfin_get_quotes` | Batch real-time quotes for multiple tickers |
15
16
  | `yfin_get_historical_prices` | OHLCV bars — any ticker, any period, any interval |
16
17
  | `yfin_get_stock_info` | Price, company profile, key statistics, financial health |
17
18
  | `yfin_get_news` | Latest news articles for a ticker |
package/dist/index.js CHANGED
@@ -68339,24 +68339,18 @@ async function withCache(key, fetchFn) {
68339
68339
  }
68340
68340
  cache.delete(key);
68341
68341
  }
68342
- await waitIfNeeded();
68343
- const data = await fetchFn();
68342
+ cache.delete(key);
68344
68343
  if (cache.size >= MAX_CACHE_SIZE) {
68345
68344
  sweepExpiredFromCache();
68346
68345
  }
68347
68346
  if (cache.size >= MAX_CACHE_SIZE) {
68348
- let oldestKey;
68349
- let oldestTimestamp = Number.POSITIVE_INFINITY;
68350
- for (const [entryKey, value] of cache) {
68351
- if (value.timestamp < oldestTimestamp) {
68352
- oldestTimestamp = value.timestamp;
68353
- oldestKey = entryKey;
68354
- }
68355
- }
68347
+ const oldestKey = cache.keys().next().value;
68356
68348
  if (oldestKey !== void 0) {
68357
68349
  cache.delete(oldestKey);
68358
68350
  }
68359
68351
  }
68352
+ await waitIfNeeded();
68353
+ const data = await fetchFn();
68360
68354
  cache.set(key, { data, timestamp: Date.now() });
68361
68355
  return data;
68362
68356
  }
@@ -68660,12 +68654,16 @@ server.registerTool(
68660
68654
  tickers: external_exports3.array(external_exports3.string()).describe(
68661
68655
  "List of ticker symbols e.g. ['AAPL', 'MSFT', 'GOOGL']"
68662
68656
  )
68663
- }),
68657
+ }).strict(),
68664
68658
  annotations: { readOnlyHint: true, openWorldHint: true }
68665
68659
  },
68666
68660
  async ({ tickers }) => {
68667
68661
  try {
68668
- const results = IS_MOCK ? MOCK_FIXTURES.getQuotes : await getQuotes(tickers);
68662
+ const results = IS_MOCK ? MOCK_FIXTURES.getQuotes.filter(
68663
+ (quote2) => tickers.some(
68664
+ (ticker) => String(quote2.symbol ?? "").toUpperCase() === ticker.toUpperCase()
68665
+ )
68666
+ ) : await getQuotes(tickers);
68669
68667
  if (!results || results.length === 0) {
68670
68668
  return createNotFoundError(
68671
68669
  "No quotes found for provided tickers."
@@ -68723,7 +68721,7 @@ server.registerTool(
68723
68721
  "3mo"
68724
68722
  ]).default("1d").describe("Bar interval"),
68725
68723
  ...paginationSchema.shape
68726
- }),
68724
+ }).strict(),
68727
68725
  annotations: { readOnlyHint: true, openWorldHint: true }
68728
68726
  },
68729
68727
  async ({ ticker, period, interval, limit, offset }) => {
@@ -68771,7 +68769,7 @@ server.registerTool(
68771
68769
  description: "Get comprehensive stock info including price, profile, and financials.",
68772
68770
  inputSchema: external_exports3.object({
68773
68771
  ticker: external_exports3.string().describe("Ticker symbol e.g. 'AAPL'")
68774
- }),
68772
+ }).strict(),
68775
68773
  annotations: { readOnlyHint: true, openWorldHint: true }
68776
68774
  },
68777
68775
  async ({ ticker }) => {
@@ -68842,7 +68840,7 @@ server.registerTool(
68842
68840
  inputSchema: external_exports3.object({
68843
68841
  ticker: external_exports3.string().describe("Ticker symbol e.g. 'AAPL'"),
68844
68842
  ...paginationSchema.shape
68845
- }),
68843
+ }).strict(),
68846
68844
  annotations: { readOnlyHint: true, openWorldHint: true }
68847
68845
  },
68848
68846
  async ({ ticker, limit, offset }) => {
@@ -68882,7 +68880,7 @@ server.registerTool(
68882
68880
  description: "Get stock dividend and split history.",
68883
68881
  inputSchema: external_exports3.object({
68884
68882
  ticker: external_exports3.string().describe("Ticker symbol e.g. 'AAPL'")
68885
- }),
68883
+ }).strict(),
68886
68884
  annotations: { readOnlyHint: true, openWorldHint: true }
68887
68885
  },
68888
68886
  async ({ ticker }) => {
@@ -68941,7 +68939,7 @@ server.registerTool(
68941
68939
  "cashflow",
68942
68940
  "quarterly_cashflow"
68943
68941
  ]).describe("Type of financial statement")
68944
- }),
68942
+ }).strict(),
68945
68943
  annotations: { readOnlyHint: true, openWorldHint: true }
68946
68944
  },
68947
68945
  async ({ ticker, financial_type }) => {
@@ -68990,7 +68988,7 @@ server.registerTool(
68990
68988
  "insider_purchases",
68991
68989
  "insider_roster_holders"
68992
68990
  ]).describe("Type of holder information")
68993
- }),
68991
+ }).strict(),
68994
68992
  annotations: { readOnlyHint: true, openWorldHint: true }
68995
68993
  },
68996
68994
  async ({ ticker, holder_type }) => {
@@ -69035,7 +69033,7 @@ server.registerTool(
69035
69033
  description: "Get available option expiration dates for a ticker.",
69036
69034
  inputSchema: external_exports3.object({
69037
69035
  ticker: external_exports3.string().describe("Ticker symbol e.g. 'AAPL'")
69038
- }),
69036
+ }).strict(),
69039
69037
  annotations: { readOnlyHint: true, openWorldHint: true }
69040
69038
  },
69041
69039
  async ({ ticker }) => {
@@ -69063,7 +69061,7 @@ server.registerTool(
69063
69061
  expiration_date: external_exports3.string().describe("Expiration date YYYY-MM-DD"),
69064
69062
  option_type: external_exports3.enum(["calls", "puts"]).describe("Option type"),
69065
69063
  ...paginationSchema.shape
69066
- }),
69064
+ }).strict(),
69067
69065
  annotations: { readOnlyHint: true, openWorldHint: true }
69068
69066
  },
69069
69067
  async ({ ticker, expiration_date, option_type, limit, offset }) => {
@@ -69111,7 +69109,7 @@ server.registerTool(
69111
69109
  recommendation_type: external_exports3.enum(["recommendations", "upgrades_downgrades"]).default("recommendations").describe("Type of recommendation data"),
69112
69110
  months_back: external_exports3.number().int().min(1).max(120).default(12).describe("Months back for upgrades/downgrades"),
69113
69111
  ...paginationSchema.shape
69114
- }),
69112
+ }).strict(),
69115
69113
  annotations: { readOnlyHint: true, openWorldHint: true }
69116
69114
  },
69117
69115
  async ({ ticker, recommendation_type, months_back, limit, offset }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/yahoo-finance",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "A Yahoo Finance MCP server for LLMs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,7 @@
16
16
  "start": "node dist/index.js",
17
17
  "dev": "tsx src/index.ts",
18
18
  "watch": "tsc -w",
19
+ "inspector": "cross-env MOCK=true npx @modelcontextprotocol/inspector node dist/index.js",
19
20
  "test": "vitest run --passWithNoTests --exclude dist"
20
21
  },
21
22
  "keywords": [