@echosaw/mcp-server 1.1.0 → 1.2.0
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 +4 -4
- package/dist/bin/echosaw-mcp.js +2 -4
- package/dist/bin/echosaw-mcp.js.map +1 -1
- package/dist/src/__tests__/smoke-integration.test.d.ts +2 -0
- package/dist/src/__tests__/smoke-integration.test.d.ts.map +1 -0
- package/dist/src/__tests__/smoke-integration.test.js +37 -0
- package/dist/src/__tests__/smoke-integration.test.js.map +1 -0
- package/dist/src/__tests__/smoke-tools-list.test.d.ts +2 -0
- package/dist/src/__tests__/smoke-tools-list.test.d.ts.map +1 -0
- package/dist/src/__tests__/smoke-tools-list.test.js +92 -0
- package/dist/src/__tests__/smoke-tools-list.test.js.map +1 -0
- package/dist/src/__tests__/smoke-version.test.d.ts +2 -0
- package/dist/src/__tests__/smoke-version.test.d.ts.map +1 -0
- package/dist/src/__tests__/smoke-version.test.js +34 -0
- package/dist/src/__tests__/smoke-version.test.js.map +1 -0
- package/dist/src/echosaw-client.js +9 -50
- package/dist/src/echosaw-client.js.map +1 -1
- package/dist/src/index.js +28 -31
- package/dist/src/index.js.map +1 -1
- package/dist/src/tools/check-status.d.ts +7 -0
- package/dist/src/tools/check-status.d.ts.map +1 -1
- package/dist/src/tools/check-status.js +13 -10
- package/dist/src/tools/check-status.js.map +1 -1
- package/dist/src/tools/download-file.d.ts +9 -2
- package/dist/src/tools/download-file.d.ts.map +1 -1
- package/dist/src/tools/download-file.js +15 -12
- package/dist/src/tools/download-file.js.map +1 -1
- package/dist/src/tools/get-results.d.ts +13 -0
- package/dist/src/tools/get-results.d.ts.map +1 -1
- package/dist/src/tools/get-results.js +40 -11
- package/dist/src/tools/get-results.js.map +1 -1
- package/dist/src/tools/submit-file.d.ts +7 -0
- package/dist/src/tools/submit-file.d.ts.map +1 -1
- package/dist/src/tools/submit-file.js +17 -47
- package/dist/src/tools/submit-file.js.map +1 -1
- package/dist/src/tools/submit-url.d.ts +7 -0
- package/dist/src/tools/submit-url.d.ts.map +1 -1
- package/dist/src/tools/submit-url.js +14 -11
- package/dist/src/tools/submit-url.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +5 -10
- package/dist/src/types.js.map +1 -1
- package/package.json +20 -7
- package/bin/echosaw-mcp.ts +0 -4
- package/src/echosaw-client.ts +0 -169
- package/src/index.ts +0 -80
- package/src/tools/check-status.ts +0 -46
- package/src/tools/download-file.ts +0 -25
- package/src/tools/get-results.ts +0 -25
- package/src/tools/submit-file.ts +0 -68
- package/src/tools/submit-url.ts +0 -42
- package/src/types.ts +0 -60
- package/tsconfig.json +0 -20
package/src/index.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
-
import {
|
|
4
|
-
CallToolRequestSchema,
|
|
5
|
-
ListToolsRequestSchema,
|
|
6
|
-
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
|
|
8
|
-
import { submitFileToolDefinition, handleSubmitFile } from './tools/submit-file.js';
|
|
9
|
-
import { submitUrlToolDefinition, handleSubmitUrl } from './tools/submit-url.js';
|
|
10
|
-
import { checkStatusToolDefinition, handleCheckStatus } from './tools/check-status.js';
|
|
11
|
-
import { getResultsToolDefinition, handleGetResults } from './tools/get-results.js';
|
|
12
|
-
import { downloadFileToolDefinition, handleDownloadFile } from './tools/download-file.js';
|
|
13
|
-
import { buildErrorResponse } from './types.js';
|
|
14
|
-
|
|
15
|
-
const server = new Server(
|
|
16
|
-
{
|
|
17
|
-
name: 'echosaw',
|
|
18
|
-
version: '1.1.0',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
capabilities: {
|
|
22
|
-
tools: {},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
28
|
-
return {
|
|
29
|
-
tools: [
|
|
30
|
-
submitFileToolDefinition,
|
|
31
|
-
submitUrlToolDefinition,
|
|
32
|
-
checkStatusToolDefinition,
|
|
33
|
-
getResultsToolDefinition,
|
|
34
|
-
downloadFileToolDefinition,
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
40
|
-
const { name, arguments: args } = request.params;
|
|
41
|
-
|
|
42
|
-
try {
|
|
43
|
-
let result: unknown;
|
|
44
|
-
|
|
45
|
-
switch (name) {
|
|
46
|
-
case 'echosaw_analyze_media':
|
|
47
|
-
result = await handleSubmitFile(args as { filePath: string; mediaType: string });
|
|
48
|
-
break;
|
|
49
|
-
case 'echosaw_analyze_media_url':
|
|
50
|
-
result = await handleSubmitUrl(args as { url: string; mediaType: string });
|
|
51
|
-
break;
|
|
52
|
-
case 'echosaw_check_job_status':
|
|
53
|
-
result = await handleCheckStatus(args as { mediaId: string });
|
|
54
|
-
break;
|
|
55
|
-
case 'echosaw_get_analysis_results':
|
|
56
|
-
result = await handleGetResults(args as { mediaId: string });
|
|
57
|
-
break;
|
|
58
|
-
case 'echosaw_download_report':
|
|
59
|
-
result = await handleDownloadFile(args as { mediaId: string });
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
result = buildErrorResponse(name, `Unknown tool: ${name}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
67
|
-
};
|
|
68
|
-
} catch (error) {
|
|
69
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
-
return {
|
|
71
|
-
content: [{ type: 'text', text: JSON.stringify(buildErrorResponse(name, message), null, 2) }],
|
|
72
|
-
isError: true,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export async function main(): Promise<void> {
|
|
78
|
-
const transport = new StdioServerTransport();
|
|
79
|
-
await server.connect(transport);
|
|
80
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { checkStatus } from '../echosaw-client.js';
|
|
2
|
-
import { buildResponse, McpToolResponse, JobStatusData } from '../types.js';
|
|
3
|
-
|
|
4
|
-
export const checkStatusToolDefinition = {
|
|
5
|
-
name: 'echosaw_check_job_status',
|
|
6
|
-
description: 'Retrieve the current processing state of an Echosaw analysis job, including whether the job is queued, processing, completed, or failed.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object' as const,
|
|
9
|
-
properties: {
|
|
10
|
-
mediaId: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The mediaId returned by echosaw_analyze_media or echosaw_analyze_media_url',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
required: ['mediaId'],
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export async function handleCheckStatus(args: { mediaId: string }): Promise<McpToolResponse<JobStatusData>> {
|
|
20
|
-
const { mediaId } = args;
|
|
21
|
-
const result = await checkStatus(mediaId);
|
|
22
|
-
|
|
23
|
-
let guidance = '';
|
|
24
|
-
let nextAction: { tool: string; description: string } | undefined;
|
|
25
|
-
const status = (result.status || '').toUpperCase();
|
|
26
|
-
|
|
27
|
-
if (status.includes('PROCESSING') || status.includes('PENDING') || status === 'UPLOADED_PENDING_SCAN') {
|
|
28
|
-
guidance = 'The analysis is still in progress. Wait a minute or two and check again.';
|
|
29
|
-
nextAction = { tool: 'echosaw_check_job_status', description: 'Retry after a short delay' };
|
|
30
|
-
} else if (status.includes('COMPLETE') || status.includes('SUCCESS')) {
|
|
31
|
-
guidance = 'The analysis is complete. Retrieve the full intelligence report.';
|
|
32
|
-
nextAction = { tool: 'echosaw_get_analysis_results', description: 'Retrieve analysis results' };
|
|
33
|
-
} else if (status.includes('FAIL') || status.includes('ERROR')) {
|
|
34
|
-
guidance = 'The analysis has failed. Check the error details.';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return buildResponse('echosaw_check_job_status', {
|
|
38
|
-
mediaId,
|
|
39
|
-
status: result.status,
|
|
40
|
-
createdAt: result.createdAt ? new Date(result.createdAt * 1000).toISOString() : null,
|
|
41
|
-
updatedAt: result.updatedAt ? new Date(result.updatedAt * 1000).toISOString() : null,
|
|
42
|
-
}, {
|
|
43
|
-
message: guidance || undefined,
|
|
44
|
-
nextAction,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { downloadFile } from '../echosaw-client.js';
|
|
2
|
-
import { buildResponse, McpToolResponse, DownloadReportData } from '../types.js';
|
|
3
|
-
|
|
4
|
-
export const downloadFileToolDefinition = {
|
|
5
|
-
name: 'echosaw_download_report',
|
|
6
|
-
description: 'Download the report or output artifact produced by Echosaw for a completed analysis job.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object' as const,
|
|
9
|
-
properties: {
|
|
10
|
-
mediaId: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The mediaId of the media to download',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
required: ['mediaId'],
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export async function handleDownloadFile(args: { mediaId: string }): Promise<McpToolResponse<DownloadReportData>> {
|
|
20
|
-
const { mediaId } = args;
|
|
21
|
-
const result = await downloadFile(mediaId);
|
|
22
|
-
return buildResponse('echosaw_download_report', { mediaId, downloadUrl: result.downloadUrl, expiresIn: '1 hour' }, {
|
|
23
|
-
message: 'Download URL generated.',
|
|
24
|
-
});
|
|
25
|
-
}
|
package/src/tools/get-results.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { getResults } from '../echosaw-client.js';
|
|
2
|
-
import { buildResponse, McpToolResponse, AnalysisResultsData } from '../types.js';
|
|
3
|
-
|
|
4
|
-
export const getResultsToolDefinition = {
|
|
5
|
-
name: 'echosaw_get_analysis_results',
|
|
6
|
-
description: 'Retrieve structured analysis results generated by Echosaw for a completed job, including summaries, transcripts, detected entities, events, and other intelligence outputs.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object' as const,
|
|
9
|
-
properties: {
|
|
10
|
-
mediaId: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'The mediaId of a completed analysis',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
required: ['mediaId'],
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export async function handleGetResults(args: { mediaId: string }): Promise<McpToolResponse<AnalysisResultsData>> {
|
|
20
|
-
const { mediaId } = args;
|
|
21
|
-
const results = await getResults(mediaId);
|
|
22
|
-
return buildResponse('echosaw_get_analysis_results', { mediaId, report: results }, {
|
|
23
|
-
message: 'Analysis results retrieved.',
|
|
24
|
-
});
|
|
25
|
-
}
|
package/src/tools/submit-file.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { submitAnalysis, uploadFile } from '../echosaw-client.js';
|
|
4
|
-
import { buildResponse, buildErrorResponse, McpToolResponse, AnalyzeMediaData } from '../types.js';
|
|
5
|
-
|
|
6
|
-
const EXTENSION_CONTENT_TYPE_MAP: Record<string, string> = {
|
|
7
|
-
'.mp4': 'video/mp4',
|
|
8
|
-
'.mov': 'video/quicktime',
|
|
9
|
-
'.avi': 'video/x-msvideo',
|
|
10
|
-
'.webm': 'video/webm',
|
|
11
|
-
'.mkv': 'video/x-matroska',
|
|
12
|
-
'.mp3': 'audio/mpeg',
|
|
13
|
-
'.wav': 'audio/wav',
|
|
14
|
-
'.flac': 'audio/flac',
|
|
15
|
-
'.aac': 'audio/aac',
|
|
16
|
-
'.ogg': 'audio/ogg',
|
|
17
|
-
'.m4a': 'audio/mp4',
|
|
18
|
-
'.jpg': 'image/jpeg',
|
|
19
|
-
'.jpeg': 'image/jpeg',
|
|
20
|
-
'.png': 'image/png',
|
|
21
|
-
'.gif': 'image/gif',
|
|
22
|
-
'.webp': 'image/webp',
|
|
23
|
-
'.bmp': 'image/bmp',
|
|
24
|
-
'.tiff': 'image/tiff',
|
|
25
|
-
'.tif': 'image/tiff',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const submitFileToolDefinition = {
|
|
29
|
-
name: 'echosaw_analyze_media',
|
|
30
|
-
description: 'Upload an audio, video, or image file to Echosaw for asynchronous media analysis. Returns a job ID used to track processing and retrieve results.',
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: 'object' as const,
|
|
33
|
-
properties: {
|
|
34
|
-
filePath: {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Absolute path to the media file on disk',
|
|
37
|
-
},
|
|
38
|
-
mediaType: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'One of: video, audio, image',
|
|
41
|
-
enum: ['video', 'audio', 'image'],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
required: ['filePath', 'mediaType'],
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export async function handleSubmitFile(args: { filePath: string; mediaType: string }): Promise<McpToolResponse<AnalyzeMediaData | null>> {
|
|
49
|
-
const { filePath, mediaType } = args;
|
|
50
|
-
|
|
51
|
-
if (!fs.existsSync(filePath)) {
|
|
52
|
-
return buildErrorResponse('echosaw_analyze_media', `File not found at path: ${filePath}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const originalFilename = path.basename(filePath);
|
|
56
|
-
const stats = fs.statSync(filePath);
|
|
57
|
-
const fileSize = stats.size;
|
|
58
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
59
|
-
const contentType = EXTENSION_CONTENT_TYPE_MAP[ext] || 'application/octet-stream';
|
|
60
|
-
|
|
61
|
-
const result = await submitAnalysis(mediaType, originalFilename, fileSize, contentType);
|
|
62
|
-
await uploadFile(result.uploadUrl, filePath, contentType);
|
|
63
|
-
|
|
64
|
-
return buildResponse('echosaw_analyze_media', { mediaId: result.mediaId, jobId: result.jobId }, {
|
|
65
|
-
message: 'File submitted for analysis.',
|
|
66
|
-
nextAction: { tool: 'echosaw_check_job_status', description: 'Check processing status' },
|
|
67
|
-
});
|
|
68
|
-
}
|
package/src/tools/submit-url.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { submitUrl } from '../echosaw-client.js';
|
|
2
|
-
import { buildResponse, buildErrorResponse, McpToolResponse, AnalyzeMediaData } from '../types.js';
|
|
3
|
-
|
|
4
|
-
export const submitUrlToolDefinition = {
|
|
5
|
-
name: 'echosaw_analyze_media_url',
|
|
6
|
-
description: 'Submit a publicly accessible or authorized media URL to Echosaw for asynchronous analysis without uploading the file directly. Returns a job ID used to track processing and retrieve results.',
|
|
7
|
-
inputSchema: {
|
|
8
|
-
type: 'object' as const,
|
|
9
|
-
properties: {
|
|
10
|
-
url: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
description: 'HTTP(S) URL of the media file',
|
|
13
|
-
},
|
|
14
|
-
mediaType: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'One of: video, audio, image',
|
|
17
|
-
enum: ['video', 'audio', 'image'],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
required: ['url', 'mediaType'],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export async function handleSubmitUrl(args: { url: string; mediaType: string }): Promise<McpToolResponse<AnalyzeMediaData | null>> {
|
|
25
|
-
const { url, mediaType } = args;
|
|
26
|
-
|
|
27
|
-
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
28
|
-
return buildErrorResponse('echosaw_analyze_media_url', 'URL must start with http:// or https://');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Derive filename from URL path
|
|
32
|
-
const parsed = new URL(url);
|
|
33
|
-
const pathSegments = parsed.pathname.split('/').filter(Boolean);
|
|
34
|
-
const originalFilename = pathSegments.length > 0 ? pathSegments[pathSegments.length - 1] : undefined;
|
|
35
|
-
|
|
36
|
-
const result = await submitUrl(url, mediaType, originalFilename);
|
|
37
|
-
|
|
38
|
-
return buildResponse('echosaw_analyze_media_url', { mediaId: result.mediaId, jobId: result.jobId }, {
|
|
39
|
-
message: 'URL submitted. Echosaw is downloading and processing the file.',
|
|
40
|
-
nextAction: { tool: 'echosaw_check_job_status', description: 'Check processing status' },
|
|
41
|
-
});
|
|
42
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export const RESPONSE_VERSION = '1.0';
|
|
2
|
-
|
|
3
|
-
export interface McpToolResponse<T = unknown> {
|
|
4
|
-
success: boolean;
|
|
5
|
-
tool: string;
|
|
6
|
-
responseVersion: string;
|
|
7
|
-
data: T;
|
|
8
|
-
message?: string;
|
|
9
|
-
error?: string;
|
|
10
|
-
nextAction?: { tool: string; description: string };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface AnalyzeMediaData {
|
|
14
|
-
mediaId: string;
|
|
15
|
-
jobId: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface JobStatusData {
|
|
19
|
-
mediaId: string;
|
|
20
|
-
status: string;
|
|
21
|
-
createdAt: string | null;
|
|
22
|
-
updatedAt: string | null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface AnalysisResultsData {
|
|
26
|
-
mediaId: string;
|
|
27
|
-
report: unknown;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface DownloadReportData {
|
|
31
|
-
mediaId: string;
|
|
32
|
-
downloadUrl: string;
|
|
33
|
-
expiresIn: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Lightweight validation helper — asserts required fields are present
|
|
37
|
-
export function buildResponse<T>(
|
|
38
|
-
tool: string,
|
|
39
|
-
data: T,
|
|
40
|
-
opts?: { message?: string; nextAction?: { tool: string; description: string } }
|
|
41
|
-
): McpToolResponse<T> {
|
|
42
|
-
return {
|
|
43
|
-
success: true,
|
|
44
|
-
tool,
|
|
45
|
-
responseVersion: RESPONSE_VERSION,
|
|
46
|
-
data,
|
|
47
|
-
...(opts?.message ? { message: opts.message } : {}),
|
|
48
|
-
...(opts?.nextAction ? { nextAction: opts.nextAction } : {}),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function buildErrorResponse(tool: string, error: string): McpToolResponse<null> {
|
|
53
|
-
return {
|
|
54
|
-
success: false,
|
|
55
|
-
tool,
|
|
56
|
-
responseVersion: RESPONSE_VERSION,
|
|
57
|
-
data: null,
|
|
58
|
-
error,
|
|
59
|
-
};
|
|
60
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"lib": ["ES2022"],
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"rootDir": ".",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"declaration": true,
|
|
15
|
-
"declarationMap": true,
|
|
16
|
-
"sourceMap": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*", "bin/**/*"],
|
|
19
|
-
"exclude": ["node_modules", "dist"]
|
|
20
|
-
}
|