Add NexusAI: universal MCP service (TTS/STT/image/video/music/web-search)
Monorepo-lite with shared @nexusai/core and @nexusai/mcp-server (stdio). Provider-agnostic tools with explicit provider selection; NordRouter adapter (media generate/poll/download, estimate, upload, models) and search via perplexity/sonar. Local STT via faster-whisper uv sidecar. SQLite journal of every generation for usage stats and future admin. 10 MCP tools.
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { zodToJsonSchema } from 'zod-to-json-schema';
|
||||
import {
|
||||
ImageSchema,
|
||||
MediaEstimateSchema,
|
||||
MediaModelsSchema,
|
||||
MediaUploadSchema,
|
||||
MusicSchema,
|
||||
SttSchema,
|
||||
TtsSchema,
|
||||
UsageStatsSchema,
|
||||
VideoSchema,
|
||||
WebSearchSchema,
|
||||
} from './schemas.js';
|
||||
|
||||
export interface ToolDef {
|
||||
name: string;
|
||||
description: string;
|
||||
inputSchema: object;
|
||||
}
|
||||
|
||||
function make(name: string, description: string, schema: unknown): ToolDef {
|
||||
const json = zodToJsonSchema(schema as any, { name, $refStrategy: 'none' }) as any;
|
||||
const def = json.definitions?.[name] ?? json;
|
||||
return { name, description, inputSchema: def };
|
||||
}
|
||||
|
||||
export const TOOLS: ToolDef[] = [
|
||||
make(
|
||||
'nexus_tts',
|
||||
'Text-to-speech. Generates spoken audio from text via a provider. Returns a saved audio file path and optional embedded audio.',
|
||||
TtsSchema
|
||||
),
|
||||
make(
|
||||
'nexus_image',
|
||||
'Generate or edit images from a text prompt (and optional source image URL). Returns a saved image file and optional embedded image.',
|
||||
ImageSchema
|
||||
),
|
||||
make(
|
||||
'nexus_video',
|
||||
'Generate video from text or an image (t2v / i2v). Async, may take minutes. Returns a saved MP4 file path.',
|
||||
VideoSchema
|
||||
),
|
||||
make(
|
||||
'nexus_music',
|
||||
'Generate music from a style/prompt. Returns saved audio file(s); some models produce two tracks.',
|
||||
MusicSchema
|
||||
),
|
||||
make(
|
||||
'nexus_stt',
|
||||
'Speech-to-text. Transcribe local/remote/base64 audio using a local whisper model. Returns text, language and segments.',
|
||||
SttSchema
|
||||
),
|
||||
make(
|
||||
'nexus_web_search',
|
||||
'Web search that returns an answer with cited source URLs (via search-augmented models).',
|
||||
WebSearchSchema
|
||||
),
|
||||
make(
|
||||
'nexus_media_models',
|
||||
'List available media models (id, type, label, estimated price) for a provider. Use to discover valid model ids and parameters.',
|
||||
MediaModelsSchema
|
||||
),
|
||||
make(
|
||||
'nexus_media_estimate',
|
||||
'Estimate the USD cost of a media generation before running it.',
|
||||
MediaEstimateSchema
|
||||
),
|
||||
make(
|
||||
'nexus_media_upload',
|
||||
'Upload a local media file to the provider and get a reference URL for use as input (image/audio/video).',
|
||||
MediaUploadSchema
|
||||
),
|
||||
make(
|
||||
'nexus_usage_stats',
|
||||
'Show usage and spend recorded in the local journal (totals by provider, capability, day) and optionally recent generations.',
|
||||
UsageStatsSchema
|
||||
),
|
||||
];
|
||||
Reference in New Issue
Block a user