farseer-cli 1.0.5 → 1.0.8
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/docs/api-reference.md +372 -0
- package/docs/arquero-patterns.md +158 -0
- package/docs/cli-guide.md +160 -0
- package/docs/how-farseer-works.md +113 -0
- package/docs/import-workflows.md +306 -0
- package/docs/model-export.md +95 -0
- package/docs/new-app-template.md +240 -0
- package/docs/query-formulas.md +97 -0
- package/docs/troubleshooting.md +140 -0
- package/package.json +3 -3
- package/dist/commands/app.js +0 -349
- package/dist/commands/app.js.map +0 -7
- package/dist/commands/apps.js +0 -111
- package/dist/commands/apps.js.map +0 -7
- package/dist/commands/checkout.js +0 -166
- package/dist/commands/checkout.js.map +0 -7
- package/dist/commands/config.js +0 -139
- package/dist/commands/config.js.map +0 -7
- package/dist/commands/diff.js +0 -183
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/dimensions.js +0 -145
- package/dist/commands/dimensions.js.map +0 -7
- package/dist/commands/files.js +0 -99
- package/dist/commands/files.js.map +0 -7
- package/dist/commands/install.js +0 -79
- package/dist/commands/install.js.map +0 -7
- package/dist/commands/list.js +0 -92
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js +0 -134
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/logout.js +0 -59
- package/dist/commands/logout.js.map +0 -7
- package/dist/commands/mcp-server.js +0 -41
- package/dist/commands/mcp-server.js.map +0 -7
- package/dist/commands/model.js +0 -189
- package/dist/commands/model.js.map +0 -7
- package/dist/commands/pull.js +0 -287
- package/dist/commands/pull.js.map +0 -7
- package/dist/commands/push.js +0 -251
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/run.js +0 -288
- package/dist/commands/run.js.map +0 -7
- package/dist/commands/status.js +0 -145
- package/dist/commands/status.js.map +0 -7
- package/dist/commands/variables.js +0 -176
- package/dist/commands/variables.js.map +0 -7
- package/dist/commands/whoami.js +0 -63
- package/dist/commands/whoami.js.map +0 -7
- package/dist/index.js +0 -153
- package/dist/index.js.map +0 -7
- package/dist/mcp/index.js +0 -35
- package/dist/mcp/index.js.map +0 -7
- package/dist/mcp/prompts/workflows.js +0 -437
- package/dist/mcp/prompts/workflows.js.map +0 -7
- package/dist/mcp/resources/documentation.js +0 -167
- package/dist/mcp/resources/documentation.js.map +0 -7
- package/dist/mcp/server.js +0 -52
- package/dist/mcp/server.js.map +0 -7
- package/dist/mcp/tools/appTools.js +0 -377
- package/dist/mcp/tools/appTools.js.map +0 -7
- package/dist/mcp/tools/authTools.js +0 -158
- package/dist/mcp/tools/authTools.js.map +0 -7
- package/dist/mcp/tools/dataTools.js +0 -366
- package/dist/mcp/tools/dataTools.js.map +0 -7
- package/dist/mcp/tools/modelTools.js +0 -331
- package/dist/mcp/tools/modelTools.js.map +0 -7
- package/dist/mcp/tools/runTools.js +0 -231
- package/dist/mcp/tools/runTools.js.map +0 -7
- package/dist/mcp/tools/syncTools.js +0 -382
- package/dist/mcp/tools/syncTools.js.map +0 -7
- package/dist/mcp/utils/helpers.js +0 -113
- package/dist/mcp/utils/helpers.js.map +0 -7
- package/dist/services/appSyncService.js +0 -399
- package/dist/services/appSyncService.js.map +0 -7
- package/dist/services/configService.js +0 -196
- package/dist/services/configService.js.map +0 -7
- package/dist/services/farseerApi.js +0 -426
- package/dist/services/farseerApi.js.map +0 -7
- package/dist/services/farseerFactory.js +0 -231
- package/dist/services/farseerFactory.js.map +0 -7
- package/dist/services/farseerService.js +0 -614
- package/dist/services/farseerService.js.map +0 -7
- package/dist/services/gitService.js +0 -134
- package/dist/services/gitService.js.map +0 -7
- package/dist/services/syncService.js +0 -415
- package/dist/services/syncService.js.map +0 -7
- package/dist/utils/constants.js +0 -49
- package/dist/utils/constants.js.map +0 -7
- package/dist/utils/helpers.js +0 -433
- package/dist/utils/helpers.js.map +0 -7
- package/dist/utils/logger.js +0 -76
- package/dist/utils/logger.js.map +0 -7
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var modelTools_exports = {};
|
|
19
|
-
__export(modelTools_exports, {
|
|
20
|
-
registerModelTools: () => registerModelTools
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(modelTools_exports);
|
|
23
|
-
var import_zod = require("zod");
|
|
24
|
-
var import_farseerFactory = require("../../services/farseerFactory");
|
|
25
|
-
var import_configService = require("../../services/configService");
|
|
26
|
-
var import_helpers = require("../utils/helpers");
|
|
27
|
-
const exportModelSchema = {
|
|
28
|
-
tenant: import_zod.z.string().optional().describe("Tenant name")
|
|
29
|
-
};
|
|
30
|
-
const listTablesSchema = {
|
|
31
|
-
tenant: import_zod.z.string().optional().describe("Tenant name")
|
|
32
|
-
};
|
|
33
|
-
const listVariablesSchema = {
|
|
34
|
-
tenant: import_zod.z.string().optional().describe("Tenant name")
|
|
35
|
-
};
|
|
36
|
-
const getTableSchema = {
|
|
37
|
-
tenant: import_zod.z.string().optional().describe("Tenant name"),
|
|
38
|
-
tableName: import_zod.z.string().describe("Name of the dimension table")
|
|
39
|
-
};
|
|
40
|
-
const getVariableSchema = {
|
|
41
|
-
tenant: import_zod.z.string().optional().describe("Tenant name"),
|
|
42
|
-
variableName: import_zod.z.string().describe("Name of the variable")
|
|
43
|
-
};
|
|
44
|
-
function registerModelTools(server) {
|
|
45
|
-
server.tool(
|
|
46
|
-
"farseer_export_model",
|
|
47
|
-
`Export the complete data model structure from a Farseer tenant.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
- All dimension tables with member counts and foreign key relationships
|
|
51
|
-
- All variables with their dimensions, formulas, and roll-up types
|
|
52
|
-
|
|
53
|
-
This is essential for understanding a tenant's data structure before writing import scripts.
|
|
54
|
-
|
|
55
|
-
The model export can be large for complex tenants. Use farseer_list_tables or
|
|
56
|
-
farseer_list_variables for a summary view.
|
|
57
|
-
|
|
58
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
59
|
-
exportModelSchema,
|
|
60
|
-
async (params) => {
|
|
61
|
-
const { tenant: tenantArg } = params;
|
|
62
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
63
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
64
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
65
|
-
if (!tenant || !organisation) {
|
|
66
|
-
return (0, import_helpers.tenantRequiredResponse)();
|
|
67
|
-
}
|
|
68
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
69
|
-
if (!clientResult) {
|
|
70
|
-
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
const model = await clientResult.client.exportModel();
|
|
74
|
-
const tables = model.tables.map((t) => ({
|
|
75
|
-
name: t.name,
|
|
76
|
-
memberCount: t.rows?.length || 0,
|
|
77
|
-
columns: t.columns.map((c) => ({
|
|
78
|
-
type: c.type,
|
|
79
|
-
name: c.name,
|
|
80
|
-
foreignKeyTable: c.foreignKeyTableName
|
|
81
|
-
})),
|
|
82
|
-
foreignKeys: t.columns.filter((c) => c.type === "FOREIGN_KEY").map((c) => c.foreignKeyTableName),
|
|
83
|
-
folderPath: t.folderPath
|
|
84
|
-
}));
|
|
85
|
-
const variables = model.variables.map((v) => ({
|
|
86
|
-
name: v.name,
|
|
87
|
-
dimensions: v.tables || [],
|
|
88
|
-
formula: v.formula || void 0,
|
|
89
|
-
rollupType: v.rollupType,
|
|
90
|
-
numberFormat: v.numberFormat,
|
|
91
|
-
readonly: v.readonly,
|
|
92
|
-
calculateOnDemand: v.calculateOnDemand,
|
|
93
|
-
folderPath: v.folderPath
|
|
94
|
-
}));
|
|
95
|
-
return (0, import_helpers.successResponse)({
|
|
96
|
-
tenant,
|
|
97
|
-
summary: {
|
|
98
|
-
tableCount: tables.length,
|
|
99
|
-
variableCount: variables.length
|
|
100
|
-
},
|
|
101
|
-
tables,
|
|
102
|
-
variables
|
|
103
|
-
});
|
|
104
|
-
} catch (error) {
|
|
105
|
-
return (0, import_helpers.errorResponse)(
|
|
106
|
-
`Export model failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
107
|
-
"NETWORK_ERROR"
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
server.tool(
|
|
113
|
-
"farseer_list_tables",
|
|
114
|
-
`List all dimension tables in a Farseer tenant model.
|
|
115
|
-
|
|
116
|
-
Dimension tables define the structure of data:
|
|
117
|
-
- Product, Region, Customer (business dimensions)
|
|
118
|
-
- Months, Years (time dimensions - built-in)
|
|
119
|
-
- Versions (scenario dimension - built-in)
|
|
120
|
-
|
|
121
|
-
Returns table names, member counts, and foreign key relationships.
|
|
122
|
-
|
|
123
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
124
|
-
listTablesSchema,
|
|
125
|
-
async (params) => {
|
|
126
|
-
const { tenant: tenantArg } = params;
|
|
127
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
128
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
129
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
130
|
-
if (!tenant || !organisation) {
|
|
131
|
-
return (0, import_helpers.tenantRequiredResponse)();
|
|
132
|
-
}
|
|
133
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
134
|
-
if (!clientResult) {
|
|
135
|
-
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
const model = await clientResult.client.exportModel();
|
|
139
|
-
const tables = model.tables.map((t) => ({
|
|
140
|
-
name: t.name,
|
|
141
|
-
memberCount: t.rows?.length || 0,
|
|
142
|
-
foreignKeys: t.columns.filter((c) => c.type === "FOREIGN_KEY").map((c) => c.foreignKeyTableName)
|
|
143
|
-
}));
|
|
144
|
-
tables.sort((a, b) => a.name.localeCompare(b.name));
|
|
145
|
-
return (0, import_helpers.successResponse)({
|
|
146
|
-
tenant,
|
|
147
|
-
totalTables: tables.length,
|
|
148
|
-
tables
|
|
149
|
-
});
|
|
150
|
-
} catch (error) {
|
|
151
|
-
return (0, import_helpers.errorResponse)(
|
|
152
|
-
`List tables failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
153
|
-
"NETWORK_ERROR"
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
server.tool(
|
|
159
|
-
"farseer_list_variables",
|
|
160
|
-
`List all variables defined in a Farseer tenant model.
|
|
161
|
-
|
|
162
|
-
Variables store data and calculations - they are the core of the data model.
|
|
163
|
-
|
|
164
|
-
Each variable has:
|
|
165
|
-
- Dimensions it spans (Product, Region, Month, etc.)
|
|
166
|
-
- Optional formula for calculated values
|
|
167
|
-
- Roll-up type (how values aggregate up hierarchies)
|
|
168
|
-
|
|
169
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
170
|
-
listVariablesSchema,
|
|
171
|
-
async (params) => {
|
|
172
|
-
const { tenant: tenantArg } = params;
|
|
173
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
174
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
175
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
176
|
-
if (!tenant || !organisation) {
|
|
177
|
-
return (0, import_helpers.tenantRequiredResponse)();
|
|
178
|
-
}
|
|
179
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
180
|
-
if (!clientResult) {
|
|
181
|
-
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
182
|
-
}
|
|
183
|
-
try {
|
|
184
|
-
const model = await clientResult.client.exportModel();
|
|
185
|
-
const variables = model.variables.map((v) => ({
|
|
186
|
-
name: v.name,
|
|
187
|
-
dimensions: v.tables || [],
|
|
188
|
-
hasFormula: !!v.formula,
|
|
189
|
-
rollupType: v.rollupType,
|
|
190
|
-
readonly: v.readonly
|
|
191
|
-
}));
|
|
192
|
-
variables.sort((a, b) => a.name.localeCompare(b.name));
|
|
193
|
-
return (0, import_helpers.successResponse)({
|
|
194
|
-
tenant,
|
|
195
|
-
totalVariables: variables.length,
|
|
196
|
-
variables
|
|
197
|
-
});
|
|
198
|
-
} catch (error) {
|
|
199
|
-
return (0, import_helpers.errorResponse)(
|
|
200
|
-
`List variables failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
201
|
-
"NETWORK_ERROR"
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
server.tool(
|
|
207
|
-
"farseer_get_table",
|
|
208
|
-
`Get detailed information about a specific dimension table.
|
|
209
|
-
|
|
210
|
-
Returns:
|
|
211
|
-
- Table columns with their types
|
|
212
|
-
- Foreign key relationships to other tables
|
|
213
|
-
- Sample members (first 20)
|
|
214
|
-
- Total member count
|
|
215
|
-
|
|
216
|
-
This helps understand the structure needed for import scripts.
|
|
217
|
-
|
|
218
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
219
|
-
getTableSchema,
|
|
220
|
-
async (params) => {
|
|
221
|
-
const { tenant: tenantArg, tableName } = params;
|
|
222
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
223
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
224
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
225
|
-
if (!tenant || !organisation) {
|
|
226
|
-
return (0, import_helpers.tenantRequiredResponse)();
|
|
227
|
-
}
|
|
228
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
229
|
-
if (!clientResult) {
|
|
230
|
-
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
231
|
-
}
|
|
232
|
-
try {
|
|
233
|
-
const model = await clientResult.client.exportModel();
|
|
234
|
-
const table = model.tables.find(
|
|
235
|
-
(t) => t.name.toLowerCase() === tableName.toLowerCase()
|
|
236
|
-
);
|
|
237
|
-
if (!table) {
|
|
238
|
-
return (0, import_helpers.errorResponse)(`Table "${tableName}" not found`, "NOT_FOUND");
|
|
239
|
-
}
|
|
240
|
-
const primaryKeyColumn = table.columns.find((c) => c.type === "PRIMARY_KEY");
|
|
241
|
-
let sampleMembers = [];
|
|
242
|
-
if (table.rows && table.rows.length > 0) {
|
|
243
|
-
const pkIndex = primaryKeyColumn ? table.columns.indexOf(primaryKeyColumn) : 0;
|
|
244
|
-
sampleMembers = table.rows.slice(0, 20).map((row) => String(row[pkIndex]));
|
|
245
|
-
}
|
|
246
|
-
return (0, import_helpers.successResponse)({
|
|
247
|
-
tenant,
|
|
248
|
-
table: {
|
|
249
|
-
name: table.name,
|
|
250
|
-
columns: table.columns.map((c) => ({
|
|
251
|
-
type: c.type,
|
|
252
|
-
name: c.name,
|
|
253
|
-
foreignKeyTable: c.foreignKeyTableName
|
|
254
|
-
})),
|
|
255
|
-
memberCount: table.rows?.length || 0,
|
|
256
|
-
sampleMembers,
|
|
257
|
-
folderPath: table.folderPath
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
} catch (error) {
|
|
261
|
-
return (0, import_helpers.errorResponse)(
|
|
262
|
-
`Get table failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
263
|
-
"NETWORK_ERROR"
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
server.tool(
|
|
269
|
-
"farseer_get_variable",
|
|
270
|
-
`Get detailed information about a specific variable.
|
|
271
|
-
|
|
272
|
-
Returns:
|
|
273
|
-
- Dimensions the variable spans
|
|
274
|
-
- Formula (if calculated)
|
|
275
|
-
- Roll-up type (SUM, AVERAGE, etc.)
|
|
276
|
-
- Data type and format
|
|
277
|
-
- Whether it's readonly or calculated on demand
|
|
278
|
-
|
|
279
|
-
This is essential for understanding what dimensions and values are needed for imports.
|
|
280
|
-
|
|
281
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
282
|
-
getVariableSchema,
|
|
283
|
-
async (params) => {
|
|
284
|
-
const { tenant: tenantArg, variableName } = params;
|
|
285
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
286
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
287
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
288
|
-
if (!tenant || !organisation) {
|
|
289
|
-
return (0, import_helpers.tenantRequiredResponse)();
|
|
290
|
-
}
|
|
291
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
292
|
-
if (!clientResult) {
|
|
293
|
-
return (0, import_helpers.authRequiredResponse)(tenant);
|
|
294
|
-
}
|
|
295
|
-
try {
|
|
296
|
-
const model = await clientResult.client.exportModel();
|
|
297
|
-
const variable = model.variables.find(
|
|
298
|
-
(v) => v.name.toLowerCase() === variableName.toLowerCase()
|
|
299
|
-
);
|
|
300
|
-
if (!variable) {
|
|
301
|
-
return (0, import_helpers.errorResponse)(`Variable "${variableName}" not found`, "NOT_FOUND");
|
|
302
|
-
}
|
|
303
|
-
return (0, import_helpers.successResponse)({
|
|
304
|
-
tenant,
|
|
305
|
-
variable: {
|
|
306
|
-
name: variable.name,
|
|
307
|
-
description: variable.description,
|
|
308
|
-
formula: variable.formula,
|
|
309
|
-
dimensions: variable.tables || [],
|
|
310
|
-
rollupType: variable.rollupType,
|
|
311
|
-
dataType: variable.dataType,
|
|
312
|
-
numberFormat: variable.numberFormat,
|
|
313
|
-
readonly: variable.readonly,
|
|
314
|
-
calculateOnDemand: variable.calculateOnDemand,
|
|
315
|
-
folderPath: variable.folderPath
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
} catch (error) {
|
|
319
|
-
return (0, import_helpers.errorResponse)(
|
|
320
|
-
`Get variable failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
321
|
-
"NETWORK_ERROR"
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
328
|
-
0 && (module.exports = {
|
|
329
|
-
registerModelTools
|
|
330
|
-
});
|
|
331
|
-
//# sourceMappingURL=modelTools.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/mcp/tools/modelTools.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Model Inspection Tools\n *\n * Tools for exploring Farseer data models (dimensions, variables, formulas).\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { getFarseerClientWithFallback } from '../../services/farseerFactory';\nimport { getCurrentCheckout } from '../../services/configService';\nimport {\n successResponse,\n errorResponse,\n authRequiredResponse,\n tenantRequiredResponse,\n} from '../utils/helpers';\n\n// Define schemas outside of tool registration to avoid deep type instantiation\nconst exportModelSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n};\n\nconst listTablesSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n};\n\nconst listVariablesSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n};\n\nconst getTableSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n tableName: z.string().describe('Name of the dimension table'),\n};\n\nconst getVariableSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n variableName: z.string().describe('Name of the variable'),\n};\n\nexport function registerModelTools(server: McpServer): void {\n // farseer_export_model - Export complete model\n server.tool(\n 'farseer_export_model',\n `Export the complete data model structure from a Farseer tenant.\n\nReturns:\n- All dimension tables with member counts and foreign key relationships\n- All variables with their dimensions, formulas, and roll-up types\n\nThis is essential for understanding a tenant's data structure before writing import scripts.\n\nThe model export can be large for complex tenants. Use farseer_list_tables or\nfarseer_list_variables for a summary view.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n exportModelSchema,\n async (params: { tenant?: string }) => {\n const { tenant: tenantArg } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const model = await clientResult.client.exportModel();\n\n // Process tables\n const tables = model.tables.map((t) => ({\n name: t.name,\n memberCount: t.rows?.length || 0,\n columns: t.columns.map((c) => ({\n type: c.type,\n name: c.name,\n foreignKeyTable: c.foreignKeyTableName,\n })),\n foreignKeys: t.columns\n .filter((c) => c.type === 'FOREIGN_KEY')\n .map((c) => c.foreignKeyTableName!),\n folderPath: t.folderPath,\n }));\n\n // Process variables\n const variables = model.variables.map((v) => ({\n name: v.name,\n dimensions: v.tables || [],\n formula: v.formula || undefined,\n rollupType: v.rollupType,\n numberFormat: v.numberFormat,\n readonly: v.readonly,\n calculateOnDemand: v.calculateOnDemand,\n folderPath: v.folderPath,\n }));\n\n return successResponse({\n tenant,\n summary: {\n tableCount: tables.length,\n variableCount: variables.length,\n },\n tables,\n variables,\n });\n } catch (error) {\n return errorResponse(\n `Export model failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n\n // farseer_list_tables - List dimension tables\n server.tool(\n 'farseer_list_tables',\n `List all dimension tables in a Farseer tenant model.\n\nDimension tables define the structure of data:\n- Product, Region, Customer (business dimensions)\n- Months, Years (time dimensions - built-in)\n- Versions (scenario dimension - built-in)\n\nReturns table names, member counts, and foreign key relationships.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n listTablesSchema,\n async (params: { tenant?: string }) => {\n const { tenant: tenantArg } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const model = await clientResult.client.exportModel();\n\n const tables = model.tables.map((t) => ({\n name: t.name,\n memberCount: t.rows?.length || 0,\n foreignKeys: t.columns\n .filter((c) => c.type === 'FOREIGN_KEY')\n .map((c) => c.foreignKeyTableName!),\n }));\n\n // Sort by name\n tables.sort((a, b) => a.name.localeCompare(b.name));\n\n return successResponse({\n tenant,\n totalTables: tables.length,\n tables,\n });\n } catch (error) {\n return errorResponse(\n `List tables failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n\n // farseer_list_variables - List variables\n server.tool(\n 'farseer_list_variables',\n `List all variables defined in a Farseer tenant model.\n\nVariables store data and calculations - they are the core of the data model.\n\nEach variable has:\n- Dimensions it spans (Product, Region, Month, etc.)\n- Optional formula for calculated values\n- Roll-up type (how values aggregate up hierarchies)\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n listVariablesSchema,\n async (params: { tenant?: string }) => {\n const { tenant: tenantArg } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const model = await clientResult.client.exportModel();\n\n const variables = model.variables.map((v) => ({\n name: v.name,\n dimensions: v.tables || [],\n hasFormula: !!v.formula,\n rollupType: v.rollupType,\n readonly: v.readonly,\n }));\n\n // Sort by name\n variables.sort((a, b) => a.name.localeCompare(b.name));\n\n return successResponse({\n tenant,\n totalVariables: variables.length,\n variables,\n });\n } catch (error) {\n return errorResponse(\n `List variables failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n\n // farseer_get_table - Get dimension table details\n server.tool(\n 'farseer_get_table',\n `Get detailed information about a specific dimension table.\n\nReturns:\n- Table columns with their types\n- Foreign key relationships to other tables\n- Sample members (first 20)\n- Total member count\n\nThis helps understand the structure needed for import scripts.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n getTableSchema,\n async (params: { tenant?: string; tableName: string }) => {\n const { tenant: tenantArg, tableName } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const model = await clientResult.client.exportModel();\n\n const table = model.tables.find(\n (t) => t.name.toLowerCase() === tableName.toLowerCase()\n );\n\n if (!table) {\n return errorResponse(`Table \"${tableName}\" not found`, 'NOT_FOUND');\n }\n\n // Get sample members (first column is usually the primary key / name)\n const primaryKeyColumn = table.columns.find((c) => c.type === 'PRIMARY_KEY');\n let sampleMembers: string[] = [];\n\n if (table.rows && table.rows.length > 0) {\n const pkIndex = primaryKeyColumn\n ? table.columns.indexOf(primaryKeyColumn)\n : 0;\n sampleMembers = table.rows.slice(0, 20).map((row) => String(row[pkIndex]));\n }\n\n return successResponse({\n tenant,\n table: {\n name: table.name,\n columns: table.columns.map((c) => ({\n type: c.type,\n name: c.name,\n foreignKeyTable: c.foreignKeyTableName,\n })),\n memberCount: table.rows?.length || 0,\n sampleMembers,\n folderPath: table.folderPath,\n },\n });\n } catch (error) {\n return errorResponse(\n `Get table failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n\n // farseer_get_variable - Get variable details\n server.tool(\n 'farseer_get_variable',\n `Get detailed information about a specific variable.\n\nReturns:\n- Dimensions the variable spans\n- Formula (if calculated)\n- Roll-up type (SUM, AVERAGE, etc.)\n- Data type and format\n- Whether it's readonly or calculated on demand\n\nThis is essential for understanding what dimensions and values are needed for imports.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n getVariableSchema,\n async (params: { tenant?: string; variableName: string }) => {\n const { tenant: tenantArg, variableName } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n const model = await clientResult.client.exportModel();\n\n const variable = model.variables.find(\n (v) => v.name.toLowerCase() === variableName.toLowerCase()\n );\n\n if (!variable) {\n return errorResponse(`Variable \"${variableName}\" not found`, 'NOT_FOUND');\n }\n\n return successResponse({\n tenant,\n variable: {\n name: variable.name,\n description: variable.description,\n formula: variable.formula,\n dimensions: variable.tables || [],\n rollupType: variable.rollupType,\n dataType: variable.dataType,\n numberFormat: variable.numberFormat,\n readonly: variable.readonly,\n calculateOnDemand: variable.calculateOnDemand,\n folderPath: variable.folderPath,\n },\n });\n } catch (error) {\n return errorResponse(\n `Get variable failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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E,KAAK,YAAY,MAAM,aAAa,YAAY;AAAA,QAC7D;AAEA,YAAI,CAAC,UAAU;AACX,qBAAO,8BAAc,aAAa,YAAY,eAAe,WAAW;AAAA,QAC5E;AAEA,mBAAO,gCAAgB;AAAA,UACnB;AAAA,UACA,UAAU;AAAA,YACN,MAAM,SAAS;AAAA,YACf,aAAa,SAAS;AAAA,YACtB,SAAS,SAAS;AAAA,YAClB,YAAY,SAAS,UAAU,CAAC;AAAA,YAChC,YAAY,SAAS;AAAA,YACrB,UAAU,SAAS;AAAA,YACnB,cAAc,SAAS;AAAA,YACvB,UAAU,SAAS;AAAA,YACnB,mBAAmB,SAAS;AAAA,YAC5B,YAAY,SAAS;AAAA,UACzB;AAAA,QACJ,CAAC;AAAA,MACL,SAAS,OAAO;AACZ,mBAAO;AAAA,UACH,wBAAwB,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AAAA,UAChF;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var runTools_exports = {};
|
|
29
|
-
__export(runTools_exports, {
|
|
30
|
-
registerRunTools: () => registerRunTools
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(runTools_exports);
|
|
33
|
-
var import_zod = require("zod");
|
|
34
|
-
var import_child_process = require("child_process");
|
|
35
|
-
var fs = __toESM(require("fs"));
|
|
36
|
-
var path = __toESM(require("path"));
|
|
37
|
-
var import_farseerFactory = require("../../services/farseerFactory");
|
|
38
|
-
var import_configService = require("../../services/configService");
|
|
39
|
-
var import_farseerService = require("../../services/farseerService");
|
|
40
|
-
var import_helpers = require("../../utils/helpers");
|
|
41
|
-
var import_helpers2 = require("../utils/helpers");
|
|
42
|
-
async function getRunCredentials(tenant, tenantId) {
|
|
43
|
-
const credential = (0, import_configService.getCredential)(tenant);
|
|
44
|
-
if (credential) {
|
|
45
|
-
return {
|
|
46
|
-
tenantId: credential.tenantId,
|
|
47
|
-
apiKey: credential.apiKey,
|
|
48
|
-
basePath: credential.basePath
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const auth = (0, import_configService.getUserAuth)();
|
|
52
|
-
if (!auth) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
if (!(0, import_configService.isUserAuthValid)()) {
|
|
56
|
-
const refreshed = await (0, import_farseerService.refreshAccessToken)(auth.refreshToken, auth.realm || "master");
|
|
57
|
-
if (!refreshed) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
(0, import_configService.setUserAuth)({
|
|
61
|
-
accessToken: refreshed.accessToken,
|
|
62
|
-
refreshToken: refreshed.refreshToken,
|
|
63
|
-
expiresAt: new Date(Date.now() + refreshed.expiresIn * 1e3).toISOString(),
|
|
64
|
-
realm: auth.realm
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
const updatedAuth = (0, import_configService.getUserAuth)();
|
|
68
|
-
if (!updatedAuth) return null;
|
|
69
|
-
return {
|
|
70
|
-
tenantId: tenantId || tenant,
|
|
71
|
-
accessToken: updatedAuth.accessToken,
|
|
72
|
-
basePath: (0, import_configService.generateBasePath)(tenant)
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const runAppSchema = {
|
|
76
|
-
tenant: import_zod.z.string().optional().describe("Tenant name"),
|
|
77
|
-
appName: import_zod.z.string().describe("Name of the app to run"),
|
|
78
|
-
argumentOverrides: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional().describe("Override argument values (Name: Value pairs)")
|
|
79
|
-
};
|
|
80
|
-
function registerRunTools(server) {
|
|
81
|
-
server.tool(
|
|
82
|
-
"farseer_run_app",
|
|
83
|
-
`Run a Farseer app locally using tsx (TypeScript executor).
|
|
84
|
-
|
|
85
|
-
How it works:
|
|
86
|
-
1. Looks up app configuration to find the entrypoint script
|
|
87
|
-
2. Injects credentials via environment variables:
|
|
88
|
-
- TENANT_ID: The tenant identifier
|
|
89
|
-
- FARSEER_URL: Base API URL
|
|
90
|
-
- FARSEER_API_KEY or FARSEER_ACCESS_TOKEN: Authentication
|
|
91
|
-
3. Passes app arguments via command line (in order defined by app config)
|
|
92
|
-
4. Executes the script using npx tsx
|
|
93
|
-
|
|
94
|
-
Requirements:
|
|
95
|
-
- Scripts must be pulled locally first (farseer_pull)
|
|
96
|
-
- Dependencies must be installed (run "farseer install" in terminal)
|
|
97
|
-
|
|
98
|
-
Arguments can be overridden using the argumentOverrides parameter.
|
|
99
|
-
Arguments not overridden use their default values from app config.
|
|
100
|
-
|
|
101
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
102
|
-
runAppSchema,
|
|
103
|
-
async (params) => {
|
|
104
|
-
const { tenant: tenantArg, appName, argumentOverrides } = params;
|
|
105
|
-
const checkout = (0, import_configService.getCurrentCheckout)();
|
|
106
|
-
const tenant = tenantArg || checkout?.tenant;
|
|
107
|
-
const organisation = tenantArg || checkout?.organisation;
|
|
108
|
-
if (!tenant || !organisation) {
|
|
109
|
-
return (0, import_helpers2.tenantRequiredResponse)();
|
|
110
|
-
}
|
|
111
|
-
const clientResult = await (0, import_farseerFactory.getFarseerClientWithFallback)(organisation, tenant);
|
|
112
|
-
if (!clientResult) {
|
|
113
|
-
return (0, import_helpers2.authRequiredResponse)(tenant);
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const app = await clientResult.client.getAppByName(appName);
|
|
117
|
-
if (!app) {
|
|
118
|
-
return (0, import_helpers2.errorResponse)(`App "${appName}" not found`, "NOT_FOUND");
|
|
119
|
-
}
|
|
120
|
-
if (!app.mainScriptFileId || app.scriptFiles.length === 0) {
|
|
121
|
-
return (0, import_helpers2.errorResponse)(
|
|
122
|
-
`App "${appName}" has no scripts configured. Configure it with farseer_configure_app.`,
|
|
123
|
-
"VALIDATION_ERROR"
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
const mainScript = app.scriptFiles.find((s) => s.id === app.mainScriptFileId);
|
|
127
|
-
if (!mainScript) {
|
|
128
|
-
return (0, import_helpers2.errorResponse)(`Entrypoint script not found for app "${appName}"`, "NOT_FOUND");
|
|
129
|
-
}
|
|
130
|
-
const credentials = await getRunCredentials(organisation, tenant);
|
|
131
|
-
if (!credentials) {
|
|
132
|
-
return (0, import_helpers2.authRequiredResponse)(tenant);
|
|
133
|
-
}
|
|
134
|
-
const tenantDir = (0, import_helpers.getTenantDir)(organisation);
|
|
135
|
-
const srcDir = (0, import_helpers.getTenantSrcDir)(organisation);
|
|
136
|
-
const scriptPath = path.resolve(srcDir, mainScript.name);
|
|
137
|
-
if (!fs.existsSync(scriptPath)) {
|
|
138
|
-
return (0, import_helpers2.errorResponse)(
|
|
139
|
-
`Script not found locally: ${mainScript.name}. Run farseer_pull first.`,
|
|
140
|
-
"NOT_FOUND"
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
const nodeModulesPath = path.join(tenantDir, "node_modules");
|
|
144
|
-
if (!fs.existsSync(nodeModulesPath)) {
|
|
145
|
-
return (0, import_helpers2.errorResponse)(
|
|
146
|
-
`Dependencies not installed. Run "farseer install ${organisation}" in terminal first.`,
|
|
147
|
-
"VALIDATION_ERROR"
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
const appArgs = {};
|
|
151
|
-
for (const arg of app.expectedArguments) {
|
|
152
|
-
appArgs[arg.name] = arg.defaultValue;
|
|
153
|
-
}
|
|
154
|
-
if (argumentOverrides) {
|
|
155
|
-
for (const [name, value] of Object.entries(argumentOverrides)) {
|
|
156
|
-
appArgs[name] = value;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const envVars = {
|
|
160
|
-
...process.env,
|
|
161
|
-
TENANT_ID: credentials.tenantId,
|
|
162
|
-
FARSEER_URL: credentials.basePath
|
|
163
|
-
};
|
|
164
|
-
if (credentials.apiKey) {
|
|
165
|
-
envVars.FARSEER_API_KEY = credentials.apiKey;
|
|
166
|
-
}
|
|
167
|
-
if (credentials.accessToken) {
|
|
168
|
-
envVars.FARSEER_ACCESS_TOKEN = credentials.accessToken;
|
|
169
|
-
}
|
|
170
|
-
const cmdArgs = [];
|
|
171
|
-
for (const arg of app.expectedArguments) {
|
|
172
|
-
cmdArgs.push(appArgs[arg.name] ?? arg.defaultValue);
|
|
173
|
-
}
|
|
174
|
-
return new Promise((resolve) => {
|
|
175
|
-
let stdout = "";
|
|
176
|
-
let stderr = "";
|
|
177
|
-
const child = (0, import_child_process.spawn)("npx", ["tsx", `files/Scripts/${mainScript.name}`, ...cmdArgs], {
|
|
178
|
-
cwd: tenantDir,
|
|
179
|
-
shell: true,
|
|
180
|
-
env: envVars
|
|
181
|
-
});
|
|
182
|
-
child.stdout?.on("data", (data) => {
|
|
183
|
-
stdout += data.toString();
|
|
184
|
-
});
|
|
185
|
-
child.stderr?.on("data", (data) => {
|
|
186
|
-
stderr += data.toString();
|
|
187
|
-
});
|
|
188
|
-
child.on("close", (code) => {
|
|
189
|
-
resolve(
|
|
190
|
-
(0, import_helpers2.successResponse)({
|
|
191
|
-
tenant,
|
|
192
|
-
app: appName,
|
|
193
|
-
script: mainScript.name,
|
|
194
|
-
arguments: appArgs,
|
|
195
|
-
exitCode: code ?? 0,
|
|
196
|
-
stdout: stdout.slice(0, 1e4),
|
|
197
|
-
// Limit output size
|
|
198
|
-
stderr: stderr.slice(0, 5e3),
|
|
199
|
-
truncated: stdout.length > 1e4 || stderr.length > 5e3
|
|
200
|
-
})
|
|
201
|
-
);
|
|
202
|
-
});
|
|
203
|
-
child.on("error", (err) => {
|
|
204
|
-
resolve(
|
|
205
|
-
(0, import_helpers2.errorResponse)(
|
|
206
|
-
`Failed to run script: ${err.message}. Make sure tsx is installed: npm install -g tsx`,
|
|
207
|
-
"UNKNOWN"
|
|
208
|
-
)
|
|
209
|
-
);
|
|
210
|
-
});
|
|
211
|
-
setTimeout(() => {
|
|
212
|
-
child.kill();
|
|
213
|
-
resolve(
|
|
214
|
-
(0, import_helpers2.errorResponse)("Script execution timed out after 5 minutes", "UNKNOWN")
|
|
215
|
-
);
|
|
216
|
-
}, 5 * 60 * 1e3);
|
|
217
|
-
});
|
|
218
|
-
} catch (error) {
|
|
219
|
-
return (0, import_helpers2.errorResponse)(
|
|
220
|
-
`Run app failed: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
221
|
-
"NETWORK_ERROR"
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
228
|
-
0 && (module.exports = {
|
|
229
|
-
registerRunTools
|
|
230
|
-
});
|
|
231
|
-
//# sourceMappingURL=runTools.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/mcp/tools/runTools.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * App Execution Tools\n *\n * Tools for running Farseer apps locally.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport { spawn } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { getFarseerClientWithFallback } from '../../services/farseerFactory';\nimport {\n getCredential,\n getUserAuth,\n isUserAuthValid,\n setUserAuth,\n generateBasePath,\n getCurrentCheckout,\n} from '../../services/configService';\nimport { refreshAccessToken } from '../../services/farseerService';\nimport { getTenantDir, getTenantSrcDir } from '../../utils/helpers';\nimport {\n successResponse,\n errorResponse,\n authRequiredResponse,\n tenantRequiredResponse,\n} from '../utils/helpers';\n\ninterface RunCredentials {\n tenantId: string;\n apiKey?: string;\n accessToken?: string;\n basePath: string;\n}\n\nasync function getRunCredentials(tenant: string, tenantId?: string): Promise<RunCredentials | null> {\n // First try API key config\n const credential = getCredential(tenant);\n if (credential) {\n return {\n tenantId: credential.tenantId,\n apiKey: credential.apiKey,\n basePath: credential.basePath,\n };\n }\n\n // Try user auth (browser login)\n const auth = getUserAuth();\n if (!auth) {\n return null;\n }\n\n // Check if token needs refresh\n if (!isUserAuthValid()) {\n const refreshed = await refreshAccessToken(auth.refreshToken, auth.realm || 'master');\n if (!refreshed) {\n return null;\n }\n // Save refreshed token\n setUserAuth({\n accessToken: refreshed.accessToken,\n refreshToken: refreshed.refreshToken,\n expiresAt: new Date(Date.now() + refreshed.expiresIn * 1000).toISOString(),\n realm: auth.realm,\n });\n }\n\n const updatedAuth = getUserAuth();\n if (!updatedAuth) return null;\n\n return {\n tenantId: tenantId || tenant,\n accessToken: updatedAuth.accessToken,\n basePath: generateBasePath(tenant),\n };\n}\n\n// Define schemas outside of tool registration to avoid deep type instantiation\nconst runAppSchema = {\n tenant: z.string().optional().describe('Tenant name'),\n appName: z.string().describe('Name of the app to run'),\n argumentOverrides: z\n .record(z.string(), z.string())\n .optional()\n .describe('Override argument values (Name: Value pairs)'),\n};\n\nexport function registerRunTools(server: McpServer): void {\n // farseer_run_app - Run an app locally\n server.tool(\n 'farseer_run_app',\n `Run a Farseer app locally using tsx (TypeScript executor).\n\nHow it works:\n1. Looks up app configuration to find the entrypoint script\n2. Injects credentials via environment variables:\n - TENANT_ID: The tenant identifier\n - FARSEER_URL: Base API URL\n - FARSEER_API_KEY or FARSEER_ACCESS_TOKEN: Authentication\n3. Passes app arguments via command line (in order defined by app config)\n4. Executes the script using npx tsx\n\nRequirements:\n- Scripts must be pulled locally first (farseer_pull)\n- Dependencies must be installed (run \"farseer install\" in terminal)\n\nArguments can be overridden using the argumentOverrides parameter.\nArguments not overridden use their default values from app config.\n\nIf no tenant is specified, uses the currently checked-out tenant.`,\n runAppSchema,\n async (params: { tenant?: string; appName: string; argumentOverrides?: Record<string, string> }) => {\n const { tenant: tenantArg, appName, argumentOverrides } = params;\n const checkout = getCurrentCheckout();\n const tenant = tenantArg || checkout?.tenant;\n const organisation = tenantArg || checkout?.organisation;\n\n if (!tenant || !organisation) {\n return tenantRequiredResponse();\n }\n\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n if (!clientResult) {\n return authRequiredResponse(tenant);\n }\n\n try {\n // Get app details\n const app = await clientResult.client.getAppByName(appName);\n if (!app) {\n return errorResponse(`App \"${appName}\" not found`, 'NOT_FOUND');\n }\n\n if (!app.mainScriptFileId || app.scriptFiles.length === 0) {\n return errorResponse(\n `App \"${appName}\" has no scripts configured. Configure it with farseer_configure_app.`,\n 'VALIDATION_ERROR'\n );\n }\n\n // Find entrypoint script\n const mainScript = app.scriptFiles.find((s) => s.id === app.mainScriptFileId);\n if (!mainScript) {\n return errorResponse(`Entrypoint script not found for app \"${appName}\"`, 'NOT_FOUND');\n }\n\n // Get run credentials\n const credentials = await getRunCredentials(organisation, tenant);\n if (!credentials) {\n return authRequiredResponse(tenant);\n }\n\n const tenantDir = getTenantDir(organisation);\n const srcDir = getTenantSrcDir(organisation);\n const scriptPath = path.resolve(srcDir, mainScript.name);\n\n // Check if script exists locally\n if (!fs.existsSync(scriptPath)) {\n return errorResponse(\n `Script not found locally: ${mainScript.name}. Run farseer_pull first.`,\n 'NOT_FOUND'\n );\n }\n\n // Check if node_modules exists\n const nodeModulesPath = path.join(tenantDir, 'node_modules');\n if (!fs.existsSync(nodeModulesPath)) {\n return errorResponse(\n `Dependencies not installed. Run \"farseer install ${organisation}\" in terminal first.`,\n 'VALIDATION_ERROR'\n );\n }\n\n // Build arguments\n const appArgs: Record<string, string> = {};\n\n // Start with defaults\n for (const arg of app.expectedArguments) {\n appArgs[arg.name] = arg.defaultValue;\n }\n\n // Apply overrides\n if (argumentOverrides) {\n for (const [name, value] of Object.entries(argumentOverrides)) {\n appArgs[name] = value;\n }\n }\n\n // Build environment\n const envVars: Record<string, string> = {\n ...(process.env as Record<string, string>),\n TENANT_ID: credentials.tenantId,\n FARSEER_URL: credentials.basePath,\n };\n\n if (credentials.apiKey) {\n envVars.FARSEER_API_KEY = credentials.apiKey;\n }\n if (credentials.accessToken) {\n envVars.FARSEER_ACCESS_TOKEN = credentials.accessToken;\n }\n\n // Build command line arguments (in order)\n const cmdArgs: string[] = [];\n for (const arg of app.expectedArguments) {\n cmdArgs.push(appArgs[arg.name] ?? arg.defaultValue);\n }\n\n // Run the script\n return new Promise((resolve) => {\n let stdout = '';\n let stderr = '';\n\n const child = spawn('npx', ['tsx', `files/Scripts/${mainScript.name}`, ...cmdArgs], {\n cwd: tenantDir,\n shell: true,\n env: envVars,\n });\n\n child.stdout?.on('data', (data: Buffer) => {\n stdout += data.toString();\n });\n\n child.stderr?.on('data', (data: Buffer) => {\n stderr += data.toString();\n });\n\n child.on('close', (code) => {\n resolve(\n successResponse({\n tenant,\n app: appName,\n script: mainScript.name,\n arguments: appArgs,\n exitCode: code ?? 0,\n stdout: stdout.slice(0, 10000), // Limit output size\n stderr: stderr.slice(0, 5000),\n truncated: stdout.length > 10000 || stderr.length > 5000,\n })\n );\n });\n\n child.on('error', (err) => {\n resolve(\n errorResponse(\n `Failed to run script: ${err.message}. Make sure tsx is installed: npm install -g tsx`,\n 'UNKNOWN'\n )\n );\n });\n\n // Timeout after 5 minutes\n setTimeout(() => {\n child.kill();\n resolve(\n errorResponse('Script execution timed out after 5 minutes', 'UNKNOWN')\n );\n }, 5 * 60 * 1000);\n });\n } catch (error) {\n return errorResponse(\n `Run app failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n );\n }\n }\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAClB,2BAAsB;AACtB,SAAoB;AACpB,WAAsB;AACtB,4BAA6C;AAC7C,2BAOO;AACP,4BAAmC;AACnC,qBAA8C;AAC9C,IAAAA,kBAKO;AASP,eAAe,kBAAkB,QAAgB,UAAmD;AAEhG,QAAM,iBAAa,oCAAc,MAAM;AACvC,MAAI,YAAY;AACZ,WAAO;AAAA,MACH,UAAU,WAAW;AAAA,MACrB,QAAQ,WAAW;AAAA,MACnB,UAAU,WAAW;AAAA,IACzB;AAAA,EACJ;AAGA,QAAM,WAAO,kCAAY;AACzB,MAAI,CAAC,MAAM;AACP,WAAO;AAAA,EACX;AAGA,MAAI,KAAC,sCAAgB,GAAG;AACpB,UAAM,YAAY,UAAM,0CAAmB,KAAK,cAAc,KAAK,SAAS,QAAQ;AACpF,QAAI,CAAC,WAAW;AACZ,aAAO;AAA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