@ductape/mcp 0.1.53 → 0.1.55
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 +38 -5
- package/package.json +1 -1
- package/scripts/check-frontend-analytics-guidance.mjs +3 -0
- package/src/index.ts +38 -5
package/dist/index.js
CHANGED
|
@@ -1180,7 +1180,14 @@ function checkCli() {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
function checkLoginState() {
|
|
1182
1182
|
try {
|
|
1183
|
-
|
|
1183
|
+
// `ductape whoami` only reports whether a local credentials file exists. It does not validate
|
|
1184
|
+
// the stored token, so an expired token would be cached as authenticated and fail later with 401.
|
|
1185
|
+
// Use a harmless authenticated read to validate the credential against the API.
|
|
1186
|
+
execSync('ductape workspaces list --json', {
|
|
1187
|
+
encoding: 'utf8',
|
|
1188
|
+
timeout: 10000,
|
|
1189
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1190
|
+
});
|
|
1184
1191
|
authState = 'ok';
|
|
1185
1192
|
return 'ok';
|
|
1186
1193
|
}
|
|
@@ -1225,6 +1232,26 @@ function runCli(command) {
|
|
|
1225
1232
|
}
|
|
1226
1233
|
catch (err) {
|
|
1227
1234
|
const msg = (err.stderr || err.stdout || err.message || String(err)).trim();
|
|
1235
|
+
if (/\bHTTP 401\b|unauthori[sz]ed|invalid token|token expired/i.test(msg)) {
|
|
1236
|
+
authState = 'none';
|
|
1237
|
+
workspaceSynced = false;
|
|
1238
|
+
return {
|
|
1239
|
+
success: false,
|
|
1240
|
+
output: [
|
|
1241
|
+
'Ductape CLI authentication expired or was revoked (HTTP 401).',
|
|
1242
|
+
'This administrative operation correctly used ductape_cli; do not retry it through ductape_execute.',
|
|
1243
|
+
'',
|
|
1244
|
+
'Re-authenticate locally in a trusted terminal:',
|
|
1245
|
+
' ductape login',
|
|
1246
|
+
'or use an OAuth flow:',
|
|
1247
|
+
' ductape login --browser google',
|
|
1248
|
+
' ductape login --browser github',
|
|
1249
|
+
'',
|
|
1250
|
+
'Do not paste a password, OAuth callback token, or stored CLI credential into an agent prompt.',
|
|
1251
|
+
'After login succeeds, retry the same ductape_cli command.',
|
|
1252
|
+
].join('\n'),
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1228
1255
|
return { success: false, output: msg };
|
|
1229
1256
|
}
|
|
1230
1257
|
}
|
|
@@ -3688,12 +3715,18 @@ async function main() {
|
|
|
3688
3715
|
content: [{
|
|
3689
3716
|
type: 'text',
|
|
3690
3717
|
text: [
|
|
3691
|
-
'
|
|
3718
|
+
'The Ductape CLI has no remotely valid authenticated session.',
|
|
3719
|
+
'',
|
|
3720
|
+
'Administrative reads and writes must remain on ductape_cli; do not fall back to ductape_execute.',
|
|
3692
3721
|
'',
|
|
3693
|
-
'Ask the user
|
|
3694
|
-
`
|
|
3722
|
+
'Ask the user to re-authenticate in a trusted local terminal:',
|
|
3723
|
+
` ductape login${wsFlag}`,
|
|
3724
|
+
'or:',
|
|
3725
|
+
` ductape login --browser google${wsFlag}`,
|
|
3726
|
+
` ductape login --browser github${wsFlag}`,
|
|
3695
3727
|
'',
|
|
3696
|
-
'
|
|
3728
|
+
'Never ask the user to paste their password, OAuth callback token, or stored CLI credential into the agent.',
|
|
3729
|
+
'After login succeeds, retry the original ductape_cli command.',
|
|
3697
3730
|
].join('\n'),
|
|
3698
3731
|
}],
|
|
3699
3732
|
isError: true,
|
package/package.json
CHANGED
|
@@ -46,6 +46,9 @@ const safetyChecks = [
|
|
|
46
46
|
['resilience decision matrix present', /DECISION MATRIX[\s\S]*Database atomicity/],
|
|
47
47
|
['payload session-awareness metadata present', /session_awareness:[\s\S]*accepts_session/],
|
|
48
48
|
['execute blocks administrative mutations', /Administrative operation.*is blocked in ductape_execute/],
|
|
49
|
+
['CLI auth is remotely validated', /ductape workspaces list --json/],
|
|
50
|
+
['CLI 401 triggers login-required state', /authentication expired or was revoked \(HTTP 401\)[\s\S]*ductape login/],
|
|
51
|
+
['CLI auth guidance does not request secrets', /Never ask the user to paste their password/],
|
|
49
52
|
];
|
|
50
53
|
|
|
51
54
|
for (const [name, pattern] of safetyChecks) {
|
package/src/index.ts
CHANGED
|
@@ -1242,7 +1242,14 @@ function checkCli(): { available: boolean; version?: string } {
|
|
|
1242
1242
|
|
|
1243
1243
|
function checkLoginState(): 'ok' | 'none' {
|
|
1244
1244
|
try {
|
|
1245
|
-
|
|
1245
|
+
// `ductape whoami` only reports whether a local credentials file exists. It does not validate
|
|
1246
|
+
// the stored token, so an expired token would be cached as authenticated and fail later with 401.
|
|
1247
|
+
// Use a harmless authenticated read to validate the credential against the API.
|
|
1248
|
+
execSync('ductape workspaces list --json', {
|
|
1249
|
+
encoding: 'utf8',
|
|
1250
|
+
timeout: 10000,
|
|
1251
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1252
|
+
});
|
|
1246
1253
|
authState = 'ok';
|
|
1247
1254
|
return 'ok';
|
|
1248
1255
|
} catch {
|
|
@@ -1285,6 +1292,26 @@ function runCli(command: string): { success: boolean; output: string } {
|
|
|
1285
1292
|
return { success: true, output: output.trim() };
|
|
1286
1293
|
} catch (err: any) {
|
|
1287
1294
|
const msg = (err.stderr || err.stdout || err.message || String(err)).trim();
|
|
1295
|
+
if (/\bHTTP 401\b|unauthori[sz]ed|invalid token|token expired/i.test(msg)) {
|
|
1296
|
+
authState = 'none';
|
|
1297
|
+
workspaceSynced = false;
|
|
1298
|
+
return {
|
|
1299
|
+
success: false,
|
|
1300
|
+
output: [
|
|
1301
|
+
'Ductape CLI authentication expired or was revoked (HTTP 401).',
|
|
1302
|
+
'This administrative operation correctly used ductape_cli; do not retry it through ductape_execute.',
|
|
1303
|
+
'',
|
|
1304
|
+
'Re-authenticate locally in a trusted terminal:',
|
|
1305
|
+
' ductape login',
|
|
1306
|
+
'or use an OAuth flow:',
|
|
1307
|
+
' ductape login --browser google',
|
|
1308
|
+
' ductape login --browser github',
|
|
1309
|
+
'',
|
|
1310
|
+
'Do not paste a password, OAuth callback token, or stored CLI credential into an agent prompt.',
|
|
1311
|
+
'After login succeeds, retry the same ductape_cli command.',
|
|
1312
|
+
].join('\n'),
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1288
1315
|
return { success: false, output: msg };
|
|
1289
1316
|
}
|
|
1290
1317
|
}
|
|
@@ -3796,12 +3823,18 @@ async function main() {
|
|
|
3796
3823
|
content: [{
|
|
3797
3824
|
type: 'text',
|
|
3798
3825
|
text: [
|
|
3799
|
-
'
|
|
3826
|
+
'The Ductape CLI has no remotely valid authenticated session.',
|
|
3827
|
+
'',
|
|
3828
|
+
'Administrative reads and writes must remain on ductape_cli; do not fall back to ductape_execute.',
|
|
3800
3829
|
'',
|
|
3801
|
-
'Ask the user
|
|
3802
|
-
`
|
|
3830
|
+
'Ask the user to re-authenticate in a trusted local terminal:',
|
|
3831
|
+
` ductape login${wsFlag}`,
|
|
3832
|
+
'or:',
|
|
3833
|
+
` ductape login --browser google${wsFlag}`,
|
|
3834
|
+
` ductape login --browser github${wsFlag}`,
|
|
3803
3835
|
'',
|
|
3804
|
-
'
|
|
3836
|
+
'Never ask the user to paste their password, OAuth callback token, or stored CLI credential into the agent.',
|
|
3837
|
+
'After login succeeds, retry the original ductape_cli command.',
|
|
3805
3838
|
].join('\n'),
|
|
3806
3839
|
}],
|
|
3807
3840
|
isError: true,
|