video-context-mcp-server 0.23.7-beta → 0.24.0-beta

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.
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.23.7-beta";
1
+ export declare const VERSION = "0.24.0-beta";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/sync-version.ts — do not edit
2
- export const VERSION = '0.23.7-beta';
2
+ export const VERSION = '0.24.0-beta';
3
3
  //# sourceMappingURL=version.js.map
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import { searchTimestampTool } from './tools/searchTimestamp.js';
9
9
  import { getVideoInfoTool } from './tools/getVideoInfo.js';
10
10
  import { transcribeVideoTool } from './tools/transcribeVideo.js';
11
11
  import { setLoggerServer } from './utils/logger.js';
12
+ import { triggerUpdateCheck, wrapWithUpdateNotice, } from './utils/updateCheck.js';
12
13
  import { VERSION } from './generated/version.js';
13
14
  import { analyzeVideoSchema, summarizeVideoSchema, extractFramesSchema, searchTimestampSchema, getVideoInfoSchema, transcribeVideoSchema, } from './tools/schemas.js';
14
15
  /**
@@ -27,43 +28,52 @@ async function main() {
27
28
  });
28
29
  // Wire up the logger so tools can emit progress notifications
29
30
  setLoggerServer(server);
31
+ /**
32
+ * Wrap a tool handler to:
33
+ * 1. Trigger the background update-check on the first call (fire-and-forget)
34
+ * 2. Prepend any pending update notice to the response (single-shot)
35
+ */
36
+ const withUpdateCheck = (handler) => async (params) => {
37
+ triggerUpdateCheck();
38
+ return wrapWithUpdateNotice(await handler(params));
39
+ };
30
40
  // Register all video analysis tools
31
41
  // Tool 1: analyze_video - Ask questions about video content
32
42
  server.registerTool('analyze_video', {
33
43
  title: 'Analyze Video',
34
44
  description: 'Ask questions about video content and get AI-powered answers. Supports both local files and URLs.',
35
45
  inputSchema: analyzeVideoSchema,
36
- }, analyzeVideoTool);
46
+ }, withUpdateCheck(analyzeVideoTool));
37
47
  // Tool 2: summarize_video - Generate structured video summary
38
48
  server.registerTool('summarize_video', {
39
49
  title: 'Summarize Video',
40
50
  description: 'Generate a structured summary of the video including overview, key scenes, and timeline. For long videos (>5 min), extracts keyframes to reduce token usage (unless using Gemini, which processes natively).',
41
51
  inputSchema: summarizeVideoSchema,
42
- }, summarizeVideoTool);
52
+ }, withUpdateCheck(summarizeVideoTool));
43
53
  // Tool 3: extract_frames - Extract frames from video
44
54
  server.registerTool('extract_frames', {
45
55
  title: 'Extract Frames',
46
56
  description: 'Extract frames from a video at specific timestamps or intervals. Supports local files (including file:// URIs) and remote http(s) URLs. No AI backend required.',
47
57
  inputSchema: extractFramesSchema,
48
- }, extractFramesTool);
58
+ }, withUpdateCheck(extractFramesTool));
49
59
  // Tool 4: search_timestamp - Find when something happens in video
50
60
  server.registerTool('search_timestamp', {
51
61
  title: 'Search Timestamp',
52
62
  description: 'Find the timestamp when something specific happens in a video. Extracts frames and uses AI to locate the content. Supports local files (including file:// URIs) and remote http(s) URLs.',
53
63
  inputSchema: searchTimestampSchema,
54
- }, searchTimestampTool);
64
+ }, withUpdateCheck(searchTimestampTool));
55
65
  // Tool 5: get_video_info - Get video metadata
56
66
  server.registerTool('get_video_info', {
57
67
  title: 'Get Video Info',
58
68
  description: 'Get video metadata including duration, resolution, fps, codec, file size, and format. Supports local files (including file:// URIs) and remote http(s) URLs. No AI backend required.',
59
69
  inputSchema: getVideoInfoSchema,
60
- }, getVideoInfoTool);
70
+ }, withUpdateCheck(getVideoInfoTool));
61
71
  // Tool 6: transcribe_video - Transcribe audio from a video
62
72
  server.registerTool('transcribe_video', {
63
73
  title: 'Transcribe Video',
64
74
  description: 'Extract audio from a video and transcribe it using a dedicated speech-to-text provider (Deepgram, AssemblyAI, Groq/Whisper, or Gemini). Supports speaker diarization and translation to English.',
65
75
  inputSchema: transcribeVideoSchema,
66
- }, transcribeVideoTool);
76
+ }, withUpdateCheck(transcribeVideoTool));
67
77
  // Connect to VS Code via stdio transport
68
78
  const transport = new StdioServerTransport();
69
79
  await server.connect(transport);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,uBAAuB;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAE3B;;;GAGG;AAEH,KAAK,UAAU,IAAI;IACjB,0CAA0C;IAC1C,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,OAAO,EAAE,EAAE,EAAE,wCAAwC;SACtD;KACF,CACF,CAAA;IAED,8DAA8D;IAC9D,eAAe,CAAC,MAAM,CAAC,CAAA;IAEvB,oCAAoC;IAEpC,4DAA4D;IAC5D,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,mGAAmG;QACrG,WAAW,EAAE,kBAAkB;KA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,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,+DAA+D;AACjE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAA;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -20,4 +20,10 @@ export declare function setLoggerServer(server: McpServer): void;
20
20
  * @param message - Human-readable progress message
21
21
  */
22
22
  export declare function logProgress(message: string): Promise<void>;
23
+ /**
24
+ * Emit a warning-level log via the MCP logging notification.
25
+ * Silently swallows errors so that logging failures never break a tool call.
26
+ * @param message - Human-readable warning message
27
+ */
28
+ export declare function logWarning(message: string): Promise<void>;
23
29
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO/D"}
@@ -31,4 +31,19 @@ export async function logProgress(message) {
31
31
  // Swallow logging errors – never break a tool call because of logging
32
32
  }
33
33
  }
34
+ /**
35
+ * Emit a warning-level log via the MCP logging notification.
36
+ * Silently swallows errors so that logging failures never break a tool call.
37
+ * @param message - Human-readable warning message
38
+ */
39
+ export async function logWarning(message) {
40
+ if (!_server)
41
+ return;
42
+ try {
43
+ await _server.sendLoggingMessage({ level: 'warning', data: message });
44
+ }
45
+ catch {
46
+ // Swallow logging errors – never break a tool call because of logging
47
+ }
48
+ }
34
49
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,IAAI,OAAO,GAAqB,IAAI,CAAA;AAEpC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,GAAG,MAAM,CAAA;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,IAAI,OAAO,GAAqB,IAAI,CAAA;AAEpC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,GAAG,MAAM,CAAA;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAM;IACpB,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Silent update notification for globally-installed video-context-mcp-server.
3
+ *
4
+ * On the first tool call, spawns `npm outdated -g video-context-mcp-server --json`
5
+ * as a fire-and-forget background process. If an update is available, stores a
6
+ * one-line notice that is prepended to the next tool call response (single-shot).
7
+ *
8
+ * When running via npx, the package is not globally installed, so
9
+ * `npm outdated -g` returns `{}` — no special npx detection is needed.
10
+ */
11
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
12
+ /**
13
+ * Fire-and-forget: spawn `npm outdated -g <package> --json` once per session.
14
+ * The result is stored in `_updateNotice` when the child process completes.
15
+ *
16
+ * Safe to call on every tool invocation — no-ops after the first call.
17
+ * Never throws; all errors are silently swallowed.
18
+ */
19
+ export declare function triggerUpdateCheck(): void;
20
+ /**
21
+ * Returns the stored update notice, or `null` if:
22
+ * - no update was found
23
+ * - the background check is still running or hasn't been triggered yet
24
+ * - the check failed (network error, parse error, etc.)
25
+ */
26
+ export declare function getUpdateNotice(): string | null;
27
+ /**
28
+ * If an update notice is stored, prepend it to the tool result's content
29
+ * array and clear the stored notice (single-shot — appears only once per session).
30
+ * Returns the result unchanged when no notice is available.
31
+ */
32
+ export declare function wrapWithUpdateNotice(result: CallToolResult): CallToolResult;
33
+ /**
34
+ * Reset all module-level state.
35
+ * @internal — for unit tests only
36
+ */
37
+ export declare function _resetForTests(): void;
38
+ //# sourceMappingURL=updateCheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCheck.d.ts","sourceRoot":"","sources":["../../src/utils/updateCheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AASxE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAmCzC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAS3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Silent update notification for globally-installed video-context-mcp-server.
3
+ *
4
+ * On the first tool call, spawns `npm outdated -g video-context-mcp-server --json`
5
+ * as a fire-and-forget background process. If an update is available, stores a
6
+ * one-line notice that is prepended to the next tool call response (single-shot).
7
+ *
8
+ * When running via npx, the package is not globally installed, so
9
+ * `npm outdated -g` returns `{}` — no special npx detection is needed.
10
+ */
11
+ import { exec } from 'node:child_process';
12
+ import { logWarning } from './logger.js';
13
+ const PACKAGE_NAME = 'video-context-mcp-server';
14
+ const TIMEOUT_MS = 15_000;
15
+ let _checkTriggered = false;
16
+ let _updateNotice = null;
17
+ /**
18
+ * Fire-and-forget: spawn `npm outdated -g <package> --json` once per session.
19
+ * The result is stored in `_updateNotice` when the child process completes.
20
+ *
21
+ * Safe to call on every tool invocation — no-ops after the first call.
22
+ * Never throws; all errors are silently swallowed.
23
+ */
24
+ export function triggerUpdateCheck() {
25
+ if (_checkTriggered)
26
+ return;
27
+ _checkTriggered = true;
28
+ exec(`npm outdated -g ${PACKAGE_NAME} --json`, { timeout: TIMEOUT_MS }, (error, stdout) => {
29
+ try {
30
+ // `npm outdated` exits with code 1 when packages are outdated — this is
31
+ // intentional npm behaviour. Treat code 1 + valid JSON as "update available".
32
+ // All other error codes (ENOENT, timeout kill, etc.) are silently ignored.
33
+ const exitCode = error?.code ?? 0;
34
+ if (exitCode !== 1 || !stdout?.trim())
35
+ return;
36
+ const parsed = JSON.parse(stdout);
37
+ const info = parsed[PACKAGE_NAME];
38
+ if (!info?.current || !info?.latest)
39
+ return;
40
+ if (info.current === info.latest)
41
+ return;
42
+ const { current, latest } = info;
43
+ _updateNotice =
44
+ `⬆️ Update available: ${PACKAGE_NAME} v${latest} ` +
45
+ `(current: v${current}). Run: npm install -g ${PACKAGE_NAME}@latest`;
46
+ void logWarning(`[video-mcp] ${_updateNotice}`);
47
+ }
48
+ catch {
49
+ // Malformed JSON or any other unexpected output — silently ignore
50
+ }
51
+ });
52
+ }
53
+ /**
54
+ * Returns the stored update notice, or `null` if:
55
+ * - no update was found
56
+ * - the background check is still running or hasn't been triggered yet
57
+ * - the check failed (network error, parse error, etc.)
58
+ */
59
+ export function getUpdateNotice() {
60
+ return _updateNotice;
61
+ }
62
+ /**
63
+ * If an update notice is stored, prepend it to the tool result's content
64
+ * array and clear the stored notice (single-shot — appears only once per session).
65
+ * Returns the result unchanged when no notice is available.
66
+ */
67
+ export function wrapWithUpdateNotice(result) {
68
+ const notice = _updateNotice;
69
+ if (!notice)
70
+ return result;
71
+ _updateNotice = null;
72
+ return {
73
+ ...result,
74
+ content: [{ type: 'text', text: notice }, ...result.content],
75
+ };
76
+ }
77
+ /**
78
+ * Reset all module-level state.
79
+ * @internal — for unit tests only
80
+ */
81
+ export function _resetForTests() {
82
+ _checkTriggered = false;
83
+ _updateNotice = null;
84
+ }
85
+ //# sourceMappingURL=updateCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCheck.js","sourceRoot":"","sources":["../../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AAM,CAAC;YACP,kEAAkE;QACpE,CAAC;IACH,CAAC,CACF,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,CAAA;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,MAAM,MAAM,GAAG,aAAa,CAAA;IAC5B,IAAI,CAAC,MAAM;QAAE,OAAO,MAAM,CAAA;IAE1B,aAAa,GAAG,IAAI,CAAA;IACpB,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;KAC7D,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,eAAe,GAAG,KAAK,CAAA;IACvB,aAAa,GAAG,IAAI,CAAA;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "video-context-mcp-server",
3
- "version": "0.23.7-beta",
3
+ "version": "0.24.0-beta",
4
4
  "description": "A Model Context Protocol server that gives GitHub Copilot the ability to understand and analyze video content",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",