@mseep/korean-dart-mcp 0.9.3

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +660 -0
  3. package/build/cli.d.ts +2 -0
  4. package/build/cli.js +22 -0
  5. package/build/index.d.ts +2 -0
  6. package/build/index.js +36 -0
  7. package/build/lib/corp-code.d.ts +53 -0
  8. package/build/lib/corp-code.js +235 -0
  9. package/build/lib/dart-client.d.ts +25 -0
  10. package/build/lib/dart-client.js +71 -0
  11. package/build/lib/dart-xml.d.ts +26 -0
  12. package/build/lib/dart-xml.js +187 -0
  13. package/build/lib/xbrl-parser.d.ts +145 -0
  14. package/build/lib/xbrl-parser.js +673 -0
  15. package/build/server/mcp-server.d.ts +7 -0
  16. package/build/server/mcp-server.js +40 -0
  17. package/build/setup.d.ts +8 -0
  18. package/build/setup.js +264 -0
  19. package/build/tools/_helpers.d.ts +28 -0
  20. package/build/tools/_helpers.js +35 -0
  21. package/build/tools/buffett-quality-snapshot.d.ts +10 -0
  22. package/build/tools/buffett-quality-snapshot.js +261 -0
  23. package/build/tools/disclosure-anomaly.d.ts +14 -0
  24. package/build/tools/disclosure-anomaly.js +231 -0
  25. package/build/tools/download-document.d.ts +14 -0
  26. package/build/tools/download-document.js +89 -0
  27. package/build/tools/get-attachments.d.ts +15 -0
  28. package/build/tools/get-attachments.js +339 -0
  29. package/build/tools/get-company.d.ts +7 -0
  30. package/build/tools/get-company.js +32 -0
  31. package/build/tools/get-corporate-event.d.ts +14 -0
  32. package/build/tools/get-corporate-event.js +180 -0
  33. package/build/tools/get-executive-compensation.d.ts +13 -0
  34. package/build/tools/get-executive-compensation.js +89 -0
  35. package/build/tools/get-financials.d.ts +15 -0
  36. package/build/tools/get-financials.js +127 -0
  37. package/build/tools/get-major-holdings.d.ts +10 -0
  38. package/build/tools/get-major-holdings.js +117 -0
  39. package/build/tools/get-periodic-report.d.ts +7 -0
  40. package/build/tools/get-periodic-report.js +100 -0
  41. package/build/tools/get-shareholders.d.ts +13 -0
  42. package/build/tools/get-shareholders.js +87 -0
  43. package/build/tools/get-xbrl.d.ts +12 -0
  44. package/build/tools/get-xbrl.js +96 -0
  45. package/build/tools/index.d.ts +38 -0
  46. package/build/tools/index.js +66 -0
  47. package/build/tools/insider-signal.d.ts +15 -0
  48. package/build/tools/insider-signal.js +208 -0
  49. package/build/tools/resolve-corp-code.d.ts +7 -0
  50. package/build/tools/resolve-corp-code.js +40 -0
  51. package/build/tools/search-disclosures.d.ts +14 -0
  52. package/build/tools/search-disclosures.js +300 -0
  53. package/build/utils/safe-zip.d.ts +47 -0
  54. package/build/utils/safe-zip.js +215 -0
  55. package/build/version.d.ts +2 -0
  56. package/build/version.js +2 -0
  57. package/package.json +67 -0
@@ -0,0 +1,145 @@
1
+ /**
2
+ * XBRL 파서 — DART instance document 에서 주요 재무제표(BS/IS/CF) 추출.
3
+ *
4
+ * 설계:
5
+ * - v0.8: whitelist 기반 (핵심 50 태그 내외). presentation/calculation linkbase 무시.
6
+ * - v0.9: "full" 모드 추가 — presentation linkbase 기반 계층/순서, calculation
7
+ * linkbase 기반 합산 검증. 업종별 택소노미에 자동 대응 (taxonomy에서 직접 추출).
8
+ * - 라벨: 한국어(lab-ko.xml) primary role 만 사용, 없으면 tag 로 폴백.
9
+ * - 재무제표 본체 facts: segment 가 ConsolidatedMember/SeparateMember "만" 있는
10
+ * 단순 context (추가 axis 를 가진 주석 facts 는 제외).
11
+ * - 기간: context id prefix 로 판별 (CFY=current, PFY=prior, BPFY=before-prior).
12
+ * - 단위: 원화(KRW) 그대로. decimals 는 표시 지침이라 별도 스케일 변환 없음.
13
+ *
14
+ * DART role 코드:
15
+ * D210=BS, D310=IS, D410=CI, D520=SE(자본변동), D610=CF.
16
+ * 접미 00=연결, 05=별도. D8xxxxx 는 주석/공시.
17
+ */
18
+ export declare const BS_TAGS: string[];
19
+ export declare const IS_TAGS: string[];
20
+ export declare const CF_TAGS: string[];
21
+ export interface XbrlFact {
22
+ tag: string;
23
+ contextRef: string;
24
+ unitRef?: string;
25
+ decimals?: string;
26
+ value: string;
27
+ }
28
+ export interface XbrlContext {
29
+ id: string;
30
+ consolidated: boolean | null;
31
+ dimensionCount: number;
32
+ periodType: "instant" | "duration";
33
+ instant?: string;
34
+ startDate?: string;
35
+ endDate?: string;
36
+ periodBucket: "current" | "prior" | "priorPrior" | null;
37
+ pointType: "instant" | "duration";
38
+ }
39
+ export interface XbrlData {
40
+ facts: XbrlFact[];
41
+ contexts: Map<string, XbrlContext>;
42
+ labels: Map<string, string>;
43
+ entityId: string | null;
44
+ taxonomy?: XbrlTaxonomy;
45
+ /** DOM 파싱 중 누적된 경고·에러 메시지. 빈 결과와 파싱 실패를 구분하기 위함. */
46
+ parseWarnings?: string[];
47
+ }
48
+ export interface RoleInfo {
49
+ roleUri: string;
50
+ statementType: "BS" | "IS" | "CI" | "SE" | "CF" | null;
51
+ fs_div: "consolidated" | "separate" | null;
52
+ }
53
+ export interface PresentationNode {
54
+ tag: string;
55
+ depth: number;
56
+ order: number;
57
+ parent: string | null;
58
+ }
59
+ export interface RolePresentation {
60
+ info: RoleInfo;
61
+ nodes: PresentationNode[];
62
+ }
63
+ export interface CalcRelation {
64
+ parent: string;
65
+ child: string;
66
+ weight: number;
67
+ order: number;
68
+ }
69
+ export interface RoleCalculation {
70
+ info: RoleInfo;
71
+ relations: CalcRelation[];
72
+ }
73
+ export interface XbrlTaxonomy {
74
+ presentations: RolePresentation[];
75
+ calculations: RoleCalculation[];
76
+ }
77
+ export interface StatementRow {
78
+ tag: string;
79
+ label: string;
80
+ depth?: number;
81
+ current: number | null;
82
+ prior: number | null;
83
+ priorPrior: number | null;
84
+ }
85
+ export interface StatementTable {
86
+ rows: StatementRow[];
87
+ }
88
+ export interface CalcViolation {
89
+ parent: string;
90
+ parent_label: string;
91
+ expected: number;
92
+ actual: number;
93
+ diff: number;
94
+ ratio: number;
95
+ period: "current" | "prior" | "priorPrior";
96
+ }
97
+ export interface Statements {
98
+ periods: {
99
+ current: {
100
+ end?: string;
101
+ start?: string;
102
+ } | null;
103
+ prior: {
104
+ end?: string;
105
+ start?: string;
106
+ } | null;
107
+ priorPrior: {
108
+ end?: string;
109
+ start?: string;
110
+ } | null;
111
+ };
112
+ fs_div: "consolidated" | "separate";
113
+ mode: "whitelist" | "full";
114
+ statements: {
115
+ BS?: StatementTable;
116
+ IS?: StatementTable;
117
+ CF?: StatementTable;
118
+ };
119
+ validations?: CalcViolation[];
120
+ }
121
+ export declare function extractXbrlFilesFromZip(zipBuf: Buffer): Promise<Map<string, string>>;
122
+ export declare function parseInstance(xml: string): {
123
+ facts: XbrlFact[];
124
+ contexts: Map<string, XbrlContext>;
125
+ entityId: string | null;
126
+ errors: string[];
127
+ };
128
+ export declare function parseLabels(xml: string): Map<string, string>;
129
+ /** role URI → {statementType, fs_div}. 주석(D8xx)·자본변동(D52)은 제외 시 null 반환됨. */
130
+ export declare function classifyRole(roleUri: string): RoleInfo;
131
+ export declare function parsePresentationLinkbase(xml: string): RolePresentation[];
132
+ export declare function parseCalculationLinkbase(xml: string): RoleCalculation[];
133
+ export declare function parseXbrlZip(zipBuf: Buffer, opts?: {
134
+ loadTaxonomy?: boolean;
135
+ }): Promise<XbrlData>;
136
+ export declare function buildStatements(data: XbrlData, opts: {
137
+ fs_div: "consolidated" | "separate";
138
+ sections: ("BS" | "IS" | "CF")[];
139
+ }): Statements;
140
+ /** presentation linkbase 트리를 기반으로 full 재무제표 구성. 원본 항목 순서/계층 보존. */
141
+ export declare function buildStatementsFull(data: XbrlData, opts: {
142
+ fs_div: "consolidated" | "separate";
143
+ sections: ("BS" | "IS" | "CF")[];
144
+ }): Statements;
145
+ export declare function renderMarkdown(st: Statements): string;