Skip to content
reaatechREAATECH

@reaatech/media-pipeline-mcp-meshy

npm v0.3.0

A Meshy-4 provider for the media-pipeline framework that generates 3D meshes from text prompts or reference images, supporting PBR textures and GLB/FBX/OBJ/USDZ output formats. It exports a `MeshyProvider` class that implements the `MediaProvider` interface for use with the `@reaatech/media-pipeline-mcp` framework.

@reaatech/media-pipeline-mcp-meshy

npm version License: MIT CI

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

Meshy provider for the media pipeline framework. Supports 3D model generation with PBR texture support via Meshy-4. Text-to-3D and image-to-3D with GLB, FBX, OBJ, and USDZ output formats.

Installation

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

Feature Overview

  • Text-to-3D and image-to-3D — generate meshes from text prompts or reference images
  • PBR textures — optional physically-based rendering textures with configurable resolution
  • Multiple output formats — GLB, FBX, OBJ, and USDZ
  • Preview and refine modes — choose between fast preview or texture-rich refined output
  • Polygon budget control — specify target polygon count for generated meshes
  • Poll-based completion — automatic polling with configurable interval and timeout
  • Webhook support — provider declares webhook capability for async job completion

Quick Start

typescript
import { MeshyProvider } from "@reaatech/media-pipeline-mcp-meshy";
 
const provider = new MeshyProvider({
  apiKey: process.env.MESHY_API_KEY!,
});
 
// Text-to-3D preview
const result = await provider.execute({
  operation: "mesh.generate",
  params: {
    prompt: "A medieval wooden treasure chest with iron bands",
    format: "glb",
  },
  config: {},
});
 
console.log(result.metadata.format); // "glb"
console.log(result.metadata.taskId);  // "abc123..."
console.log(result.costUsd);          // 0.20

With PBR textures and polygon budget:

typescript
const result = await provider.execute({
  operation: "mesh.generate",
  params: {
    prompt: "A sci-fi plasma rifle with glowing accents",
    format: "fbx",
    polyBudget: 50000,
    texture: {
      enabled: true,
      pbr: true,
      resolution: 2048,
    },
  },
  config: {},
});
 
console.log(result.metadata.hasTextures); // true
console.log(result.costUsd);              // 0.40

Image-to-3D from a reference:

typescript
const result = await provider.execute({
  operation: "mesh.generate",
  params: {
    prompt: "A vintage rotary phone",
    sourceArtifactId: "https://example.com/reference-phone.jpg",
    format: "usdz",
    texture: { enabled: true, pbr: true },
  },
  config: {},
});

Supported Operations

OperationAPI EndpointDescription
mesh.generate/openapi/v2/text-to-3d or /openapi/v2/image-to-3dText-to-3D or image-to-3D mesh generation via Meshy-4

Configuration

typescript
interface MeshyConfig {
  apiKey: string;            // Required — Meshy API key (or set MESHY_API_KEY env var)
  baseUrl?: string;           // Default: "https://api.meshy.ai"
  pollIntervalMs?: number;    // Default: 5000
  maxWaitMs?: number;         // Default: 600000 (10 min)
}

API Reference

MeshyProvider

Main provider class extending MediaProvider.

MemberTypeDescription
supportedOperationsstring[]['mesh.generate']
supportsStreamingSet<string>{'mesh.generate'}
supportsWebhooksbooleantrue — webhook delivery supported by Meshy API
healthCheck()Promise<ProviderHealth>Checks /openapi/v2/users/me endpoint
estimateCost(input)Promise<CostEstimate>Returns cost based on mode (preview/refine)
execute(input)Promise<ProviderOutput>Creates task, polls for completion, downloads mesh file

MeshyConfig

Configuration interface (see Configuration section above).

Mesh Generation Parameters

ParameterTypeDefaultDescription
promptstringText description of the 3D model to generate
sourceArtifactIdstringReference image URL — triggers image-to-3D path when present
formatstringglbOutput format: glb, fbx, obj, or usdz
polyBudgetnumberTarget polygon count for the generated mesh
textureobjectTexture configuration object
texture.enabledbooleanEnable texture generation (switches to refine mode)
texture.pbrbooleanfalseEnable PBR (physically-based rendering) textures
texture.resolutionnumberTexture resolution in pixels (e.g. 1024, 2048)

Output Metadata

FieldTypeDescription
providerstringmeshy
taskIdstringMeshy task ID
formatstringActual output format
requestedFormatstringFormat requested by caller
hasTexturesbooleanWhether textures were generated
hasAnimationbooleanfalse — static mesh
promptstringOriginal generation prompt
sourceArtifactIdstringReference image URL if image-to-3D

MIME Types by Format

FormatMIME Type
glbmodel/gltf-binary
fbxapplication/octet-stream
objtext/plain
usdzmodel/vnd.usdz+zip

Cost Estimation

OperationModeEstimated Cost
mesh.generatePreview$0.20 / generation
mesh.generateRefine (with textures)$0.40 / generation

License

MIT