mcp-multi-jira 0.1.1 → 0.1.2
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/cli.js +4 -0
- package/dist/oauth/atlassian.js +13 -1
- package/dist/oauth/client-info-store.js +12 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -369,6 +369,7 @@ async function fetchUserEmail(session, toolNames) {
|
|
|
369
369
|
}
|
|
370
370
|
async function handleLogin(alias, options) {
|
|
371
371
|
const config = await loadConfig();
|
|
372
|
+
const existingAccount = Boolean(config.accounts[alias]);
|
|
372
373
|
if (config.accounts[alias]) {
|
|
373
374
|
const overwrite = await confirm({
|
|
374
375
|
message: `Account alias "${alias}" already exists. Re-authenticate and overwrite?`,
|
|
@@ -384,6 +385,9 @@ async function handleLogin(alias, options) {
|
|
|
384
385
|
const tokenStore = await createTokenStore({
|
|
385
386
|
store: tokenStoreKind,
|
|
386
387
|
});
|
|
388
|
+
if (existingAccount) {
|
|
389
|
+
await tokenStore.remove(alias);
|
|
390
|
+
}
|
|
387
391
|
const staticClientInfo = getStaticClientInfoFromEnv(options);
|
|
388
392
|
await loginWithDynamicOAuth({
|
|
389
393
|
alias,
|
package/dist/oauth/atlassian.js
CHANGED
|
@@ -5,7 +5,7 @@ import { auth, discoverAuthorizationServerMetadata, discoverOAuthProtectedResour
|
|
|
5
5
|
import getPort from "get-port";
|
|
6
6
|
import open from "open";
|
|
7
7
|
import { debug, info, warn } from "../utils/log.js";
|
|
8
|
-
import { readClientInfo, writeClientInfo } from "./client-info-store.js";
|
|
8
|
+
import { deleteClientInfo, readClientInfo, writeClientInfo, } from "./client-info-store.js";
|
|
9
9
|
export const DEFAULT_SCOPES = [
|
|
10
10
|
"offline_access",
|
|
11
11
|
"read:jira-work",
|
|
@@ -156,6 +156,18 @@ export class LocalOAuthProvider {
|
|
|
156
156
|
}
|
|
157
157
|
return this.codeVerifierValue;
|
|
158
158
|
}
|
|
159
|
+
async invalidateCredentials(scope) {
|
|
160
|
+
if (scope === "verifier" || scope === "all") {
|
|
161
|
+
this.codeVerifierValue = undefined;
|
|
162
|
+
}
|
|
163
|
+
if (scope === "tokens" || scope === "all") {
|
|
164
|
+
await this.tokenStore.remove(this.alias);
|
|
165
|
+
}
|
|
166
|
+
if ((scope === "client" || scope === "all") && !this.staticClientInfo) {
|
|
167
|
+
this.clientInfoCache = null;
|
|
168
|
+
await deleteClientInfo(MCP_SERVER_URL);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
159
171
|
}
|
|
160
172
|
function extractRedirectUriFromClientInfo(clientInfo) {
|
|
161
173
|
if (!clientInfo || typeof clientInfo !== "object") {
|
|
@@ -22,6 +22,18 @@ export async function readClientInfo(serverUrl) {
|
|
|
22
22
|
throw err;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
export async function deleteClientInfo(serverUrl) {
|
|
26
|
+
const filePath = clientInfoPath(serverUrl);
|
|
27
|
+
try {
|
|
28
|
+
await fs.unlink(filePath);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (err.code === "ENOENT") {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
throw err;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
25
37
|
export async function writeClientInfo(serverUrl, info) {
|
|
26
38
|
const filePath = clientInfoPath(serverUrl);
|
|
27
39
|
await ensureDir(path.dirname(filePath));
|