@plaud-ai/mcp 0.2.4 → 0.3.1

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.
@@ -0,0 +1,15 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
+ }) : x)(function(x) {
5
+ if (typeof require !== "undefined") return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+ var __commonJS = (cb, mod) => function __require2() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+
12
+ export {
13
+ __require,
14
+ __commonJS
15
+ };
@@ -0,0 +1,10 @@
1
+ // src/logger.ts
2
+ import pino from "pino";
3
+ var logger = pino(
4
+ { level: process.env.LOG_LEVEL ?? "info" },
5
+ pino.destination(2)
6
+ );
7
+
8
+ export {
9
+ logger
10
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ PlaudClient,
3
+ capture
4
+ } from "./chunk-R5G6UXSI.js";
5
+ import {
6
+ httpClientDuration,
7
+ httpClientRequests
8
+ } from "./chunk-RUFCT6DQ.js";
9
+
10
+ // src/config.ts
11
+ function buildExtraHeaders() {
12
+ const headers = {};
13
+ if (process.env.PLAUD_ENV) headers["x-pld-env"] = process.env.PLAUD_ENV;
14
+ if (process.env.PLAUD_REGION) headers["x-pld-region"] = process.env.PLAUD_REGION;
15
+ return headers;
16
+ }
17
+ function normalizeEndpoint(path) {
18
+ return path.replace(/\/open\/third-party\/files\/[^/?]+/, "/open/third-party/files/:id").split("?")[0];
19
+ }
20
+ function recordUpstreamRequest(obs) {
21
+ const endpoint = normalizeEndpoint(obs.path);
22
+ httpClientRequests.inc({ host: obs.host, endpoint, status: String(obs.status) });
23
+ httpClientDuration.observe({ host: obs.host, endpoint }, obs.durationMs / 1e3);
24
+ }
25
+ var CONFIG = {
26
+ clientId: process.env.PLAUD_MCP_CLIENT_ID ?? process.env.PLAUD_CLIENT_ID ?? "client_9c501dad-8a0d-40b2-a7b0-d1cb8787f674",
27
+ clientSecret: process.env.PLAUD_CLIENT_SECRET ?? "",
28
+ redirectUri: "http://localhost:8199/auth/callback",
29
+ tokenFile: "tokens-mcp.json",
30
+ apiBase: process.env.PLAUD_API_BASE,
31
+ authorizationUrl: process.env.PLAUD_AUTH_URL,
32
+ tokenUrl: process.env.PLAUD_TOKEN_URL,
33
+ refreshUrl: process.env.PLAUD_REFRESH_URL,
34
+ extraHeaders: buildExtraHeaders(),
35
+ onRequest: recordUpstreamRequest,
36
+ // Background token refresh → passive telemetry event. CLI/stdio only:
37
+ // capture() no-ops in the HTTP server (which never inits frontend telemetry).
38
+ onTokenRefresh: (status, errorType) => capture(`auth:token_refresh:${status}`, { passive: true, ...errorType ? { error_type: errorType } : {} })
39
+ };
40
+ var client = null;
41
+ function getClient() {
42
+ if (!client) {
43
+ client = new PlaudClient(CONFIG);
44
+ }
45
+ return client;
46
+ }
47
+
48
+ export {
49
+ getClient
50
+ };