@pi-archimedes/mcp 2.6.2 → 2.6.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/auth-flow.ts +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-archimedes/mcp",
3
- "version": "2.6.2",
3
+ "version": "2.6.3",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -17,7 +17,7 @@
17
17
  "@modelcontextprotocol/sdk": "^1.30.0",
18
18
  "@napi-rs/keyring": "^1.3.0",
19
19
  "open": "^10.2.0",
20
- "@pi-archimedes/core": "2.6.2"
20
+ "@pi-archimedes/core": "2.6.3"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@earendil-works/pi-coding-agent": ">=0.1.0",
package/src/auth-flow.ts CHANGED
@@ -33,7 +33,7 @@
33
33
 
34
34
  import { auth } from "@modelcontextprotocol/sdk/client/auth.js";
35
35
 
36
- import { getAuthEntry } from "./auth-storage.js";
36
+ import { getAuthEntry, saveAuthEntry } from "./auth-storage.js";
37
37
  import { ensureCallbackServer, reserveAuthState, waitForCallback } from "./callback-server.js";
38
38
  import { McpOAuthProvider, type OAuthCallbacks } from "./oauth-provider.js";
39
39
  import { OAUTH_CONFIG_FIELDS, type McpOAuthConfig } from "./types.js";
@@ -267,6 +267,17 @@ export async function authenticate(
267
267
  return { status: "needs-interaction" };
268
268
  }
269
269
 
270
+ // If there is stored clientInfo but no tokens, the previous DCR
271
+ // registration was never completed (or tokens were cleared). Wipe the
272
+ // clientInfo so the SDK runs a fresh DCR with the current boundPort —
273
+ // otherwise it reuses the old redirectUri (a different port) and
274
+ // Atlassian/other servers redirect back to a listener that isn't running.
275
+ const existing = getAuthEntry(serverName);
276
+ if (existing?.clientInfo && !existing.tokens) {
277
+ const { clientInfo: _drop, ...withoutClient } = existing;
278
+ saveAuthEntry(serverName, withoutClient, serverUrl);
279
+ }
280
+
270
281
  const provider = new McpOAuthProvider(
271
282
  serverName,
272
283
  serverUrl,