@jieunmarslim/server-editable-slides 0.2.2 → 0.2.3
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/index.js +51 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -344,7 +344,58 @@ async function downloadPptxHelper(downloadUrl, targetPath) {
|
|
|
344
344
|
return null;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
function assertEnvironmentOrExit() {
|
|
348
|
+
const account = getAccount();
|
|
349
|
+
const token = getAuthToken();
|
|
350
|
+
const project = getProject();
|
|
351
|
+
|
|
352
|
+
if (!account || !token) {
|
|
353
|
+
console.error('\n[EditNBLM] ❌ Activation Failed: Google Cloud authentication required.');
|
|
354
|
+
console.error('[EditNBLM] Please run `gcloud auth login` before activating this MCP server.');
|
|
355
|
+
console.error('[EditNBLM] Run `npx -y @jieunmarslim/server-editable-slides doctor` to diagnose.\n');
|
|
356
|
+
process.exit(1);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (!project) {
|
|
360
|
+
console.error('\n[EditNBLM] ❌ Activation Failed: No GCP Project configured for GEAP billing.');
|
|
361
|
+
console.error('[EditNBLM] Please run `gcloud config set project <PROJECT_ID>` or export EDITABLE_SLIDES_PROJECT.');
|
|
362
|
+
console.error('[EditNBLM] Run `npx -y @jieunmarslim/server-editable-slides doctor` to diagnose.\n');
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Verify that account actually has permission to access the project
|
|
367
|
+
try {
|
|
368
|
+
const check = execSync(
|
|
369
|
+
`gcloud projects describe ${project} --format="value(projectId)"`,
|
|
370
|
+
{ stdio: ['ignore', 'pipe', 'pipe'] },
|
|
371
|
+
)
|
|
372
|
+
.toString()
|
|
373
|
+
.trim();
|
|
374
|
+
if (check !== project) {
|
|
375
|
+
throw new Error(`Project mismatch`);
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
const stderr = err.stderr ? err.stderr.toString() : err.message;
|
|
379
|
+
console.error(`\n[EditNBLM] ❌ Activation Failed: Account [${account}] does NOT have access to project [${project}].`);
|
|
380
|
+
if (
|
|
381
|
+
stderr.includes('does not have permission') ||
|
|
382
|
+
stderr.includes('caller does not have permission')
|
|
383
|
+
) {
|
|
384
|
+
console.error(`[EditNBLM] 👉 Solution 1: Switch to an account with access: gcloud config set account <ACCOUNT>`);
|
|
385
|
+
console.error(`[EditNBLM] 👉 Solution 2: Switch to a project that [${account}] can access: gcloud config set project <PROJECT>`);
|
|
386
|
+
} else if (stderr.includes('not found') || stderr.includes('404')) {
|
|
387
|
+
console.error(`[EditNBLM] 👉 Project [${project}] does not exist. Run: gcloud config set project <VALID_PROJECT_ID>`);
|
|
388
|
+
} else {
|
|
389
|
+
console.error(`[EditNBLM] 👉 Details: ${stderr.trim()}`);
|
|
390
|
+
}
|
|
391
|
+
console.error('[EditNBLM] Run `npx -y @jieunmarslim/server-editable-slides doctor` to diagnose.\n');
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
347
396
|
function startMcpServer() {
|
|
397
|
+
assertEnvironmentOrExit();
|
|
398
|
+
|
|
348
399
|
const server = new McpServer({
|
|
349
400
|
name: 'editable-slides',
|
|
350
401
|
version: '1.0.0',
|