@plaud-ai/mcp 0.2.3 → 0.2.4
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
|
@@ -18,7 +18,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
18
18
|
import open from "open";
|
|
19
19
|
var server = new McpServer({
|
|
20
20
|
name: "plaud",
|
|
21
|
-
version: "0.2.
|
|
21
|
+
version: "0.2.4"
|
|
22
22
|
});
|
|
23
23
|
var CALLBACK_PORT = 8199;
|
|
24
24
|
var LOGIN_TIMEOUT_MS = 12e4;
|
|
@@ -28,7 +28,20 @@ server.registerTool("login", {
|
|
|
28
28
|
const client = getClient();
|
|
29
29
|
const existingToken = await client.auth.getAccessToken();
|
|
30
30
|
if (existingToken) {
|
|
31
|
-
|
|
31
|
+
try {
|
|
32
|
+
await client.getCurrentUser();
|
|
33
|
+
return { content: [{ type: "text", text: "Already logged in." }] };
|
|
34
|
+
} catch (err) {
|
|
35
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
36
|
+
if (msg.includes("401") || msg.includes("Not authenticated")) {
|
|
37
|
+
await client.auth.logout();
|
|
38
|
+
} else {
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: `Failed to verify login state: ${msg}` }],
|
|
41
|
+
isError: true
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
32
45
|
}
|
|
33
46
|
const { url, codeVerifier, state } = client.auth.createAuthorizationRequest();
|
|
34
47
|
const result = await runOAuthCallback({
|
|
@@ -104,7 +117,7 @@ async function main() {
|
|
|
104
117
|
const sub = process.argv[2];
|
|
105
118
|
const sub2 = process.argv[3];
|
|
106
119
|
if (sub === "install") {
|
|
107
|
-
const { runInstall } = await import("./install-
|
|
120
|
+
const { runInstall } = await import("./install-ALLWR7CL.js");
|
|
108
121
|
const args = process.argv.slice(3);
|
|
109
122
|
const yes = args.some((a) => a === "--yes" || a === "-y");
|
|
110
123
|
const noLogin = args.some((a) => a === "--no-login");
|
|
@@ -137,7 +150,7 @@ async function main() {
|
|
|
137
150
|
return;
|
|
138
151
|
}
|
|
139
152
|
if (sub === "http") {
|
|
140
|
-
const { startHttpServer } = await import("./server-
|
|
153
|
+
const { startHttpServer } = await import("./server-VY7ANVCH.js");
|
|
141
154
|
startHttpServer();
|
|
142
155
|
return;
|
|
143
156
|
}
|
|
@@ -411,8 +411,13 @@ async function runLogin() {
|
|
|
411
411
|
try {
|
|
412
412
|
const user = await client.getCurrentUser();
|
|
413
413
|
return { status: "already-authed", who: pickIdentity(user) };
|
|
414
|
-
} catch {
|
|
415
|
-
|
|
414
|
+
} catch (err) {
|
|
415
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
416
|
+
if (msg.includes("401") || msg.includes("Not authenticated")) {
|
|
417
|
+
await client.auth.logout().catch(() => void 0);
|
|
418
|
+
} else {
|
|
419
|
+
return { status: "already-authed" };
|
|
420
|
+
}
|
|
416
421
|
}
|
|
417
422
|
}
|
|
418
423
|
} catch {
|
|
@@ -534,8 +539,14 @@ async function doLoginStep(nonInteractive) {
|
|
|
534
539
|
const who = pickIdentity(user);
|
|
535
540
|
console.log(` already signed in${who ? ` as ${who}` : ""} \u2014 skipping OAuth.`);
|
|
536
541
|
return { status: "already-authed", who };
|
|
537
|
-
} catch {
|
|
538
|
-
|
|
542
|
+
} catch (err) {
|
|
543
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
544
|
+
if (msg.includes("401") || msg.includes("Not authenticated")) {
|
|
545
|
+
console.log(" saved token was revoked server-side \u2014 clearing and re-authenticating.");
|
|
546
|
+
await client.auth.logout().catch(() => void 0);
|
|
547
|
+
} else {
|
|
548
|
+
console.log(" token present but user lookup failed \u2014 will re-auth.");
|
|
549
|
+
}
|
|
539
550
|
}
|
|
540
551
|
}
|
|
541
552
|
} catch {
|
|
@@ -982,7 +982,7 @@ function startHttpServer() {
|
|
|
982
982
|
apiBase,
|
|
983
983
|
staticToken: token
|
|
984
984
|
});
|
|
985
|
-
const mcpServer = new McpServer({ name: "plaud", version: "0.2.
|
|
985
|
+
const mcpServer = new McpServer({ name: "plaud", version: "0.2.4" });
|
|
986
986
|
registerTools(mcpServer, client);
|
|
987
987
|
const transport = new StreamableHTTPServerTransport({
|
|
988
988
|
sessionIdGenerator: void 0,
|
package/package.json
CHANGED