@warmio/mcp 5.0.1 → 7.0.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.
@@ -1,184 +1,243 @@
1
- type NormalizedAccountType = 'depository' | 'credit' | 'loan' | 'investment' | 'other';
1
+ import { type WarmApiAudience } from './config-paths.js';
2
2
  export interface WarmApiClientOptions {
3
+ audience?: WarmApiAudience;
3
4
  apiKeyResolver?: () => string | null;
4
5
  apiUrl?: string;
5
6
  fetchImplementation?: typeof fetch;
6
7
  requestTimeoutMs?: number;
7
8
  }
8
- export interface WarmApiAccount {
9
- account_id?: string | null;
10
- available_balance?: number | null;
11
- current_balance?: number | null;
12
- institution_name?: string | null;
13
- mask?: string | null;
14
- name?: string | null;
15
- subtype?: string | null;
16
- type?: string | null;
17
- }
18
- export interface WarmApiTransaction {
19
- account_id?: string | null;
20
- amount?: number | null;
21
- date?: string | null;
22
- detailed_category?: string | null;
23
- id?: string | null;
24
- merchant_name?: string | null;
25
- name?: string | null;
26
- primary_category?: string | null;
27
- }
28
- export interface WarmApiBudget {
29
- amount?: number | null;
30
- name?: string | null;
31
- period?: string | null;
32
- percent_used?: number | null;
33
- remaining?: number | null;
34
- spent?: number | null;
35
- status?: string | null;
36
- }
37
- export interface WarmApiGoal {
38
- category?: string | null;
39
- current?: number | null;
40
- monthly_contribution_needed?: number | null;
41
- name?: string | null;
42
- progress_percent?: number | null;
43
- status?: string | null;
44
- target?: number | null;
45
- target_date?: string | null;
46
- }
47
- export interface WarmFinancialState extends Record<string, unknown> {
48
- budgets: Array<{
49
- amount: number;
50
- name: string;
51
- percent_used: number;
52
- period: string;
53
- remaining: number;
54
- spent: number;
55
- status: string | null;
56
- }>;
57
- category_spending: Array<{
58
- amount: number;
59
- category: string;
60
- }>;
61
- generated_at: string;
62
- goals: Array<{
63
- category: string | null;
64
- current: number;
65
- monthly_contribution_needed: number | null;
66
- name: string;
67
- progress_percent: number;
68
- status: string | null;
69
- target: number;
70
- target_date: string | null;
71
- }>;
72
- health: {
73
- data_completeness: number | null;
74
- label: string | null;
75
- message: string | null;
76
- pillars: {
77
- borrow: number | null;
78
- build: number | null;
79
- save: number | null;
80
- spend: number | null;
81
- } | null;
82
- score: number | null;
83
- };
84
- holdings: Array<{
85
- account_id: string;
86
- cost_basis: number | null;
87
- quantity: number;
88
- security_name: string | null;
89
- symbol: string | null;
90
- type: string | null;
91
- value: number | null;
92
- }>;
93
- liabilities: Array<{
94
- account_id: string;
95
- apr_percentage: number | null;
96
- balance: number | null;
97
- is_overdue: boolean | null;
98
- minimum_payment: number | null;
99
- next_payment_due_date: string | null;
100
- type: string;
101
- }>;
102
- recurring: Array<{
103
- active: boolean;
104
- amount: number;
105
- frequency: string;
106
- merchant: string;
107
- next_date: string | null;
108
- type: string | null;
109
- }>;
110
- snapshots: Array<{
111
- date: string;
112
- net_worth: number;
113
- total_assets: number;
114
- total_liabilities: number;
9
+ export interface TransactionIndex {
10
+ total: number;
11
+ months: Array<{
12
+ month: string;
13
+ count: number;
115
14
  }>;
116
15
  }
117
- export interface GetTransactionsInput {
118
- cursor?: string;
119
- last_knowledge?: string;
120
- limit: number;
121
- search?: string;
122
- }
123
- export interface GetTransactionsOutput extends Record<string, unknown> {
124
- generated_at: string | null;
125
- next_knowledge: string | null;
126
- pagination: {
127
- has_more: boolean;
128
- limit: number;
129
- next_cursor: string | null;
130
- };
131
- txns: Array<{
132
- amount: number;
133
- category: string | null;
134
- date: string | null;
135
- description: string | null;
136
- detailed_category: string | null;
137
- id: string | null;
138
- merchant: string | null;
139
- }>;
16
+ export interface Position {
17
+ date: string | null;
18
+ net_worth: number | null;
19
+ cash: number | null;
20
+ debt: number | null;
21
+ investments: number | null;
22
+ other_assets: number | null;
23
+ total_assets: number | null;
140
24
  }
141
- export interface GetAccountsOutput extends Record<string, unknown> {
142
- accounts: Array<{
143
- balance: number;
144
- institution: string | null;
145
- mask: string | null;
146
- name: string;
147
- subtype: string | null;
148
- type: NormalizedAccountType;
149
- }>;
25
+ export interface Account {
26
+ id: string;
27
+ name: string;
28
+ type: 'depository' | 'credit' | 'loan' | 'investment' | 'brokerage' | 'other';
29
+ subtype: string | null;
30
+ group: 'cash' | 'debt' | 'investments' | null;
31
+ institution: string | null;
32
+ mask: string | null;
33
+ balance: number | null;
34
+ available: number | null;
35
+ currency: string | null;
36
+ updated_at: string | null;
37
+ }
38
+ export interface Status {
39
+ position: Position | null;
40
+ accounts: Account[];
41
+ }
42
+ export interface Recurring {
43
+ id: string;
44
+ account_id: string | null;
45
+ direction: 'inflow' | 'outflow' | null;
46
+ frequency: 'WEEKLY' | 'BIWEEKLY' | 'MONTHLY' | 'QUARTERLY' | 'SEMI_ANNUALLY' | 'ANNUALLY' | null;
47
+ status: 'active' | 'inactive' | 'dismissed' | null;
48
+ merchant: string | null;
49
+ amount: number | null;
50
+ next_date: string | null;
51
+ }
52
+ export interface Budget {
53
+ id: string;
54
+ name: string;
55
+ type: 'category' | 'merchant';
56
+ period: 'weekly' | 'biweekly' | 'monthly';
57
+ status: 'under' | 'warning' | 'over';
58
+ amount: number;
59
+ spent: number;
60
+ remaining: number;
61
+ used_percent: number;
62
+ }
63
+ export interface Goal {
64
+ id: string;
65
+ name: string;
66
+ category: string;
67
+ status: 'not_started' | 'in_progress' | 'on_track' | 'behind' | 'completed';
68
+ target: number;
69
+ current: number;
70
+ progress_percent: number;
71
+ target_date: string | null;
72
+ }
73
+ export interface Snapshot {
74
+ date: string;
75
+ net_worth: number | null;
76
+ cash: number | null;
77
+ debt: number | null;
78
+ income: number | null;
79
+ expenses: number | null;
80
+ cash_flow: number | null;
81
+ savings_rate: number | null;
82
+ investments: number | null;
83
+ assets: number | null;
84
+ health_score: number | null;
85
+ }
86
+ export interface Liability {
87
+ account_id: string | null;
88
+ type: 'credit' | 'student' | 'mortgage' | 'other' | null;
89
+ balance: number | null;
90
+ minimum_payment: number | null;
91
+ due_date: string | null;
92
+ interest_rate: number | null;
93
+ rate_type: 'fixed' | 'variable' | null;
94
+ overdue: boolean | null;
95
+ }
96
+ export interface Holding {
97
+ account_id: string | null;
98
+ symbol: string | null;
99
+ name: string | null;
100
+ type: 'cash' | 'derivative' | 'equity' | 'etf' | 'fixed_income' | 'mutual_fund' | 'other' | null;
101
+ quantity: number | null;
102
+ value: number | null;
103
+ cost_basis: number | null;
104
+ }
105
+ export interface Health {
106
+ score: number;
107
+ label: 'Needs Attention' | 'Good' | 'Strong';
108
+ level: 'critical' | 'poor' | 'fair' | 'good' | 'strong';
109
+ summary: string;
110
+ data_completeness: number;
111
+ pillars: {
112
+ spend: number | null;
113
+ save: number | null;
114
+ borrow: number | null;
115
+ build: number | null;
116
+ } | null;
117
+ }
118
+ export interface FinancialContext extends Record<string, unknown> {
119
+ version: 'v1';
120
+ updated_at: string;
121
+ currency: 'USD';
122
+ status: Status;
123
+ transactions: TransactionIndex;
124
+ recurring: Recurring[];
125
+ budgets: Budget[];
126
+ goals: Goal[];
127
+ snapshots: Snapshot[];
128
+ liabilities: Liability[];
129
+ holdings: Holding[];
130
+ health: Health | null;
131
+ }
132
+ export interface Transaction {
133
+ id: string;
134
+ account_id: string | null;
135
+ date: string | null;
136
+ amount: number;
137
+ merchant: string | null;
138
+ name: string | null;
139
+ category: string | null;
140
+ subcategory: string | null;
141
+ pending: boolean | null;
142
+ currency: string | null;
143
+ }
144
+ export interface TransactionMonth extends Record<string, unknown> {
145
+ month: string;
146
+ start_date: string;
147
+ end_date: string;
148
+ count: number;
149
+ items: Transaction[];
150
+ }
151
+ export interface LatestTransactions extends Record<string, unknown> {
152
+ since: string;
153
+ window_days: 10;
154
+ count: number;
155
+ items: Transaction[];
156
+ }
157
+ export type GetTransactionsInput = {
158
+ month: string;
159
+ latest?: never;
160
+ } | {
161
+ latest: true;
162
+ month?: never;
163
+ };
164
+ export type GetTransactionsOutput = TransactionMonth | LatestTransactions;
165
+ export interface FinancialContextMeta extends Record<string, unknown> {
166
+ version: 'v1';
167
+ user_id: string;
168
+ context_id: string;
169
+ generated_at: string;
170
+ updated_at: string;
171
+ content_hash: string;
172
+ byte_length: number;
173
+ counts: {
174
+ accounts: number;
175
+ transaction_months: number;
176
+ transactions: number;
177
+ snapshots: number;
178
+ };
150
179
  }
151
180
  export interface VerifyKeyOutput extends Record<string, unknown> {
181
+ audience?: 'automation' | 'context' | 'oauth';
152
182
  status: string;
153
183
  valid: boolean;
154
184
  }
185
+ export interface AutomationOperation extends Record<string, unknown> {
186
+ confirmation_required: boolean;
187
+ description: string;
188
+ method: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
189
+ operation_id: string;
190
+ path: string;
191
+ risk: Array<'read' | 'write' | 'destructive' | 'external_effect'>;
192
+ summary: string;
193
+ }
194
+ export interface AutomationInput {
195
+ body?: Record<string, unknown>;
196
+ params?: Record<string, string>;
197
+ }
198
+ export interface AutomationOperationDescription extends AutomationOperation {
199
+ input_schema: Record<string, unknown>;
200
+ }
201
+ export interface DescribeOperationOutput extends Record<string, unknown> {
202
+ approval?: {
203
+ approval_url: string;
204
+ expires_at: string;
205
+ id: string;
206
+ status: string;
207
+ };
208
+ operation: AutomationOperationDescription;
209
+ }
210
+ export interface InvokeOperationOutput extends Record<string, unknown> {
211
+ body: unknown;
212
+ headers: Record<string, string>;
213
+ operation_id: string;
214
+ status: number;
215
+ }
155
216
  export interface WarmApiClient {
156
- getAccounts(): Promise<GetAccountsOutput>;
157
- getFinancialState(): Promise<WarmFinancialState>;
217
+ getFinancialContext(): Promise<FinancialContext>;
218
+ getFinancialContextMeta(): Promise<FinancialContextMeta>;
158
219
  getTransactions(input: GetTransactionsInput): Promise<GetTransactionsOutput>;
220
+ searchOperations(query?: string): Promise<{
221
+ operations: AutomationOperation[];
222
+ }>;
223
+ describeOperation(operationId: string, input?: AutomationInput): Promise<DescribeOperationOutput>;
224
+ invokeOperation(operationId: string, input?: AutomationInput, approvalId?: string): Promise<InvokeOperationOutput>;
225
+ validateAudience(): Promise<VerifyKeyOutput>;
159
226
  verifyKey(): Promise<VerifyKeyOutput>;
160
227
  }
161
- export interface WarmApiLiability {
162
- account_id?: string | null;
163
- apr_percentage?: number | null;
164
- balance?: number | null;
165
- is_overdue?: boolean | null;
166
- minimum_payment?: number | null;
167
- next_payment_due_date?: string | null;
168
- type?: string | null;
169
- }
170
- export interface WarmApiHolding {
171
- account_id?: string | null;
172
- cost_basis?: number | null;
173
- quantity?: number | null;
174
- security_name?: string | null;
175
- symbol?: string | null;
176
- type?: string | null;
177
- value?: number | null;
178
- }
179
- export declare function getConfiguredApiKey(): string | null;
228
+ export declare function getConfiguredApiKey(audience?: WarmApiAudience): string | null;
180
229
  export declare function resetConfiguredApiKeyCache(): void;
181
- export declare function apiRequest<TResponse>(endpoint: string, params?: Record<string, string | undefined>, options?: WarmApiClientOptions): Promise<TResponse>;
230
+ interface WarmApiResponse<TBody> {
231
+ body: TBody;
232
+ headers: Record<string, string>;
233
+ status: number;
234
+ }
235
+ export declare class WarmApiError extends Error {
236
+ readonly body: unknown;
237
+ readonly headers: Record<string, string>;
238
+ readonly status: number;
239
+ constructor(message: string, response: WarmApiResponse<unknown>);
240
+ }
182
241
  export declare function createWarmApiClient(options?: WarmApiClientOptions): WarmApiClient;
183
- export declare function verifyWarmApiKey(apiKey: string): Promise<VerifyKeyOutput>;
242
+ export declare function verifyWarmApiKey(apiKey: string, audience?: WarmApiAudience): Promise<VerifyKeyOutput>;
184
243
  export {};