@ratio-mcp/dev-server 1.0.1 → 1.1.1
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/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -9
- package/dist/index.js.map +1 -1
- package/dist/orchestrated-index.d.ts +16 -0
- package/dist/orchestrated-index.d.ts.map +1 -0
- package/dist/orchestrated-index.js +41 -0
- package/dist/orchestrated-index.js.map +1 -0
- package/dist/orchestrated-server.d.ts +16 -0
- package/dist/orchestrated-server.d.ts.map +1 -0
- package/dist/orchestrated-server.js +63 -0
- package/dist/orchestrated-server.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +26 -0
- package/dist/server.js.map +1 -1
- package/dist/services/orchestrator.d.ts +63 -0
- package/dist/services/orchestrator.d.ts.map +1 -0
- package/dist/services/orchestrator.js +769 -0
- package/dist/services/orchestrator.js.map +1 -0
- package/dist/services/response-formatter.d.ts +24 -0
- package/dist/services/response-formatter.d.ts.map +1 -0
- package/dist/services/response-formatter.js +311 -0
- package/dist/services/response-formatter.js.map +1 -0
- package/dist/services/session-state.d.ts +51 -0
- package/dist/services/session-state.d.ts.map +1 -0
- package/dist/services/session-state.js +248 -0
- package/dist/services/session-state.js.map +1 -0
- package/dist/services/tool-guard.d.ts +20 -0
- package/dist/services/tool-guard.d.ts.map +1 -0
- package/dist/services/tool-guard.js +164 -0
- package/dist/services/tool-guard.js.map +1 -0
- package/dist/store/requirements-store.d.ts.map +1 -1
- package/dist/store/requirements-store.js +16 -3
- package/dist/store/requirements-store.js.map +1 -1
- package/dist/store/token-store.d.ts.map +1 -1
- package/dist/store/token-store.js +8 -2
- package/dist/store/token-store.js.map +1 -1
- package/dist/templates/backend/.env.example +3 -1
- package/dist/tools/agent-chat.d.ts +9 -0
- package/dist/tools/agent-chat.d.ts.map +1 -0
- package/dist/tools/agent-chat.js +379 -0
- package/dist/tools/agent-chat.js.map +1 -0
- package/dist/tools/app-management.d.ts.map +1 -1
- package/dist/tools/app-management.js +29 -8
- package/dist/tools/app-management.js.map +1 -1
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +45 -8
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/build.d.ts.map +1 -1
- package/dist/tools/build.js +13 -2
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/codegen.d.ts.map +1 -1
- package/dist/tools/codegen.js +39 -6
- package/dist/tools/codegen.js.map +1 -1
- package/dist/tools/gather-requirements.d.ts +3 -0
- package/dist/tools/gather-requirements.d.ts.map +1 -0
- package/dist/tools/gather-requirements.js +281 -0
- package/dist/tools/gather-requirements.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +7 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/lifecycle.d.ts.map +1 -1
- package/dist/tools/lifecycle.js +40 -32
- package/dist/tools/lifecycle.js.map +1 -1
- package/dist/tools/reference-data.d.ts +8 -0
- package/dist/tools/reference-data.d.ts.map +1 -0
- package/dist/tools/reference-data.js +79 -0
- package/dist/tools/reference-data.js.map +1 -0
- package/dist/tools/scaffold.d.ts.map +1 -1
- package/dist/tools/scaffold.js +17 -1
- package/dist/tools/scaffold.js.map +1 -1
- package/dist/tools/submission.d.ts.map +1 -1
- package/dist/tools/submission.js +79 -21
- package/dist/tools/submission.js.map +1 -1
- package/dist/tools/webhooks.d.ts +3 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +303 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/utils/logger.d.ts +15 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +93 -14
- package/dist/utils/logger.js.map +1 -1
- package/package.json +16 -14
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { RATIO_API_BASE_URL } from '@ratio-mcp/shared';
|
|
4
|
+
import { developerApiRequest } from '../api/developer.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
import { getSession } from '../services/session-state.js';
|
|
7
|
+
// ─── Scope-to-Webhook Event Mapping ─────────────────────────────────────────
|
|
8
|
+
//
|
|
9
|
+
// Maps OAuth scopes to their relevant webhook event categories.
|
|
10
|
+
// When a developer confirms scopes (e.g. read_orders), we auto-suggest the
|
|
11
|
+
// matching webhook events (e.g. app.ecosystem.order.*).
|
|
12
|
+
//
|
|
13
|
+
// This mapping doesn't exist in the backend — it's agent-level intelligence.
|
|
14
|
+
//
|
|
15
|
+
const SCOPE_TO_EVENT_PREFIX = {
|
|
16
|
+
// Order scopes → order events
|
|
17
|
+
read_orders: ['app.ecosystem.order'],
|
|
18
|
+
write_orders: ['app.ecosystem.order'],
|
|
19
|
+
// Product scopes → product events
|
|
20
|
+
read_products: ['app.ecosystem.product'],
|
|
21
|
+
write_products: ['app.ecosystem.product'],
|
|
22
|
+
// Customer scopes → customer events
|
|
23
|
+
read_customers: ['app.ecosystem.customer'],
|
|
24
|
+
write_customers: ['app.ecosystem.customer'],
|
|
25
|
+
// Inventory scopes → inventory events
|
|
26
|
+
read_inventory: ['app.ecosystem.inventory'],
|
|
27
|
+
write_inventory: ['app.ecosystem.inventory'],
|
|
28
|
+
// Fulfillment scopes → fulfillment events
|
|
29
|
+
read_fulfillments: ['app.ecosystem.fulfillment'],
|
|
30
|
+
write_fulfillments: ['app.ecosystem.fulfillment'],
|
|
31
|
+
// Discount / price rule scopes → no direct webhook events yet
|
|
32
|
+
read_discounts: [],
|
|
33
|
+
write_discounts: [],
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Given a list of confirmed scopes, return the event name prefixes that are relevant.
|
|
37
|
+
*/
|
|
38
|
+
function getRelevantEventPrefixes(scopes) {
|
|
39
|
+
const prefixes = new Set();
|
|
40
|
+
for (const scope of scopes) {
|
|
41
|
+
const mapped = SCOPE_TO_EVENT_PREFIX[scope];
|
|
42
|
+
if (mapped) {
|
|
43
|
+
for (const prefix of mapped)
|
|
44
|
+
prefixes.add(prefix);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return [...prefixes];
|
|
48
|
+
}
|
|
49
|
+
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
50
|
+
/**
|
|
51
|
+
* Fetch event definitions from the admin setup endpoint.
|
|
52
|
+
* This endpoint has no auth guard — it returns the event category config.
|
|
53
|
+
*/
|
|
54
|
+
async function fetchEventDefinitions() {
|
|
55
|
+
const url = `${RATIO_API_BASE_URL}/admin/webhook-setup/event-definitions`;
|
|
56
|
+
logger.apiRequest('GET', url);
|
|
57
|
+
const startTime = Date.now();
|
|
58
|
+
try {
|
|
59
|
+
const response = await axios.get(url, {
|
|
60
|
+
headers: { Accept: 'application/json' },
|
|
61
|
+
});
|
|
62
|
+
const duration = Date.now() - startTime;
|
|
63
|
+
logger.apiResponse('GET', url, response.status, duration);
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const duration = Date.now() - startTime;
|
|
68
|
+
if (axios.isAxiosError(error)) {
|
|
69
|
+
logger.apiError('GET', url, error.response?.status, duration, error.response?.data);
|
|
70
|
+
}
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// ─── Tools ──────────────────────────────────────────────────────────────────
|
|
75
|
+
export const webhookTools = [
|
|
76
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
77
|
+
// 1. get_webhook_topics
|
|
78
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
79
|
+
{
|
|
80
|
+
name: 'get_webhook_topics',
|
|
81
|
+
description: 'Fetch available webhook events and auto-suggest relevant ones based on the app\'s confirmed scopes. ' +
|
|
82
|
+
'Must be called AFTER define_app_requirements (scopes confirmed). ' +
|
|
83
|
+
'Shows the developer which events match their scopes and asks for their webhook endpoint URL.',
|
|
84
|
+
inputSchema: z.object({}),
|
|
85
|
+
handler: async () => {
|
|
86
|
+
logger.info('Fetching webhook event definitions (scope-aware)');
|
|
87
|
+
const data = await fetchEventDefinitions();
|
|
88
|
+
const session = getSession();
|
|
89
|
+
const confirmedScopes = session.context.confirmedScopes || [];
|
|
90
|
+
const relevantPrefixes = getRelevantEventPrefixes(confirmedScopes);
|
|
91
|
+
// Separate events into recommended (matches scopes) and other
|
|
92
|
+
const recommended = [];
|
|
93
|
+
const other = [];
|
|
94
|
+
for (const cat of data.categories) {
|
|
95
|
+
for (const evt of cat.events) {
|
|
96
|
+
const matchedPrefix = relevantPrefixes.find((p) => evt.name.startsWith(p));
|
|
97
|
+
if (matchedPrefix) {
|
|
98
|
+
// Find which scope triggered this match
|
|
99
|
+
const matchedScope = confirmedScopes.find((s) => {
|
|
100
|
+
const prefixes = SCOPE_TO_EVENT_PREFIX[s] || [];
|
|
101
|
+
return prefixes.includes(matchedPrefix);
|
|
102
|
+
});
|
|
103
|
+
recommended.push({
|
|
104
|
+
event_name: evt.name,
|
|
105
|
+
display_name: evt.displayName,
|
|
106
|
+
description: evt.description,
|
|
107
|
+
matched_scope: matchedScope || 'unknown',
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
other.push({
|
|
112
|
+
event_name: evt.name,
|
|
113
|
+
display_name: evt.displayName,
|
|
114
|
+
description: evt.description,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
success: true,
|
|
121
|
+
confirmed_scopes: confirmedScopes,
|
|
122
|
+
recommended_events: recommended,
|
|
123
|
+
recommended_count: recommended.length,
|
|
124
|
+
other_available_events: other,
|
|
125
|
+
other_count: other.length,
|
|
126
|
+
_instruction: 'Show the developer the RECOMMENDED events first — these match their selected scopes. ' +
|
|
127
|
+
'Tell them: "Based on your scopes, I recommend subscribing to these webhook events:" ' +
|
|
128
|
+
'and list the recommended events. Then mention there are other events available if they want more. ' +
|
|
129
|
+
'Ask for their HTTPS webhook endpoint URL. Then call create_webhooks with the selected events.',
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
134
|
+
// 2. create_webhooks
|
|
135
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
136
|
+
{
|
|
137
|
+
name: 'create_webhooks',
|
|
138
|
+
description: 'Create webhook subscriptions for an app (bulk). Registers a webhook endpoint URL ' +
|
|
139
|
+
'for multiple event types at once. ' +
|
|
140
|
+
'PREREQUISITES:\n' +
|
|
141
|
+
'1. Call get_webhook_topics first and let the developer choose events\n' +
|
|
142
|
+
'2. Ask the developer for their HTTPS webhook endpoint URL\n' +
|
|
143
|
+
'Only call create_webhooks after both are answered.',
|
|
144
|
+
inputSchema: z.object({
|
|
145
|
+
app_id: z.string().min(1).describe('Application ID'),
|
|
146
|
+
webhook_url: z
|
|
147
|
+
.string()
|
|
148
|
+
.url()
|
|
149
|
+
.describe('HTTPS URL that will receive webhook POST requests. ' +
|
|
150
|
+
'MUST ask the developer for this URL. Example: https://api.yourapp.com/webhooks'),
|
|
151
|
+
event_names: z
|
|
152
|
+
.array(z.string())
|
|
153
|
+
.min(1)
|
|
154
|
+
.max(50)
|
|
155
|
+
.describe('Array of event names to subscribe to (from get_webhook_topics). ' +
|
|
156
|
+
'Example: ["app.ecosystem.product.created", "app.ecosystem.order.created"]'),
|
|
157
|
+
secret_key: z
|
|
158
|
+
.string()
|
|
159
|
+
.min(16)
|
|
160
|
+
.max(256)
|
|
161
|
+
.optional()
|
|
162
|
+
.describe('Optional HMAC-SHA256 secret for signature verification (min 16 chars). Auto-generated if not provided.'),
|
|
163
|
+
name: z.string().max(255).optional().describe('Optional friendly name for this webhook endpoint'),
|
|
164
|
+
}),
|
|
165
|
+
handler: async (input) => {
|
|
166
|
+
const inp = input;
|
|
167
|
+
logger.info(`Creating webhooks for app ${inp.app_id}: ${inp.event_names.length} events → ${inp.webhook_url}`);
|
|
168
|
+
const body = {
|
|
169
|
+
webhookUrl: inp.webhook_url,
|
|
170
|
+
eventNames: inp.event_names,
|
|
171
|
+
};
|
|
172
|
+
if (inp.secret_key)
|
|
173
|
+
body['secretKey'] = inp.secret_key;
|
|
174
|
+
if (inp.name)
|
|
175
|
+
body['name'] = inp.name;
|
|
176
|
+
const response = await developerApiRequest('POST', `/app-webhooks/developer/${inp.app_id}/bulk`, body);
|
|
177
|
+
const createdCount = response.created?.length ?? 0;
|
|
178
|
+
const skippedCount = response.skipped?.length ?? 0;
|
|
179
|
+
const errorCount = response.errors?.length ?? 0;
|
|
180
|
+
const summary = [];
|
|
181
|
+
if (createdCount > 0)
|
|
182
|
+
summary.push(`${createdCount} webhooks created`);
|
|
183
|
+
if (skippedCount > 0)
|
|
184
|
+
summary.push(`${skippedCount} already existed (skipped)`);
|
|
185
|
+
if (errorCount > 0)
|
|
186
|
+
summary.push(`${errorCount} failed`);
|
|
187
|
+
return {
|
|
188
|
+
success: createdCount > 0,
|
|
189
|
+
message: summary.join(', ') || 'No webhooks created',
|
|
190
|
+
created: createdCount,
|
|
191
|
+
skipped: skippedCount,
|
|
192
|
+
errors: errorCount,
|
|
193
|
+
webhook_url: inp.webhook_url,
|
|
194
|
+
created_events: response.created?.map((w) => w.eventName) ?? [],
|
|
195
|
+
skipped_events: response.skipped ?? [],
|
|
196
|
+
error_details: response.errors ?? [],
|
|
197
|
+
next_steps: [
|
|
198
|
+
'Webhooks are now configured as defaults for your app.',
|
|
199
|
+
'When a merchant installs your app, these webhooks will be automatically activated.',
|
|
200
|
+
'You can manage webhooks with list_webhooks, toggle_webhook, and delete_webhook.',
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
206
|
+
// 3. list_webhooks
|
|
207
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
208
|
+
{
|
|
209
|
+
name: 'list_webhooks',
|
|
210
|
+
description: 'List all webhook subscriptions configured for an app. Shows endpoint URLs, ' +
|
|
211
|
+
'subscribed events, and active/inactive status.',
|
|
212
|
+
inputSchema: z.object({
|
|
213
|
+
app_id: z.string().min(1).describe('Application ID'),
|
|
214
|
+
}),
|
|
215
|
+
handler: async (input) => {
|
|
216
|
+
const { app_id } = input;
|
|
217
|
+
logger.info(`Listing webhooks for app ${app_id}`);
|
|
218
|
+
const response = await developerApiRequest('GET', `/app-webhooks/developer/${app_id}`);
|
|
219
|
+
// Handle both array and wrapped response formats
|
|
220
|
+
const webhooks = Array.isArray(response)
|
|
221
|
+
? response
|
|
222
|
+
: response.data ?? [];
|
|
223
|
+
// Group by URL for cleaner display
|
|
224
|
+
const byUrl = new Map();
|
|
225
|
+
for (const wh of webhooks) {
|
|
226
|
+
const url = wh.defaultUrl || wh.webhookUrl || 'unknown';
|
|
227
|
+
if (!byUrl.has(url))
|
|
228
|
+
byUrl.set(url, []);
|
|
229
|
+
byUrl.get(url).push(wh);
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
success: true,
|
|
233
|
+
total_webhooks: webhooks.length,
|
|
234
|
+
total_endpoints: byUrl.size,
|
|
235
|
+
endpoints: Array.from(byUrl.entries()).map(([url, whs]) => ({
|
|
236
|
+
url,
|
|
237
|
+
event_count: whs.length,
|
|
238
|
+
events: whs.map((w) => ({
|
|
239
|
+
id: w.id,
|
|
240
|
+
event_name: w.eventName,
|
|
241
|
+
active: w.isActive ?? w.active ?? true,
|
|
242
|
+
name: w.name || null,
|
|
243
|
+
failure_count: w.failureCount ?? 0,
|
|
244
|
+
})),
|
|
245
|
+
})),
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
250
|
+
// 4. toggle_webhook
|
|
251
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
252
|
+
{
|
|
253
|
+
name: 'toggle_webhook',
|
|
254
|
+
description: 'Enable or disable a specific webhook subscription. ' +
|
|
255
|
+
'Use list_webhooks first to get the webhook ID.',
|
|
256
|
+
inputSchema: z.object({
|
|
257
|
+
webhook_id: z.string().min(1).describe('Webhook ID (from list_webhooks)'),
|
|
258
|
+
}),
|
|
259
|
+
handler: async (input) => {
|
|
260
|
+
const { webhook_id } = input;
|
|
261
|
+
logger.info(`Toggling webhook ${webhook_id}`);
|
|
262
|
+
const response = await developerApiRequest('PATCH', `/app-webhooks/developer/webhook/${webhook_id}/toggle`);
|
|
263
|
+
const isActive = response.isActive ?? response.active;
|
|
264
|
+
return {
|
|
265
|
+
success: true,
|
|
266
|
+
webhook_id: response.id || webhook_id,
|
|
267
|
+
event_name: response.eventName || null,
|
|
268
|
+
active: isActive,
|
|
269
|
+
message: `Webhook ${isActive ? 'enabled' : 'disabled'} successfully`,
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
274
|
+
// 5. delete_webhook
|
|
275
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
276
|
+
{
|
|
277
|
+
name: 'delete_webhook',
|
|
278
|
+
description: 'Delete a webhook subscription. This action cannot be undone. ' +
|
|
279
|
+
'Use list_webhooks first to get the webhook ID.',
|
|
280
|
+
inputSchema: z.object({
|
|
281
|
+
webhook_id: z.string().min(1).describe('Webhook ID to delete (from list_webhooks)'),
|
|
282
|
+
confirm: z
|
|
283
|
+
.boolean()
|
|
284
|
+
.describe('Set to true to confirm deletion. MUST ask the developer before deleting.'),
|
|
285
|
+
}),
|
|
286
|
+
handler: async (input) => {
|
|
287
|
+
const { webhook_id, confirm } = input;
|
|
288
|
+
if (!confirm) {
|
|
289
|
+
return {
|
|
290
|
+
success: false,
|
|
291
|
+
message: 'Deletion not confirmed. Set confirm: true to proceed.',
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
logger.info(`Deleting webhook ${webhook_id}`);
|
|
295
|
+
await developerApiRequest('DELETE', `/app-webhooks/developer/webhook/${webhook_id}`);
|
|
296
|
+
return {
|
|
297
|
+
success: true,
|
|
298
|
+
message: `Webhook ${webhook_id} deleted successfully`,
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AA6D1D,+EAA+E;AAC/E,EAAE;AACF,gEAAgE;AAChE,2EAA2E;AAC3E,wDAAwD;AACxD,EAAE;AACF,6EAA6E;AAC7E,EAAE;AAEF,MAAM,qBAAqB,GAA6B;IACtD,8BAA8B;IAC9B,WAAW,EAAI,CAAC,qBAAqB,CAAC;IACtC,YAAY,EAAG,CAAC,qBAAqB,CAAC;IACtC,kCAAkC;IAClC,aAAa,EAAG,CAAC,uBAAuB,CAAC;IACzC,cAAc,EAAE,CAAC,uBAAuB,CAAC;IACzC,oCAAoC;IACpC,cAAc,EAAG,CAAC,wBAAwB,CAAC;IAC3C,eAAe,EAAE,CAAC,wBAAwB,CAAC;IAC3C,sCAAsC;IACtC,cAAc,EAAG,CAAC,yBAAyB,CAAC;IAC5C,eAAe,EAAE,CAAC,yBAAyB,CAAC;IAC5C,0CAA0C;IAC1C,iBAAiB,EAAG,CAAC,2BAA2B,CAAC;IACjD,kBAAkB,EAAE,CAAC,2BAA2B,CAAC;IACjD,8DAA8D;IAC9D,cAAc,EAAG,EAAE;IACnB,eAAe,EAAE,EAAE;C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EAA2E;IAC3E;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,+DAA+D;YAC/D,gDAAgD;QAClD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;YACnF,OAAO,EAAE,CAAC;iBACP,OAAO,EAAE;iBACT,QAAQ,CAAC,0EAA0E,CAAC;SACxF,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACvB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAiD,CAAC;YAElF,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,uDAAuD;iBACjE,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,oBAAoB,UAAU,EAAE,CAAC,CAAC;YAE9C,MAAM,mBAAmB,CACvB,QAAQ,EACR,mCAAmC,UAAU,EAAE,CAChD,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,WAAW,UAAU,uBAAuB;aACtD,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Logger that writes to BOTH stderr (for MCP protocol) AND a persistent log file.
|
|
3
|
+
* The log file is stored in the mcp-v2 root so you can review the full flow after testing.
|
|
4
4
|
*/
|
|
5
|
+
declare const LOG_FILE: string;
|
|
5
6
|
/**
|
|
6
|
-
* Safely stringify objects for logging, truncating to maxLen to avoid flooding
|
|
7
|
+
* Safely stringify objects for logging, truncating to maxLen to avoid flooding.
|
|
7
8
|
* Redacts sensitive fields (passwords, tokens, secrets).
|
|
8
9
|
*/
|
|
9
10
|
declare function safeStringify(obj: unknown, maxLen?: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* Full stringify WITHOUT redaction — for the log file only (not stderr).
|
|
13
|
+
* This lets you see actual values like client_id, merchant_id, scopes when debugging.
|
|
14
|
+
*/
|
|
15
|
+
declare function fullStringify(obj: unknown, maxLen?: number): string;
|
|
10
16
|
export declare const logger: {
|
|
11
17
|
info: (message: string, ...args: unknown[]) => void;
|
|
12
18
|
warn: (message: string, ...args: unknown[]) => void;
|
|
@@ -21,9 +27,13 @@ export declare const logger: {
|
|
|
21
27
|
/** Log an outgoing API request to the backend */
|
|
22
28
|
apiRequest: (method: string, url: string, data?: unknown) => void;
|
|
23
29
|
/** Log a successful API response */
|
|
24
|
-
apiResponse: (method: string, url: string, status: number, durationMs: number) => void;
|
|
30
|
+
apiResponse: (method: string, url: string, status: number, durationMs: number, responseData?: unknown) => void;
|
|
25
31
|
/** Log a failed API response */
|
|
26
32
|
apiError: (method: string, url: string, status: number | undefined, durationMs: number, errorBody?: unknown) => void;
|
|
33
|
+
/** Log session state snapshots for debugging flow issues */
|
|
34
|
+
sessionSnapshot: (label: string, context: Record<string, unknown>) => void;
|
|
35
|
+
/** Separator for clarity between flow phases */
|
|
36
|
+
phase: (phaseName: string, details?: string) => void;
|
|
27
37
|
};
|
|
28
|
-
export { safeStringify };
|
|
38
|
+
export { safeStringify, fullStringify, LOG_FILE };
|
|
29
39
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,QAAA,MAAM,QAAQ,QAAmC,CAAC;AA0BlD;;;GAGG;AACH,iBAAS,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,SAAO,GAAG,MAAM,CAgB1D;AAED;;;GAGG;AACH,iBAAS,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,SAAO,GAAG,MAAM,CAU1D;AAED,eAAO,MAAM,MAAM;oBACD,MAAM,WAAW,OAAO,EAAE;oBAK1B,MAAM,WAAW,OAAO,EAAE;qBAKzB,MAAM,WAAW,OAAO,EAAE;qBAK1B,MAAM,WAAW,OAAO,EAAE;IAS3C,0DAA0D;yBACrC,MAAM,SAAS,OAAO;IAO3C,mCAAmC;2BACZ,MAAM,cAAc,MAAM,UAAU,OAAO;IAOlE,kCAAkC;0BACZ,MAAM,cAAc,MAAM,SAAS,OAAO;IAUhE,iDAAiD;yBAC5B,MAAM,OAAO,MAAM,SAAS,OAAO;IAOxD,oCAAoC;0BACd,MAAM,OAAO,MAAM,UAAU,MAAM,cAAc,MAAM,iBAAiB,OAAO;IAKrG,gCAAgC;uBACb,MAAM,OAAO,MAAM,UAAU,MAAM,GAAG,SAAS,cAAc,MAAM,cAAc,OAAO;IAM3G,4DAA4D;6BACnC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKjE,gDAAgD;uBAC7B,MAAM,YAAY,MAAM;CAK5C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Logger that writes to BOTH stderr (for MCP protocol) AND a persistent log file.
|
|
3
|
+
* The log file is stored in the mcp-v2 root so you can review the full flow after testing.
|
|
4
4
|
*/
|
|
5
|
+
import { appendFileSync, existsSync, mkdirSync } from 'fs';
|
|
6
|
+
import { join, resolve, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
// Log file lives in ratio-mcp-v2/logs/dev-server.log
|
|
11
|
+
const LOGS_DIR = resolve(__dirname, '..', '..', '..', '..', 'logs');
|
|
12
|
+
const LOG_FILE = join(LOGS_DIR, 'dev-server.log');
|
|
13
|
+
// Ensure logs directory exists
|
|
14
|
+
try {
|
|
15
|
+
if (!existsSync(LOGS_DIR)) {
|
|
16
|
+
mkdirSync(LOGS_DIR, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch { /* ignore — will retry on first write */ }
|
|
5
20
|
function timestamp() {
|
|
6
21
|
return new Date().toISOString();
|
|
7
22
|
}
|
|
8
23
|
/**
|
|
9
|
-
*
|
|
24
|
+
* Write a line to the persistent log file.
|
|
25
|
+
* Never throws — logging failures should not break the app.
|
|
26
|
+
*/
|
|
27
|
+
function writeToFile(line) {
|
|
28
|
+
try {
|
|
29
|
+
if (!existsSync(LOGS_DIR)) {
|
|
30
|
+
mkdirSync(LOGS_DIR, { recursive: true });
|
|
31
|
+
}
|
|
32
|
+
appendFileSync(LOG_FILE, line + '\n', 'utf-8');
|
|
33
|
+
}
|
|
34
|
+
catch { /* swallow — don't break app for logging */ }
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Safely stringify objects for logging, truncating to maxLen to avoid flooding.
|
|
10
38
|
* Redacts sensitive fields (passwords, tokens, secrets).
|
|
11
39
|
*/
|
|
12
|
-
function safeStringify(obj, maxLen =
|
|
40
|
+
function safeStringify(obj, maxLen = 4000) {
|
|
13
41
|
const REDACTED_KEYS = ['password', 'token', 'secret', 'client_secret', 'access_token', 'refresh_token', 'authorization'];
|
|
14
42
|
try {
|
|
15
43
|
const str = JSON.stringify(obj, (key, value) => {
|
|
@@ -27,48 +55,99 @@ function safeStringify(obj, maxLen = 2000) {
|
|
|
27
55
|
return String(obj);
|
|
28
56
|
}
|
|
29
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Full stringify WITHOUT redaction — for the log file only (not stderr).
|
|
60
|
+
* This lets you see actual values like client_id, merchant_id, scopes when debugging.
|
|
61
|
+
*/
|
|
62
|
+
function fullStringify(obj, maxLen = 8000) {
|
|
63
|
+
try {
|
|
64
|
+
const str = JSON.stringify(obj, null, 2);
|
|
65
|
+
if (str && str.length > maxLen) {
|
|
66
|
+
return str.substring(0, maxLen) + `...[truncated, total ${str.length} chars]`;
|
|
67
|
+
}
|
|
68
|
+
return str || '';
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return String(obj);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
30
74
|
export const logger = {
|
|
31
75
|
info: (message, ...args) => {
|
|
32
|
-
|
|
76
|
+
const line = `[ratio-dev] ${timestamp()} INFO: ${message}${args.length ? ' ' + args.map(a => safeStringify(a)).join(' ') : ''}`;
|
|
77
|
+
console.error(line);
|
|
78
|
+
writeToFile(line);
|
|
33
79
|
},
|
|
34
80
|
warn: (message, ...args) => {
|
|
35
|
-
|
|
81
|
+
const line = `[ratio-dev] ${timestamp()} WARN: ${message}${args.length ? ' ' + args.map(a => safeStringify(a)).join(' ') : ''}`;
|
|
82
|
+
console.error(line);
|
|
83
|
+
writeToFile(line);
|
|
36
84
|
},
|
|
37
85
|
error: (message, ...args) => {
|
|
38
|
-
|
|
86
|
+
const line = `[ratio-dev] ${timestamp()} ERROR: ${message}${args.length ? ' ' + args.map(a => safeStringify(a)).join(' ') : ''}`;
|
|
87
|
+
console.error(line);
|
|
88
|
+
writeToFile(line);
|
|
39
89
|
},
|
|
40
90
|
debug: (message, ...args) => {
|
|
91
|
+
const line = `[ratio-dev] ${timestamp()} DEBUG: ${message}${args.length ? ' ' + args.map(a => safeStringify(a)).join(' ') : ''}`;
|
|
92
|
+
// Always write to file, only stderr if DEBUG env is set
|
|
41
93
|
if (process.env.DEBUG) {
|
|
42
|
-
console.error(
|
|
94
|
+
console.error(line);
|
|
43
95
|
}
|
|
96
|
+
writeToFile(line);
|
|
44
97
|
},
|
|
45
98
|
/** Log an incoming tool call with its input parameters */
|
|
46
99
|
toolCall: (toolName, input) => {
|
|
47
|
-
|
|
100
|
+
const stderrLine = `[ratio-dev] ${timestamp()} TOOL_CALL: ▶ ${toolName} | input: ${safeStringify(input)}`;
|
|
101
|
+
const fileLine = `[ratio-dev] ${timestamp()} TOOL_CALL: ▶ ${toolName} | input: ${fullStringify(input)}`;
|
|
102
|
+
console.error(stderrLine);
|
|
103
|
+
writeToFile(fileLine);
|
|
48
104
|
},
|
|
49
105
|
/** Log a successful tool result */
|
|
50
106
|
toolResult: (toolName, durationMs, result) => {
|
|
51
|
-
|
|
107
|
+
const stderrLine = `[ratio-dev] ${timestamp()} TOOL_RESULT: ✓ ${toolName} | ${durationMs}ms | output: ${safeStringify(result)}`;
|
|
108
|
+
const fileLine = `[ratio-dev] ${timestamp()} TOOL_RESULT: ✓ ${toolName} | ${durationMs}ms | output: ${fullStringify(result)}`;
|
|
109
|
+
console.error(stderrLine);
|
|
110
|
+
writeToFile(fileLine);
|
|
52
111
|
},
|
|
53
112
|
/** Log a failed tool execution */
|
|
54
113
|
toolError: (toolName, durationMs, error) => {
|
|
55
114
|
const message = error instanceof Error ? error.message : String(error);
|
|
115
|
+
const stack = error instanceof Error ? error.stack : '';
|
|
56
116
|
const details = error?.details;
|
|
57
|
-
|
|
117
|
+
const stderrLine = `[ratio-dev] ${timestamp()} TOOL_ERROR: ✗ ${toolName} | ${durationMs}ms | error: ${message}${details ? ` | details: ${safeStringify(details, 500)}` : ''}`;
|
|
118
|
+
const fileLine = `[ratio-dev] ${timestamp()} TOOL_ERROR: ✗ ${toolName} | ${durationMs}ms | error: ${message}${details ? ` | details: ${fullStringify(details)}` : ''}${stack ? `\n STACK: ${stack}` : ''}`;
|
|
119
|
+
console.error(stderrLine);
|
|
120
|
+
writeToFile(fileLine);
|
|
58
121
|
},
|
|
59
122
|
/** Log an outgoing API request to the backend */
|
|
60
123
|
apiRequest: (method, url, data) => {
|
|
61
124
|
const body = data ? ` | body: ${safeStringify(data, 500)}` : '';
|
|
125
|
+
const fullBody = data ? ` | body: ${fullStringify(data)}` : '';
|
|
62
126
|
console.error(`[ratio-dev] ${timestamp()} API_REQ: → ${method} ${url}${body}`);
|
|
127
|
+
writeToFile(`[ratio-dev] ${timestamp()} API_REQ: → ${method} ${url}${fullBody}`);
|
|
63
128
|
},
|
|
64
129
|
/** Log a successful API response */
|
|
65
|
-
apiResponse: (method, url, status, durationMs) => {
|
|
130
|
+
apiResponse: (method, url, status, durationMs, responseData) => {
|
|
66
131
|
console.error(`[ratio-dev] ${timestamp()} API_RES: ← ${method} ${url} | ${status} | ${durationMs}ms`);
|
|
132
|
+
writeToFile(`[ratio-dev] ${timestamp()} API_RES: ← ${method} ${url} | ${status} | ${durationMs}ms${responseData ? ` | data: ${fullStringify(responseData)}` : ''}`);
|
|
67
133
|
},
|
|
68
134
|
/** Log a failed API response */
|
|
69
135
|
apiError: (method, url, status, durationMs, errorBody) => {
|
|
70
|
-
|
|
136
|
+
const line = `[ratio-dev] ${timestamp()} API_ERR: ✗ ${method} ${url} | ${status || 'NO_RESPONSE'} | ${durationMs}ms | body: ${fullStringify(errorBody)}`;
|
|
137
|
+
console.error(line);
|
|
138
|
+
writeToFile(line);
|
|
139
|
+
},
|
|
140
|
+
/** Log session state snapshots for debugging flow issues */
|
|
141
|
+
sessionSnapshot: (label, context) => {
|
|
142
|
+
const line = `[ratio-dev] ${timestamp()} SESSION [${label}]: ${fullStringify(context)}`;
|
|
143
|
+
writeToFile(line);
|
|
144
|
+
},
|
|
145
|
+
/** Separator for clarity between flow phases */
|
|
146
|
+
phase: (phaseName, details) => {
|
|
147
|
+
const separator = '═'.repeat(60);
|
|
148
|
+
const line = `\n${separator}\n[ratio-dev] ${timestamp()} PHASE: ${phaseName}${details ? ` | ${details}` : ''}\n${separator}`;
|
|
149
|
+
writeToFile(line);
|
|
71
150
|
},
|
|
72
151
|
};
|
|
73
|
-
export { safeStringify };
|
|
152
|
+
export { safeStringify, fullStringify, LOG_FILE };
|
|
74
153
|
//# sourceMappingURL=logger.js.map
|
package/dist/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;QACzJ,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,4DAA4D;IAC5D,eAAe,EAAE,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAE;QACnE,MAAM,IAAI,GAAG,eAAe,SAAS,EAAE,aAAa,KAAK,MAAM,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QACxF,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,gDAAgD;IAChD,KAAK,EAAE,CAAC,SAAiB,EAAE,OAAgB,EAAE,EAAE;QAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,KAAK,SAAS,iBAAiB,SAAS,EAAE,WAAW,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC7H,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ratio-mcp/dev-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
6
|
+
"files": ["dist"],
|
|
9
7
|
"bin": {
|
|
10
8
|
"ratio-dev-server": "dist/index.js"
|
|
11
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc && npm run copy-templates",
|
|
12
|
+
"copy-templates": "rm -rf dist/templates && cp -r src/templates dist/templates 2>/dev/null || true",
|
|
13
|
+
"dev": "node --loader ts-node/esm src/index.ts",
|
|
14
|
+
"dev:orchestrated": "node --loader ts-node/esm src/orchestrated-index.ts",
|
|
15
|
+
"start": "node dist/index.js",
|
|
16
|
+
"start:orchestrated": "node dist/orchestrated-index.js",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"prepublishOnly": "pnpm build"
|
|
19
|
+
},
|
|
12
20
|
"dependencies": {
|
|
13
21
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
22
|
+
"@ratio-mcp/shared": "workspace:^",
|
|
14
23
|
"axios": "^1.7.0",
|
|
15
24
|
"zod": "^3.23.0",
|
|
16
25
|
"archiver": "^7.0.0",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
26
|
+
"dotenv": "^16.4.0",
|
|
27
|
+
"form-data": "^4.0.0"
|
|
19
28
|
},
|
|
20
29
|
"devDependencies": {
|
|
21
30
|
"@types/node": "^20.0.0",
|
|
22
31
|
"@types/archiver": "^6.0.0",
|
|
23
32
|
"typescript": "^5.4.0"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc && npm run copy-templates",
|
|
27
|
-
"copy-templates": "rm -rf dist/templates && cp -r src/templates dist/templates 2>/dev/null || true",
|
|
28
|
-
"dev": "node --loader ts-node/esm src/index.ts",
|
|
29
|
-
"start": "node dist/index.js",
|
|
30
|
-
"typecheck": "tsc --noEmit"
|
|
31
33
|
}
|
|
32
|
-
}
|
|
34
|
+
}
|