piapi-mcp-server is a Model Context Protocol (MCP) server implemented in TypeScript, used to integrate PiAPI's API. Its goal is to enable users to generate media content with PiAPI directly from Claude or any other MCP-compatible application, with supported models and services including Midjourney, Flux, Kling, LumaLabs, Udio, Chrip, Trellis, and more.
In terms of purpose, the project acts as a bridge between MCP clients (such as Claude Desktop and Cursor) and PiAPI. Users can trigger media generation tasks for images, videos, music, speech, 3D models, and more through natural language or tool calls without leaving the conversation interface, and it supports workflow planning within the LLM.
The main capabilities include: basic image toolkit, basic video toolkit; Flux generates images from text or image prompts; Hunyuan generates videos from text or image prompts; Skyreels generates videos from image prompts; Wan generates videos from text or image prompts; MMAudio generates music from video; TTS zero-shot speech generation; Midjourney image generation (imagine, etc.); Kling video and effects generation; Luma Dream Machine video generation; Suno music generation; Suno lyrics generation; Udio music and lyrics generation; Trellis generates 3D models from images. The project description also notes that time-consuming tools such as video generation may fail to complete due to Claude's timeout limits.
In terms of usage, Node.js 16.x or higher is required, as well as a PiAPI API key (available at piapi.ai). Installation can be done automatically via Smithery to install PiAPI MCP Server for Claude Desktop, or manually: clone the repository, install dependencies, and build the project. After building, a dist/index.js file is generated, which can be configured for Claude Desktop and other applications. Optionally, the server can be tested using MCP Inspector: first create a .env file containing the API key in the project root directory, then run the command to start MCP Inspector, with the default address being http://localhost:5173,默认超时为 10000 milliseconds (10 seconds), which may be insufficient for tasks such as image generation. It is recommended to adjust the timeout via URL parameters, for example http://localhost:5173?timeout=60000。MCP Inspector provides features such as interactive testing, real-time feedback, request/response inspection, function documentation, custom parameters, and history.
When connecting to Claude Desktop, you need to add the corresponding configuration in its configuration file (the macOS path is ~/Library/Application Support/Claude/claude_desktop_config.json, and the Windows path is %APPDATA%\Claude\claude_desktop_config.json). After updating, restart Claude for Desktop, and a hammer icon should appear in the lower-right corner of the input box. When connecting to Cursor (the instructions are based on Cursor 0.47.5; different versions may behave differently), go to File > Preferences > Cursor Settings in order, or use the shortcut Ctrl+Shift+J, select the MCP tab on the left, click Add new global MCP server in the upper-right corner, and add the configuration in the opened mcp.json file; after the configuration is complete, a piapi entry will appear on the MCP Servers page. Click refresh or restart Cursor to connect. When testing image generation, select Agent mode in Cursor Chat or use Ctrl+I, and enter a test prompt (for example, generate image of a dog). To disable it, find the piapi entry on the MCP Servers page and switch Enabled to Disabled.
The project also includes a mechanism to keep tools in sync with PiAPI. src/index.ts registers a contract-based MCP tool for each committed PiAPI (model, task type) capability. The tool name is deterministic: piapi_<model>_<task_type> (for example, piapi_qubico_flux1_schnell_txt2img), and its input schema is generated from the committed catalog. The original handwritten convenience tools are still available, while the contract-based tools ensure that the exposed interface remains complete when the Manager catalog changes. The repository includes a repeatable drift detector that compares the catalog baseline with the versioned API contract of PiAPI Manager to detect newly added API, deprecated APIs, parameter changes, and description changes. The source of truth is the Go API.postman_collection.json contract in the PiAPI Manager GitHub repository (Gocyber-world/midjourney-http-v2); the task fetches that versioned contract directly from GitHub and extracts the POST /api/v1/task examples as (model, task type) capabilities. If the Manager repository is private, you need to set the CI secret MCP_SYNC_GITHUB_TOKEN and grant it least privilege (contents: read on that source repository, as well as separately approved write permissions required for MCP update automation). This mechanism does not depend on Apidog and intentionally does not inspect or report pricing. By default, npm run sync uses the Manager GitHub contract; for recovery or local development, an exported OpenAPI JSON file can also be provided. When a drift report is produced, after the baseline is accepted, the new capability is already represented by its contract-based MCP tool. Verify the MCP server, run npm run sync:accept, and commit the refreshed baseline. Update the handwritten convenience tools only when a curated model-specific user experience is useful. .github/workflows/sync-piapi.yml is retained only for manual triggering; periodic synchronization runs in an approved local automation environment that holds separately owner-approved MCP credentials and can verify, accept, and push catalog updates after its sensitive information gate passes.
Applicable scenarios include: directly generating images, videos, music, speech, and 3D models in MCP-compatible applications such as Claude Desktop or Cursor; needing to integrate PiAPI's multiple media generation capabilities into LLM workflows; and development and maintenance scenarios that require keeping MCP tools in sync with PiAPI's latest API contract.
In terms of limitations: time-consuming tools such as video generation may not complete due to Claude's timeout limits; MCP Inspector has a default timeout of 10 seconds, which may be insufficient for tasks such as image generation and needs to be adjusted manually; the instructions for connecting to Cursor are based on version 0.47.5, and behavior may differ across versions; the synchronization mechanism requires access to PiAPI Manager's GitHub contract, private repositories require configuring the corresponding token; the project explicitly does not check or report pricing.