@ductape/mcp 0.1.55 → 0.1.56

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/index.js CHANGED
@@ -1233,6 +1233,21 @@ function runCli(command) {
1233
1233
  catch (err) {
1234
1234
  const msg = (err.stderr || err.stdout || err.message || String(err)).trim();
1235
1235
  if (/\bHTTP 401\b|unauthori[sz]ed|invalid token|token expired/i.test(msg)) {
1236
+ // Distinguish a genuinely expired login from a command-specific endpoint/auth bug.
1237
+ // A valid workspace read proves the CLI session and selected workspace are authenticated.
1238
+ if (checkLoginState() === 'ok') {
1239
+ return {
1240
+ success: false,
1241
+ output: [
1242
+ 'The Ductape CLI session and active workspace are authenticated, but this command endpoint returned HTTP 401.',
1243
+ 'Do not ask the user to log in again and do not retry through ductape_execute.',
1244
+ 'This indicates a CLI command routing or endpoint authorization problem.',
1245
+ '',
1246
+ 'Update the Ductape CLI to the latest version and retry the same ductape_cli command.',
1247
+ `Original command: ductape ${command}`,
1248
+ ].join('\n'),
1249
+ };
1250
+ }
1236
1251
  authState = 'none';
1237
1252
  workspaceSynced = false;
1238
1253
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,6 +48,7 @@ const safetyChecks = [
48
48
  ['execute blocks administrative mutations', /Administrative operation.*is blocked in ductape_execute/],
49
49
  ['CLI auth is remotely validated', /ductape workspaces list --json/],
50
50
  ['CLI 401 triggers login-required state', /authentication expired or was revoked \(HTTP 401\)[\s\S]*ductape login/],
51
+ ['CLI distinguishes endpoint 401 from expired login', /session and active workspace are authenticated[\s\S]*Do not ask the user to log in again/],
51
52
  ['CLI auth guidance does not request secrets', /Never ask the user to paste their password/],
52
53
  ];
53
54
 
package/src/index.ts CHANGED
@@ -1293,6 +1293,21 @@ function runCli(command: string): { success: boolean; output: string } {
1293
1293
  } catch (err: any) {
1294
1294
  const msg = (err.stderr || err.stdout || err.message || String(err)).trim();
1295
1295
  if (/\bHTTP 401\b|unauthori[sz]ed|invalid token|token expired/i.test(msg)) {
1296
+ // Distinguish a genuinely expired login from a command-specific endpoint/auth bug.
1297
+ // A valid workspace read proves the CLI session and selected workspace are authenticated.
1298
+ if (checkLoginState() === 'ok') {
1299
+ return {
1300
+ success: false,
1301
+ output: [
1302
+ 'The Ductape CLI session and active workspace are authenticated, but this command endpoint returned HTTP 401.',
1303
+ 'Do not ask the user to log in again and do not retry through ductape_execute.',
1304
+ 'This indicates a CLI command routing or endpoint authorization problem.',
1305
+ '',
1306
+ 'Update the Ductape CLI to the latest version and retry the same ductape_cli command.',
1307
+ `Original command: ductape ${command}`,
1308
+ ].join('\n'),
1309
+ };
1310
+ }
1296
1311
  authState = 'none';
1297
1312
  workspaceSynced = false;
1298
1313
  return {