npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reaatech/media-pipeline-mcp-fal

v0.3.0

Published

Fal.ai provider — Fast Flux Pro image generation, Real-ESRGAN upscaling, background removal, Kling video generation

Readme

@reaatech/media-pipeline-mcp-fal

npm version License: MIT CI

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

Fal.ai provider for the media pipeline framework. Supports image generation (Fast Flux Pro), upscaling (Real-ESRGAN), background removal, video generation (Kling Video), and image-to-video animation via the fal.ai API. Features native webhook support with HMAC signatures and streaming queue events for long-running operations.

Installation

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

Feature Overview

  • Image generation with Fast Flux Pro (configurable inference steps, guidance scale)
  • Image upscaling with Real-ESRGAN (2x/4x scale, optional face enhancement)
  • Background removal with dedicated fal model
  • Text-to-video generation with Kling Video (duration, aspect ratio, FPS control)
  • Image-to-video animation with Kling I2V
  • Streaming support for all operations via fal SDK queue events (supportsStreaming)
  • Webhook support for async completion notifications (supportsWebhooks)
  • Aspect ratio mapping for common social media dimensions

Quick Start

import { FalProvider } from "@reaatech/media-pipeline-mcp-fal";

const provider = new FalProvider({ apiKey: process.env.FAL_API_KEY! });

// Generate an image
const result = await provider.execute({
  operation: "image.generate",
  params: {
    prompt: "A photorealistic portrait of a cat wearing a spacesuit",
    aspect_ratio: "1:1",
  },
  config: {},
});
console.log(result.metadata.model); // "fal-ai/fast-flux-pro"

// Generate a video from text
const video = await provider.execute({
  operation: "video.generate",
  params: {
    prompt: "A drone flythrough of a futuristic city at golden hour",
    duration: 5,
    aspect_ratio: "16:9",
  },
  config: {},
});

// Upscale an existing image
const upscaled = await provider.execute({
  operation: "image.upscale",
  params: { image_data: imageBuffer, scale: 4 },
  config: {},
});

Supported Operations

| Operation | Default Model | Description | Output | |-----------|---------------|-------------|--------| | image.generate | fal-ai/fast-flux-pro | Text-to-image with inference config control | PNG image buffer | | image.upscale | fal-ai/real-esrgan | Image upscaling with configurable scale factor | Upscaled image buffer | | image.remove_background | fal-ai/background-removal | Background removal | Transparent PNG buffer | | video.generate | fal-ai/kling-video/v1/prod/text-to-video | Text-to-video generation | MP4 video buffer | | video.image_to_video | fal-ai/kling-video/v1/prod/image-to-video | Image-to-video animation | MP4 video buffer |

Configuration Parameters

image.generate

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | prompt | string | required | Text description of the desired image | | aspect_ratio | string | "1:1" | One of 1:1, 16:9, 9:16, 4:3, 3:4 |

image.upscale

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | image_data | Buffer | required | Input image as raw buffer | | scale | number | 4 | Scale factor (2 or 4) |

image.remove_background

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | image_data | Buffer | required | Input image as raw buffer |

video.generate

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | prompt | string | required | Text description of the desired video | | duration | number | 5 | Video duration in seconds | | aspect_ratio | string | "16:9" | Video aspect ratio (16:9, 9:16, 1:1) |

video.image_to_video

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | image_data | Buffer | required | Input image as raw buffer | | motion_prompt | string | — | Description of desired motion | | duration | number | 5 | Video duration in seconds |

API Reference

FalProvider

class FalProvider extends MediaProvider {
  constructor(config: FalProviderConfig)

  healthCheck(): Promise<ProviderHealth>
  estimateCost(input: ProviderInput): Promise<CostEstimate>
  execute(input: ProviderInput): Promise<ProviderOutput>
}

FalProviderConfig

interface FalProviderConfig {
  apiKey: string;
  models?: {
    imageGenerate?: string;       // Default: "fal-ai/fast-flux-pro"
    upscale?: string;             // Default: "fal-ai/real-esrgan"
    removeBackground?: string;    // Default: "fal-ai/background-removal"
    videoGenerate?: string;       // Default: "fal-ai/kling-video/v1/prod/text-to-video"
    videoImageToVideo?: string;   // Default: "fal-ai/kling-video/v1/prod/image-to-video"
  };
  pollingInterval?: number;       // Queue polling interval in ms
  timeout?: number;                // Request timeout in ms
}

Factory Function

import { defineFalProvider } from "@reaatech/media-pipeline-mcp-fal";

const provider = defineFalProvider({ apiKey: process.env.FAL_API_KEY! });

Key Methods

| Method | Returns | Description | |--------|---------|-------------| | healthCheck() | ProviderHealth | Validates API key by querying the fal balance endpoint | | estimateCost(input) | CostEstimate | Returns fixed per-operation cost from pricing table | | execute(input) | ProviderOutput | Submits to fal queue via fal.subscribe(), polls for completion, fetches output |

Non-Retryable Errors

The provider classifies these errors as non-retryable: authentication failed, invalid API key, permission denied, model not found, insufficient credits.

Cost Estimation

| Operation | Model | Cost | |-----------|-------|------| | image.generate | Fast Flux Pro | $0.008 / image | | image.upscale | Real-ESRGAN | $0.004 / image | | image.remove_background | Background Removal | $0.002 / image | | video.generate | Kling Video (T2V) | $0.12 / video | | video.image_to_video | Kling I2V | $0.10 / video |

Costs are fixed per-operation and retrieved from pricing.json. No per-step or per-second multipliers are applied.

Aspect Ratio Mapping

| Ratio | Dimensions | |-------|-----------| | 1:1 | 1024 × 1024 | | 16:9 | 1920 × 1080 | | 9:16 | 1080 × 1920 | | 4:3 | 1024 × 768 | | 3:4 | 768 × 1024 |

Cache Configuration

The provider exposes static cacheConfig with deterministic and non-deterministic parameters.

Deterministic parameters: prompt, negative_prompt, model, seed, image_url, image_size, num_inference_steps, guidance_scale, duration, aspect_ratio

Non-deterministic parameters: request_id, webhook_url, sync_mode

The normalize() function trims and collapses whitespace in prompt strings, and drops webhook/sync fields so that cache keys are based solely on model input parameters.

Health Check

The health check sends a GET request to https://api.fal.ai/v1/balance using the API key as a Bearer token. Returns { healthy: true, latency: <ms> } on success, or { healthy: false, error: "HTTP <status>: <message>" } on failure.

Related Packages

License

MIT