farseer-cli 1.8.5 → 1.9.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/README.md +7 -6
- package/dist/commands/mcp-server.js +8 -2
- package/dist/commands/mcp-server.js.map +2 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/index.js +10 -1
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/prompts/workflows.js +8 -7
- package/dist/mcp/prompts/workflows.js.map +2 -2
- package/dist/mcp/server.js +12 -4
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tools/appTools.js +10 -30
- package/dist/mcp/tools/appTools.js.map +2 -2
- package/dist/mcp/tools/authTools.js +50 -100
- package/dist/mcp/tools/authTools.js.map +2 -2
- package/dist/mcp/tools/cellTools.js +2 -6
- package/dist/mcp/tools/cellTools.js.map +2 -2
- package/dist/mcp/tools/dashboardTools.js +22 -66
- package/dist/mcp/tools/dashboardTools.js.map +2 -2
- package/dist/mcp/tools/dataTools.js +8 -24
- package/dist/mcp/tools/dataTools.js.map +2 -2
- package/dist/mcp/tools/folderTools.js +4 -12
- package/dist/mcp/tools/folderTools.js.map +2 -2
- package/dist/mcp/tools/modelTools.js +30 -84
- package/dist/mcp/tools/modelTools.js.map +2 -2
- package/dist/mcp/tools/runTools.js +5 -13
- package/dist/mcp/tools/runTools.js.map +2 -2
- package/dist/mcp/tools/sheetTools.js +20 -60
- package/dist/mcp/tools/sheetTools.js.map +2 -2
- package/dist/mcp/tools/syncTools.js +8 -30
- package/dist/mcp/tools/syncTools.js.map +2 -2
- package/dist/mcp/utils/helpers.js +18 -44
- package/dist/mcp/utils/helpers.js.map +2 -2
- package/dist/mcp/utils/launchPin.js +44 -0
- package/dist/mcp/utils/launchPin.js.map +7 -0
- package/dist/mcp/utils/tenantPin.js +58 -0
- package/dist/mcp/utils/tenantPin.js.map +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ Add to config file:
|
|
|
134
134
|
"mcpServers": {
|
|
135
135
|
"farseer": {
|
|
136
136
|
"command": "farseer",
|
|
137
|
-
"args": ["mcp-server"]
|
|
137
|
+
"args": ["mcp-server", "--tenant", "my-tenant"]
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -151,7 +151,7 @@ Add to `.cursor/mcp_config.json` (project) or `~/.cursor/mcp_config.json` (globa
|
|
|
151
151
|
"mcpServers": {
|
|
152
152
|
"farseer": {
|
|
153
153
|
"command": "farseer",
|
|
154
|
-
"args": ["mcp-server"]
|
|
154
|
+
"args": ["mcp-server", "--tenant", "my-tenant"]
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -164,6 +164,8 @@ Once configured, you can ask the AI assistant things like:
|
|
|
164
164
|
|
|
165
165
|
See [MCP Tools & Resources](#mcp-tools--resources) for full list of available tools.
|
|
166
166
|
|
|
167
|
+
**Tenant binding:** each `mcp-server` process works on a single tenant. Pass it at launch — `--tenant <slug>` or the `FARSEER_TENANT` env (e.g. `"args": ["mcp-server", "--tenant", "my-tenant"]`) — to run one server per tenant, isolated. Launched without one, the server connects and the agent binds it once per session via `farseer_select_tenant` (then it's locked; restart the server to switch tenants).
|
|
168
|
+
|
|
167
169
|
---
|
|
168
170
|
|
|
169
171
|
## Authentication
|
|
@@ -646,10 +648,9 @@ Farseer CLI implements the [Model Context Protocol (MCP)](https://modelcontextpr
|
|
|
646
648
|
|
|
647
649
|
Once configured, AI assistants have access to:
|
|
648
650
|
|
|
649
|
-
**Authentication:**
|
|
650
|
-
- `farseer_whoami` - Check
|
|
651
|
-
- `
|
|
652
|
-
- `farseer_checkout_clear` - Clear default tenant
|
|
651
|
+
**Authentication & tenant:**
|
|
652
|
+
- `farseer_whoami` - Check auth status and the tenant this session is bound to
|
|
653
|
+
- `farseer_select_tenant` - Bind this session to a tenant (once per session, then locked)
|
|
653
654
|
|
|
654
655
|
**Sync Operations:**
|
|
655
656
|
- `farseer_pull` - Pull scripts and apps from remote. `force=true` overwrites local edits with remote on conflicts (does NOT wipe local-only files — that destructive step lives behind the CLI's interactive confirm; use `farseer pull --force` from a shell when you actually want a hard reset). Per-file conflict resolutions (keep_local / keep_remote / keep_both / merge_markers) are CLI-only because they require an interactive prompt; the MCP path either lets the conflict bubble up in the response (`conflicts[]` field) or `force=true` to overwrite.
|
|
@@ -23,9 +23,15 @@ __export(mcp_server_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(mcp_server_exports);
|
|
24
24
|
var import_mcp = require("../mcp");
|
|
25
25
|
function registerMcpServerCommand(program) {
|
|
26
|
-
program.command("mcp-server").description("Start MCP server for AI assistant integration (Claude, Cursor, etc.)").
|
|
26
|
+
program.command("mcp-server").description("Start MCP server for AI assistant integration (Claude, Cursor, etc.)").option(
|
|
27
|
+
"--tenant <slug>",
|
|
28
|
+
"Tenant to bind this server to at launch (or set FARSEER_TENANT). If omitted, an agent binds it once via farseer_select_tenant."
|
|
29
|
+
).option(
|
|
30
|
+
"--org <org>",
|
|
31
|
+
"Organisation subdomain (or FARSEER_ORG). Defaults to the saved mapping for the tenant, else the tenant name."
|
|
32
|
+
).action(async (options) => {
|
|
27
33
|
try {
|
|
28
|
-
await (0, import_mcp.startMcpServer)();
|
|
34
|
+
await (0, import_mcp.startMcpServer)({ tenant: options.tenant, org: options.org });
|
|
29
35
|
} catch (error) {
|
|
30
36
|
console.error("Failed to start MCP server:", error instanceof Error ? error.message : "Unknown error");
|
|
31
37
|
process.exit(1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/mcp-server.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * MCP Server Command\n *\n * Starts the Farseer MCP (Model Context Protocol) server for AI assistant integration.\n * This allows Claude, Cursor, and other AI assistants to directly use Farseer functionality.\n */\n\nimport { Command } from 'commander';\nimport { startMcpServer } from '../mcp';\n\nexport function registerMcpServerCommand(program: Command): void {\n program\n .command('mcp-server')\n .description('Start MCP server for AI assistant integration (Claude, Cursor, etc.)')\n .action(async () => {\n try {\n await startMcpServer();\n } catch (error) {\n // MCP servers communicate errors via JSON-RPC, not stderr\n // Only log to stderr for unexpected startup failures\n console.error('Failed to start MCP server:', error instanceof Error ? error.message : 'Unknown error');\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["/**\n * MCP Server Command\n *\n * Starts the Farseer MCP (Model Context Protocol) server for AI assistant integration.\n * This allows Claude, Cursor, and other AI assistants to directly use Farseer functionality.\n *\n * The server binds to a single tenant per invocation \u2014 via --tenant/--org or the\n * FARSEER_TENANT/FARSEER_ORG env \u2014 so a host can run one server per tenant\n * concurrently without them colliding on the global checkout.\n */\n\nimport { Command } from 'commander';\nimport { startMcpServer } from '../mcp';\n\nexport function registerMcpServerCommand(program: Command): void {\n program\n .command('mcp-server')\n .description('Start MCP server for AI assistant integration (Claude, Cursor, etc.)')\n .option(\n '--tenant <slug>',\n 'Tenant to bind this server to at launch (or set FARSEER_TENANT). If omitted, an agent binds it once via farseer_select_tenant.',\n )\n .option(\n '--org <org>',\n 'Organisation subdomain (or FARSEER_ORG). Defaults to the saved mapping for the tenant, else the tenant name.',\n )\n .action(async (options: { tenant?: string; org?: string }) => {\n try {\n await startMcpServer({ tenant: options.tenant, org: options.org });\n } catch (error) {\n // MCP servers communicate errors via JSON-RPC, not stderr\n // Only log to stderr for unexpected startup failures\n console.error('Failed to start MCP server:', error instanceof Error ? error.message : 'Unknown error');\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,iBAA+B;AAExB,SAAS,yBAAyB,SAAwB;AAC7D,UACK,QAAQ,YAAY,EACpB,YAAY,sEAAsE,EAClF;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC;AAAA,IACG;AAAA,IACA;AAAA,EACJ,EACC,OAAO,OAAO,YAA+C;AAC1D,QAAI;AACA,gBAAM,2BAAe,EAAE,QAAQ,QAAQ,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAAA,IACrE,SAAS,OAAO;AAGZ,cAAQ,MAAM,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AACrG,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ,CAAC;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -218,7 +218,8 @@ ${import_chalk.default.bold.underline("File Management")} ${import_chalk.defaul
|
|
|
218
218
|
${import_chalk.default.dim("--all")} Show all files (not just scripts)
|
|
219
219
|
|
|
220
220
|
${import_chalk.default.bold.underline("MCP Server")} ${import_chalk.default.dim("(AI assistant integration)")}
|
|
221
|
-
mcp-server
|
|
221
|
+
mcp-server --tenant <slug> Start MCP server bound to a tenant (Claude, Cursor, etc.)
|
|
222
|
+
${import_chalk.default.dim("--org <org>")} Organisation subdomain (default: saved mapping, else tenant)
|
|
222
223
|
|
|
223
224
|
${import_chalk.default.bold.underline("Examples")}
|
|
224
225
|
${import_chalk.default.green("$")} farseer login ${import_chalk.default.dim("Login via browser")}
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n\n// Suppress punycode deprecation warning (comes from dependencies like axios)\nconst originalEmit = process.emit;\n// @ts-expect-error - overriding process.emit\nprocess.emit = function (name: string, data: unknown, ...args: unknown[]) {\n if (\n name === 'warning' &&\n typeof data === 'object' &&\n data !== null &&\n 'name' in data &&\n data.name === 'DeprecationWarning' &&\n 'message' in data &&\n typeof data.message === 'string' &&\n data.message.includes('punycode')\n ) {\n return false;\n }\n // @ts-expect-error - calling original emit\n return originalEmit.apply(process, [name, data, ...args]);\n};\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { CLI_VERSION } from './utils/constants';\nimport { fileLogger } from './utils/fileLogger';\n\n// Initialize file logging and crash handlers\nfileLogger.init();\nfileLogger.installCrashHandlers();\nimport { registerLoginCommand } from './commands/login';\nimport { registerLogoutCommand } from './commands/logout';\nimport { registerConfigCommand } from './commands/config';\nimport { registerListCommand } from './commands/list';\nimport { registerFilesCommand } from './commands/files';\nimport { registerStatusCommand } from './commands/status';\nimport { registerDiffCommand } from './commands/diff';\nimport { registerPullCommand } from './commands/pull';\nimport { registerPushCommand } from './commands/push';\nimport { registerRefreshCommand } from './commands/refresh';\nimport { registerRunCommand } from './commands/run';\nimport { registerInstallCommand } from './commands/install';\nimport { registerWhoamiCommand } from './commands/whoami';\nimport { registerAppCommand } from './commands/app';\nimport { registerModelCommand } from './commands/model';\nimport { registerVariablesCommand } from './commands/variables';\nimport { registerDimensionsCommand } from './commands/dimensions';\nimport { registerCheckoutCommand } from './commands/checkout';\nimport { registerMcpServerCommand } from './commands/mcp-server';\nimport { registerSheetsCommand } from './commands/sheets';\nimport { registerDashboardsCommand } from './commands/dashboards';\nimport { registerCellsCommand } from './commands/cells';\nimport { registerFormulaCommand } from './commands/formula';\nimport { checkForUpdates } from './utils/updateCheck';\n\n// Start non-blocking update check (skip for MCP server \u2014 it's a long-lived process)\nconst updateMessagePromise = process.argv.includes('mcp-server') ? null : checkForUpdates();\n\nconst program = new Command();\n\n// Configure help to hide default command list (we show our own custom list)\nprogram.configureHelp({\n visibleCommands: () => [], // Hide all commands from default list\n});\n\nprogram\n .name('farseer')\n .description('CLI tool for syncing Farseer App scripts between local folder and Farseer instances')\n .version(CLI_VERSION)\n .addHelpText(\n 'after',\n `\n${chalk.bold.underline('Tenant Resolution')}\n Most commands accept ${chalk.cyan('[org] [tenant]')} arguments:\n ${chalk.green('$')} farseer checkout ${chalk.cyan('salvus-2 salvus-prodaja')} ${chalk.dim('First time: specify <org> <tenant>')}\n ${chalk.green('$')} farseer pull ${chalk.cyan('salvus-prodaja')} ${chalk.dim('After that: just <tenant> (org is remembered)')}\n ${chalk.green('$')} farseer push ${chalk.dim('Or omit entirely if checked out')}\n\n${chalk.bold.underline('Workspace Layout')} ${chalk.dim('(created by farseer checkout)')}\n ${chalk.dim('farseer-apps/<tenant>/files/')} Your scripts and data \u2014 sync source\n ${chalk.dim('farseer-apps/<tenant>/apps/')} App configs (mirrored remote Apps)\n ${chalk.dim('farseer-apps/<tenant>/.farseer-sync.json')} Per-machine diff baseline (do not commit; gitignored)\n ${chalk.dim('farseer-apps/<tenant>/package.json')} Node deps for run / install\n If the baseline drifts out of step, ${chalk.cyan('farseer refresh')} rebuilds it from a fresh remote hash fetch and current local files.\n\n${chalk.bold.underline('Authentication')}\n login Login via browser (OAuth)\n logout [tenant] Logout and remove credentials\n whoami Show login status and configured tenants\n checkout [org] [tenant] Set default tenant (verifies auth & pulls)\n ${chalk.dim('--no-pull')} Skip automatic pull\n\n${chalk.bold.underline('Configuration')} ${chalk.dim('(farseer config <command>)')}\n config set <tenant> Set API key for a tenant\n ${chalk.dim('--api-key <key>')} API key (required)\n ${chalk.dim('--org <name>')} Organisation if different from tenant\n config remove <tenant> Remove credentials\n config list List all configured tenants\n config show <tenant> Show full credentials (incl. API key)\n config test <tenant> Test connection to tenant\n config include Manage extra file types to sync\n ${chalk.dim('--ext <ext>')} Add extension (repeatable, e.g., --ext .json)\n ${chalk.dim('--folder <path>')} Add folder (repeatable)\n ${chalk.dim('--remove-ext <ext>')} Remove extension\n ${chalk.dim('--remove-folder <path>')} Remove folder\n ${chalk.dim('--clear')} Remove all sync includes\n\n${chalk.bold.underline('Sync Operations')} ${chalk.dim('(tenant optional if checked out)')}\n pull [org] [tenant] Pull files and apps from remote\n ${chalk.dim('--all')} Download every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist)\n ${chalk.dim('--force')} Mirror remote \u2192 local: overwrite local edits AND delete local-only (asks confirmation)\n ${chalk.dim('-y, --yes')} Skip confirm when local has uncommitted changes\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n push [org] [tenant] Push local changes to remote\n ${chalk.dim('-y, --yes')} Skip confirmation for non-destructive pushes\n ${chalk.dim('--force')} Mirror local \u2192 remote: overwrite drift AND delete remote-only (asks confirmation)\n ${chalk.dim('--shallow')} Skip remote-content hash pre-flight (faster, but may miss remote edits)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n status [tenant] Show sync status (local vs remote)\n ${chalk.dim('--all')} Show every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist)\n ${chalk.dim('--shallow')} Skip remote-content hash check (faster, but may miss remote edits)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n diff [tenant] [file] Show file differences\n refresh [org] [tenant] Rebuild the local sync baseline (.farseer-sync.json)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n\n${chalk.bold.underline('App Management')} ${chalk.dim('(tenant optional if checked out)')}\n app list [tenant] List all apps\n ${chalk.dim('--details')} Show details for each app\n app show [tenant] <name> Show app details\n app create [tenant] <name> Create new app\n app configure [tenant] <name> Configure app\n ${chalk.dim('--entrypoint <script>')} Set main script\n ${chalk.dim('--scripts <list>')} Comma-separated scripts\n ${chalk.dim('--add-arg <Name=Value>')} Add argument (repeatable)\n ${chalk.dim('--description <text>')} Set description\n app delete [tenant] <name> Delete app (requires --force)\n\n${chalk.bold.underline('Running & Development')} ${chalk.dim('(tenant optional if checked out)')}\n run [tenant] <app> Run app locally with injected credentials\n ${chalk.dim('--arg <Name=Value>')} Override argument (repeatable)\n run-script [tenant] <file> Run script directly (no app wrapper)\n install [tenant] Install npm dependencies (npm install)\n\n${chalk.bold.underline('Variables')} ${chalk.dim('(tenant optional if checked out)')}\n variables list [tenant] List all variables\n variables create [tenant] Create a new variable\n ${chalk.dim('--name <name>')} Variable name (required)\n ${chalk.dim('--dimensions <csv>')} Comma-separated dimension tables\n ${chalk.dim('--formula <expr>')} Formula expression\n ${chalk.dim('--rollup <type>')} Rollup type (Sum, Average, etc.)\n ${chalk.dim('--data-type <type>')} Data type (Decimal, Integer, Text)\n ${chalk.dim('--description <text>')} Description\n variables update [tenant] Update an existing variable\n ${chalk.dim('--name <name>')} Variable name (required)\n ${chalk.dim('--formula <expr>')} New formula\n ${chalk.dim('--rollup <type>')} New rollup type\n ${chalk.dim('--description <text>')} New description\n variable details <name> Show variable details (dimensions, formula, etc.)\n variable export <name> Export variable data to CSV\n ${chalk.dim('--output <file>')} Output file path\n ${chalk.dim('--format <csv|json|xlsx>')} Output format (default: csv)\n ${chalk.dim('--limit <n>')} Limit number of rows\n\n${chalk.bold.underline('Dimensions')} ${chalk.dim('(tenant optional if checked out)')}\n dimensions list [tenant] List all dimension tables\n dimensions members <table> List all members of a dimension table\n ${chalk.dim('--limit <n>')} Limit number of members shown\n dimensions create-member Create a new dimension member\n ${chalk.dim('--table <name>')} Dimension table name\n ${chalk.dim('--name <name>')} New member name\n ${chalk.dim('--parent <name>')} Parent member name (optional)\n dimensions delete-member Delete a dimension member\n ${chalk.dim('--table <name> --name <name>')} Table and member to delete\n ${chalk.dim('-y')} Skip confirmation\n dimension details <name> Show table details (columns, members)\n ${chalk.dim('--members <n>')} Number of sample members (default: 10)\n\n${chalk.bold.underline('Sheets')} ${chalk.dim('(tenant optional if checked out)')}\n sheets list [tenant] List all sheets\n sheets show <nameOrId> Show sheet configuration\n sheets data <nameOrId> Get sheet data\n ${chalk.dim('--limit <n>')} Limit cells returned\n sheets set-data Set sheet data from JSON file\n ${chalk.dim('--sheet <nameOrId>')} Sheet name or ID\n ${chalk.dim('--input <file>')} JSON data file\n ${chalk.dim('-y')} Skip confirmation\n\n${chalk.bold.underline('Dashboards')} ${chalk.dim('(tenant optional if checked out)')}\n dashboards list [tenant] List all dashboards\n dashboards show <nameOrId> Show dashboard details\n ${chalk.dim('--tiles')} Include tile details\n\n${chalk.bold.underline('Cells')} ${chalk.dim('(tenant optional if checked out)')}\n cells query Query cell values\n ${chalk.dim('--variable <name>')} Variable name (required)\n ${chalk.dim('--dimension <table=member>')} Dimension filter (repeatable)\n cells update Update a cell value\n ${chalk.dim('--variable <name>')} Variable name (required)\n ${chalk.dim('--dimension <table=member>')} Dimension filter (repeatable)\n ${chalk.dim('--value <number>')} New value (required)\n ${chalk.dim('-y')} Skip confirmation\n\n${chalk.bold.underline('Formula')} ${chalk.dim('(tenant optional if checked out)')}\n formula eval <expression> Evaluate a formula expression\n ${chalk.dim('--filter <table=member>')} Dimension filter (repeatable)\n\n${chalk.bold.underline('Model Inspection')} ${chalk.dim('(tenant optional if checked out)')}\n model [tenant] Show model structure (dimensions, variables)\n ${chalk.dim('--variables')} List all variables\n ${chalk.dim('--tables')} List all dimension tables\n ${chalk.dim('--variable <name>')} Show dimensions for variable\n\n${chalk.bold.underline('File Management')} ${chalk.dim('(farseer files <command>)')}\n files list [tenant] List files on remote\n ${chalk.dim('--all')} Show all files (not just scripts)\n\n${chalk.bold.underline('MCP Server')} ${chalk.dim('(AI assistant integration)')}\n mcp-server Start MCP server for Claude, Cursor, etc.\n\n${chalk.bold.underline('Examples')}\n ${chalk.green('$')} farseer login ${chalk.dim('Login via browser')}\n ${chalk.green('$')} farseer checkout salvus-2 salvus-prod ${chalk.dim('First time: org + tenant')}\n ${chalk.green('$')} farseer pull salvus-prod ${chalk.dim('Next time: just tenant')}\n ${chalk.green('$')} farseer push ${chalk.dim('If checked out: no args needed')}\n ${chalk.green('$')} farseer push -y ${chalk.dim('Push without confirmation')}\n ${chalk.green('$')} farseer run \"My App\" ${chalk.dim('Run app locally')}\n ${chalk.green('$')} farseer variables list ${chalk.dim('List all variables')}\n ${chalk.green('$')} farseer variable details \"Revenue\" ${chalk.dim('Show variable details')}\n ${chalk.green('$')} farseer dimensions list ${chalk.dim('List dimension tables')}\n`,\n );\n\n// Register all commands (hidden from default help, shown in custom help above)\nregisterLoginCommand(program);\nregisterLogoutCommand(program);\nregisterCheckoutCommand(program);\nregisterConfigCommand(program);\nregisterListCommand(program);\nregisterFilesCommand(program);\nregisterAppCommand(program);\nregisterVariablesCommand(program);\nregisterDimensionsCommand(program);\nregisterModelCommand(program);\nregisterStatusCommand(program);\nregisterDiffCommand(program);\nregisterPullCommand(program);\nregisterPushCommand(program);\nregisterRefreshCommand(program);\nregisterRunCommand(program);\nregisterInstallCommand(program);\nregisterWhoamiCommand(program);\nregisterSheetsCommand(program);\nregisterDashboardsCommand(program);\nregisterCellsCommand(program);\nregisterFormulaCommand(program);\nregisterMcpServerCommand(program);\n\n// Display update notification after any command finishes\nif (updateMessagePromise) {\n program.hook('postAction', async () => {\n const message = await updateMessagePromise;\n if (message) {\n process.stderr.write(message + '\\n');\n }\n });\n}\n\n// Parse arguments\nprogram.parse();\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,uBAAwB;AACxB,mBAAkB;AAClB,uBAA4B;AAC5B,wBAA2B;AAK3B,mBAAqC;AACrC,oBAAsC;AACtC,oBAAsC;AACtC,kBAAoC;AACpC,mBAAqC;AACrC,oBAAsC;AACtC,kBAAoC;AACpC,kBAAoC;AACpC,kBAAoC;AACpC,qBAAuC;AACvC,iBAAmC;AACnC,qBAAuC;AACvC,oBAAsC;AACtC,iBAAmC;AACnC,mBAAqC;AACrC,uBAAyC;AACzC,wBAA0C;AAC1C,sBAAwC;AACxC,wBAAyC;AACzC,oBAAsC;AACtC,wBAA0C;AAC1C,mBAAqC;AACrC,qBAAuC;AACvC,yBAAgC;AAlDhC,MAAM,eAAe,QAA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;AAAA;AAAA,EAExB,aAAAA,QAAM,KAAK,UAAU,OAAO,CAAC,KAAK,aAAAA,QAAM,IAAI,kCAAkC,CAAC;AAAA;AAAA,MAE3E,aAAAA,QAAM,IAAI,mBAAmB,CAAC;AAAA,MAC9B,aAAAA,QAAM,IAAI,4BAA4B,CAAC;AAAA;AAAA,MAEvC,aAAAA,QAAM,IAAI,mBAAmB,CAAC;AAAA,MAC9B,aAAAA,QAAM,IAAI,4BAA4B,CAAC;AAAA,MACvC,aAAAA,QAAM,IAAI,kBAAkB,CAAC;AAAA,MAC7B,aAAAA,QAAM,IAAI,IAAI,CAAC;AAAA;AAAA,EAEnB,aAAAA,QAAM,KAAK,UAAU,SAAS,CAAC,KAAK,aAAAA,QAAM,IAAI,kCAAkC,CAAC;AAAA;AAAA,MAE7E,aAAAA,QAAM,IAAI,yBAAyB,CAAC;AAAA;AAAA,EAExC,aAAAA,QAAM,KAAK,UAAU,kBAAkB,CAAC,KAAK,aAAAA,QAAM,IAAI,kCAAkC,CAAC;AAAA;AAAA,MAEtF,aAAAA,QAAM,IAAI,aAAa,CAAC;AAAA,MACxB,aAAAA,QAAM,IAAI,UAAU,CAAC;AAAA,MACrB,aAAAA,QAAM,IAAI,mBAAmB,CAAC;AAAA;AAAA,EAElC,aAAAA,QAAM,KAAK,UAAU,iBAAiB,CAAC,KAAK,aAAAA,QAAM,IAAI,2BAA2B,CAAC;AAAA;AAAA,MAE9E,aAAAA,QAAM,IAAI,OAAO,CAAC;AAAA;AAAA,EAEtB,aAAAA,QAAM,KAAK,UAAU,YAAY,CAAC,KAAK,aAAAA,QAAM,IAAI,4BAA4B,CAAC;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n\n// Suppress punycode deprecation warning (comes from dependencies like axios)\nconst originalEmit = process.emit;\n// @ts-expect-error - overriding process.emit\nprocess.emit = function (name: string, data: unknown, ...args: unknown[]) {\n if (\n name === 'warning' &&\n typeof data === 'object' &&\n data !== null &&\n 'name' in data &&\n data.name === 'DeprecationWarning' &&\n 'message' in data &&\n typeof data.message === 'string' &&\n data.message.includes('punycode')\n ) {\n return false;\n }\n // @ts-expect-error - calling original emit\n return originalEmit.apply(process, [name, data, ...args]);\n};\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { CLI_VERSION } from './utils/constants';\nimport { fileLogger } from './utils/fileLogger';\n\n// Initialize file logging and crash handlers\nfileLogger.init();\nfileLogger.installCrashHandlers();\nimport { registerLoginCommand } from './commands/login';\nimport { registerLogoutCommand } from './commands/logout';\nimport { registerConfigCommand } from './commands/config';\nimport { registerListCommand } from './commands/list';\nimport { registerFilesCommand } from './commands/files';\nimport { registerStatusCommand } from './commands/status';\nimport { registerDiffCommand } from './commands/diff';\nimport { registerPullCommand } from './commands/pull';\nimport { registerPushCommand } from './commands/push';\nimport { registerRefreshCommand } from './commands/refresh';\nimport { registerRunCommand } from './commands/run';\nimport { registerInstallCommand } from './commands/install';\nimport { registerWhoamiCommand } from './commands/whoami';\nimport { registerAppCommand } from './commands/app';\nimport { registerModelCommand } from './commands/model';\nimport { registerVariablesCommand } from './commands/variables';\nimport { registerDimensionsCommand } from './commands/dimensions';\nimport { registerCheckoutCommand } from './commands/checkout';\nimport { registerMcpServerCommand } from './commands/mcp-server';\nimport { registerSheetsCommand } from './commands/sheets';\nimport { registerDashboardsCommand } from './commands/dashboards';\nimport { registerCellsCommand } from './commands/cells';\nimport { registerFormulaCommand } from './commands/formula';\nimport { checkForUpdates } from './utils/updateCheck';\n\n// Start non-blocking update check (skip for MCP server \u2014 it's a long-lived process)\nconst updateMessagePromise = process.argv.includes('mcp-server') ? null : checkForUpdates();\n\nconst program = new Command();\n\n// Configure help to hide default command list (we show our own custom list)\nprogram.configureHelp({\n visibleCommands: () => [], // Hide all commands from default list\n});\n\nprogram\n .name('farseer')\n .description('CLI tool for syncing Farseer App scripts between local folder and Farseer instances')\n .version(CLI_VERSION)\n .addHelpText(\n 'after',\n `\n${chalk.bold.underline('Tenant Resolution')}\n Most commands accept ${chalk.cyan('[org] [tenant]')} arguments:\n ${chalk.green('$')} farseer checkout ${chalk.cyan('salvus-2 salvus-prodaja')} ${chalk.dim('First time: specify <org> <tenant>')}\n ${chalk.green('$')} farseer pull ${chalk.cyan('salvus-prodaja')} ${chalk.dim('After that: just <tenant> (org is remembered)')}\n ${chalk.green('$')} farseer push ${chalk.dim('Or omit entirely if checked out')}\n\n${chalk.bold.underline('Workspace Layout')} ${chalk.dim('(created by farseer checkout)')}\n ${chalk.dim('farseer-apps/<tenant>/files/')} Your scripts and data \u2014 sync source\n ${chalk.dim('farseer-apps/<tenant>/apps/')} App configs (mirrored remote Apps)\n ${chalk.dim('farseer-apps/<tenant>/.farseer-sync.json')} Per-machine diff baseline (do not commit; gitignored)\n ${chalk.dim('farseer-apps/<tenant>/package.json')} Node deps for run / install\n If the baseline drifts out of step, ${chalk.cyan('farseer refresh')} rebuilds it from a fresh remote hash fetch and current local files.\n\n${chalk.bold.underline('Authentication')}\n login Login via browser (OAuth)\n logout [tenant] Logout and remove credentials\n whoami Show login status and configured tenants\n checkout [org] [tenant] Set default tenant (verifies auth & pulls)\n ${chalk.dim('--no-pull')} Skip automatic pull\n\n${chalk.bold.underline('Configuration')} ${chalk.dim('(farseer config <command>)')}\n config set <tenant> Set API key for a tenant\n ${chalk.dim('--api-key <key>')} API key (required)\n ${chalk.dim('--org <name>')} Organisation if different from tenant\n config remove <tenant> Remove credentials\n config list List all configured tenants\n config show <tenant> Show full credentials (incl. API key)\n config test <tenant> Test connection to tenant\n config include Manage extra file types to sync\n ${chalk.dim('--ext <ext>')} Add extension (repeatable, e.g., --ext .json)\n ${chalk.dim('--folder <path>')} Add folder (repeatable)\n ${chalk.dim('--remove-ext <ext>')} Remove extension\n ${chalk.dim('--remove-folder <path>')} Remove folder\n ${chalk.dim('--clear')} Remove all sync includes\n\n${chalk.bold.underline('Sync Operations')} ${chalk.dim('(tenant optional if checked out)')}\n pull [org] [tenant] Pull files and apps from remote\n ${chalk.dim('--all')} Download every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist)\n ${chalk.dim('--force')} Mirror remote \u2192 local: overwrite local edits AND delete local-only (asks confirmation)\n ${chalk.dim('-y, --yes')} Skip confirm when local has uncommitted changes\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n push [org] [tenant] Push local changes to remote\n ${chalk.dim('-y, --yes')} Skip confirmation for non-destructive pushes\n ${chalk.dim('--force')} Mirror local \u2192 remote: overwrite drift AND delete remote-only (asks confirmation)\n ${chalk.dim('--shallow')} Skip remote-content hash pre-flight (faster, but may miss remote edits)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n status [tenant] Show sync status (local vs remote)\n ${chalk.dim('--all')} Show every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist)\n ${chalk.dim('--shallow')} Skip remote-content hash check (faster, but may miss remote edits)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n diff [tenant] [file] Show file differences\n refresh [org] [tenant] Rebuild the local sync baseline (.farseer-sync.json)\n ${chalk.dim('--include-ext <ext>')} Include extra extension (repeatable)\n ${chalk.dim('--include-folder <folder>')} Include all files in folder (repeatable)\n\n${chalk.bold.underline('App Management')} ${chalk.dim('(tenant optional if checked out)')}\n app list [tenant] List all apps\n ${chalk.dim('--details')} Show details for each app\n app show [tenant] <name> Show app details\n app create [tenant] <name> Create new app\n app configure [tenant] <name> Configure app\n ${chalk.dim('--entrypoint <script>')} Set main script\n ${chalk.dim('--scripts <list>')} Comma-separated scripts\n ${chalk.dim('--add-arg <Name=Value>')} Add argument (repeatable)\n ${chalk.dim('--description <text>')} Set description\n app delete [tenant] <name> Delete app (requires --force)\n\n${chalk.bold.underline('Running & Development')} ${chalk.dim('(tenant optional if checked out)')}\n run [tenant] <app> Run app locally with injected credentials\n ${chalk.dim('--arg <Name=Value>')} Override argument (repeatable)\n run-script [tenant] <file> Run script directly (no app wrapper)\n install [tenant] Install npm dependencies (npm install)\n\n${chalk.bold.underline('Variables')} ${chalk.dim('(tenant optional if checked out)')}\n variables list [tenant] List all variables\n variables create [tenant] Create a new variable\n ${chalk.dim('--name <name>')} Variable name (required)\n ${chalk.dim('--dimensions <csv>')} Comma-separated dimension tables\n ${chalk.dim('--formula <expr>')} Formula expression\n ${chalk.dim('--rollup <type>')} Rollup type (Sum, Average, etc.)\n ${chalk.dim('--data-type <type>')} Data type (Decimal, Integer, Text)\n ${chalk.dim('--description <text>')} Description\n variables update [tenant] Update an existing variable\n ${chalk.dim('--name <name>')} Variable name (required)\n ${chalk.dim('--formula <expr>')} New formula\n ${chalk.dim('--rollup <type>')} New rollup type\n ${chalk.dim('--description <text>')} New description\n variable details <name> Show variable details (dimensions, formula, etc.)\n variable export <name> Export variable data to CSV\n ${chalk.dim('--output <file>')} Output file path\n ${chalk.dim('--format <csv|json|xlsx>')} Output format (default: csv)\n ${chalk.dim('--limit <n>')} Limit number of rows\n\n${chalk.bold.underline('Dimensions')} ${chalk.dim('(tenant optional if checked out)')}\n dimensions list [tenant] List all dimension tables\n dimensions members <table> List all members of a dimension table\n ${chalk.dim('--limit <n>')} Limit number of members shown\n dimensions create-member Create a new dimension member\n ${chalk.dim('--table <name>')} Dimension table name\n ${chalk.dim('--name <name>')} New member name\n ${chalk.dim('--parent <name>')} Parent member name (optional)\n dimensions delete-member Delete a dimension member\n ${chalk.dim('--table <name> --name <name>')} Table and member to delete\n ${chalk.dim('-y')} Skip confirmation\n dimension details <name> Show table details (columns, members)\n ${chalk.dim('--members <n>')} Number of sample members (default: 10)\n\n${chalk.bold.underline('Sheets')} ${chalk.dim('(tenant optional if checked out)')}\n sheets list [tenant] List all sheets\n sheets show <nameOrId> Show sheet configuration\n sheets data <nameOrId> Get sheet data\n ${chalk.dim('--limit <n>')} Limit cells returned\n sheets set-data Set sheet data from JSON file\n ${chalk.dim('--sheet <nameOrId>')} Sheet name or ID\n ${chalk.dim('--input <file>')} JSON data file\n ${chalk.dim('-y')} Skip confirmation\n\n${chalk.bold.underline('Dashboards')} ${chalk.dim('(tenant optional if checked out)')}\n dashboards list [tenant] List all dashboards\n dashboards show <nameOrId> Show dashboard details\n ${chalk.dim('--tiles')} Include tile details\n\n${chalk.bold.underline('Cells')} ${chalk.dim('(tenant optional if checked out)')}\n cells query Query cell values\n ${chalk.dim('--variable <name>')} Variable name (required)\n ${chalk.dim('--dimension <table=member>')} Dimension filter (repeatable)\n cells update Update a cell value\n ${chalk.dim('--variable <name>')} Variable name (required)\n ${chalk.dim('--dimension <table=member>')} Dimension filter (repeatable)\n ${chalk.dim('--value <number>')} New value (required)\n ${chalk.dim('-y')} Skip confirmation\n\n${chalk.bold.underline('Formula')} ${chalk.dim('(tenant optional if checked out)')}\n formula eval <expression> Evaluate a formula expression\n ${chalk.dim('--filter <table=member>')} Dimension filter (repeatable)\n\n${chalk.bold.underline('Model Inspection')} ${chalk.dim('(tenant optional if checked out)')}\n model [tenant] Show model structure (dimensions, variables)\n ${chalk.dim('--variables')} List all variables\n ${chalk.dim('--tables')} List all dimension tables\n ${chalk.dim('--variable <name>')} Show dimensions for variable\n\n${chalk.bold.underline('File Management')} ${chalk.dim('(farseer files <command>)')}\n files list [tenant] List files on remote\n ${chalk.dim('--all')} Show all files (not just scripts)\n\n${chalk.bold.underline('MCP Server')} ${chalk.dim('(AI assistant integration)')}\n mcp-server --tenant <slug> Start MCP server bound to a tenant (Claude, Cursor, etc.)\n ${chalk.dim('--org <org>')} Organisation subdomain (default: saved mapping, else tenant)\n\n${chalk.bold.underline('Examples')}\n ${chalk.green('$')} farseer login ${chalk.dim('Login via browser')}\n ${chalk.green('$')} farseer checkout salvus-2 salvus-prod ${chalk.dim('First time: org + tenant')}\n ${chalk.green('$')} farseer pull salvus-prod ${chalk.dim('Next time: just tenant')}\n ${chalk.green('$')} farseer push ${chalk.dim('If checked out: no args needed')}\n ${chalk.green('$')} farseer push -y ${chalk.dim('Push without confirmation')}\n ${chalk.green('$')} farseer run \"My App\" ${chalk.dim('Run app locally')}\n ${chalk.green('$')} farseer variables list ${chalk.dim('List all variables')}\n ${chalk.green('$')} farseer variable details \"Revenue\" ${chalk.dim('Show variable details')}\n ${chalk.green('$')} farseer dimensions list ${chalk.dim('List dimension tables')}\n`,\n );\n\n// Register all commands (hidden from default help, shown in custom help above)\nregisterLoginCommand(program);\nregisterLogoutCommand(program);\nregisterCheckoutCommand(program);\nregisterConfigCommand(program);\nregisterListCommand(program);\nregisterFilesCommand(program);\nregisterAppCommand(program);\nregisterVariablesCommand(program);\nregisterDimensionsCommand(program);\nregisterModelCommand(program);\nregisterStatusCommand(program);\nregisterDiffCommand(program);\nregisterPullCommand(program);\nregisterPushCommand(program);\nregisterRefreshCommand(program);\nregisterRunCommand(program);\nregisterInstallCommand(program);\nregisterWhoamiCommand(program);\nregisterSheetsCommand(program);\nregisterDashboardsCommand(program);\nregisterCellsCommand(program);\nregisterFormulaCommand(program);\nregisterMcpServerCommand(program);\n\n// Display update notification after any command finishes\nif (updateMessagePromise) {\n program.hook('postAction', async () => {\n const message = await updateMessagePromise;\n if (message) {\n process.stderr.write(message + '\\n');\n }\n });\n}\n\n// Parse arguments\nprogram.parse();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAsBA,uBAAwB;AACxB,mBAAkB;AAClB,uBAA4B;AAC5B,wBAA2B;AAK3B,mBAAqC;AACrC,oBAAsC;AACtC,oBAAsC;AACtC,kBAAoC;AACpC,mBAAqC;AACrC,oBAAsC;AACtC,kBAAoC;AACpC,kBAAoC;AACpC,kBAAoC;AACpC,qBAAuC;AACvC,iBAAmC;AACnC,qBAAuC;AACvC,oBAAsC;AACtC,iBAAmC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AO;AAAA,IAC3B,uCAAuB,OAAO;AAAA,IAC9B,+BAAmB,OAAO;AAAA,IAC1B,uCAAuB,OAAO;AAAA,IAC9B,qCAAsB,OAAO;AAAA,IAC7B,qCAAsB,OAAO;AAAA,IAC7B,6CAA0B,OAAO;AAAA,IACjC,mCAAqB,OAAO;AAAA,IAC5B,uCAAuB,OAAO;AAAA,IAC9B,4CAAyB,OAAO;AAGhC,IAAI,sBAAsB;AACtB,UAAQ,KAAK,cAAc,YAAY;AACnC,UAAM,UAAU,MAAM;AACtB,QAAI,SAAS;AACT,cAAQ,OAAO,MAAM,UAAU,IAAI;AAAA,IACvC;AAAA,EACJ,CAAC;AACL;AAGA,QAAQ,MAAM;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
package/dist/mcp/index.js
CHANGED
|
@@ -23,12 +23,21 @@ __export(mcp_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(mcp_exports);
|
|
24
24
|
var import_server = require("./server");
|
|
25
25
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
26
|
+
var import_tenantPin = require("./utils/tenantPin");
|
|
27
|
+
var import_launchPin = require("./utils/launchPin");
|
|
26
28
|
var import_fileLogger = require("../utils/fileLogger");
|
|
27
|
-
async function startMcpServer() {
|
|
29
|
+
async function startMcpServer(options = {}) {
|
|
28
30
|
process.env.FARSEER_MCP = "1";
|
|
29
31
|
import_fileLogger.fileLogger.init();
|
|
30
32
|
import_fileLogger.fileLogger.installCrashHandlers();
|
|
31
33
|
import_fileLogger.fileLogger.log("mcp", "MCP server starting");
|
|
34
|
+
const pin = (0, import_launchPin.resolveLaunchPin)(options, process.env);
|
|
35
|
+
if (pin) {
|
|
36
|
+
(0, import_tenantPin.setLaunchTenant)(pin);
|
|
37
|
+
import_fileLogger.fileLogger.log("mcp", `Launch-pinned to tenant ${pin.tenant} (org ${pin.organisation})`);
|
|
38
|
+
} else {
|
|
39
|
+
import_fileLogger.fileLogger.log("mcp", "Started without a tenant; awaiting farseer_select_tenant");
|
|
40
|
+
}
|
|
32
41
|
const server = (0, import_server.createMcpServer)();
|
|
33
42
|
const transport = new import_stdio.StdioServerTransport();
|
|
34
43
|
await server.connect(transport);
|
package/dist/mcp/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mcp/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * MCP Server Entry Point\n *\n * Starts the Farseer MCP server for AI assistant integration.\n * Uses stdio transport for CLI compatibility.\n */\n\nimport { createMcpServer } from './server';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { fileLogger } from '../utils/fileLogger';\n\nexport async function startMcpServer(): Promise<void> {\n // Signal MCP context so logger and progress output avoid stdout\n process.env.FARSEER_MCP = '1';\n\n // Initialize file logging (crash handlers especially important for long-lived MCP process)\n fileLogger.init();\n fileLogger.installCrashHandlers();\n fileLogger.log('mcp', 'MCP server starting');\n\n const server = createMcpServer();\n\n // Use stdio transport for CLI integration\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n fileLogger.log('mcp', 'MCP server connected');\n // Log to stderr since stdout is reserved for MCP protocol\n console.error('Farseer MCP server started');\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAAgC;AAChC,mBAAqC;AACrC,wBAA2B;
|
|
4
|
+
"sourcesContent": ["/**\n * MCP Server Entry Point\n *\n * Starts the Farseer MCP server for AI assistant integration.\n * Uses stdio transport for CLI compatibility.\n */\n\nimport { createMcpServer } from './server';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { setLaunchTenant } from './utils/tenantPin';\nimport { resolveLaunchPin } from './utils/launchPin';\nimport type { McpServerOptions } from './utils/launchPin';\nimport { fileLogger } from '../utils/fileLogger';\n\nexport type { McpServerOptions };\n\nexport async function startMcpServer(options: McpServerOptions = {}): Promise<void> {\n // Signal MCP context so logger and progress output avoid stdout\n process.env.FARSEER_MCP = '1';\n\n // Initialize file logging (crash handlers especially important for long-lived MCP process)\n fileLogger.init();\n fileLogger.installCrashHandlers();\n fileLogger.log('mcp', 'MCP server starting');\n\n // Bind this server to a single tenant for its lifetime if one was supplied at\n // launch \u2014 via --tenant/--org, or the FARSEER_TENANT/FARSEER_ORG env (the\n // channel Mindseer already uses). The pin lives only in memory; the global\n // checkout in ~/.farseer/config.json is never read or written, so it can't\n // collide with the CLI or with other concurrent servers. Launched without a\n // tenant, the server connects unbound and an agent binds it once via\n // farseer_select_tenant.\n const pin = resolveLaunchPin(options, process.env);\n if (pin) {\n setLaunchTenant(pin);\n fileLogger.log('mcp', `Launch-pinned to tenant ${pin.tenant} (org ${pin.organisation})`);\n } else {\n fileLogger.log('mcp', 'Started without a tenant; awaiting farseer_select_tenant');\n }\n\n const server = createMcpServer();\n\n // Use stdio transport for CLI integration\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n fileLogger.log('mcp', 'MCP server connected');\n // Log to stderr since stdout is reserved for MCP protocol\n console.error('Farseer MCP server started');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAAgC;AAChC,mBAAqC;AACrC,uBAAgC;AAChC,uBAAiC;AAEjC,wBAA2B;AAI3B,eAAsB,eAAe,UAA4B,CAAC,GAAkB;AAEhF,UAAQ,IAAI,cAAc;AAG1B,+BAAW,KAAK;AAChB,+BAAW,qBAAqB;AAChC,+BAAW,IAAI,OAAO,qBAAqB;AAS3C,QAAM,UAAM,mCAAiB,SAAS,QAAQ,GAAG;AACjD,MAAI,KAAK;AACL,0CAAgB,GAAG;AACnB,iCAAW,IAAI,OAAO,2BAA2B,IAAI,MAAM,SAAS,IAAI,YAAY,GAAG;AAAA,EAC3F,OAAO;AACH,iCAAW,IAAI,OAAO,0DAA0D;AAAA,EACpF;AAEA,QAAM,aAAS,+BAAgB;AAG/B,QAAM,YAAY,IAAI,kCAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAE9B,+BAAW,IAAI,OAAO,sBAAsB;AAE5C,UAAQ,MAAM,4BAA4B;AAC9C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -53,7 +53,7 @@ function registerWorkflowPrompts(server) {
|
|
|
53
53
|
const anyServer = server;
|
|
54
54
|
anyServer.prompt(
|
|
55
55
|
"setup_new_tenant",
|
|
56
|
-
"Guide for
|
|
56
|
+
"Guide for getting started on the tenant this server is bound to: verify login, pull, install dependencies.",
|
|
57
57
|
setupTenantSchema,
|
|
58
58
|
async (params) => {
|
|
59
59
|
const { tenant } = params;
|
|
@@ -67,12 +67,13 @@ function registerWorkflowPrompts(server) {
|
|
|
67
67
|
|
|
68
68
|
Steps to follow:
|
|
69
69
|
|
|
70
|
-
1.
|
|
70
|
+
1. Check authentication and the bound tenant with farseer_whoami
|
|
71
71
|
2. If not logged in, inform the user to run "farseer login" in terminal (MCP cannot do browser login)
|
|
72
|
-
3.
|
|
73
|
-
4.
|
|
74
|
-
5.
|
|
75
|
-
6. Use
|
|
72
|
+
3. If farseer_whoami does not show "${tenant}", tell the user to set --tenant ${tenant} in this MCP server's config and reconnect \u2014 MCP tools cannot change the tenant
|
|
73
|
+
4. Pull files and apps with farseer_pull
|
|
74
|
+
5. Tell user to run "farseer install ${tenant}" in terminal to install npm dependencies
|
|
75
|
+
6. Use farseer_list_apps to show available apps
|
|
76
|
+
7. Use farseer_export_model to understand the data structure
|
|
76
77
|
|
|
77
78
|
After setup, the user can:
|
|
78
79
|
- Run apps with farseer_run_app
|
|
@@ -401,7 +402,7 @@ Steps to follow:
|
|
|
401
402
|
|
|
402
403
|
1. Check authentication: farseer_whoami
|
|
403
404
|
- Is JWT valid?
|
|
404
|
-
-
|
|
405
|
+
- Which tenant is this server bound to (via --tenant)?
|
|
405
406
|
|
|
406
407
|
2. Check sync status: farseer_status
|
|
407
408
|
- Are there modified files?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/mcp/prompts/workflows.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Workflow Prompts\n *\n * Reusable prompt templates for common Farseer workflows.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\n\n// Define schemas outside of prompt registration to avoid deep type instantiation\nconst setupTenantSchema = {\n tenant: z.string().describe('Tenant name to setup'),\n};\n\nconst createAppSchema = {\n tenant: z.string().describe('Tenant name'),\n appName: z.string().describe('Name for the new app'),\n scriptName: z.string().optional().describe('Main script filename (default: index.ts)'),\n};\n\nconst understandModelSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nconst writeImportScriptSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Target variable to import into'),\n};\n\nconst copyAppSchema = {\n tenant: z.string().describe('Tenant name'),\n sourceApp: z.string().describe('Name of app to copy'),\n newAppName: z.string().describe('Name for the new app'),\n};\n\nconst exportDataSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Variable to export'),\n};\n\nconst debugSyncSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nexport function registerWorkflowPrompts(server: McpServer): void {\n // Cast to any to avoid very deep generic type instantiation from the MCP SDK\n const anyServer = server as any;\n // Setup new tenant\n anyServer.prompt(\n 'setup_new_tenant',\n 'Guide for setting up a new Farseer tenant: login, checkout, pull, install dependencies.',\n setupTenantSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `You are setting up a new Farseer tenant \"${tenant}\".\n\nSteps to follow:\n\n1. First, check authentication status with farseer_whoami\n2. If not logged in, inform the user to run \"farseer login\" in terminal (MCP cannot do browser login)\n3. Use farseer_checkout to set \"${tenant}\" as the default tenant (this also pulls files and apps)\n4. Tell user to run \"farseer install ${tenant}\" in terminal to install npm dependencies\n5. Use farseer_list_apps to show available apps\n6. Use farseer_export_model to understand the data structure\n\nAfter setup, the user can:\n- Run apps with farseer_run_app\n- Edit scripts in apps/${tenant}/files/Scripts/\n- Push changes with farseer_push\n- Check model with farseer_get_variable or farseer_get_table`,\n },\n },\n ],\n };\n },\n );\n\n // Create new app\n anyServer.prompt(\n 'create_new_app',\n 'Guide for creating a new Farseer app from scratch.',\n createAppSchema,\n async (params: { tenant: string; appName: string; scriptName?: string }) => {\n const { tenant, appName, scriptName } = params;\n const script = scriptName || 'index.ts';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Creating a new Farseer app \"${appName}\" for tenant \"${tenant}\".\n\nIMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.\nThe script uses \\`farseer-client\\` to interact with the Farseer API.\nAuthentication is automatic - \\`new FarseerClient()\\` reads credentials from environment variables injected by the CLI.\nYou NEVER hardcode credentials in scripts.\n\nSteps to follow:\n\n1. Write the script file at farseer-apps/${tenant}/files/Scripts/${script}\n Use the template below as a starting point.\n\n2. Push the script to remote with farseer_push\n (Scripts must exist on remote before they can be assigned to an app)\n\n3. Create the app with farseer_create_app (name: \"${appName}\")\n\n4. Configure the app with farseer_configure_app:\n - sourceFolder: \"Scripts\"\n - entrypoint: \"${script}\"\n - arguments: Add any arguments the script expects (they arrive via process.argv)\n\n5. Test with farseer_run_app\n The CLI injects auth credentials as env vars and runs the script with npx tsx.\n\nScript template:\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\n// FarseerClient auto-configures from env vars injected by \"farseer run\"\n// NEVER hardcode credentials - just use the empty constructor\nconst client = new farseer.FarseerClient();\n\n// Arguments come via process.argv in the order defined by app config\nconst args = process.argv.slice(2);\n\nasync function main() {\n // Load dimension/variable metadata\n await client.initTagMap();\n\n // Your code here\n console.log('App running successfully');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\``,\n },\n },\n ],\n };\n },\n );\n\n // Understand model\n anyServer.prompt(\n 'understand_model',\n 'Explore and understand the data model of a Farseer tenant.',\n understandModelSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Analyzing the data model for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_export_model to get the full model structure\n\n2. Review dimension tables:\n - Use farseer_list_tables for overview\n - Key dimensions usually include: Products, Regions, Time (Months, Years), Versions\n - Check foreign key relationships between tables\n\n3. Review variables:\n - Use farseer_list_variables for overview\n - Use farseer_get_variable for specific variable details\n - Note which dimensions each variable has\n\n4. For import scripts, you need to know:\n - Target variable name\n - All dimensions the variable has\n - Valid members for each dimension\n\nKey concepts:\n- Dimensions structure the data (Product, Region, Month, Year, Version)\n- Variables store values at dimension intersections\n- Formulas calculate values automatically\n- Roll-up types determine aggregation (SUM, AVERAGE, etc.)\n\nCommon dimension tables:\n- Months, Years (time)\n- Versions (Plan, Actual, Forecast)\n- Products, Categories, Brands\n- Regions, Entities, Cost Centers`,\n },\n },\n ],\n };\n },\n );\n\n // Write import script\n anyServer.prompt(\n 'write_import_script',\n 'Guide for writing a data import script.',\n writeImportScriptSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Writing an import script for variable \"${variableName}\" in tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the target variable:\n - What dimensions does it have?\n - What is the roll-up type?\n\n2. Use farseer_get_table for each dimension to see valid members\n\n3. Create the import script with this pattern:\n\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\nconst client = new farseer.FarseerClient();\n\nasync function main() {\n await client.initTagMap();\n\n // Create import job with column definitions\n const importJob = await client.createImportJob({\n title: 'Import ${variableName}',\n columns: [\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Product' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Years' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Months' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },\n { type: 'VARIABLE', variableName: '${variableName}' },\n ],\n labels: ['auto', 'import-${variableName.toLowerCase().replace(/\\s+/g, '-')}']\n });\n\n // Add rows - each row matches column order\n const rows = [\n ['ProductA', 'Y2025', 'M1', 'Plan', 1000],\n ['ProductB', 'Y2025', 'M1', 'Plan', 2000],\n ];\n\n await importJob.addRows(rows);\n await importJob.flushRows();\n await importJob.undoPrevious(); // Remove previous import\n await importJob.commit();\n\n console.log('Import completed!');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\`\n\n4. Save script to apps/${tenant}/files/Scripts/\n5. Push with farseer_push\n6. Create app with farseer_create_app\n7. Configure with farseer_configure_app\n8. Test with farseer_run_app\n\nALTERNATIVE: For simple imports without a script, use the farseer_create_import_job tool directly.\nIt handles the full workflow (create metadata, add rows, undo previous, commit) in a single call.\nUse farseer_create_import_job when:\n- Data is already available (no need to fetch from external source)\n- The import is a one-time or simple operation\n- You want to quickly import without creating a full script\n\nUse a script when:\n- Data comes from external sources (APIs, databases, files)\n- Complex data transformation is needed\n- The import runs on a schedule as an App`,\n },\n },\n ],\n };\n },\n );\n\n // Copy existing app\n anyServer.prompt(\n 'copy_app',\n 'Guide for copying an existing app to create a new one.',\n copyAppSchema,\n async (params: { tenant: string; sourceApp: string; newAppName: string }) => {\n const { tenant, sourceApp, newAppName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Copying app \"${sourceApp}\" to create \"${newAppName}\" for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Pull latest with farseer_pull to get current app JSON\n\n2. Use farseer_get_app to see the source app configuration\n\n3. The app JSON files are in apps/${tenant}/apps/\n\n Copy the source JSON file and modify:\n - Change \"name\" to \"${newAppName}\"\n - **IMPORTANT: Remove \"_remote\" field** (this makes it a new app)\n - Modify arguments, description as needed\n\n4. JSON format for new app:\n\\`\\`\\`json\n{\n \"name\": \"${newAppName}\",\n \"description\": \"Copied from ${sourceApp}\",\n \"entrypoint\": \"script.ts\",\n \"scripts\": [\"script.ts\"],\n \"arguments\": [\n { \"name\": \"Year\", \"defaultValue\": \"2025\" }\n ]\n}\n\\`\\`\\`\n\nNote: Do NOT include \"_remote\" for new apps - CLI adds it after first push.\n\n5. Push with farseer_push to create the new app\n\n6. Test with farseer_run_app`,\n },\n },\n ],\n };\n },\n );\n\n // Export data\n anyServer.prompt(\n 'export_data',\n 'Guide for exporting variable data from Farseer.',\n exportDataSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Exporting data for variable \"${variableName}\" from tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the variable:\n - What dimensions does it span?\n - What is its data type?\n\n2. Choose export method:\n\n **Option A: Quick export (farseer_export_variable_data)**\n - Uses ExportApi.exportFormula() internally\n - Returns CSV/JSON data inline\n - Good for quick inspection or small datasets\n - Use 'limit' parameter for large datasets\n\n **Option B: Structured export (farseer_load_variable_data)**\n - Uses data.loadFarseerVariable() internally\n - Can specify which dimensions to include as columns\n - Returns structured CSV data\n - Good when you need specific dimension breakdowns\n\n **Option C: CLI export (farseer variable export)**\n - Saves CSV/JSON/XLSX to a local file\n - Best for saving data locally for analysis\n\n3. For analysis:\n - Parse the CSV data returned by the tools\n - Summarize, filter, or transform as needed`,\n },\n },\n ],\n };\n },\n );\n\n // Debug sync issues\n anyServer.prompt(\n 'debug_sync_issues',\n 'Troubleshoot synchronization problems between local and remote.',\n debugSyncSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Debugging sync issues for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Check authentication: farseer_whoami\n - Is JWT valid?\n - Is tenant checked out?\n\n2. Check sync status: farseer_status\n - Are there modified files?\n - Are there only-local or only-remote files?\n\n3. If files show as modified:\n - Use farseer_diff to see differences\n - Decide: pull (accept remote) or push (upload local)\n\n4. Common issues and solutions:\n\n **\"No credentials found\"**\n \u2192 User needs to run \"farseer login\" in terminal\n \u2192 Or configure API key: \"farseer config set ${tenant} --api-key KEY\"\n\n **\"Remote has changes\"**\n \u2192 Pull first with farseer_pull\n \u2192 Then push with farseer_push\n\n **\"Token expired\"**\n \u2192 User needs to run \"farseer login\" again\n\n **Apps not syncing**\n \u2192 Need JWT login (browser), not API key\n \u2192 API key only syncs files, not apps\n\n5. Force resolution:\n - To accept all remote changes: farseer_pull with force=true (overwrites local)\n - To accept all local changes: farseer_push with force=true (overwrites remote)\n - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)\n\n6. Check specific file diff:\n - Use farseer_diff with file parameter to see exact changes`,\n },\n },\n ],\n };\n },\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAGlB,MAAM,oBAAoB;AAAA,EACtB,QAAQ,aAAE,OAAO,EAAE,SAAS,sBAAsB;AACtD;AAEA,MAAM,kBAAkB;AAAA,EACpB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,SAAS,aAAE,OAAO,EAAE,SAAS,sBAAsB;AAAA,EACnD,YAAY,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AACzF;AAEA,MAAM,wBAAwB;AAAA,EAC1B,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAC7C;AAEA,MAAM,0BAA0B;AAAA,EAC5B,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,cAAc,aAAE,OAAO,EAAE,SAAS,gCAAgC;AACtE;AAEA,MAAM,gBAAgB;AAAA,EAClB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,WAAW,aAAE,OAAO,EAAE,SAAS,qBAAqB;AAAA,EACpD,YAAY,aAAE,OAAO,EAAE,SAAS,sBAAsB;AAC1D;AAEA,MAAM,mBAAmB;AAAA,EACrB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAAA,EACzC,cAAc,aAAE,OAAO,EAAE,SAAS,oBAAoB;AAC1D;AAEA,MAAM,kBAAkB;AAAA,EACpB,QAAQ,aAAE,OAAO,EAAE,SAAS,aAAa;AAC7C;AAEO,SAAS,wBAAwB,QAAyB;AAE7D,QAAM,YAAY;AAElB,YAAU;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAA+B;AAClC,YAAM,EAAE,OAAO,IAAI;AACnB,aAAO;AAAA,QACH,UAAU;AAAA,UACN;AAAA,YACI,MAAM;AAAA,YACN,SAAS;AAAA,cACL,MAAM;AAAA,cACN,MAAM,4CAA4C,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * Workflow Prompts\n *\n * Reusable prompt templates for common Farseer workflows.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\n\n// Define schemas outside of prompt registration to avoid deep type instantiation\nconst setupTenantSchema = {\n tenant: z.string().describe('Tenant name to setup'),\n};\n\nconst createAppSchema = {\n tenant: z.string().describe('Tenant name'),\n appName: z.string().describe('Name for the new app'),\n scriptName: z.string().optional().describe('Main script filename (default: index.ts)'),\n};\n\nconst understandModelSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nconst writeImportScriptSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Target variable to import into'),\n};\n\nconst copyAppSchema = {\n tenant: z.string().describe('Tenant name'),\n sourceApp: z.string().describe('Name of app to copy'),\n newAppName: z.string().describe('Name for the new app'),\n};\n\nconst exportDataSchema = {\n tenant: z.string().describe('Tenant name'),\n variableName: z.string().describe('Variable to export'),\n};\n\nconst debugSyncSchema = {\n tenant: z.string().describe('Tenant name'),\n};\n\nexport function registerWorkflowPrompts(server: McpServer): void {\n // Cast to any to avoid very deep generic type instantiation from the MCP SDK\n const anyServer = server as any;\n // Setup new tenant\n anyServer.prompt(\n 'setup_new_tenant',\n 'Guide for getting started on the tenant this server is bound to: verify login, pull, install dependencies.',\n setupTenantSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `You are setting up a new Farseer tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Check authentication and the bound tenant with farseer_whoami\n2. If not logged in, inform the user to run \"farseer login\" in terminal (MCP cannot do browser login)\n3. If farseer_whoami does not show \"${tenant}\", tell the user to set --tenant ${tenant} in this MCP server's config and reconnect \u2014 MCP tools cannot change the tenant\n4. Pull files and apps with farseer_pull\n5. Tell user to run \"farseer install ${tenant}\" in terminal to install npm dependencies\n6. Use farseer_list_apps to show available apps\n7. Use farseer_export_model to understand the data structure\n\nAfter setup, the user can:\n- Run apps with farseer_run_app\n- Edit scripts in apps/${tenant}/files/Scripts/\n- Push changes with farseer_push\n- Check model with farseer_get_variable or farseer_get_table`,\n },\n },\n ],\n };\n },\n );\n\n // Create new app\n anyServer.prompt(\n 'create_new_app',\n 'Guide for creating a new Farseer app from scratch.',\n createAppSchema,\n async (params: { tenant: string; appName: string; scriptName?: string }) => {\n const { tenant, appName, scriptName } = params;\n const script = scriptName || 'index.ts';\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Creating a new Farseer app \"${appName}\" for tenant \"${tenant}\".\n\nIMPORTANT: A Farseer App = a TypeScript script + an app config that tells Farseer which script to run and with what arguments.\nThe script uses \\`farseer-client\\` to interact with the Farseer API.\nAuthentication is automatic - \\`new FarseerClient()\\` reads credentials from environment variables injected by the CLI.\nYou NEVER hardcode credentials in scripts.\n\nSteps to follow:\n\n1. Write the script file at farseer-apps/${tenant}/files/Scripts/${script}\n Use the template below as a starting point.\n\n2. Push the script to remote with farseer_push\n (Scripts must exist on remote before they can be assigned to an app)\n\n3. Create the app with farseer_create_app (name: \"${appName}\")\n\n4. Configure the app with farseer_configure_app:\n - sourceFolder: \"Scripts\"\n - entrypoint: \"${script}\"\n - arguments: Add any arguments the script expects (they arrive via process.argv)\n\n5. Test with farseer_run_app\n The CLI injects auth credentials as env vars and runs the script with npx tsx.\n\nScript template:\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\n// FarseerClient auto-configures from env vars injected by \"farseer run\"\n// NEVER hardcode credentials - just use the empty constructor\nconst client = new farseer.FarseerClient();\n\n// Arguments come via process.argv in the order defined by app config\nconst args = process.argv.slice(2);\n\nasync function main() {\n // Load dimension/variable metadata\n await client.initTagMap();\n\n // Your code here\n console.log('App running successfully');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\``,\n },\n },\n ],\n };\n },\n );\n\n // Understand model\n anyServer.prompt(\n 'understand_model',\n 'Explore and understand the data model of a Farseer tenant.',\n understandModelSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Analyzing the data model for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_export_model to get the full model structure\n\n2. Review dimension tables:\n - Use farseer_list_tables for overview\n - Key dimensions usually include: Products, Regions, Time (Months, Years), Versions\n - Check foreign key relationships between tables\n\n3. Review variables:\n - Use farseer_list_variables for overview\n - Use farseer_get_variable for specific variable details\n - Note which dimensions each variable has\n\n4. For import scripts, you need to know:\n - Target variable name\n - All dimensions the variable has\n - Valid members for each dimension\n\nKey concepts:\n- Dimensions structure the data (Product, Region, Month, Year, Version)\n- Variables store values at dimension intersections\n- Formulas calculate values automatically\n- Roll-up types determine aggregation (SUM, AVERAGE, etc.)\n\nCommon dimension tables:\n- Months, Years (time)\n- Versions (Plan, Actual, Forecast)\n- Products, Categories, Brands\n- Regions, Entities, Cost Centers`,\n },\n },\n ],\n };\n },\n );\n\n // Write import script\n anyServer.prompt(\n 'write_import_script',\n 'Guide for writing a data import script.',\n writeImportScriptSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Writing an import script for variable \"${variableName}\" in tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the target variable:\n - What dimensions does it have?\n - What is the roll-up type?\n\n2. Use farseer_get_table for each dimension to see valid members\n\n3. Create the import script with this pattern:\n\n\\`\\`\\`typescript\nimport * as farseer from 'farseer-client';\n\nconst client = new farseer.FarseerClient();\n\nasync function main() {\n await client.initTagMap();\n\n // Create import job with column definitions\n const importJob = await client.createImportJob({\n title: 'Import ${variableName}',\n columns: [\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Product' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Years' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Months' },\n { type: 'DIMENSION_TABLE', dimensionTableName: 'Versions' },\n { type: 'VARIABLE', variableName: '${variableName}' },\n ],\n labels: ['auto', 'import-${variableName.toLowerCase().replace(/\\s+/g, '-')}']\n });\n\n // Add rows - each row matches column order\n const rows = [\n ['ProductA', 'Y2025', 'M1', 'Plan', 1000],\n ['ProductB', 'Y2025', 'M1', 'Plan', 2000],\n ];\n\n await importJob.addRows(rows);\n await importJob.flushRows();\n await importJob.undoPrevious(); // Remove previous import\n await importJob.commit();\n\n console.log('Import completed!');\n}\n\nmain().catch(farseer.handleUnknownError);\n\\`\\`\\`\n\n4. Save script to apps/${tenant}/files/Scripts/\n5. Push with farseer_push\n6. Create app with farseer_create_app\n7. Configure with farseer_configure_app\n8. Test with farseer_run_app\n\nALTERNATIVE: For simple imports without a script, use the farseer_create_import_job tool directly.\nIt handles the full workflow (create metadata, add rows, undo previous, commit) in a single call.\nUse farseer_create_import_job when:\n- Data is already available (no need to fetch from external source)\n- The import is a one-time or simple operation\n- You want to quickly import without creating a full script\n\nUse a script when:\n- Data comes from external sources (APIs, databases, files)\n- Complex data transformation is needed\n- The import runs on a schedule as an App`,\n },\n },\n ],\n };\n },\n );\n\n // Copy existing app\n anyServer.prompt(\n 'copy_app',\n 'Guide for copying an existing app to create a new one.',\n copyAppSchema,\n async (params: { tenant: string; sourceApp: string; newAppName: string }) => {\n const { tenant, sourceApp, newAppName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Copying app \"${sourceApp}\" to create \"${newAppName}\" for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Pull latest with farseer_pull to get current app JSON\n\n2. Use farseer_get_app to see the source app configuration\n\n3. The app JSON files are in apps/${tenant}/apps/\n\n Copy the source JSON file and modify:\n - Change \"name\" to \"${newAppName}\"\n - **IMPORTANT: Remove \"_remote\" field** (this makes it a new app)\n - Modify arguments, description as needed\n\n4. JSON format for new app:\n\\`\\`\\`json\n{\n \"name\": \"${newAppName}\",\n \"description\": \"Copied from ${sourceApp}\",\n \"entrypoint\": \"script.ts\",\n \"scripts\": [\"script.ts\"],\n \"arguments\": [\n { \"name\": \"Year\", \"defaultValue\": \"2025\" }\n ]\n}\n\\`\\`\\`\n\nNote: Do NOT include \"_remote\" for new apps - CLI adds it after first push.\n\n5. Push with farseer_push to create the new app\n\n6. Test with farseer_run_app`,\n },\n },\n ],\n };\n },\n );\n\n // Export data\n anyServer.prompt(\n 'export_data',\n 'Guide for exporting variable data from Farseer.',\n exportDataSchema,\n async (params: { tenant: string; variableName: string }) => {\n const { tenant, variableName } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Exporting data for variable \"${variableName}\" from tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Use farseer_get_variable to understand the variable:\n - What dimensions does it span?\n - What is its data type?\n\n2. Choose export method:\n\n **Option A: Quick export (farseer_export_variable_data)**\n - Uses ExportApi.exportFormula() internally\n - Returns CSV/JSON data inline\n - Good for quick inspection or small datasets\n - Use 'limit' parameter for large datasets\n\n **Option B: Structured export (farseer_load_variable_data)**\n - Uses data.loadFarseerVariable() internally\n - Can specify which dimensions to include as columns\n - Returns structured CSV data\n - Good when you need specific dimension breakdowns\n\n **Option C: CLI export (farseer variable export)**\n - Saves CSV/JSON/XLSX to a local file\n - Best for saving data locally for analysis\n\n3. For analysis:\n - Parse the CSV data returned by the tools\n - Summarize, filter, or transform as needed`,\n },\n },\n ],\n };\n },\n );\n\n // Debug sync issues\n anyServer.prompt(\n 'debug_sync_issues',\n 'Troubleshoot synchronization problems between local and remote.',\n debugSyncSchema,\n async (params: { tenant: string }) => {\n const { tenant } = params;\n return {\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Debugging sync issues for tenant \"${tenant}\".\n\nSteps to follow:\n\n1. Check authentication: farseer_whoami\n - Is JWT valid?\n - Which tenant is this server bound to (via --tenant)?\n\n2. Check sync status: farseer_status\n - Are there modified files?\n - Are there only-local or only-remote files?\n\n3. If files show as modified:\n - Use farseer_diff to see differences\n - Decide: pull (accept remote) or push (upload local)\n\n4. Common issues and solutions:\n\n **\"No credentials found\"**\n \u2192 User needs to run \"farseer login\" in terminal\n \u2192 Or configure API key: \"farseer config set ${tenant} --api-key KEY\"\n\n **\"Remote has changes\"**\n \u2192 Pull first with farseer_pull\n \u2192 Then push with farseer_push\n\n **\"Token expired\"**\n \u2192 User needs to run \"farseer login\" again\n\n **Apps not syncing**\n \u2192 Need JWT login (browser), not API key\n \u2192 API key only syncs files, not apps\n\n5. Force resolution:\n - To accept all remote changes: farseer_pull with force=true (overwrites local)\n - To accept all local changes: farseer_push with force=true (overwrites remote)\n - For selective resolution: farseer_pull without force will skip conflicts (resolve via CLI)\n\n6. Check specific file diff:\n - Use farseer_diff with file parameter to see exact changes`,\n },\n },\n ],\n };\n },\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,iBAAkB;AAGlB,MAAM,oBAAoB;AAAA,EACtB,QAAQ,aAAE,OAAO,EAAE,SAAS,sBAA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@ -35,11 +35,19 @@ var import_cellTools = require("./tools/cellTools");
|
|
|
35
35
|
var import_folderTools = require("./tools/folderTools");
|
|
36
36
|
var import_documentation = require("./resources/documentation");
|
|
37
37
|
var import_workflows = require("./prompts/workflows");
|
|
38
|
+
const SERVER_INSTRUCTIONS = `This MCP server works on a single Farseer tenant per session \u2014 one tenant for the whole session, never switched.
|
|
39
|
+
|
|
40
|
+
- If it was launched with a tenant (\`--tenant <slug>\` or the \`FARSEER_TENANT\` env), it is locked to that tenant. Tools take no tenant/organisation argument; they always act on the bound tenant. Do not use farseer CLI checkout/login to change it.
|
|
41
|
+
- If no tenant is set yet, bind it once: when the user says which tenant/client to work on, call \`farseer_select_tenant\`. After that first selection the tenant is locked for the session; to use a different tenant, start a new session.
|
|
42
|
+
- Use \`farseer_whoami\` to see the active tenant. Do not call other tools before a tenant is set.`;
|
|
38
43
|
function createMcpServer() {
|
|
39
|
-
const server = new import_mcp.McpServer(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
const server = new import_mcp.McpServer(
|
|
45
|
+
{
|
|
46
|
+
name: "farseer-cli",
|
|
47
|
+
version: import_constants.CLI_VERSION
|
|
48
|
+
},
|
|
49
|
+
{ instructions: SERVER_INSTRUCTIONS }
|
|
50
|
+
);
|
|
43
51
|
(0, import_authTools.registerAuthTools)(server);
|
|
44
52
|
(0, import_syncTools.registerSyncTools)(server);
|
|
45
53
|
(0, import_appTools.registerAppTools)(server);
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mcp/server.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * MCP Server Configuration\n *\n * Creates and configures the Farseer MCP server with all tools, resources, and prompts.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { CLI_VERSION } from '../utils/constants';\nimport { registerAuthTools } from './tools/authTools';\nimport { registerSyncTools } from './tools/syncTools';\nimport { registerAppTools } from './tools/appTools';\nimport { registerModelTools } from './tools/modelTools';\nimport { registerRunTools } from './tools/runTools';\nimport { registerDataTools } from './tools/dataTools';\nimport { registerSheetTools } from './tools/sheetTools';\nimport { registerDashboardTools } from './tools/dashboardTools';\nimport { registerCellTools } from './tools/cellTools';\nimport { registerFolderTools } from './tools/folderTools';\nimport { registerDocumentationResources } from './resources/documentation';\nimport { registerWorkflowPrompts } from './prompts/workflows';\n\nexport function createMcpServer(): McpServer {\n const server = new McpServer({\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAA0B;AAC1B,uBAA4B;AAC5B,uBAAkC;AAClC,uBAAkC;AAClC,sBAAiC;AACjC,wBAAmC;AACnC,sBAAiC;AACjC,uBAAkC;AAClC,wBAAmC;AACnC,4BAAuC;AACvC,uBAAkC;AAClC,yBAAoC;AACpC,2BAA+C;AAC/C,uBAAwC;
|
|
4
|
+
"sourcesContent": ["/**\n * MCP Server Configuration\n *\n * Creates and configures the Farseer MCP server with all tools, resources, and prompts.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { CLI_VERSION } from '../utils/constants';\nimport { registerAuthTools } from './tools/authTools';\nimport { registerSyncTools } from './tools/syncTools';\nimport { registerAppTools } from './tools/appTools';\nimport { registerModelTools } from './tools/modelTools';\nimport { registerRunTools } from './tools/runTools';\nimport { registerDataTools } from './tools/dataTools';\nimport { registerSheetTools } from './tools/sheetTools';\nimport { registerDashboardTools } from './tools/dashboardTools';\nimport { registerCellTools } from './tools/cellTools';\nimport { registerFolderTools } from './tools/folderTools';\nimport { registerDocumentationResources } from './resources/documentation';\nimport { registerWorkflowPrompts } from './prompts/workflows';\n\n// Surfaced to the model at connect time (MCP `instructions`). It sets the\n// mental model up front so an agent doesn't try to \"check out\" or authenticate\n// a tenant through CLI commands \u2014 which live on a different code path and do\n// not affect this server.\nconst SERVER_INSTRUCTIONS = `This MCP server works on a single Farseer tenant per session \u2014 one tenant for the whole session, never switched.\n\n- If it was launched with a tenant (\\`--tenant <slug>\\` or the \\`FARSEER_TENANT\\` env), it is locked to that tenant. Tools take no tenant/organisation argument; they always act on the bound tenant. Do not use farseer CLI checkout/login to change it.\n- If no tenant is set yet, bind it once: when the user says which tenant/client to work on, call \\`farseer_select_tenant\\`. After that first selection the tenant is locked for the session; to use a different tenant, start a new session.\n- Use \\`farseer_whoami\\` to see the active tenant. Do not call other tools before a tenant is set.`;\n\nexport function createMcpServer(): McpServer {\n const server = new McpServer(\n {\n name: 'farseer-cli',\n version: CLI_VERSION,\n },\n { instructions: SERVER_INSTRUCTIONS },\n );\n\n // Register all tools\n registerAuthTools(server);\n registerSyncTools(server);\n registerAppTools(server);\n registerModelTools(server);\n registerRunTools(server);\n registerDataTools(server);\n registerSheetTools(server);\n registerDashboardTools(server);\n registerCellTools(server);\n registerFolderTools(server);\n\n // Register resources (documentation)\n registerDocumentationResources(server);\n\n // Register prompts (workflow templates)\n registerWorkflowPrompts(server);\n\n return server;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,iBAA0B;AAC1B,uBAA4B;AAC5B,uBAAkC;AAClC,uBAAkC;AAClC,sBAAiC;AACjC,wBAAmC;AACnC,sBAAiC;AACjC,uBAAkC;AAClC,wBAAmC;AACnC,4BAAuC;AACvC,uBAAkC;AAClC,yBAAoC;AACpC,2BAA+C;AAC/C,uBAAwC;AAMxC,MAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAMrB,SAAS,kBAA6B;AACzC,QAAM,SAAS,IAAI;AAAA,IACf;AAAA,MACI,MAAM;AAAA,MACN,SAAS;AAAA,IACb;AAAA,IACA,EAAE,cAAc,oBAAoB;AAAA,EACxC;AAGA,0CAAkB,MAAM;AACxB,0CAAkB,MAAM;AACxB,wCAAiB,MAAM;AACvB,4CAAmB,MAAM;AACzB,wCAAiB,MAAM;AACvB,0CAAkB,MAAM;AACxB,4CAAmB,MAAM;AACzB,oDAAuB,MAAM;AAC7B,0CAAkB,MAAM;AACxB,8CAAoB,MAAM;AAG1B,2DAA+B,MAAM;AAGrC,gDAAwB,MAAM;AAE9B,SAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,18 +28,12 @@ var import_farseerApi = require("../../services/farseerApi");
|
|
|
28
28
|
var import_helpers = require("../utils/helpers");
|
|
29
29
|
var import_errorFormatter = require("../../utils/errorFormatter");
|
|
30
30
|
const listAppsSchema = {
|
|
31
|
-
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
32
|
-
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
33
31
|
details: import_zod.z.boolean().optional().describe("Include full details for each app")
|
|
34
32
|
};
|
|
35
33
|
const getAppSchema = {
|
|
36
|
-
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
37
|
-
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
38
34
|
appName: import_zod.z.string().describe("Name of the app (can include spaces)")
|
|
39
35
|
};
|
|
40
36
|
const createAppSchema = {
|
|
41
|
-
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
42
|
-
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
43
37
|
appName: import_zod.z.string().describe("Name for the new app")
|
|
44
38
|
};
|
|
45
39
|
const argumentSchema = import_zod.z.object({
|
|
@@ -60,8 +54,6 @@ const argumentSchema = import_zod.z.object({
|
|
|
60
54
|
path: ["defaultValue"]
|
|
61
55
|
});
|
|
62
56
|
const configureAppSchema = {
|
|
63
|
-
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
64
|
-
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
65
57
|
appName: import_zod.z.string().describe("Name of the app to configure"),
|
|
66
58
|
entrypoint: import_zod.z.string().optional().describe(`Main script filename \u2014 must be a file in the app's source folder (e.g., "index.ts")`),
|
|
67
59
|
sourceFolder: import_zod.z.string().optional().describe(`Source folder the app's scripts come from (path under Files/, e.g. "Scripts/MyApp")`),
|
|
@@ -70,8 +62,6 @@ const configureAppSchema = {
|
|
|
70
62
|
newName: import_zod.z.string().optional().describe("Rename the app")
|
|
71
63
|
};
|
|
72
64
|
const deleteAppSchema = {
|
|
73
|
-
organisation: import_zod.z.string().optional().describe("Farseer organisation (subdomain). If omitted, uses checked-out org or saved mapping."),
|
|
74
|
-
tenant: import_zod.z.string().optional().describe("Tenant ID. Uses checked-out tenant if omitted."),
|
|
75
65
|
appName: import_zod.z.string().describe("Name of the app to delete")
|
|
76
66
|
};
|
|
77
67
|
function registerAppTools(server) {
|
|
@@ -85,12 +75,10 @@ Apps are executable script configurations that include:
|
|
|
85
75
|
- List of included scripts
|
|
86
76
|
- Expected arguments with default values
|
|
87
77
|
|
|
88
|
-
Use details=true to include full information for each app
|
|
89
|
-
|
|
90
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
78
|
+
Use details=true to include full information for each app.`,
|
|
91
79
|
listAppsSchema,
|
|
92
80
|
async (params) => {
|
|
93
|
-
const resolved = (0, import_helpers.
|
|
81
|
+
const resolved = (0, import_helpers.getSessionTenant)();
|
|
94
82
|
if (!resolved) {
|
|
95
83
|
return (0, import_helpers.tenantRequiredResponse)();
|
|
96
84
|
}
|
|
@@ -153,12 +141,10 @@ Returns:
|
|
|
153
141
|
- App name and description
|
|
154
142
|
- Entry point script (main script that runs)
|
|
155
143
|
- List of all included scripts
|
|
156
|
-
- Expected arguments with their default values
|
|
157
|
-
|
|
158
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
144
|
+
- Expected arguments with their default values`,
|
|
159
145
|
getAppSchema,
|
|
160
146
|
async (params) => {
|
|
161
|
-
const resolved = (0, import_helpers.
|
|
147
|
+
const resolved = (0, import_helpers.getSessionTenant)();
|
|
162
148
|
if (!resolved) {
|
|
163
149
|
return (0, import_helpers.tenantRequiredResponse)();
|
|
164
150
|
}
|
|
@@ -217,12 +203,10 @@ Workflow to create a new app:
|
|
|
217
203
|
4. Configure it with farseer_configure_app (set entrypoint, scripts, arguments)
|
|
218
204
|
5. Run it with farseer_run_app (CLI injects auth credentials automatically)
|
|
219
205
|
|
|
220
|
-
Scripts should use \`new FarseerClient()\` with no arguments - credentials are injected via environment variables by the CLI at runtime
|
|
221
|
-
|
|
222
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
206
|
+
Scripts should use \`new FarseerClient()\` with no arguments - credentials are injected via environment variables by the CLI at runtime.`,
|
|
223
207
|
createAppSchema,
|
|
224
208
|
async (params) => {
|
|
225
|
-
const resolved = (0, import_helpers.
|
|
209
|
+
const resolved = (0, import_helpers.getSessionTenant)();
|
|
226
210
|
if (!resolved) {
|
|
227
211
|
return (0, import_helpers.tenantRequiredResponse)();
|
|
228
212
|
}
|
|
@@ -272,12 +256,10 @@ Important:
|
|
|
272
256
|
- Settings you don't pass are preserved (this only changes what you specify).
|
|
273
257
|
- Arguments are passed to the script as a JSON-encoded FARSEER_ARGS env var
|
|
274
258
|
- Boolean dataType requires defaultValue \u2208 { "true", "false" }; defaultValue
|
|
275
|
-
must be one of options when options is set
|
|
276
|
-
|
|
277
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
259
|
+
must be one of options when options is set`,
|
|
278
260
|
configureAppSchema,
|
|
279
261
|
async (params) => {
|
|
280
|
-
const resolved = (0, import_helpers.
|
|
262
|
+
const resolved = (0, import_helpers.getSessionTenant)();
|
|
281
263
|
if (!resolved) {
|
|
282
264
|
return (0, import_helpers.tenantRequiredResponse)();
|
|
283
265
|
}
|
|
@@ -346,12 +328,10 @@ If no tenant is specified, uses the currently checked-out tenant.`,
|
|
|
346
328
|
|
|
347
329
|
WARNING: This is irreversible - the app will be permanently removed from the remote instance.
|
|
348
330
|
|
|
349
|
-
This does NOT delete the script files, only the app configuration
|
|
350
|
-
|
|
351
|
-
If no tenant is specified, uses the currently checked-out tenant.`,
|
|
331
|
+
This does NOT delete the script files, only the app configuration.`,
|
|
352
332
|
deleteAppSchema,
|
|
353
333
|
async (params) => {
|
|
354
|
-
const resolved = (0, import_helpers.
|
|
334
|
+
const resolved = (0, import_helpers.getSessionTenant)();
|
|
355
335
|
if (!resolved) {
|
|
356
336
|
return (0, import_helpers.tenantRequiredResponse)();
|
|
357
337
|
}
|