@thenavidm/youtube-mcp-cli 2.0.0 → 3.0.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.
Files changed (49) hide show
  1. package/README.md +108 -38
  2. package/SKILL.md +6 -3
  3. package/dist/app.d.ts +9 -0
  4. package/dist/app.js +70 -0
  5. package/dist/app.js.map +1 -0
  6. package/dist/config.js +5 -4
  7. package/dist/config.js.map +1 -1
  8. package/dist/doctor.d.ts +13 -5
  9. package/dist/doctor.js +60 -59
  10. package/dist/doctor.js.map +1 -1
  11. package/dist/guide.d.ts +5 -0
  12. package/dist/guide.js +16 -0
  13. package/dist/guide.js.map +1 -0
  14. package/dist/index.d.ts +5 -9
  15. package/dist/index.js +9 -129
  16. package/dist/index.js.map +1 -1
  17. package/dist/npx.d.ts +2 -0
  18. package/dist/npx.js +14 -0
  19. package/dist/npx.js.map +1 -0
  20. package/dist/tools/account.js +4 -3
  21. package/dist/tools/account.js.map +1 -1
  22. package/dist/tools/kit.d.ts +20 -32
  23. package/dist/tools/kit.js +63 -56
  24. package/dist/tools/kit.js.map +1 -1
  25. package/dist/tools/research.js +4 -3
  26. package/dist/tools/research.js.map +1 -1
  27. package/dist/tools/transcripts.js +2 -1
  28. package/dist/tools/transcripts.js.map +1 -1
  29. package/dist/youtube/transcripts.d.ts +2 -2
  30. package/dist/youtube/transcripts.js +5 -3
  31. package/dist/youtube/transcripts.js.map +1 -1
  32. package/dist/youtube/ytdlp.js +3 -1
  33. package/dist/youtube/ytdlp.js.map +1 -1
  34. package/package.json +12 -8
  35. package/dist/cli.d.ts +0 -55
  36. package/dist/cli.js +0 -439
  37. package/dist/cli.js.map +0 -1
  38. package/dist/safety.d.ts +0 -50
  39. package/dist/safety.js +0 -84
  40. package/dist/safety.js.map +0 -1
  41. package/dist/server.d.ts +0 -10
  42. package/dist/server.js +0 -28
  43. package/dist/server.js.map +0 -1
  44. package/dist/tools/types.d.ts +0 -6
  45. package/dist/tools/types.js +0 -2
  46. package/dist/tools/types.js.map +0 -1
  47. package/dist/transport/http.d.ts +0 -23
  48. package/dist/transport/http.js +0 -83
  49. package/dist/transport/http.js.map +0 -1
@@ -1,6 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import type { Config } from "../config.js";
3
- export type ToolContext = {
4
- config: Config;
5
- };
6
- export type ToolModule = (server: McpServer, ctx: ToolContext) => void;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- /**
2
- * HTTP transport, for running the server somewhere always on.
3
- *
4
- * Streamable HTTP per the 2025-03-26 spec, stateless: every request builds its
5
- * own transport and tears it down. No session map means no session leak, which
6
- * matters more here than the reconnect support a stateful server would buy.
7
- *
8
- * Bound to 127.0.0.1 by default. A connected refresh token can upload to and
9
- * delete from a real channel, so a server that binds 0.0.0.0 without being
10
- * asked is a mistake that only has to be made once. YOUTUBE_HTTP_HOST is there
11
- * for people who mean it, and YOUTUBE_HTTP_TOKEN should be set with it.
12
- */
13
- import type { BuiltServer } from "../server.js";
14
- export type HttpOptions = {
15
- port: number;
16
- host: string;
17
- /** When set, every request must send `Authorization: Bearer <token>`. */
18
- token?: string;
19
- };
20
- export declare function httpOptionsFromEnv(argv?: string[]): HttpOptions;
21
- export declare function startHttpServer(built: BuiltServer, options: HttpOptions): Promise<{
22
- close: () => Promise<void>;
23
- }>;
@@ -1,83 +0,0 @@
1
- /**
2
- * HTTP transport, for running the server somewhere always on.
3
- *
4
- * Streamable HTTP per the 2025-03-26 spec, stateless: every request builds its
5
- * own transport and tears it down. No session map means no session leak, which
6
- * matters more here than the reconnect support a stateful server would buy.
7
- *
8
- * Bound to 127.0.0.1 by default. A connected refresh token can upload to and
9
- * delete from a real channel, so a server that binds 0.0.0.0 without being
10
- * asked is a mistake that only has to be made once. YOUTUBE_HTTP_HOST is there
11
- * for people who mean it, and YOUTUBE_HTTP_TOKEN should be set with it.
12
- */
13
- import { createServer } from "node:http";
14
- import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
15
- export function httpOptionsFromEnv(argv = []) {
16
- const flag = argv.find((a) => a.startsWith("--port="));
17
- const port = Number(flag?.split("=")[1] ?? process.env.YOUTUBE_HTTP_PORT ?? 8787);
18
- return {
19
- port: Number.isFinite(port) && port > 0 ? port : 8787,
20
- host: process.env.YOUTUBE_HTTP_HOST || "127.0.0.1",
21
- token: process.env.YOUTUBE_HTTP_TOKEN || undefined,
22
- };
23
- }
24
- async function readBody(req) {
25
- const chunks = [];
26
- for await (const chunk of req)
27
- chunks.push(chunk);
28
- const raw = Buffer.concat(chunks).toString("utf8");
29
- if (!raw)
30
- return undefined;
31
- try {
32
- return JSON.parse(raw);
33
- }
34
- catch {
35
- return undefined;
36
- }
37
- }
38
- export async function startHttpServer(built, options) {
39
- const http = createServer((req, res) => {
40
- void handle(built, options, req, res).catch((error) => {
41
- if (!res.headersSent)
42
- res.writeHead(500, { "content-type": "application/json" });
43
- res.end(JSON.stringify({
44
- jsonrpc: "2.0",
45
- error: { code: -32603, message: error?.message ?? "internal error" },
46
- id: null,
47
- }));
48
- });
49
- });
50
- await new Promise((resolve) => http.listen(options.port, options.host, resolve));
51
- process.stderr.write(`[youtube-mcp] listening on http://${options.host}:${options.port}/mcp${options.token ? " (bearer token required)" : ""}\n`);
52
- return {
53
- close: () => new Promise((resolve) => {
54
- http.close(() => resolve());
55
- }),
56
- };
57
- }
58
- async function handle(built, options, req, res) {
59
- if (req.url === "/health") {
60
- res.writeHead(200, { "content-type": "application/json" });
61
- res.end(JSON.stringify({ ok: true, tools: built.toolCount, accounts: built.config.accounts.length }));
62
- return;
63
- }
64
- if (options.token) {
65
- if ((req.headers.authorization ?? "") !== `Bearer ${options.token}`) {
66
- res.writeHead(401, { "content-type": "application/json" });
67
- res.end(JSON.stringify({ error: "unauthorized" }));
68
- return;
69
- }
70
- }
71
- if (req.method === "DELETE") {
72
- // Stateless: there is no session to end, and saying so beats a 404.
73
- res.writeHead(204).end();
74
- return;
75
- }
76
- // A fresh transport per request. `sessionIdGenerator: undefined` is what puts
77
- // the SDK into stateless mode.
78
- const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
79
- res.on("close", () => void transport.close());
80
- await built.server.connect(transport);
81
- await transport.handleRequest(req, res, await readBody(req));
82
- }
83
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/transport/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAUnG,MAAM,UAAU,kBAAkB,CAAC,OAAiB,EAAE;IACpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC;IAClF,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QACrD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,WAAW;QAClD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS;KACnD,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,GAAoB;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;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