@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.
- package/README.md +167 -165
- package/dist/config-paths.d.ts +2 -1
- package/dist/config-paths.js +6 -4
- package/dist/http.d.ts +6 -0
- package/dist/http.js +36 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +100 -6
- package/dist/install.d.ts +2 -0
- package/dist/install.js +209 -94
- package/dist/schemas.d.ts +1198 -186
- package/dist/schemas.js +226 -139
- package/dist/server.d.ts +5 -3
- package/dist/server.js +96 -32
- package/dist/types.d.ts +5 -2
- package/dist/types.js +8 -3
- package/dist/warm-api-client.d.ts +222 -163
- package/dist/warm-api-client.js +110 -222
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { startHttpServer } from './http.js';
|
|
|
4
4
|
import { loadDotEnv } from './load-env.js';
|
|
5
5
|
import { createWarmServer } from './server.js';
|
|
6
6
|
import { AdaptiveStdioTransport } from './stdio.js';
|
|
7
|
+
import { createWarmApiClient } from './warm-api-client.js';
|
|
7
8
|
function isInteractiveSession() {
|
|
8
9
|
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
9
10
|
}
|
|
@@ -15,15 +16,23 @@ function printUsage() {
|
|
|
15
16
|
console.log(' warmio');
|
|
16
17
|
console.log(' Run the interactive installer');
|
|
17
18
|
console.log('');
|
|
18
|
-
console.log(' warmio install [--force] [--no-validate]');
|
|
19
|
-
console.log(' warmio mcp');
|
|
20
|
-
console.log(' warmio http [--host 127.0.0.1] [--port 3000] [--path /mcp]');
|
|
19
|
+
console.log(' warmio install --mode context|automation [--force] [--no-validate]');
|
|
20
|
+
console.log(' warmio mcp [--mode context|automation]');
|
|
21
|
+
console.log(' warmio http [--mode context|automation] [--host 127.0.0.1] [--port 3000] [--path /mcp]');
|
|
22
|
+
console.log(' warmio context get');
|
|
23
|
+
console.log(' warmio context meta');
|
|
24
|
+
console.log(' warmio transactions get --month YYYY-MM');
|
|
25
|
+
console.log(' warmio transactions get --latest');
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log(' Transactions require exactly one selector: --month YYYY-MM or --latest.');
|
|
28
|
+
console.log(' Month and latest are mutually exclusive. Latest is a fixed 10-day window.');
|
|
21
29
|
console.log('');
|
|
22
30
|
}
|
|
23
31
|
function parseCliArgs(args) {
|
|
24
32
|
const options = {
|
|
25
33
|
command: isInteractiveSession() ? 'install' : 'mcp',
|
|
26
34
|
force: false,
|
|
35
|
+
mode: 'context',
|
|
27
36
|
validateApiKey: true,
|
|
28
37
|
};
|
|
29
38
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -44,6 +53,62 @@ function parseCliArgs(args) {
|
|
|
44
53
|
options.command = 'http';
|
|
45
54
|
continue;
|
|
46
55
|
}
|
|
56
|
+
if (arg === 'context') {
|
|
57
|
+
const subcommand = args[index + 1];
|
|
58
|
+
if (subcommand === 'get') {
|
|
59
|
+
options.command = 'context-get';
|
|
60
|
+
index += 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (subcommand === 'meta') {
|
|
64
|
+
options.command = 'context-meta';
|
|
65
|
+
index += 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
throw new Error('Usage: warmio context get | warmio context meta');
|
|
69
|
+
}
|
|
70
|
+
if (arg === 'transactions') {
|
|
71
|
+
const subcommand = args[index + 1];
|
|
72
|
+
if (subcommand !== 'get') {
|
|
73
|
+
throw new Error('Usage: warmio transactions get --month YYYY-MM | --latest');
|
|
74
|
+
}
|
|
75
|
+
options.command = 'transactions-get';
|
|
76
|
+
index += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (arg === '--format') {
|
|
80
|
+
const format = args[index + 1];
|
|
81
|
+
if (format !== 'json') {
|
|
82
|
+
throw new Error('Only --format json is supported.');
|
|
83
|
+
}
|
|
84
|
+
index += 1;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (arg === '--month') {
|
|
88
|
+
const month = args[index + 1];
|
|
89
|
+
if (!month) {
|
|
90
|
+
throw new Error('Missing value for --month');
|
|
91
|
+
}
|
|
92
|
+
if (!/^\d{4}-\d{2}$/.test(month)) {
|
|
93
|
+
throw new Error(`Invalid value for --month: ${month}. Expected YYYY-MM.`);
|
|
94
|
+
}
|
|
95
|
+
options.month = month;
|
|
96
|
+
index += 1;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (arg === '--latest') {
|
|
100
|
+
options.latest = true;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (arg === '--mode') {
|
|
104
|
+
const mode = args[index + 1];
|
|
105
|
+
if (mode !== 'context' && mode !== 'automation') {
|
|
106
|
+
throw new Error('Expected --mode context or --mode automation.');
|
|
107
|
+
}
|
|
108
|
+
options.mode = mode;
|
|
109
|
+
index += 1;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
47
112
|
if (arg === '--host') {
|
|
48
113
|
options.httpHost = args[index + 1];
|
|
49
114
|
index += 1;
|
|
@@ -79,8 +144,25 @@ function parseCliArgs(args) {
|
|
|
79
144
|
}
|
|
80
145
|
return options;
|
|
81
146
|
}
|
|
82
|
-
|
|
83
|
-
|
|
147
|
+
function validateCliOptions(options) {
|
|
148
|
+
if (options.command !== 'transactions-get') {
|
|
149
|
+
if (options.month || options.latest) {
|
|
150
|
+
throw new Error('--month and --latest are only valid with `warmio transactions get`.');
|
|
151
|
+
}
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (options.month && options.latest) {
|
|
155
|
+
throw new Error('--month and --latest are mutually exclusive.');
|
|
156
|
+
}
|
|
157
|
+
if (!options.month && !options.latest) {
|
|
158
|
+
throw new Error('Usage: warmio transactions get --month YYYY-MM | --latest');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function printJson(value) {
|
|
162
|
+
console.log(JSON.stringify(value, null, 2));
|
|
163
|
+
}
|
|
164
|
+
export async function startStdioServer(mode = 'context') {
|
|
165
|
+
const server = createWarmServer({ mode });
|
|
84
166
|
const transport = new AdaptiveStdioTransport();
|
|
85
167
|
await server.connect(transport);
|
|
86
168
|
return server;
|
|
@@ -88,23 +170,35 @@ export async function startStdioServer() {
|
|
|
88
170
|
async function main() {
|
|
89
171
|
loadDotEnv();
|
|
90
172
|
const options = parseCliArgs(process.argv.slice(2));
|
|
173
|
+
validateCliOptions(options);
|
|
91
174
|
switch (options.command) {
|
|
175
|
+
case 'context-get':
|
|
176
|
+
printJson(await createWarmApiClient().getFinancialContext());
|
|
177
|
+
return;
|
|
178
|
+
case 'context-meta':
|
|
179
|
+
printJson(await createWarmApiClient().getFinancialContextMeta());
|
|
180
|
+
return;
|
|
181
|
+
case 'transactions-get':
|
|
182
|
+
printJson(await createWarmApiClient().getTransactions(options.month ? { month: options.month } : { latest: true }));
|
|
183
|
+
return;
|
|
92
184
|
case 'help':
|
|
93
185
|
printUsage();
|
|
94
186
|
return;
|
|
95
187
|
case 'mcp':
|
|
96
|
-
await startStdioServer();
|
|
188
|
+
await startStdioServer(options.mode);
|
|
97
189
|
return;
|
|
98
190
|
case 'http':
|
|
99
191
|
await startHttpServer({
|
|
100
192
|
host: options.httpHost,
|
|
101
193
|
path: options.httpPath,
|
|
102
194
|
port: options.httpPort,
|
|
195
|
+
mode: options.mode,
|
|
103
196
|
});
|
|
104
197
|
return;
|
|
105
198
|
case 'install':
|
|
106
199
|
await install({
|
|
107
200
|
force: options.force,
|
|
201
|
+
mode: options.mode,
|
|
108
202
|
validateApiKey: options.validateApiKey,
|
|
109
203
|
});
|
|
110
204
|
return;
|
package/dist/install.d.ts
CHANGED