farseer-cli 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/commands/app.js +377 -0
  2. package/dist/commands/apps.js +91 -0
  3. package/dist/commands/checkout.js +164 -0
  4. package/dist/commands/config.js +141 -0
  5. package/dist/commands/diff.js +210 -0
  6. package/dist/commands/dimensions.js +130 -0
  7. package/dist/commands/files.js +88 -0
  8. package/dist/commands/install.js +82 -0
  9. package/dist/commands/list.js +77 -0
  10. package/dist/commands/login.js +109 -0
  11. package/dist/commands/logout.js +44 -0
  12. package/dist/commands/mcp-server.js +26 -0
  13. package/dist/commands/model.js +181 -0
  14. package/dist/commands/pull.js +286 -0
  15. package/dist/commands/push.js +235 -0
  16. package/dist/commands/run.js +336 -0
  17. package/dist/commands/status.js +178 -0
  18. package/dist/commands/variables.js +200 -0
  19. package/dist/commands/whoami.js +47 -0
  20. package/dist/index.js +163 -0
  21. package/dist/mcp/index.js +19 -0
  22. package/dist/mcp/prompts/workflows.js +403 -0
  23. package/dist/mcp/resources/documentation.js +158 -0
  24. package/dist/mcp/server.js +36 -0
  25. package/dist/mcp/tools/appTools.js +348 -0
  26. package/dist/mcp/tools/authTools.js +152 -0
  27. package/dist/mcp/tools/dataTools.js +358 -0
  28. package/dist/mcp/tools/modelTools.js +293 -0
  29. package/dist/mcp/tools/runTools.js +239 -0
  30. package/dist/mcp/tools/syncTools.js +383 -0
  31. package/dist/mcp/utils/helpers.js +142 -0
  32. package/dist/services/appSyncService.js +458 -0
  33. package/dist/services/configService.js +186 -0
  34. package/dist/services/farseerApi.js +426 -0
  35. package/dist/services/farseerFactory.js +297 -0
  36. package/dist/services/farseerService.js +647 -0
  37. package/dist/services/syncService.js +764 -0
  38. package/dist/utils/constants.js +21 -0
  39. package/dist/utils/helpers.js +446 -0
  40. package/dist/utils/logger.js +45 -0
  41. package/package.json +8 -1
@@ -0,0 +1,403 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow Prompts
4
+ *
5
+ * Reusable prompt templates for common Farseer workflows.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.registerWorkflowPrompts = registerWorkflowPrompts;
9
+ const zod_1 = require("zod");
10
+ // Define schemas outside of prompt registration to avoid deep type instantiation
11
+ const setupTenantSchema = {
12
+ tenant: zod_1.z.string().describe('Tenant name to setup'),
13
+ };
14
+ const createAppSchema = {
15
+ tenant: zod_1.z.string().describe('Tenant name'),
16
+ appName: zod_1.z.string().describe('Name for the new app'),
17
+ scriptName: zod_1.z.string().optional().describe('Main script filename (default: index.ts)'),
18
+ };
19
+ const understandModelSchema = {
20
+ tenant: zod_1.z.string().describe('Tenant name'),
21
+ };
22
+ const writeImportScriptSchema = {
23
+ tenant: zod_1.z.string().describe('Tenant name'),
24
+ variableName: zod_1.z.string().describe('Target variable to import into'),
25
+ };
26
+ const copyAppSchema = {
27
+ tenant: zod_1.z.string().describe('Tenant name'),
28
+ sourceApp: zod_1.z.string().describe('Name of app to copy'),
29
+ newAppName: zod_1.z.string().describe('Name for the new app'),
30
+ };
31
+ const exportDataSchema = {
32
+ tenant: zod_1.z.string().describe('Tenant name'),
33
+ variableName: zod_1.z.string().describe('Variable to export'),
34
+ };
35
+ const debugSyncSchema = {
36
+ tenant: zod_1.z.string().describe('Tenant name'),
37
+ };
38
+ function registerWorkflowPrompts(server) {
39
+ // Cast to any to avoid very deep generic type instantiation from the MCP SDK
40
+ const anyServer = server;
41
+ // Setup new tenant
42
+ anyServer.prompt('setup_new_tenant', 'Guide for setting up a new Farseer tenant: login, checkout, pull, install dependencies.', setupTenantSchema, async (params) => {
43
+ const { tenant } = params;
44
+ return {
45
+ messages: [
46
+ {
47
+ role: 'user',
48
+ content: {
49
+ type: 'text',
50
+ text: `You are setting up a new Farseer tenant "${tenant}".
51
+
52
+ Steps to follow:
53
+
54
+ 1. First, check authentication status with farseer_whoami
55
+ 2. If not logged in, inform the user to run "farseer login" in terminal (MCP cannot do browser login)
56
+ 3. Use farseer_checkout to set "${tenant}" as the default tenant (this also pulls files and apps)
57
+ 4. Tell user to run "farseer install ${tenant}" in terminal to install npm dependencies
58
+ 5. Use farseer_list_apps to show available apps
59
+ 6. Use farseer_export_model to understand the data structure
60
+
61
+ After setup, the user can:
62
+ - Run apps with farseer_run_app
63
+ - Edit scripts in apps/${tenant}/files/Scripts/
64
+ - Push changes with farseer_push
65
+ - Check model with farseer_get_variable or farseer_get_table`,
66
+ },
67
+ },
68
+ ],
69
+ };
70
+ });
71
+ // Create new app
72
+ anyServer.prompt('create_new_app', 'Guide for creating a new Farseer app from scratch.', createAppSchema, async (params) => {
73
+ const { tenant, appName, scriptName } = params;
74
+ const script = scriptName || 'index.ts';
75
+ return {
76
+ messages: [
77
+ {
78
+ role: 'user',
79
+ content: {
80
+ type: 'text',
81
+ text: `Creating a new Farseer app "${appName}" for tenant "${tenant}".
82
+
83
+ IMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.
84
+ The script uses \`farseer-client\` to interact with the Farseer API.
85
+ Authentication is automatic - \`new FarseerClient()\` reads credentials from environment variables injected by the CLI.
86
+ You NEVER hardcode credentials in scripts.
87
+
88
+ Steps to follow:
89
+
90
+ 1. Write the script file at farseer-apps/${tenant}/files/Scripts/${script}
91
+ Use the template below as a starting point.
92
+
93
+ 2. Push the script to remote with farseer_push
94
+ (Scripts must exist on remote before they can be assigned to an app)
95
+
96
+ 3. Create the app with farseer_create_app (name: "${appName}")
97
+
98
+ 4. Configure the app with farseer_configure_app:
99
+ - entrypoint: "${script}"
100
+ - scripts: ["${script}"]
101
+ - arguments: Add any arguments the script expects (they arrive via process.argv)
102
+
103
+ 5. Test with farseer_run_app
104
+ The CLI injects auth credentials as env vars and runs the script with npx tsx.
105
+
106
+ Script template:
107
+ \`\`\`typescript
108
+ import * as farseer from 'farseer-client';
109
+
110
+ // FarseerClient auto-configures from env vars injected by "farseer run"
111
+ // NEVER hardcode credentials - just use the empty constructor
112
+ const client = new farseer.FarseerClient();
113
+
114
+ // Arguments come via process.argv in the order defined by app config
115
+ const args = process.argv.slice(2);
116
+
117
+ async function main() {
118
+ // Load dimension/variable metadata
119
+ await client.initTagMap();
120
+
121
+ // Your code here
122
+ console.log('App running successfully');
123
+ }
124
+
125
+ main().catch(farseer.handleUnknownError);
126
+ \`\`\``,
127
+ },
128
+ },
129
+ ],
130
+ };
131
+ });
132
+ // Understand model
133
+ anyServer.prompt('understand_model', 'Explore and understand the data model of a Farseer tenant.', understandModelSchema, async (params) => {
134
+ const { tenant } = params;
135
+ return {
136
+ messages: [
137
+ {
138
+ role: 'user',
139
+ content: {
140
+ type: 'text',
141
+ text: `Analyzing the data model for tenant "${tenant}".
142
+
143
+ Steps to follow:
144
+
145
+ 1. Use farseer_export_model to get the full model structure
146
+
147
+ 2. Review dimension tables:
148
+ - Use farseer_list_tables for overview
149
+ - Key dimensions usually include: Products, Regions, Time (Months, Years), Versions
150
+ - Check foreign key relationships between tables
151
+
152
+ 3. Review variables:
153
+ - Use farseer_list_variables for overview
154
+ - Use farseer_get_variable for specific variable details
155
+ - Note which dimensions each variable has
156
+
157
+ 4. For import scripts, you need to know:
158
+ - Target variable name
159
+ - All dimensions the variable has
160
+ - Valid members for each dimension
161
+
162
+ Key concepts:
163
+ - Dimensions structure the data (Product, Region, Month, Year, Version)
164
+ - Variables store values at dimension intersections
165
+ - Formulas calculate values automatically
166
+ - Roll-up types determine aggregation (SUM, AVERAGE, etc.)
167
+
168
+ Common dimension tables:
169
+ - Months, Years (time)
170
+ - Versions (Plan, Actual, Forecast)
171
+ - Products, Categories, Brands
172
+ - Regions, Entities, Cost Centers`,
173
+ },
174
+ },
175
+ ],
176
+ };
177
+ });
178
+ // Write import script
179
+ anyServer.prompt('write_import_script', 'Guide for writing a data import script.', writeImportScriptSchema, async (params) => {
180
+ const { tenant, variableName } = params;
181
+ return {
182
+ messages: [
183
+ {
184
+ role: 'user',
185
+ content: {
186
+ type: 'text',
187
+ text: `Writing an import script for variable "${variableName}" in tenant "${tenant}".
188
+
189
+ Steps to follow:
190
+
191
+ 1. Use farseer_get_variable to understand the target variable:
192
+ - What dimensions does it have?
193
+ - What is the roll-up type?
194
+
195
+ 2. Use farseer_get_table for each dimension to see valid members
196
+
197
+ 3. Create the import script with this pattern:
198
+
199
+ \`\`\`typescript
200
+ import * as farseer from 'farseer-client';
201
+
202
+ const client = new farseer.FarseerClient();
203
+
204
+ async function main() {
205
+ await client.initTagMap();
206
+
207
+ // Create import job with column definitions
208
+ const importJob = await client.createImportJob({
209
+ title: 'Import ${variableName}',
210
+ columns: [
211
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Product' },
212
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Years' },
213
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Months' },
214
+ { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },
215
+ { type: 'VARIABLE', variableName: '${variableName}' },
216
+ ],
217
+ labels: ['auto', 'import-${variableName.toLowerCase().replace(/\s+/g, '-')}']
218
+ });
219
+
220
+ // Add rows - each row matches column order
221
+ const rows = [
222
+ ['ProductA', 'Y2025', 'M1', 'Plan', 1000],
223
+ ['ProductB', 'Y2025', 'M1', 'Plan', 2000],
224
+ ];
225
+
226
+ await importJob.addRows(rows);
227
+ await importJob.flushRows();
228
+ await importJob.undoPrevious(); // Remove previous import
229
+ await importJob.commit();
230
+
231
+ console.log('Import completed!');
232
+ }
233
+
234
+ main().catch(farseer.handleUnknownError);
235
+ \`\`\`
236
+
237
+ 4. Save script to apps/${tenant}/files/Scripts/
238
+ 5. Push with farseer_push
239
+ 6. Create app with farseer_create_app
240
+ 7. Configure with farseer_configure_app
241
+ 8. Test with farseer_run_app
242
+
243
+ ALTERNATIVE: For simple imports without a script, use the farseer_create_import_job tool directly.
244
+ It handles the full workflow (create metadata, add rows, undo previous, commit) in a single call.
245
+ Use farseer_create_import_job when:
246
+ - Data is already available (no need to fetch from external source)
247
+ - The import is a one-time or simple operation
248
+ - You want to quickly import without creating a full script
249
+
250
+ Use a script when:
251
+ - Data comes from external sources (APIs, databases, files)
252
+ - Complex data transformation is needed
253
+ - The import runs on a schedule as an App`,
254
+ },
255
+ },
256
+ ],
257
+ };
258
+ });
259
+ // Copy existing app
260
+ anyServer.prompt('copy_app', 'Guide for copying an existing app to create a new one.', copyAppSchema, async (params) => {
261
+ const { tenant, sourceApp, newAppName } = params;
262
+ return {
263
+ messages: [
264
+ {
265
+ role: 'user',
266
+ content: {
267
+ type: 'text',
268
+ text: `Copying app "${sourceApp}" to create "${newAppName}" for tenant "${tenant}".
269
+
270
+ Steps to follow:
271
+
272
+ 1. Pull latest with farseer_pull to get current app JSON
273
+
274
+ 2. Use farseer_get_app to see the source app configuration
275
+
276
+ 3. The app JSON files are in apps/${tenant}/apps/
277
+
278
+ Copy the source JSON file and modify:
279
+ - Change "name" to "${newAppName}"
280
+ - **IMPORTANT: Remove "_remote" field** (this makes it a new app)
281
+ - Modify arguments, description as needed
282
+
283
+ 4. JSON format for new app:
284
+ \`\`\`json
285
+ {
286
+ "name": "${newAppName}",
287
+ "description": "Copied from ${sourceApp}",
288
+ "entrypoint": "script.ts",
289
+ "scripts": ["script.ts"],
290
+ "arguments": [
291
+ { "name": "Year", "defaultValue": "2025" }
292
+ ]
293
+ }
294
+ \`\`\`
295
+
296
+ Note: Do NOT include "_remote" for new apps - CLI adds it after first push.
297
+
298
+ 5. Push with farseer_push to create the new app
299
+
300
+ 6. Test with farseer_run_app`,
301
+ },
302
+ },
303
+ ],
304
+ };
305
+ });
306
+ // Export data
307
+ anyServer.prompt('export_data', 'Guide for exporting variable data from Farseer.', exportDataSchema, async (params) => {
308
+ const { tenant, variableName } = params;
309
+ return {
310
+ messages: [
311
+ {
312
+ role: 'user',
313
+ content: {
314
+ type: 'text',
315
+ text: `Exporting data for variable "${variableName}" from tenant "${tenant}".
316
+
317
+ Steps to follow:
318
+
319
+ 1. Use farseer_get_variable to understand the variable:
320
+ - What dimensions does it span?
321
+ - What is its data type?
322
+
323
+ 2. Choose export method:
324
+
325
+ **Option A: Quick export (farseer_export_variable_data)**
326
+ - Uses ExportApi.exportFormula() internally
327
+ - Returns CSV/JSON data inline
328
+ - Good for quick inspection or small datasets
329
+ - Use 'limit' parameter for large datasets
330
+
331
+ **Option B: Structured export (farseer_load_variable_data)**
332
+ - Uses data.loadFarseerVariable() internally
333
+ - Can specify which dimensions to include as columns
334
+ - Returns structured CSV data
335
+ - Good when you need specific dimension breakdowns
336
+
337
+ **Option C: CLI export (farseer variable export)**
338
+ - Saves CSV/JSON/XLSX to a local file
339
+ - Best for saving data locally for analysis
340
+
341
+ 3. For analysis:
342
+ - Parse the CSV data returned by the tools
343
+ - Summarize, filter, or transform as needed`,
344
+ },
345
+ },
346
+ ],
347
+ };
348
+ });
349
+ // Debug sync issues
350
+ anyServer.prompt('debug_sync_issues', 'Troubleshoot synchronization problems between local and remote.', debugSyncSchema, async (params) => {
351
+ const { tenant } = params;
352
+ return {
353
+ messages: [
354
+ {
355
+ role: 'user',
356
+ content: {
357
+ type: 'text',
358
+ text: `Debugging sync issues for tenant "${tenant}".
359
+
360
+ Steps to follow:
361
+
362
+ 1. Check authentication: farseer_whoami
363
+ - Is JWT valid?
364
+ - Is tenant checked out?
365
+
366
+ 2. Check sync status: farseer_status
367
+ - Are there modified files?
368
+ - Are there only-local or only-remote files?
369
+
370
+ 3. If files show as modified:
371
+ - Use farseer_diff to see differences
372
+ - Decide: pull (accept remote) or push (upload local)
373
+
374
+ 4. Common issues and solutions:
375
+
376
+ **"No credentials found"**
377
+ → User needs to run "farseer login" in terminal
378
+ → Or configure API key: "farseer config set ${tenant} --api-key KEY"
379
+
380
+ **"Remote has changes"**
381
+ → Pull first with farseer_pull
382
+ → Then push with farseer_push
383
+
384
+ **"Token expired"**
385
+ → User needs to run "farseer login" again
386
+
387
+ **Apps not syncing**
388
+ → Need JWT login (browser), not API key
389
+ → API key only syncs files, not apps
390
+
391
+ 5. Force resolution:
392
+ - To accept all remote changes: farseer_pull with force=true (overwrites local)
393
+ - To accept all local changes: farseer_push with force=true (overwrites remote)
394
+ - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)
395
+
396
+ 6. Check specific file diff:
397
+ - Use farseer_diff with file parameter to see exact changes`,
398
+ },
399
+ },
400
+ ],
401
+ };
402
+ });
403
+ }
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ /**
3
+ * Documentation Resources
4
+ *
5
+ * Exposes Farseer documentation as MCP resources for AI assistants.
6
+ * Documentation is read from files at runtime (bundled with npm package).
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.registerDocumentationResources = registerDocumentationResources;
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ // Documentation metadata - actual content loaded on demand
46
+ const DOCS = [
47
+ {
48
+ name: 'how-farseer-works',
49
+ uri: 'farseer://docs/how-farseer-works',
50
+ title: 'How Farseer Works',
51
+ description: 'Core Farseer concepts: Dimensions, Variables, Formulas, Versions. ESSENTIAL reading for understanding the data model.',
52
+ filePath: '../../../docs/how-farseer-works.md',
53
+ },
54
+ {
55
+ name: 'cli-guide',
56
+ uri: 'farseer://docs/cli-guide',
57
+ title: 'CLI Guide',
58
+ description: 'Complete guide to Farseer CLI commands: pull, push, apps, run, model, checkout.',
59
+ filePath: '../../../docs/cli-guide.md',
60
+ },
61
+ {
62
+ name: 'api-reference',
63
+ uri: 'farseer://docs/api-reference',
64
+ title: 'farseer-client API Reference',
65
+ description: 'Full API documentation for farseer-client: FarseerClient, queries, imports, dimensions, variables.',
66
+ filePath: '../../../docs/api-reference.md',
67
+ },
68
+ {
69
+ name: 'new-app-template',
70
+ uri: 'farseer://docs/new-app-template',
71
+ title: 'New App Template',
72
+ description: 'Template and structure for creating new Farseer apps (Remote Jobs).',
73
+ filePath: '../../../docs/new-app-template.md',
74
+ },
75
+ {
76
+ name: 'troubleshooting',
77
+ uri: 'farseer://docs/troubleshooting',
78
+ title: 'Troubleshooting Guide',
79
+ description: 'Common issues and solutions: auth errors, sync conflicts, API errors, performance.',
80
+ filePath: '../../../docs/troubleshooting.md',
81
+ },
82
+ {
83
+ name: 'import-workflows',
84
+ uri: 'farseer://docs/import-workflows',
85
+ title: 'Import Workflows',
86
+ description: 'Patterns for data imports: CSV, Excel, API, batch processing, error handling.',
87
+ filePath: '../../../docs/import-workflows.md',
88
+ },
89
+ {
90
+ name: 'arquero-patterns',
91
+ uri: 'farseer://docs/arquero-patterns',
92
+ title: 'Arquero Data Processing',
93
+ description: 'Using Arquero for data transformation: filtering, grouping, pivoting, joins.',
94
+ filePath: '../../../docs/arquero-patterns.md',
95
+ },
96
+ {
97
+ name: 'query-formulas',
98
+ uri: 'farseer://docs/query-formulas',
99
+ title: 'Query and Formula Guide',
100
+ description: 'Querying data and understanding formulas: filters, aggregations, formula syntax.',
101
+ filePath: '../../../docs/query-formulas.md',
102
+ },
103
+ {
104
+ name: 'model-export',
105
+ uri: 'farseer://docs/model-export',
106
+ title: 'Model Export Guide',
107
+ description: 'Understanding model exports: tables, variables, relationships, folder structure.',
108
+ filePath: '../../../docs/model-export.md',
109
+ },
110
+ ];
111
+ function loadDocContent(doc) {
112
+ try {
113
+ const fullPath = path.resolve(__dirname, doc.filePath);
114
+ return fs.readFileSync(fullPath, 'utf-8');
115
+ }
116
+ catch (error) {
117
+ return `# ${doc.title}\n\n[Documentation file not found: ${doc.filePath}]\n\nThis may happen if the CLI was installed globally and documentation files were not included in the package.`;
118
+ }
119
+ }
120
+ function registerDocumentationResources(server) {
121
+ // Register list of all docs
122
+ server.resource('farseer-docs-list', 'farseer://docs', {
123
+ description: 'List of all available Farseer documentation',
124
+ mimeType: 'application/json',
125
+ }, () => {
126
+ return {
127
+ contents: [
128
+ {
129
+ uri: 'farseer://docs',
130
+ mimeType: 'application/json',
131
+ text: JSON.stringify(DOCS.map((doc) => ({
132
+ name: doc.name,
133
+ uri: doc.uri,
134
+ title: doc.title,
135
+ description: doc.description,
136
+ })), null, 2),
137
+ },
138
+ ],
139
+ };
140
+ });
141
+ // Register each doc individually
142
+ for (const doc of DOCS) {
143
+ server.resource(doc.name, doc.uri, {
144
+ description: doc.description,
145
+ mimeType: 'text/markdown',
146
+ }, () => {
147
+ return {
148
+ contents: [
149
+ {
150
+ uri: doc.uri,
151
+ mimeType: 'text/markdown',
152
+ text: loadDocContent(doc),
153
+ },
154
+ ],
155
+ };
156
+ });
157
+ }
158
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * MCP Server Configuration
4
+ *
5
+ * Creates and configures the Farseer MCP server with all tools, resources, and prompts.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.createMcpServer = createMcpServer;
9
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
10
+ const constants_1 = require("../utils/constants");
11
+ const authTools_1 = require("./tools/authTools");
12
+ const syncTools_1 = require("./tools/syncTools");
13
+ const appTools_1 = require("./tools/appTools");
14
+ const modelTools_1 = require("./tools/modelTools");
15
+ const runTools_1 = require("./tools/runTools");
16
+ const dataTools_1 = require("./tools/dataTools");
17
+ const documentation_1 = require("./resources/documentation");
18
+ const workflows_1 = require("./prompts/workflows");
19
+ function createMcpServer() {
20
+ const server = new mcp_js_1.McpServer({
21
+ name: 'farseer-cli',
22
+ version: constants_1.CLI_VERSION,
23
+ });
24
+ // Register all tools
25
+ (0, authTools_1.registerAuthTools)(server);
26
+ (0, syncTools_1.registerSyncTools)(server);
27
+ (0, appTools_1.registerAppTools)(server);
28
+ (0, modelTools_1.registerModelTools)(server);
29
+ (0, runTools_1.registerRunTools)(server);
30
+ (0, dataTools_1.registerDataTools)(server);
31
+ // Register resources (documentation)
32
+ (0, documentation_1.registerDocumentationResources)(server);
33
+ // Register prompts (workflow templates)
34
+ (0, workflows_1.registerWorkflowPrompts)(server);
35
+ return server;
36
+ }