farseer-cli 1.8.4 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/commands/checkout.js +27 -0
- package/dist/commands/checkout.js.map +2 -2
- 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/authTools.js +50 -100
- package/dist/mcp/tools/authTools.js.map +2 -2
- package/dist/mcp/tools/runTools.js +1 -1
- package/dist/mcp/tools/runTools.js.map +1 -1
- package/dist/mcp/utils/helpers.js +20 -33
- 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/dist/services/farseerApi.js +4 -0
- package/dist/services/farseerApi.js.map +2 -2
- package/dist/services/farseerFactory.js.map +2 -2
- package/dist/services/farseerService.js +3 -0
- package/dist/services/farseerService.js.map +2 -2
- 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.
|
|
@@ -81,6 +81,33 @@ function registerCheckoutCommand(program) {
|
|
|
81
81
|
process.exit(1);
|
|
82
82
|
}
|
|
83
83
|
const authLabel = clientResult.authType === "apiKey" ? "API key" : "browser login";
|
|
84
|
+
if (clientResult.authType === "jwt") {
|
|
85
|
+
import_logger.logger.info("Verifying tenant belongs to organisation...");
|
|
86
|
+
let orgInfo;
|
|
87
|
+
try {
|
|
88
|
+
orgInfo = await clientResult.client.getOrganizationInfo();
|
|
89
|
+
} catch (error) {
|
|
90
|
+
import_logger.logger.error(
|
|
91
|
+
`Could not verify that tenant ${import_chalk.default.bold(tenant)} belongs to organisation ${import_chalk.default.bold(organisation)}.`
|
|
92
|
+
);
|
|
93
|
+
import_logger.logger.dim("Checkout aborted \u2014 refusing to set a tenant whose organisation cannot be confirmed.");
|
|
94
|
+
if (error instanceof Error) {
|
|
95
|
+
import_logger.logger.dim(error.message);
|
|
96
|
+
}
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
const orgTenantNames = orgInfo.tenants.map((t) => t.name);
|
|
100
|
+
if (!orgTenantNames.includes(tenant)) {
|
|
101
|
+
import_logger.logger.error(
|
|
102
|
+
`Tenant ${import_chalk.default.bold(tenant)} is not registered under organisation ${import_chalk.default.bold(organisation)}.`
|
|
103
|
+
);
|
|
104
|
+
if (orgTenantNames.length > 0) {
|
|
105
|
+
import_logger.logger.dim(`Tenants under ${import_chalk.default.bold(organisation)}: ${orgTenantNames.join(", ")}`);
|
|
106
|
+
}
|
|
107
|
+
import_logger.logger.dim("You likely specified the wrong organisation for this tenant. Checkout aborted.");
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
84
111
|
import_logger.logger.success(`Authenticated (using ${authLabel})`);
|
|
85
112
|
(0, import_configService.setCurrentCheckout)(organisation, tenant);
|
|
86
113
|
(0, import_configService.saveTenantOrgMapping)(tenant, organisation);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/checkout.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport {\n getCurrentCheckout,\n setCurrentCheckout,\n clearCurrentTenant,\n saveTenantOrgMapping,\n} from '../services/configService';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport { getTenantDir, ensureDirectoryExists } from '../utils/helpers';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// Re-export for tests that import from the original location and for\n// any downstream consumers that already pinned to this path.\nexport { ensureGitignoreEntries };\n\nexport function registerCheckoutCommand(program: Command): void {\n program\n .command('checkout [org] [tenant]')\n .description('Set default tenant for commands (runs auth check and pull)')\n .option('--no-pull', 'Skip automatic pull')\n .option('--clear', 'Clear current checkout')\n .option('--include-ext <ext>', 'Include extra file extension for pull (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder for pull (repeatable)', collectValues, [])\n .action(async (first, second, options) => {\n // Handle --clear flag\n if (options.clear) {\n clearCurrentTenant();\n logger.success('Checkout cleared. You now need to specify tenant for each command.');\n return;\n }\n\n // If no arguments specified, show current checkout status\n if (!first) {\n const current = getCurrentCheckout();\n if (current) {\n if (current.organisation === current.tenant) {\n logger.info(`Currently checked out: ${chalk.bold(current.tenant)}`);\n } else {\n logger.info(\n `Currently checked out: ${chalk.bold(current.tenant)} (org: ${chalk.bold(current.organisation)})`,\n );\n }\n logger.dim('Run \"farseer checkout <tenant>\" to switch tenants.');\n logger.dim('Run \"farseer checkout --clear\" to clear checkout.');\n } else {\n logger.info('No tenant currently checked out.');\n logger.dim('Run \"farseer checkout <tenant>\" to set a default tenant.');\n logger.dim('Run \"farseer checkout <org> <tenant>\" if organisation and tenant differ.');\n }\n return;\n }\n\n // Determine organisation and tenant\n // If two arguments: first=organisation, second=tenant\n // If one argument: organisation=tenant=first\n const organisation = second ? first : first;\n const tenant = second || first;\n\n logger.info(`Checking out tenant: ${chalk.bold(tenant)} (org: ${chalk.bold(organisation)})...`);\n console.log();\n\n // Step 1: Verify authentication\n logger.info('Verifying authentication...');\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const authLabel = clientResult.authType === 'apiKey' ? 'API key' : 'browser login';\n logger.success(`Authenticated (using ${authLabel})`);\n\n // Step 2: Set as current checkout and save org-tenant mapping\n setCurrentCheckout(organisation, tenant);\n saveTenantOrgMapping(tenant, organisation);\n\n // Step 3: Auto-pull (unless --no-pull)\n if (options.pull) {\n console.log();\n logger.info('Pulling latest files and apps...');\n\n const syncService = new SyncService(tenant, clientResult.client);\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n try {\n // Ensure package.json exists\n const packageJsonPath = path.join(tenantDir, 'package.json');\n if (!fs.existsSync(packageJsonPath)) {\n createDefaultPackageJson(tenant, packageJsonPath);\n }\n\n // Ensure .gitignore exists AND contains the per-machine\n // sync entries. Idempotent on the lines, not on the file\n // \u2014 pre-1.6.2 checkouts and `npm init`-seeded workspaces\n // already have a partial .gitignore (node_modules/) but\n // are missing `.farseer-sync.json`; just checking for\n // file existence leaves those workspaces leaking\n // baseline state into git.\n const gitignorePath = path.join(tenantDir, '.gitignore');\n ensureGitignoreEntries(gitignorePath);\n\n // Pull files (scripts + includes by default)\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const result = await syncService.pull({\n all: false,\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n });\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // Pull apps\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n const appResult = await appSyncService.pull();\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n logger.success('Pull complete!');\n } catch (error) {\n logger.warning('Pull failed, but checkout is complete.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n }\n }\n\n // Final message\n console.log();\n logger.success(`Tenant ${chalk.bold(tenant)} is now checked out.`);\n logger.dim('You can now run commands without specifying the tenant:');\n logger.dim(' farseer status');\n logger.dim(' farseer model --variables');\n logger.dim(' farseer apps');\n logger.dim(' farseer push');\n });\n}\n\nfunction createDefaultPackageJson(tenant: string, packageJsonPath: string): void {\n const packageJson = {\n name: `farseer-${tenant}`,\n version: '1.0.0',\n description: `Farseer scripts for ${tenant}`,\n type: 'module',\n scripts: {\n build: 'tsc',\n },\n dependencies: {\n 'farseer-client': FARSEER_CLIENT_URL,\n arquero: '^7.0.1',\n xlsx: '^0.18.5',\n xmldom: '^0.6.0',\n },\n devDependencies: {\n '@types/node': '^22.5.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,2BAKO;AACP,4BAA8D;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { logger } from '../utils/logger';\nimport {\n getCurrentCheckout,\n setCurrentCheckout,\n clearCurrentTenant,\n saveTenantOrgMapping,\n} from '../services/configService';\nimport { getFarseerClientWithFallback, showLoginPrompt } from '../services/farseerFactory';\nimport type { OrganizationInfo } from '../services/farseerFactory';\nimport { SyncService } from '../services/syncService';\nimport { AppSyncService } from '../services/appSyncService';\nimport { getTenantDir, ensureDirectoryExists } from '../utils/helpers';\nimport { collectValues, normalizeExtensions } from '../utils/cliOptions';\nimport { FARSEER_CLIENT_URL } from '../utils/constants';\nimport { ensureGitignoreEntries } from '../utils/workspace';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// Re-export for tests that import from the original location and for\n// any downstream consumers that already pinned to this path.\nexport { ensureGitignoreEntries };\n\nexport function registerCheckoutCommand(program: Command): void {\n program\n .command('checkout [org] [tenant]')\n .description('Set default tenant for commands (runs auth check and pull)')\n .option('--no-pull', 'Skip automatic pull')\n .option('--clear', 'Clear current checkout')\n .option('--include-ext <ext>', 'Include extra file extension for pull (repeatable)', collectValues, [])\n .option('--include-folder <folder>', 'Include all files in folder for pull (repeatable)', collectValues, [])\n .action(async (first, second, options) => {\n // Handle --clear flag\n if (options.clear) {\n clearCurrentTenant();\n logger.success('Checkout cleared. You now need to specify tenant for each command.');\n return;\n }\n\n // If no arguments specified, show current checkout status\n if (!first) {\n const current = getCurrentCheckout();\n if (current) {\n if (current.organisation === current.tenant) {\n logger.info(`Currently checked out: ${chalk.bold(current.tenant)}`);\n } else {\n logger.info(\n `Currently checked out: ${chalk.bold(current.tenant)} (org: ${chalk.bold(current.organisation)})`,\n );\n }\n logger.dim('Run \"farseer checkout <tenant>\" to switch tenants.');\n logger.dim('Run \"farseer checkout --clear\" to clear checkout.');\n } else {\n logger.info('No tenant currently checked out.');\n logger.dim('Run \"farseer checkout <tenant>\" to set a default tenant.');\n logger.dim('Run \"farseer checkout <org> <tenant>\" if organisation and tenant differ.');\n }\n return;\n }\n\n // Determine organisation and tenant\n // If two arguments: first=organisation, second=tenant\n // If one argument: organisation=tenant=first\n const organisation = second ? first : first;\n const tenant = second || first;\n\n logger.info(`Checking out tenant: ${chalk.bold(tenant)} (org: ${chalk.bold(organisation)})...`);\n console.log();\n\n // Step 1: Verify authentication\n logger.info('Verifying authentication...');\n const clientResult = await getFarseerClientWithFallback(organisation, tenant);\n\n if (!clientResult) {\n showLoginPrompt(tenant);\n process.exit(1);\n }\n\n const authLabel = clientResult.authType === 'apiKey' ? 'API key' : 'browser login';\n\n // Step 2: Confirm the org+tenant pair via /organization \u2014 JWT (browser\n // login) path only. That's the only path where the typed <org> routes\n // the request; the API-key path ignores <org> and resolves host+tenant\n // from the stored credential, and /organization is login-token-shaped\n // (filters by the JWT's roles), so the check is both unnecessary and\n // unanswerable there.\n if (clientResult.authType === 'jwt') {\n logger.info('Verifying tenant belongs to organisation...');\n let orgInfo: OrganizationInfo;\n try {\n orgInfo = await clientResult.client.getOrganizationInfo();\n } catch (error) {\n logger.error(\n `Could not verify that tenant ${chalk.bold(tenant)} belongs to organisation ${chalk.bold(organisation)}.`,\n );\n logger.dim('Checkout aborted \u2014 refusing to set a tenant whose organisation cannot be confirmed.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n process.exit(1);\n }\n\n const orgTenantNames = orgInfo.tenants.map((t) => t.name);\n if (!orgTenantNames.includes(tenant)) {\n logger.error(\n `Tenant ${chalk.bold(tenant)} is not registered under organisation ${chalk.bold(organisation)}.`,\n );\n if (orgTenantNames.length > 0) {\n logger.dim(`Tenants under ${chalk.bold(organisation)}: ${orgTenantNames.join(', ')}`);\n }\n logger.dim('You likely specified the wrong organisation for this tenant. Checkout aborted.');\n process.exit(1);\n }\n }\n\n // Auth and \u2014 on the JWT path \u2014 the org+tenant pairing are now both\n // confirmed. Emit the success only here so a mismatch aborts above\n // without first flashing a misleading \"Authenticated\" check.\n logger.success(`Authenticated (using ${authLabel})`);\n\n // Step 3: Set as current checkout and save org-tenant mapping\n setCurrentCheckout(organisation, tenant);\n saveTenantOrgMapping(tenant, organisation);\n\n // Step 4: Auto-pull (unless --no-pull)\n if (options.pull) {\n console.log();\n logger.info('Pulling latest files and apps...');\n\n const syncService = new SyncService(tenant, clientResult.client);\n const tenantDir = getTenantDir(tenant);\n ensureDirectoryExists(tenantDir);\n\n try {\n // Ensure package.json exists\n const packageJsonPath = path.join(tenantDir, 'package.json');\n if (!fs.existsSync(packageJsonPath)) {\n createDefaultPackageJson(tenant, packageJsonPath);\n }\n\n // Ensure .gitignore exists AND contains the per-machine\n // sync entries. Idempotent on the lines, not on the file\n // \u2014 pre-1.6.2 checkouts and `npm init`-seeded workspaces\n // already have a partial .gitignore (node_modules/) but\n // are missing `.farseer-sync.json`; just checking for\n // file existence leaves those workspaces leaking\n // baseline state into git.\n const gitignorePath = path.join(tenantDir, '.gitignore');\n ensureGitignoreEntries(gitignorePath);\n\n // Pull files (scripts + includes by default)\n const includeExtensions = normalizeExtensions(options.includeExt);\n const includeFolders = options.includeFolder as string[];\n const result = await syncService.pull({\n all: false,\n includeExtensions: includeExtensions.length > 0 ? includeExtensions : undefined,\n includeFolders: includeFolders.length > 0 ? includeFolders : undefined,\n });\n logger.dim(\n `Files: +${result.downloaded.length} -${result.deleted.length} (${result.unchanged.length} unchanged)`,\n );\n\n // Pull apps\n const appSyncService = new AppSyncService(tenant, clientResult.client);\n const appResult = await appSyncService.pull();\n logger.dim(\n `Apps: +${appResult.created.length} ~${appResult.updated.length} -${appResult.deleted.length} (${appResult.unchanged.length} unchanged)`,\n );\n\n logger.success('Pull complete!');\n } catch (error) {\n logger.warning('Pull failed, but checkout is complete.');\n if (error instanceof Error) {\n logger.dim(error.message);\n }\n }\n }\n\n // Final message\n console.log();\n logger.success(`Tenant ${chalk.bold(tenant)} is now checked out.`);\n logger.dim('You can now run commands without specifying the tenant:');\n logger.dim(' farseer status');\n logger.dim(' farseer model --variables');\n logger.dim(' farseer apps');\n logger.dim(' farseer push');\n });\n}\n\nfunction createDefaultPackageJson(tenant: string, packageJsonPath: string): void {\n const packageJson = {\n name: `farseer-${tenant}`,\n version: '1.0.0',\n description: `Farseer scripts for ${tenant}`,\n type: 'module',\n scripts: {\n build: 'tsc',\n },\n dependencies: {\n 'farseer-client': FARSEER_CLIENT_URL,\n arquero: '^7.0.1',\n xlsx: '^0.18.5',\n xmldom: '^0.6.0',\n },\n devDependencies: {\n '@types/node': '^22.5.0',\n '@types/xmldom': '^0.1.34',\n 'ts-node': '^10.9.2',\n typescript: '^5.5.4',\n },\n };\n\n fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');\n logger.dim(`Created package.json for ${tenant}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAClB,oBAAuB;AACvB,2BAKO;AACP,4BAA8D;AAE9D,yBAA4B;AAC5B,4BAA+B;AAC/B,qBAAoD;AACpD,wBAAmD;AACnD,uBAAmC;AACnC,uBAAuC;AACvC,SAAoB;AACpB,WAAsB;AAMf,SAAS,wBAAwB,SAAwB;AAC5D,UACK,QAAQ,yBAAyB,EACjC,YAAY,4DAA4D,EACxE,OAAO,aAAa,qBAAqB,EACzC,OAAO,WAAW,wBAAwB,EAC1C,OAAO,uBAAuB,sDAAsD,iCAAe,CAAC,CAAC,EACrG,OAAO,6BAA6B,qDAAqD,iCAAe,CAAC,CAAC,EAC1G,OAAO,OAAO,OAAO,QAAQ,YAAY;AAEtC,QAAI,QAAQ,OAAO;AACf,mDAAmB;AACnB,2BAAO,QAAQ,oEAAoE;AACnF;AAAA,IACJ;AAGA,QAAI,CAAC,OAAO;AACR,YAAM,cAAU,yCAAmB;AACnC,UAAI,SAAS;AACT,YAAI,QAAQ,iBAAiB,QAAQ,QAAQ;AACzC,+BAAO,KAAK,0BAA0B,aAAAA,QAAM,KAAK,QAAQ,MAAM,CAAC,EAAE;AAAA,QACtE,OAAO;AACH,+BAAO;AAAA,YACH,0BAA0B,aAAAA,QAAM,KAAK,QAAQ,MAAM,CAAC,UAAU,aAAAA,QAAM,KAAK,QAAQ,YAAY,CAAC;AAAA,UAClG;AAAA,QACJ;AACA,6BAAO,IAAI,oDAAoD;AAC/D,6BAAO,IAAI,mDAAmD;AAAA,MAClE,OAAO;AACH,6BAAO,KAAK,kCAAkC;AAC9C,6BAAO,IAAI,0DAA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;AAAA,QAC5B;AAAA,MACJ;AAAA,IACJ;AAGA,YAAQ,IAAI;AACZ,yBAAO,QAAQ,UAAU,aAAAA,QAAM,KAAK,MAAM,CAAC,sBAAsB;AACjE,yBAAO,IAAI,yDAAyD;AACpE,yBAAO,IAAI,kBAAkB;AAC7B,yBAAO,IAAI,6BAA6B;AACxC,yBAAO,IAAI,gBAAgB;AAC3B,yBAAO,IAAI,gBAAgB;AAAA,EAC/B,CAAC;AACT;AAEA,SAAS,yBAAyB,QAAgB,iBAA+B;AAC7E,QAAM,cAAc;AAAA,IAChB,MAAM,WAAW,MAAM;AAAA,IACvB,SAAS;AAAA,IACT,aAAa,uBAAuB,MAAM;AAAA,IAC1C,MAAM;AAAA,IACN,SAAS;AAAA,MACL,OAAO;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACV,kBAAkB;AAAA,MAClB,SAAS;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,IACZ;AAAA,IACA,iBAAiB;AAAA,MACb,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,WAAW;AAAA,MACX,YAAY;AAAA,IAChB;AAAA,EACJ;AAEA,KAAG,cAAc,iBAAiB,KAAK,UAAU,aAAa,MAAM,CAAC,GAAG,OAAO;AAC/E,uBAAO,IAAI,4BAA4B,MAAM,EAAE;AACnD;",
|
|
6
6
|
"names": ["chalk"]
|
|
7
7
|
}
|
|
@@ -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,QAAQ;AAE7B,QAAQ,OAAO,SAAU,MAAc,SAAkB,MAAiB;AACtE,MACI,SAAS,aACT,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,SAAS,wBACd,aAAa,QACb,OAAO,KAAK,YAAY,YACxB,KAAK,QAAQ,SAAS,UAAU,GAClC;AACE,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,MAAM,SAAS,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAC5D;AAQA,6BAAW,KAAK;AAChB,6BAAW,qBAAqB;AA2BhC,MAAM,uBAAuB,QAAQ,KAAK,SAAS,YAAY,IAAI,WAAO,oCAAgB;AAE1F,MAAM,UAAU,IAAI,yBAAQ;AAG5B,QAAQ,cAAc;AAAA,EAClB,iBAAiB,MAAM,CAAC;AAAA;AAC5B,CAAC;AAED,QACK,KAAK,SAAS,EACd,YAAY,qFAAqF,EACjG,QAAQ,4BAAW,EACnB;AAAA,EACG;AAAA,EACA;AAAA,EACN,aAAAA,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AAI,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;AACnC,mBAAqC;AACrC,uBAAyC;AACzC,wBAA0C;AAC1C,sBAAwC;AACxC,wBAAyC;AACzC,oBAAsC;AACtC,wBAA0C;AAC1C,mBAAqC;AACrC,qBAAuC;AACvC,yBAAgC;AAlDhC,MAAM,eAAe,QAAQ;AAE7B,QAAQ,OAAO,SAAU,MAAc,SAAkB,MAAiB;AACtE,MACI,SAAS,aACT,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,SAAS,wBACd,aAAa,QACb,OAAO,KAAK,YAAY,YACxB,KAAK,QAAQ,SAAS,UAAU,GAClC;AACE,WAAO;AAAA,EACX;AAEA,SAAO,aAAa,MAAM,SAAS,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAC5D;AAQA,6BAAW,KAAK;AAChB,6BAAW,qBAAqB;AA2BhC,MAAM,uBAAuB,QAAQ,KAAK,SAAS,YAAY,IAAI,WAAO,oCAAgB;AAE1F,MAAM,UAAU,IAAI,yBAAQ;AAG5B,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G,CAAC,4CAA4C,aAAAA,QAAM,IAAI,oBAAoB,CAAC;AAAA,IAC3F,aAAAA,QAAM,MAAM,GAAG,CAAC,4CAA4C,aAAAA,QAAM,IAAI,uBAAuB,CAAC;AAAA,IAC9F,aAAAA,QAAM,MAAM,GAAG,CAAC,4CAA4C,aAAAA,QAAM,IAAI,uBAAuB,CAAC;AAAA;AAE9F;AAAA,IAGJ,mCAAqB,OAAO;AAAA,IAC5B,qCAAsB,OAAO;AAAA,IAC7B,yCAAwB,OAAO;AAAA,IAC/B,qCAAsB,OAAO;AAAA,IAC7B,iCAAoB,OAAO;AAAA,IAC3B,mCAAqB,OAAO;AAAA,IAC5B,+BAAmB,OAAO;AAAA,IAC1B,2CAAyB,OAAO;AAAA,IAChC,6CAA0B,OAAO;AAAA,IACjC,mCAAqB,OAAO;AAAA,IAC5B,qCAAsB,OAAO;AAAA,IAC7B,iCAAoB,OAAO;AAAA,IAC3B,iCAAoB,OAAO;AAAA,IAC3B,iCAAoB,OAAO;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;AAA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*\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,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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J;AAGA,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,qCAAqC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sDAoB5B,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAoB/B;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/mcp/server.js
CHANGED
|
@@ -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. Do not pass \`tenant\`/\`organisation\` arguments (a different one is rejected), and 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. Do not pass \\`tenant\\`/\\`organisation\\` arguments (a different one is rejected), and 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
|
}
|