Skip to content
reaatechREAATECH

@reaatech/media-pipeline-mcp-server

npm v0.3.0

An MCP server that exposes 35+ media operations (image generation/editing, audio TTS/STT, video generation, document extraction, 3D mesh generation) as JSON-RPC 2.0 tools over StreamableHTTP transport, with built-in provider routing, cost tracking, pipeline execution, quality gates, webhooks, and multi-tenant key management. It provides a CLI binary (`media-pipeline-mcp`) and depends on `@modelcontextprotocol/sdk` for MCP protocol compliance, with provider auto-detection from environment variables (`OPENAI_API_KEY`, `STABILITY_API_KEY`, etc.).

@reaatech/media-pipeline-mcp-server

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

MCP server that exposes 35+ media operations via the Model Context Protocol over StreamableHTTP transport. Orchestrates provider routing, storage, security, cost tracking, pipeline execution, quality gates, webhooks, streaming progress, batch pipelines, real-time STT, 3D mesh generation, and multi-tenant key management.

Installation

terminal
npm install @reaatech/media-pipeline-mcp-server
# or
pnpm add @reaatech/media-pipeline-mcp-server

Feature Overview

Core Features

  • 35+ MCP tools — image generation/editing, audio TTS/STT, video generation, document extraction, pipeline execution, quality gates, cost tracking, 3D mesh generation, and real-time STT streaming
  • StreamableHTTP transport — MCP protocol compliance with JSON-RPC 2.0 routing via @modelcontextprotocol/sdk
  • Provider auto-detection — env-var-based provider instantiation (OPENAI_API_KEY, STABILITY_API_KEY, etc.) with automatic fallback to MockProvider
  • Multi-provider routing — operation-based provider selection with primary/fallback, cheapest-acceptable, fastest, and first-success strategies
  • Cost tracking — daily/monthly/per-pipeline budget limits with alert thresholds (ok → warning → critical → exceeded)
  • Pipeline engine integration — execute multi-step pipeline definitions with artifact passing, variable interpolation, and quality gates
  • Quality gate evaluation — LLM-judge, threshold, dimension-check, loudness, safety, and custom gates within pipelines or standalone
  • CLI binarymedia-pipeline-mcp command to start the server
  • Authentication & RBAC — JWT-based auth and API key validation with fine-grained permissions
  • Rate limiting — per-client and per-operation rate limiting with configurable burst sizes
  • Input validation — Zod schema validation on all tool inputs

Phase 2 Features (F1–F21)

FeatureIDDescription
IdempotencyF1SHA-256 body hashing with in-flight conflict detection, completed replay, and failed replay. Uses _meta.idempotencyKey for safe retries.
Budget CapsF4Pre-flight cost estimation; blocks operations exceeding daily, monthly, or per-pipeline budget limits.
Pipeline EstimationF5Dry-run cost and duration estimation via media.pipeline.estimate / pipeline.estimate using per-provider estimateCost().
Streaming ProgressF6MCP $/progress notifications with throttled progress events (step milestones, cost accrual, budget warnings).
WebhooksF7Outbound event subscriptions and inbound provider callbacks (Replicate, Fal, Deepgram) with HMAC signature verification.
Provider RoutingF8Advanced routing strategies: cheapest-acceptable, fastest, first-success with multi-candidate decision making.
VariantsF9Execute multiple prompt/model variants in parallel and LLM-judge the best result.
Ratio Fan-outF11Single prompt → multiple aspect ratio renders in one step.
Context ResolutionF13Interpolate {{run.}} and {{step.}} variables from pipeline run context.
Loudness GateF14Two-pass EBU R128 loudness measurement and normalization via ffmpeg.
Batch PipelinesF15Execute pipelines from CSV, JSONL, or inline data sources with {{row.field}} interpolation, concurrency control, and per-row budget limits.
Safety GateF16Default-on safety moderation gate on all moderable operations.
Provenance (C2PA)F17C2PA manifest signing with model ingredient assertions and upstream artifact references.
Multi-TenantF18Per-tenant key vault resolution, budget caps, provider allow-lists, and artifact prefix isolation via TenantScopedArtifactStore.
MCP ResourcesF19Artifacts exposed as MCP resources with resources/list_changed notifications for subscribe-based refresh.
STT StreamingF20Real-time WebSocket STT via Deepgram with interim results, speaker diarization, and URL/inline sources.
3D Mesh GenerationF21Text-to-3D and image-to-3D mesh generation (GLB, FBX, OBJ, USDZ, PLY) via Meshy/Luma providers.

Quick Start

CLI

terminal
# Start with auto-detected providers
export OPENAI_API_KEY=sk-...
export STABILITY_API_KEY=sk-...
export DEEPGRAM_API_KEY=...
npx @reaatech/media-pipeline-mcp-server start
 
# Server listening on http://0.0.0.0:8080

With Feature Flags

terminal
# Enable Phase 2 features
FEATURE_WEBHOOKS=true \
FEATURE_STREAMING=true \
FEATURE_BATCH=true \
FEATURE_STT_STREAM=true \
npx @reaatech/media-pipeline-mcp-server start

Programmatic

typescript
import { MCPServer, loadConfig } from "@reaatech/media-pipeline-mcp-server";
 
const config = loadConfig();
const server = new MCPServer(config);
await server.start();
 
// Graceful shutdown
process.on("SIGTERM", async () => {
  await server.stop();
  process.exit(0);
});

API Reference

MCPServer

Main server class that orchestrates all components. Wraps an MCP Server from @modelcontextprotocol/sdk.

typescript
class MCPServer {
  constructor(config: ServerConfig);
 
  start(): Promise<void>;
  stop(): Promise<void>;
 
  getAuthMiddleware(): AuthMiddleware | undefined;
  getRateLimiter(): RateLimiter | undefined;
  getCostTracker(): CostTracker;
}

ServerConfig

Top-level configuration object. Validated at runtime with Zod.

PropertyTypeDefaultDescription
portnumber8080HTTP listen port
hoststring0.0.0.0Listen address
logLevelerror" | "warn" | "info" | "debuginfoLog verbosity
storageStorageConfig{ type: "local" }Storage backend (local, s3, gcs)
providersProviderConfig[]auto-detectedProvider configurations
authAuthConfigAuthentication config
rateLimitRateLimitConfigRate limiting config
budgetBudgetConfigCost budget limits
featuresFeaturesConfigFeature flags (see below)
webhookBaseUrlstringBase URL for outbound webhook callbacks
pipelineStateStorePipelineStateStorePersistent pipeline state store
costLedgerCostLedgerPersistent cost ledger
eventBusEventBus<PipelineEvent>Event bus for streaming/webhooks
provenanceConfigProvenanceConfigC2PA provenance signing config
multiTenantMultiTenantConfigMulti-tenant key vault + resolver

loadConfig(env?)

Loads configuration from environment variables with sensible defaults and full validation.

typescript
function loadConfig(env?: NodeJS.ProcessEnv): ServerConfig;

validateConfig(config)

Validates a raw config object against the server schema.

typescript
function validateConfig(config: unknown): ServerConfig;

FeaturesConfig

Feature flags control which Phase 2 capabilities are active. All default to false except idempotency, budgetCaps, dryRun, runContext, and safetyGate.

FlagDefaultDescription
idempotencytrueF1: Idempotent retries with body hash
contentCachefalseContent-based result caching
resumablePipelinesfalseResume gated pipelines
budgetCapstrueF4: Budget pre-flight checks
dryRuntrueF5: Pipeline cost estimation
streamingfalseF6: MCP progress notifications
webhooksfalseF7: Outbound/inbound webhooks
routingfalseF8: Advanced provider routing
variantsfalseF9: Variant fan-out + judging
subtitlesfalseSubtitle pipeline support
runContexttrueF13: {{run.}} interpolation
batchfalseF15: Batch pipeline execution
safetyGatetrueF16: Default safety moderation
provenancefalseF17: C2PA provenance signing
mcpResourcesfalseF19: Artifact MCP resources
multiTenantfalseF18: Multi-tenant isolation
sttStreamfalseF20: Real-time STT streaming

CostTracker

Tracks all operation costs with daily/monthly/per-pipeline aggregation and budget enforcement.

typescript
class CostTracker {
  constructor(budgetConfig?: BudgetConfig);
 
  canAfford(cost: number, pipelineId?: string): boolean;
  getBudgetStatus(pipelineId?: string): BudgetStatus;
  record(record: CostRecord): void;
  getSummary(): CostSummary;
  getRecords(): CostRecord[];
  getPipelineCost(pipelineId: string): number;
  getOperationCost(operation: string): number;
  getProviderCost(provider: string): number;
  reset(): void;
}

BudgetConfig

PropertyTypeDescription
dailyLimitnumberDaily cost limit in USD
monthlyLimitnumberMonthly cost limit in USD
perPipelineLimitnumberPer-pipeline limit in USD
alertThresholdnumberFraction of limit to trigger alert (0–1, default: 0.9)

Budget Alert Levels

LevelMeaning
okBelow 75% of alert threshold
warningAt or above 75% of alert threshold
criticalAt or above the alert threshold
exceededAt or above the limit — new operations blocked

ProviderRegistry

Manages registered providers and routes operations to the first provider that supports them.

typescript
class ProviderRegistry {
  register(provider: Provider): void;
  getProvider(operation: string): Provider | undefined;
  getProviderByName(name: string): Provider | undefined;
  getAllProviders(): Provider[];
  getHealthStatus(): ProviderHealthStatus[];
  checkHealth(providerName: string): Promise<ProviderHealthStatus>;
  checkAllHealth(): Promise<ProviderHealthStatus[]>;
  isAvailable(operation: string): boolean;
}

ProviderFactory

Creates provider instances from configuration with environment variable and key vault resolution.

typescript
function createProvider(config: ProviderConfig, keyVault?: KeyVault): Promise<Provider | null>;
function createProviders(configs: ProviderConfig[], keyVault?: KeyVault): Promise<Provider[]>;

Auto-Detected Provider Env Vars

Env VarProvider ClassOperations
STABILITY_API_KEYStabilityProviderimage.generate, image.inpaint
OPENAI_API_KEYOpenAIProviderimage.generate, audio.tts, audio.stt, image.describe
REPLICATE_API_KEYReplicateProviderimage.generate, image.upscale, image.remove_background, video.generate
FAL_API_KEYFalProviderimage.generate, image.upscale, image.remove_background
ELEVENLABS_API_KEYElevenLabsProvideraudio.tts
DEEPGRAM_API_KEYDeepgramProvideraudio.stt, audio.diarize
ANTHROPIC_API_KEYAnthropicProviderimage.describe, document.ocr, document.extract_tables, document.extract_fields, document.summarize
GOOGLE_PROJECT_IDGoogleProviderdocument.ocr, document.extract_tables, document.extract_fields, image.describe

IdempotencyMiddleware

Prevents duplicate pipeline executions using SHA-256 body hashing. Supports in-flight conflict detection, completed result replay, and failed result replay.

typescript
class IdempotencyMiddleware {
  constructor(options: IdempotencyMiddlewareOptions);
  extractIdempotencyKey(args: Record<string, unknown>): string | undefined;
  extractProgressToken(args: Record<string, unknown>): string | undefined;
  wrap<TArgs, TResult>(handler: (args: TArgs, runId: string) => Promise<TResult>): (args: TArgs) => Promise<TResult>;
}

InMemoryIdempotencyStore

Default in-memory store. Replace with a persistent store (DynamoDB, Redis, Postgres) for production.

typescript
class InMemoryIdempotencyStore implements IdempotencyStore {
  get(key: string): Promise<IdempotencyEntry | undefined>;
  set(entry: IdempotencyEntry): Promise<void>;
  delete(key: string): Promise<void>;
}

StreamingBridge

Bridges pipeline events to MCP $/progress notifications. Supports configurable throttling and event taxonomy normalisation.

typescript
class StreamingBridge {
  constructor(eventBus: EventBus<PipelineEvent>, throttleMs?: number);
  subscribe(runId: string, progressToken: string, onProgress?: (n: ProgressNotification) => void): void;
  unsubscribe(progressToken: string): void;
  unsubscribeAll(): void;
}

ToolRegistry

Manages the full catalog of MCP tools with input validation and operation-to-tool mapping.

typescript
class ToolRegistry {
  getTool(name: string): ToolDefinition | undefined;
  getToolForOperation(operation: string): ToolDefinition | undefined;
  getAllTools(): ToolDefinition[];
  getToolsByCategory(category: string): ToolDefinition[];
  getSupportedOperations(): string[];
  toMCPTools(): Tool[];  // MCP SDK-compatible tool list
  isOperationSupported(operation: string): boolean;
  validateInput(toolName: string, input: Record<string, unknown>): { valid: boolean; errors: string[] };
}

PipelineEstimator

Interface for pipeline cost/duration estimation.

typescript
interface PipelineEstimator {
  estimate(pipeline: PipelineDefinition): Promise<PipelineEstimate>;
}
 
function handlePipelineEstimate(
  estimator: PipelineEstimator,
  args: { pipeline: PipelineDefinition },
): Promise<{ content: { type: string; text: string }[]; estimate: PipelineEstimate; success: boolean }>;

MCP Tools

Image Operations

ToolDescriptionRequired Params
image.generateGenerate an image from a text promptprompt
image.generate.batchGenerate multiple images from prompt variationsprompts
image.upscaleUpscale an image to higher resolution (2x/4x/8x)artifact_id, scale
image.remove_backgroundRemove background from an image (png/webp)artifact_id
image.inpaintInpaint or edit parts of an imageartifact_id, prompt
image.describeGenerate a text description of an imageartifact_id
image.resizeResize an image to new dimensions (cover/contain/fill)artifact_id, dimensions
image.cropCrop an image to a specific regionartifact_id, x, y, width, height
image.compositeComposite overlay one image onto anotherbase_artifact_id, overlay_artifact_id
image.image_to_imageTransform an image based on a text promptartifact_id, prompt
mesh.generateGenerate a 3D mesh from text or image (F21)

Audio Operations

ToolDescriptionRequired Params
audio.ttsConvert text to speechtext
audio.sttTranscribe audio to textartifact_id
audio.diarizeIdentify speakers in audioartifact_id
audio.isolateIsolate specific audio stems (vocals/instruments/drums/bass)artifact_id, target
audio.musicGenerate music from a text promptprompt
audio.sound_effectGenerate a sound effect from a text promptprompt
audio.transcribeStreamReal-time STT streaming via WebSocket (F20)source

Video Operations

ToolDescriptionRequired Params
video.generateGenerate a video from a text promptprompt
video.image_to_videoAnimate an image into a videoartifact_id
video.extract_framesExtract frames from a video at intervals or timestampsartifact_id
video.extract_audioExtract audio track from a video (mp3/wav/aac)artifact_id
video.subtitleGenerate subtitles via STT with optional burn-inartifactId

Document Operations

ToolDescriptionRequired Params
document.ocrExtract text from document images (plain_text/structured_json/markdown)artifact_id
document.extract_tablesExtract tables from documents (markdown/json)artifact_id
document.extract_fieldsExtract structured fields from documents with a schemaartifact_id, field_schema
document.summarizeSummarize document content (short/medium/long/detailed)artifact_id

Pipeline Operations

ToolSpec AliasDescriptionRequired Params
media.pipeline.runpipeline.executeExecute a pipeline definitionpipeline
media.pipeline.statuspipeline.statusCheck pipeline run statuspipeline_id
media.pipeline.resumepipeline.resumeResume a gated or failed pipeline by run IDrunId
media.pipeline.cancelpipeline.cancelCancel a running pipelinepipeline_id
media.pipeline.estimatepipeline.estimateDry-run cost and duration estimatepipeline
media.pipeline.subscribepipeline.subscribeSubscribe to pipeline events via webhookpipeline_id, url, events
media.pipeline.defineValidate and preview a pipeline without executingpipeline
media.pipeline.templatespipeline.templatesList pre-built pipeline templates
media.pipeline.batchpipeline.batchExecute batch pipelines from CSV/JSONL/inline datapipeline, source
media.pipeline.batch.statuspipeline.batch.statusCheck batch execution statusbatchId
media.pipeline.batch.retrypipeline.batch.retryRetry failed rows in a batchbatchId
media.pipeline.batch.cancelpipeline.batch.cancelCancel a running batch executionbatchId

Other Tools

ToolDescriptionRequired Params
media.artifact.getRetrieve artifact metadata by IDartifact_id
media.artifact.listList artifacts with optional prefix filter and limit
media.artifact.deleteDelete an artifact by IDartifact_id
media.providers.listList configured providers and health status
media.providers.healthCheck health of a specific providerprovider_id
quality_gate.evaluateEvaluate an artifact against a quality gateartifact_id, gate
media.costs.summaryGet running cost totals by operation and provider

Usage Patterns

Pipeline Execution

jsonc
// POST to /tools/call with MCP protocol
{
  "jsonrpc": "2.0",
  "id": "req-1",
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.run",
    "arguments": {
      "pipeline": {
        "id": "product-photo",
        "steps": [
          {
            "id": "generate",
            "operation": "image.generate",
            "inputs": { "prompt": "Professional product photo of a white sneaker" },
            "config": { "model": "sd3", "dimensions": "1024x1024" },
            "qualityGate": {
              "type": "llm-judge",
              "config": { "prompt": "Does this look professional?", "model": "gpt-4o-mini" },
              "action": "retry",
              "maxRetries": 2
            }
          },
          {
            "id": "upscale",
            "operation": "image.upscale",
            "inputs": { "artifact_id": "{{generate.output}}" },
            "config": { "scale": "4x" }
          },
          {
            "id": "remove_bg",
            "operation": "image.remove_background",
            "inputs": { "artifact_id": "{{upscale.output}}" }
          }
        ]
      }
    }
  }
}

Response:

jsonc
{
  "jsonrpc": "2.0",
  "id": "req-1",
  "result": {
    "success": true,
    "content": [{ "type": "text", "text": "Pipeline 'product-photo' completed with status: completed\nDuration: 12.3s\nCost: $0.0280\nArtifacts: 3" }],
    "pipeline_id": "product-photo",
    "status": "completed",
    "artifacts": [
      { "id": "image-generate-1716300000000", "type": "image", "uri": "s3://bucket/...", "sourceStep": "generate" },
      { "id": "image-upscale-1716300010000", "type": "image", "uri": "s3://bucket/...", "sourceStep": "upscale" },
      { "id": "image-remove_background-1716300020000", "type": "image", "uri": "s3://bucket/...", "sourceStep": "remove_bg" }
    ],
    "cost_usd": 0.028,
    "duration_ms": 12300
  }
}

Pipeline with Idempotency

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.run",
    "arguments": {
      "_meta": {
        "idempotencyKey": "order-1234567",
        "progressToken": "stream-xyz"
      },
      "pipeline": {
        "id": "product-photo",
        "steps": [ /* ... */ ]
      }
    }
  }
}

Idempotency behaviors:

  • First call → executes the pipeline, stores result
  • Duplicate call (same body) → returns stored result instantly, no re-execution
  • Concurrent call → throws IdempotencyConflictError('in-flight')
  • Mismatched body → throws IdempotencyConflictError('body-mismatch')
  • Prior failure → re-throws the stored error

Pipeline Resume

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.resume",
    "arguments": {
      "runId": "run-1716300000000-abc123",
      "fromStepId": "upscale"
    }
  }
}

Resumes a pipeline from the point of failure/gate. Pass fromStepId to resume from a specific step.

Pipeline Estimate

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.estimate",
    "arguments": {
      "pipeline": {
        "id": "product-photo",
        "steps": [
          {
            "id": "generate",
            "operation": "image.generate",
            "inputs": { "prompt": "..." },
            "config": { "model": "sd3", "dimensions": "1024x1024" }
          }
        ]
      }
    }
  }
}

Returns a PipelineEstimate with per-step cost ranges, total min/max cost, estimated duration, router spread warnings, and variable-output-size notes.

Batch Pipeline

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.batch",
    "arguments": {
      "pipeline": {
        "id": "bulk-product-photos",
        "steps": [
          {
            "id": "generate",
            "operation": "image.generate",
            "inputs": { "prompt": "{{row.prompt}}" },
            "config": { "dimensions": "1024x1024" }
          }
        ]
      },
      "source": {
        "type": "inline",
        "rows": [
          { "prompt": "White sneaker on clean white background" },
          { "prompt": "Red running shoe on gym floor" },
          { "prompt": "Blue dress shoe on wooden surface" }
        ]
      },
      "concurrency": 2,
      "onRowFailure": "continue",
      "perRunBudget": { "maxUsd": 0.05, "onExceed": "abort" }
    }
  }
}

Batch operations:

  • media.pipeline.batch.status — check batch progress (completed/failed/in-flight counts)
  • media.pipeline.batch.retry — retry failed or specific rows
  • media.pipeline.batch.cancel — cancel a running batch

Webhook Subscription

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "media.pipeline.subscribe",
    "arguments": {
      "runId": "run-1716300000000-abc123",
      "webhookUrl": "https://my-app.com/webhooks/media-pipeline",
      "events": ["run-completed", "run-failed", "step-completed"],
      "secret": "my-hmac-secret"
    }
  }
}

If secret is omitted, the server mints one and returns it so the caller can verify outbound HMAC signatures.

Quality Gate Evaluation (Standalone)

jsonc
{
  "method": "tools/call",
  "params": {
    "name": "quality_gate.evaluate",
    "arguments": {
      "artifact_id": "img-123",
      "gate": {
        "type": "llm-judge",
        "config": {
          "prompt": "Is this image appropriate for commercial use? Rate 1-10.",
          "model": "gpt-4o-mini"
        },
        "action": "fail"
      }
    }
  }
}

Response Format

All tool responses follow a consistent format:

jsonc
// Success
{
  "success": true,
  "content": [{ "type": "text", "text": "Operation completed successfully.\n..." }],
  "pipeline_id": "my-pipeline",
  "status": "completed",
  "artifacts": [{ "id": "artifact-123", "type": "image", "uri": "s3://...", "sourceStep": "step1" }],
  "cost_usd": 0.014,
  "duration_ms": 4523
}
 
// Error
{
  "success": false,
  "error": "Artifact not found: invalid-id"
}

Webhook Configuration

Outbound Webhooks

Outbound webhooks deliver pipeline events to subscriber URLs. Configure via media.pipeline.subscribe tool or programmatically.

Events dispatched: run-created, run-started, run-completed, run-failed, run-suspended, run-resumed, step-started, step-completed, step-failed, step-gated, step-cached, step-progress.

typescript
// Programmatic subscription
import { SubscriptionManager, WebhookDeliveryService } from "@reaatech/media-pipeline-mcp-server";
 
const manager = new SubscriptionManager();
const delivery = new WebhookDeliveryService();
 
const sub = manager.subscribe({
  pipelineId: "run-123",
  url: "https://my-app.com/hooks",
  events: ["run-completed", "run-failed"],
  secret: "hmac-key-32+chars",
});

Inbound Webhooks

Inbound webhooks receive provider callbacks on POST /webhooks/:provider/:runId. Supported providers:

ProviderEnv Var for SecretPurpose
replicateREPLICATE_WEBHOOK_SECRETAsync model prediction completion
falFAL_WEBHOOK_SECRETAsync fal model completion
deepgramDEEPGRAM_WEBHOOK_SECRETBatch transcription results

Webhook signatures are verified via provider-specific HMAC before the handler auto-resumes the associated pipeline.

Multi-Tenant Configuration

When features.multiTenant is enabled, every request resolves a TenantContext before tool dispatch:

typescript
const config: ServerConfig = {
  features: { multiTenant: true },
  multiTenant: {
    enabled: true,
    keyVault: new AwsKeyVault(/* ... */),
    resolver: { kind: "header", headerName: "x-tenant-id" },
    defaultBudgetCaps: { dailyLimit: 50, monthlyLimit: 1000 },
  },
};

The resolved TenantContext flows through AsyncLocalStorage to:

  • Provider factory — per-tenant API keys from the key vault
  • StorageTenantScopedArtifactStore prefixes all artifacts to tenants/{tenantId}/
  • Cost ledger — per-tenant cost aggregation
  • Provider allow-listenforceTenantPolicy blocks unapproved providers/models
  • MCP Resources — cross-tenant reads return ArtifactAccessDeniedError (403)

Tenant resolution strategies:

  • header — reads x-tenant-id from HTTP headers
  • static — fixed tenant ID from config
  • Custom — supply your own resolution function

Environment Variables

Server Configuration

VariableDefaultDescription
PORT8080HTTP listen port
HOST0.0.0.0Listen address
LOG_LEVELinfoLog level (error, warn, info, debug)

Storage

VariableDefaultDescription
STORAGE_TYPElocalStorage backend (local, s3, gcs)
STORAGE_PATH./artifactsLocal storage directory
STORAGE_TTLTTL in seconds for local storage
STORAGE_SERVE_HTTPfalseServe artifacts via HTTP
S3_BUCKETmedia-artifactsS3 bucket name
S3_REGIONus-east-1S3 region
S3_PREFIXartifacts/S3 key prefix
GCS_BUCKETmedia-artifactsGCS bucket name
GCS_PREFIXartifacts/GCS key prefix

Provider API Keys

VariableProvider
OPENAI_API_KEYOpenAI (image, audio, vision)
STABILITY_API_KEYStability AI (image generation, inpainting)
REPLICATE_API_KEYReplicate (image/video generation, upscaling)
FAL_API_KEYFal (image/video generation)
ELEVENLABS_API_KEYElevenLabs (TTS)
DEEPGRAM_API_KEYDeepgram (STT, diarization)
ANTHROPIC_API_KEYAnthropic (vision, document extraction)
GOOGLE_PROJECT_IDGoogle Cloud project for Document AI / Vertex AI
GOOGLE_LOCATIONGoogle Cloud location (default: us-central1)
GOOGLE_DOCUMENT_AI_PROCESSOR_IDDocument AI processor ID
GOOGLE_GEMINI_MODELGemini model override for image description
GOOGLE_KEY_FILEGoogle service account JSON path
GOOGLE_APPLICATION_CREDENTIALSStandard Google credentials env var

Authentication & Security

VariableDefaultDescription
AUTH_ENABLEDfalseEnable JWT/API key authentication
JWT_SECRETJWT signing secret (min 32 characters)
API_KEYSComma-separated API keys

Rate Limiting

VariableDefaultDescription
RATE_LIMIT_ENABLEDtrueEnable rate limiting
RATE_LIMIT_RPM60Requests per minute per client
RATE_LIMIT_BURST10Burst size per client
EXPENSIVE_OPS_RPM10Rate limit for expensive operations (image/video gen, TTS)

Budget & Cost Controls

VariableDefaultDescription
BUDGET_DAILY_LIMITDaily budget limit in USD
BUDGET_MONTHLY_LIMITMonthly budget limit in USD
BUDGET_PER_PIPELINE_LIMITPer-pipeline budget limit in USD
BUDGET_ALERT_THRESHOLD0.9Alert threshold as fraction of limit (0–1)

Feature Flags

VariableDefaultDescription
FEATURE_IDEMPOTENCYtrueIdempotent retries (F1)
FEATURE_CONTENT_CACHEfalseContent-based caching
FEATURE_RESUMABLE_PIPELINESfalseResumable pipelines
FEATURE_BUDGET_CAPStrueBudget pre-flight checks (F4)
FEATURE_DRY_RUNtrueCost estimation (F5)
FEATURE_STREAMINGfalseProgress notifications (F6)
FEATURE_WEBHOOKSfalseInbound/outbound webhooks (F7)
FEATURE_ROUTINGfalseAdvanced provider routing (F8)
FEATURE_VARIANTSfalseVariant fan-out (F9)
FEATURE_SUBTITLESfalseSubtitle pipeline
FEATURE_RUN_CONTEXTtrueRun context interpolation (F13)
FEATURE_BATCHfalseBatch pipelines (F15)
FEATURE_SAFETY_GATEtrueSafety moderation gate (F16)
FEATURE_PROVENANCEfalseC2PA provenance (F17)
FEATURE_MULTI_TENANTfalseMulti-tenant isolation (F18)
FEATURE_MCP_RESOURCESfalseArtifact MCP resources (F19)
FEATURE_STT_STREAMfalseReal-time STT (F20)

Observability

VariableDefaultDescription
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry collector endpoint
WEBHOOK_BASE_URLBase URL for outbound webhook callbacks

License

MIT