@mkterswingman/yt-mcp 0.1.0 → 0.1.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.
@@ -18,14 +18,25 @@ function createRemoteTool(server, def, tokenManager, apiUrl) {
18
18
  }
19
19
  let res;
20
20
  try {
21
- res = await fetch(`${apiUrl}/${def.remotePath}`, {
22
- method: "POST",
23
- headers: {
24
- Authorization: `Bearer ${token}`,
25
- "Content-Type": "application/json",
26
- },
27
- body: JSON.stringify(params),
28
- });
21
+ const method = def.method ?? "POST";
22
+ const url = new URL(`${apiUrl}/${def.remotePath}`);
23
+ const headers = {
24
+ Authorization: `Bearer ${token}`,
25
+ };
26
+ const fetchOptions = { method, headers };
27
+ if (method === "GET") {
28
+ // For GET requests, pass params as query string
29
+ for (const [key, value] of Object.entries(params)) {
30
+ if (value !== undefined && value !== null) {
31
+ url.searchParams.set(key, String(value));
32
+ }
33
+ }
34
+ }
35
+ else {
36
+ headers["Content-Type"] = "application/json";
37
+ fetchOptions.body = JSON.stringify(params);
38
+ }
39
+ res = await fetch(url.toString(), fetchOptions);
29
40
  }
30
41
  catch (err) {
31
42
  return toolErr("REMOTE_ERROR", `Network error: ${err instanceof Error ? err.message : String(err)}`);
@@ -209,6 +220,7 @@ const REMOTE_TOOLS = [
209
220
  max_chars: z.number().int().min(500).max(50_000).optional(),
210
221
  },
211
222
  remotePath: "api/patch-notes",
223
+ method: "GET",
212
224
  },
213
225
  ];
214
226
  export function registerRemoteTools(server, config, tokenManager) {
@@ -95,8 +95,10 @@ async function downloadSubtitle(videoId, lang, format) {
95
95
  error: result.stderr.slice(0, 500) || `yt-dlp exited with ${result.exitCode}`,
96
96
  };
97
97
  }
98
- // Find the output file - yt-dlp appends lang and format extension
99
- const possibleExts = [`${lang}.${format}`, `${lang}.vtt`, `${lang}.srt`, `${lang}.ttml`, `${lang}.srv3`];
98
+ // Find the output file - yt-dlp appends lang and format extension.
99
+ // For CSV: yt-dlp downloads as VTT first, so only search for VTT (not stale .csv from previous runs).
100
+ const searchFormat = format === "csv" ? "vtt" : format;
101
+ const possibleExts = [`${lang}.${searchFormat}`, `${lang}.vtt`, `${lang}.srt`, `${lang}.ttml`, `${lang}.srv3`];
100
102
  let foundFile;
101
103
  for (const ext of possibleExts) {
102
104
  const candidate = `${outTemplate}.${ext}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkterswingman/yt-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "YouTube MCP client — local subtitles + remote API proxy",
5
5
  "type": "module",
6
6
  "bin": {