@mindstone/mcp-server-elevenlabs 0.2.2

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.
@@ -0,0 +1,60 @@
1
+ export declare const REQUEST_TIMEOUT_MS = 30000;
2
+ export interface BridgeState {
3
+ port: number;
4
+ token: string;
5
+ }
6
+ export declare class ElevenLabsError extends Error {
7
+ readonly code: string;
8
+ readonly resolution: string;
9
+ constructor(message: string, code: string, resolution: string);
10
+ }
11
+ export interface VoiceResult {
12
+ voice_id: string;
13
+ name: string;
14
+ category?: string;
15
+ description?: string;
16
+ preview_url?: string;
17
+ labels?: Record<string, string>;
18
+ }
19
+ export interface VoicesResponse {
20
+ voices: VoiceResult[];
21
+ has_more?: boolean;
22
+ }
23
+ export interface CompositionSection {
24
+ style?: string;
25
+ lyrics?: string;
26
+ duration_ms?: number;
27
+ }
28
+ export interface CompositionPlan {
29
+ positive_global_styles?: string[];
30
+ negative_global_styles?: string[];
31
+ sections?: CompositionSection[];
32
+ }
33
+ export interface MusicPlanResponse {
34
+ positive_global_styles: string[];
35
+ negative_global_styles: string[];
36
+ sections: Array<{
37
+ style: string;
38
+ lyrics: string;
39
+ duration_ms: number;
40
+ }>;
41
+ }
42
+ export interface TranscriptionWord {
43
+ text: string;
44
+ start: number;
45
+ end: number;
46
+ type?: string;
47
+ }
48
+ export interface TranscriptionResponse {
49
+ text: string;
50
+ words?: TranscriptionWord[];
51
+ }
52
+ export interface AudioResult {
53
+ filePath: string;
54
+ sizeBytes: number;
55
+ }
56
+ /**
57
+ * Resolve an error status code to an actionable resolution string.
58
+ */
59
+ export declare function getErrorResolution(status: number, detail?: string): string;
60
+ //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1,34 @@
1
+ export const REQUEST_TIMEOUT_MS = 30_000;
2
+ export class ElevenLabsError extends Error {
3
+ code;
4
+ resolution;
5
+ constructor(message, code, resolution) {
6
+ super(message);
7
+ this.code = code;
8
+ this.resolution = resolution;
9
+ this.name = 'ElevenLabsError';
10
+ }
11
+ }
12
+ /**
13
+ * Resolve an error status code to an actionable resolution string.
14
+ */
15
+ export function getErrorResolution(status, detail) {
16
+ const msg = (detail || '').toLowerCase();
17
+ if (status === 401 || msg.includes('unauthorized') || msg.includes('invalid api key')) {
18
+ return 'Authentication failed. Check your ElevenLabs API key in Settings. Get one at https://elevenlabs.io/app/settings/api-keys';
19
+ }
20
+ if (status === 403 || msg.includes('quota') || msg.includes('limit') || msg.includes('credits')) {
21
+ return 'Insufficient credits or quota exceeded. Check usage at https://elevenlabs.io/app/usage';
22
+ }
23
+ if (status === 422 || msg.includes('validation')) {
24
+ return 'Invalid request parameters. Check the input values and try again.';
25
+ }
26
+ if (status === 429) {
27
+ return 'Rate limited. Wait a moment and try again.';
28
+ }
29
+ if (msg.includes('content') || msg.includes('policy') || msg.includes('moderation')) {
30
+ return 'Content policy violation. Try a different prompt.';
31
+ }
32
+ return 'Please try again. If the issue persists, check your API key and credits at https://elevenlabs.io/app/settings/api-keys';
33
+ }
34
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,14 @@
1
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ type ToolHandler<T> = (args: T, extra: unknown) => Promise<CallToolResult>;
3
+ /**
4
+ * Wraps a tool handler with standard error handling.
5
+ *
6
+ * - On success: returns the string result as a text content block.
7
+ * - On ElevenLabsError: returns a structured JSON error with code and resolution.
8
+ * - On unknown error: returns a generic error message.
9
+ *
10
+ * Secrets are never exposed in error messages.
11
+ */
12
+ export declare function withErrorHandling<T>(fn: (args: T, extra: unknown) => Promise<string>): ToolHandler<T>;
13
+ export {};
14
+ //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js ADDED
@@ -0,0 +1,42 @@
1
+ import { ElevenLabsError } from './types.js';
2
+ /**
3
+ * Wraps a tool handler with standard error handling.
4
+ *
5
+ * - On success: returns the string result as a text content block.
6
+ * - On ElevenLabsError: returns a structured JSON error with code and resolution.
7
+ * - On unknown error: returns a generic error message.
8
+ *
9
+ * Secrets are never exposed in error messages.
10
+ */
11
+ export function withErrorHandling(fn) {
12
+ return async (args, extra) => {
13
+ try {
14
+ const result = await fn(args, extra);
15
+ return { content: [{ type: 'text', text: result }] };
16
+ }
17
+ catch (error) {
18
+ if (error instanceof ElevenLabsError) {
19
+ return {
20
+ content: [
21
+ {
22
+ type: 'text',
23
+ text: JSON.stringify({
24
+ ok: false,
25
+ error: error.message,
26
+ code: error.code,
27
+ resolution: error.resolution,
28
+ }),
29
+ },
30
+ ],
31
+ isError: true,
32
+ };
33
+ }
34
+ const errorMessage = error instanceof Error ? error.message : String(error);
35
+ return {
36
+ content: [{ type: 'text', text: JSON.stringify({ ok: false, error: errorMessage }) }],
37
+ isError: true,
38
+ };
39
+ }
40
+ };
41
+ }
42
+ //# sourceMappingURL=utils.js.map
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@mindstone/mcp-server-elevenlabs",
3
+ "version": "0.2.2",
4
+ "mcpName": "io.github.mindstone/mcp-server-elevenlabs",
5
+ "description": "ElevenLabs MCP server for Model Context Protocol hosts \u2014 music, TTS, sound effects, voices, transcription",
6
+ "license": "FSL-1.1-MIT",
7
+ "type": "module",
8
+ "bin": {
9
+ "mcp-server-elevenlabs": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.map"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/mindstone/mcp-servers.git",
18
+ "directory": "connectors/elevenlabs"
19
+ },
20
+ "homepage": "https://github.com/mindstone/mcp-servers/tree/main/connectors/elevenlabs",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc && shx chmod +x dist/index.js",
26
+ "prepare": "npm run build",
27
+ "watch": "tsc --watch",
28
+ "start": "node dist/index.js",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "test:coverage": "vitest run --coverage"
32
+ },
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.26.0",
35
+ "zod": "^3.23.0"
36
+ },
37
+ "devDependencies": {
38
+ "@mindstone/mcp-test-harness": "file:../../test-harness",
39
+ "@types/node": "^22",
40
+ "@vitest/coverage-v8": "^4.1.3",
41
+ "msw": "^2.13.2",
42
+ "shx": "^0.3.4",
43
+ "typescript": "^5.8.2",
44
+ "vitest": "^4.1.3"
45
+ },
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "overrides": {
50
+ "fast-uri": "^3.1.2",
51
+ "hono": "^4.12.18",
52
+ "ip-address": "^10.2.0"
53
+ }
54
+ }