canli-fundamentals-mcp 0.7.2 → 0.7.4
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.
- package/package.json +1 -1
- package/src/server.mjs +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canli-fundamentals-mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "MCP server for SEC company fundamentals point in time: what was first reported, what was known on any date, and every later restatement, each value with the filing behind it. Computed locally from a hash-checked SEC snapshot.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
package/src/server.mjs
CHANGED
|
@@ -203,7 +203,8 @@ async function nameIndex(session) {
|
|
|
203
203
|
const MATCH_LEVELS = ["ticker", "cik", "name", "same_name_as_ticker_holder", "name_start", "name_words", "name_contains"];
|
|
204
204
|
|
|
205
205
|
export async function findCompanies(session, query, limit = 8) {
|
|
206
|
-
|
|
206
|
+
// Fund reports write names their own way: "Southern Co/The", "Hess Corp/DE".
|
|
207
|
+
const text = String(query).trim().replace(/^\$/, "").replace(/\s*\/\s*(?:the|[a-z]{2,3})\s*\/?\s*$/i, "");
|
|
207
208
|
const ticker = text.toUpperCase();
|
|
208
209
|
const names = await nameIndex(session);
|
|
209
210
|
const found = new Map();
|
|
@@ -230,7 +231,10 @@ export async function findCompanies(session, query, limit = 8) {
|
|
|
230
231
|
const best = ranked[0];
|
|
231
232
|
const tied = best ? ranked.filter((r) => r.level === best.level) : [];
|
|
232
233
|
const listed = tied.filter((r) => r.c.tickers.length);
|
|
233
|
-
|
|
234
|
+
// A listed company beats an unlisted filer that only fits by its first words: "T Rowe Price Group" is PRICE T
|
|
235
|
+
// ROWE GROUP INC, not T. ROWE PRICE OHA SELECT PRIVATE CREDIT FUND.
|
|
236
|
+
const listedFits = ranked.filter((r) => r.level <= 5 && r.c.tickers.length);
|
|
237
|
+
const pick = !best ? null : best.level >= 4 && !best.c.tickers.length && listedFits.length === 1 ? listedFits[0] : ranked.length === 1 ? best : best.level > 4 ? null : tied.length === 1 ? best : listed.length === 1 ? listed[0] : null;
|
|
234
238
|
// Companies as good a match as the one used (the same name, another filer): the answer names them,
|
|
235
239
|
// since a question about the other one would otherwise get this one's figures without a word.
|
|
236
240
|
const alike = pick && tied.length > 1 ? tied.filter((r) => r !== pick).map(({ c }) => ({ cik: c.cik, name: c.name, tickers: c.tickers })) : [];
|
|
@@ -404,7 +408,12 @@ export function indexFacts(facts, only) {
|
|
|
404
408
|
}
|
|
405
409
|
const list = [...periods.values()];
|
|
406
410
|
// Filing order: by date, then accession number, so the order never depends on the file.
|
|
407
|
-
for (const p of list)
|
|
411
|
+
for (const p of list) {
|
|
412
|
+
p.vintages.sort(byFiling);
|
|
413
|
+
// A 10-Q is not where a full year is restated: Comfort Systems' April 2026 10-Q tagged a quarter's
|
|
414
|
+
// $1.83 billion as all of 2025, which would have replaced the 10-K's $9.1 billion.
|
|
415
|
+
if (p.start && durationKind(p.start, p.end) === "annual" && p.vintages.some((v) => ANNUAL_FORM.test(v.form ?? ""))) p.vintages = p.vintages.filter((v) => !INTERIM_FORM.test(v.form ?? ""));
|
|
416
|
+
}
|
|
408
417
|
list.sort((a, b) => b.end.localeCompare(a.end) || String(b.start).localeCompare(String(a.start)));
|
|
409
418
|
if (list.length) units[unit] = list;
|
|
410
419
|
}
|
|
@@ -423,7 +432,7 @@ export function indexFacts(facts, only) {
|
|
|
423
432
|
// RevenueFromContractWithCustomerExcludingAssessedTax in 2018, Toyota from us-gaap to IFRS) is
|
|
424
433
|
// followed across the switch, and every value names the tag it came from.
|
|
425
434
|
export const FRIENDLY = Object.freeze({
|
|
426
|
-
revenue: ["us-gaap:Revenues", "us-gaap:RevenueFromContractWithCustomerExcludingAssessedTax", "us-gaap:RevenueFromContractWithCustomerIncludingAssessedTax", "us-gaap:SalesRevenueNet", "ifrs-full:Revenue", "ifrs-full:RevenueFromContractsWithCustomers"],
|
|
435
|
+
revenue: ["us-gaap:RevenuesNetOfInterestExpense", "us-gaap:Revenues", "us-gaap:RevenueFromContractWithCustomerExcludingAssessedTax", "us-gaap:RevenueFromContractWithCustomerIncludingAssessedTax", "us-gaap:SalesRevenueNet", "ifrs-full:Revenue", "ifrs-full:RevenueFromContractsWithCustomers"],
|
|
427
436
|
// Since the 2025 reports many 10-Ks tag the common-stockholders line or ProfitLoss and not NetIncomeLoss.
|
|
428
437
|
net_income: ["us-gaap:NetIncomeLoss", "ifrs-full:ProfitLossAttributableToOwnersOfParent", "us-gaap:NetIncomeLossAvailableToCommonStockholdersBasic", "us-gaap:ProfitLoss", "ifrs-full:ProfitLoss"],
|
|
429
438
|
operating_income: ["us-gaap:OperatingIncomeLoss", "ifrs-full:ProfitLossFromOperatingActivities"],
|