@tacitai/mcp-server 0.6.43 → 0.6.44
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/dist/setup.js +16 -2
- package/package.json +1 -1
package/dist/setup.js
CHANGED
|
@@ -423,7 +423,11 @@ async function loginFlow(apiUrl) {
|
|
|
423
423
|
process.stderr.write('\n Login failed — check your email and PIN.\n');
|
|
424
424
|
}
|
|
425
425
|
else {
|
|
426
|
-
|
|
426
|
+
const isHtml = body.trimStart().startsWith('<!') || body.trimStart().startsWith('<html');
|
|
427
|
+
const detail = isHtml
|
|
428
|
+
? `The server returned an HTML page instead of a JSON response.\n This usually means --api-url points to the web app, not the API.\n Try without --api-url (the default is correct for most users),\n or use the API URL (e.g. https://api-beta.tacitai.app).`
|
|
429
|
+
: body.slice(0, 200);
|
|
430
|
+
process.stderr.write(`\n Login failed (${res.status}): ${detail}\n`);
|
|
427
431
|
}
|
|
428
432
|
process.exit(1);
|
|
429
433
|
}
|
|
@@ -471,7 +475,17 @@ async function runSmoke(apiUrl, token) {
|
|
|
471
475
|
export async function setup(argv) {
|
|
472
476
|
const opts = parseArgs(argv);
|
|
473
477
|
// Resolve api-url: flag > env > default.
|
|
474
|
-
|
|
478
|
+
let apiUrl = opts.apiUrl ?? process.env['TACIT_API_URL'] ?? 'https://api-beta.tacitai.app';
|
|
479
|
+
// Auto-correct common mistake: frontend URL (beta.tacitai.app) → API URL (api-beta.tacitai.app).
|
|
480
|
+
try {
|
|
481
|
+
const parsed = new URL(apiUrl);
|
|
482
|
+
if (/^(?!api[-.]).*\.tacitai\.app$/.test(parsed.hostname)) {
|
|
483
|
+
const corrected = `${parsed.protocol}//api-${parsed.hostname}`;
|
|
484
|
+
process.stderr.write(`\n Note: ${apiUrl} looks like the web app URL.\n Using API URL instead: ${corrected}\n\n`);
|
|
485
|
+
apiUrl = corrected;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
catch { /* invalid URL — let it fail naturally downstream */ }
|
|
475
489
|
// Determine profile and token.
|
|
476
490
|
let profile = opts.profile;
|
|
477
491
|
let token = opts.token;
|