@mkterswingman/5mghost-yonder 0.0.1 → 0.0.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.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * `yt-mcp check` — verify token, cookies, yt-dlp, and remote API connectivity.
3
+ */
4
+ export declare function runCheck(): Promise<void>;
@@ -0,0 +1,87 @@
1
+ import { existsSync } from "node:fs";
2
+ import { PATHS, loadConfig } from "../utils/config.js";
3
+ import { TokenManager } from "../auth/tokenManager.js";
4
+ import { hasSIDCookies, areCookiesExpired } from "../utils/cookies.js";
5
+ import { getYtDlpVersion } from "../utils/ytdlpPath.js";
6
+ /**
7
+ * `yt-mcp check` — verify token, cookies, yt-dlp, and remote API connectivity.
8
+ */
9
+ export async function runCheck() {
10
+ const config = loadConfig();
11
+ const tm = new TokenManager(config.auth_url);
12
+ console.log("yt-mcp check\n");
13
+ // 1. Token
14
+ const token = await tm.getValidToken();
15
+ if (token) {
16
+ const masked = token.slice(0, 8) + "...";
17
+ const source = process.env.YT_MCP_TOKEN ? "env" : "auth.json";
18
+ console.log(`🔑 Token: ✅ present (${masked}) [${source}]`);
19
+ // Server verification
20
+ try {
21
+ const res = await fetch(`${config.auth_url}/api/me`, {
22
+ headers: { Authorization: `Bearer ${token}` },
23
+ signal: AbortSignal.timeout(10_000),
24
+ });
25
+ if (res.ok) {
26
+ console.log("🔐 Server verification: ✅ active");
27
+ }
28
+ else {
29
+ console.log(`🔐 Server verification: ❌ ${res.status} ${res.statusText}`);
30
+ console.log(" Run `yt-mcp setup` to re-authenticate.");
31
+ }
32
+ }
33
+ catch (err) {
34
+ const msg = err instanceof Error ? err.message : String(err);
35
+ console.log(`🔐 Server verification: ⚠️ unreachable (${msg})`);
36
+ }
37
+ }
38
+ else {
39
+ console.log("🔑 Token: ❌ not configured");
40
+ console.log(" Run `yt-mcp setup` or set YT_MCP_TOKEN env var");
41
+ }
42
+ // 2. Cookies
43
+ if (existsSync(PATHS.cookiesTxt)) {
44
+ const hasSID = hasSIDCookies(PATHS.cookiesTxt);
45
+ const expired = areCookiesExpired(PATHS.cookiesTxt);
46
+ if (hasSID && !expired) {
47
+ console.log("🍪 Cookies: ✅ valid (SID present, not expired)");
48
+ }
49
+ else if (hasSID && expired) {
50
+ console.log("🍪 Cookies: ❌ expired");
51
+ console.log(" Run `yt-mcp setup-cookies` to refresh");
52
+ }
53
+ else {
54
+ console.log("🍪 Cookies: ❌ no YouTube session cookies found");
55
+ console.log(" Run `yt-mcp setup-cookies`");
56
+ }
57
+ }
58
+ else {
59
+ console.log("🍪 Cookies: ❌ not found");
60
+ console.log(" Run `yt-mcp setup-cookies`");
61
+ }
62
+ // 3. yt-dlp
63
+ const ytdlp = getYtDlpVersion();
64
+ if (ytdlp) {
65
+ console.log(`🎬 yt-dlp: ✅ ${ytdlp.version} (${ytdlp.source})`);
66
+ }
67
+ else {
68
+ console.log("🎬 yt-dlp: ❌ not found");
69
+ console.log(" Install: brew install yt-dlp (or pip install yt-dlp)");
70
+ }
71
+ // 4. Remote API
72
+ try {
73
+ const res = await fetch(`${config.api_url}/healthz`, {
74
+ signal: AbortSignal.timeout(10_000),
75
+ });
76
+ if (res.ok) {
77
+ console.log(`🌐 Remote API: ✅ reachable (${config.api_url})`);
78
+ }
79
+ else {
80
+ console.log(`🌐 Remote API: ⚠️ ${res.status} ${res.statusText}`);
81
+ }
82
+ }
83
+ catch (err) {
84
+ const msg = err instanceof Error ? err.message : String(err);
85
+ console.log(`🌐 Remote API: ❌ unreachable (${msg})`);
86
+ }
87
+ }
package/dist/cli/index.js CHANGED
@@ -27,6 +27,11 @@ async function main() {
27
27
  await runServe();
28
28
  break;
29
29
  }
30
+ case "check": {
31
+ const { runCheck } = await import("./check.js");
32
+ await runCheck();
33
+ break;
34
+ }
30
35
  case "setup-cookies": {
31
36
  const { runSetupCookies } = await import("./setupCookies.js");
32
37
  await runSetupCookies();
@@ -76,6 +81,7 @@ Usage: yt-mcp <command>
76
81
  Commands:
77
82
  setup Run first-time setup (OAuth + cookies + MCP registration)
78
83
  serve Start the MCP server (stdio transport)
84
+ check Check token, cookies, yt-dlp, and API connectivity
79
85
  setup-cookies Refresh YouTube cookies using browser login
80
86
  update Update to the latest version
81
87
  version Show current version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkterswingman/5mghost-yonder",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Internal MCP client with local data tools and remote API proxy",
5
5
  "type": "module",
6
6
  "bin": {