@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.
- package/README.md +108 -38
- package/SKILL.md +6 -3
- package/dist/app.d.ts +9 -0
- package/dist/app.js +70 -0
- package/dist/app.js.map +1 -0
- package/dist/config.js +5 -4
- package/dist/config.js.map +1 -1
- package/dist/doctor.d.ts +13 -5
- package/dist/doctor.js +60 -59
- package/dist/doctor.js.map +1 -1
- package/dist/guide.d.ts +5 -0
- package/dist/guide.js +16 -0
- package/dist/guide.js.map +1 -0
- package/dist/index.d.ts +5 -9
- package/dist/index.js +9 -129
- package/dist/index.js.map +1 -1
- package/dist/npx.d.ts +2 -0
- package/dist/npx.js +14 -0
- package/dist/npx.js.map +1 -0
- package/dist/tools/account.js +4 -3
- package/dist/tools/account.js.map +1 -1
- package/dist/tools/kit.d.ts +20 -32
- package/dist/tools/kit.js +63 -56
- package/dist/tools/kit.js.map +1 -1
- package/dist/tools/research.js +4 -3
- package/dist/tools/research.js.map +1 -1
- package/dist/tools/transcripts.js +2 -1
- package/dist/tools/transcripts.js.map +1 -1
- package/dist/youtube/transcripts.d.ts +2 -2
- package/dist/youtube/transcripts.js +5 -3
- package/dist/youtube/transcripts.js.map +1 -1
- package/dist/youtube/ytdlp.js +3 -1
- package/dist/youtube/ytdlp.js.map +1 -1
- package/package.json +12 -8
- package/dist/cli.d.ts +0 -55
- package/dist/cli.js +0 -439
- package/dist/cli.js.map +0 -1
- package/dist/safety.d.ts +0 -50
- package/dist/safety.js +0 -84
- package/dist/safety.js.map +0 -1
- package/dist/server.d.ts +0 -10
- package/dist/server.js +0 -28
- package/dist/server.js.map +0 -1
- package/dist/tools/types.d.ts +0 -6
- package/dist/tools/types.js +0 -2
- package/dist/tools/types.js.map +0 -1
- package/dist/transport/http.d.ts +0 -23
- package/dist/transport/http.js +0 -83
- package/dist/transport/http.js.map +0 -1
package/dist/tools/types.d.ts
DELETED
package/dist/tools/types.js
DELETED
package/dist/tools/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""}
|
package/dist/transport/http.d.ts
DELETED
|
@@ -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
|
-
}>;
|
package/dist/transport/http.js
DELETED
|
@@ -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,EAA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