scm-claude-tools 1.0.0 → 1.1.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.
Files changed (2) hide show
  1. package/mcp-stdio-proxy.js +14 -3
  2. package/package.json +1 -1
@@ -39,7 +39,7 @@
39
39
  */
40
40
 
41
41
  const { createServer } = require("node:http");
42
- const { readFileSync, writeFileSync, existsSync, mkdirSync } = require("node:fs");
42
+ const { readFileSync, writeFileSync, existsSync, mkdirSync, unlinkSync } = require("node:fs");
43
43
  const { join } = require("node:path");
44
44
  const { randomBytes, createHash } = require("node:crypto");
45
45
  const { execSync } = require("node:child_process");
@@ -96,6 +96,11 @@ function generateToken() {
96
96
  return randomBytes(32).toString("hex");
97
97
  }
98
98
 
99
+ function clearLocalAuth() {
100
+ try { unlinkSync(TOKENS_FILE); } catch {}
101
+ try { unlinkSync(CLIENT_FILE); } catch {}
102
+ }
103
+
99
104
  function base64url(buf) {
100
105
  return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
101
106
  }
@@ -166,7 +171,12 @@ async function refreshAccessToken(metadata, client, refreshToken) {
166
171
  body: params.toString(),
167
172
  });
168
173
 
169
- if (!res.ok) return null;
174
+ if (!res.ok) {
175
+ // Refresh token expired or revoked — clear local auth so user re-authenticates
176
+ log("Refresh token rejected, clearing local auth...");
177
+ clearLocalAuth();
178
+ return null;
179
+ }
170
180
  const tokens = await res.json();
171
181
  saveJson(TOKENS_FILE, tokens);
172
182
  return tokens;
@@ -433,7 +443,8 @@ async function main() {
433
443
  accessToken = await getAccessToken();
434
444
  await forwardToRemote(message);
435
445
  } catch {
436
- log("Re-auth failed");
446
+ log("Re-auth failed, clearing local auth...");
447
+ clearLocalAuth();
437
448
  process.exit(1);
438
449
  }
439
450
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scm-claude-tools",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "MCP proxy for State & Liberty SCM tools — connects Claude Desktop to the remote SCM MCP server",
5
5
  "bin": {
6
6
  "scm-claude-tools": "mcp-stdio-proxy.js"