by apinetwork
Enables Claude, Cursor, and other MCP‑compatible applications to generate images, videos, audio, text‑to‑speech, and 3‑D models through PiAPI’s extensive media creation models.
Piapi Mcp Server is a TypeScript‑based MCP server that bridges MCP‑compatible clients (e.g., Claude Desktop, Cursor) with PiAPI’s suite of generative AI models. It exposes a catalog of tools such as image creation, video synthesis, music generation, TTS, and 3‑D model rendering, allowing LLMs to request media content directly.
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
npm install
npm run build
.env file with PIAPI_API_KEY=your_key. Add the server entry to the client’s MCP configuration (Claude Desktop or Cursor) pointing to the compiled dist/index.js.node dist/index.js (or via the client’s launch command). Optionally test with the built‑in MCP Inspector (npm run inspect).Q: Do I need a separate PiAPI account for each model? A: No, a single PiAPI API key grants access to all supported models; usage limits are enforced by PiAPI.
Q: Why might video generation fail?
A: Time‑consuming tasks may exceed Claude’s default timeout. Increase the timeout in the MCP Inspector URL (e.g., ?timeout=60000).
Q: Can I add new models without modifying code?
A: Yes. The sync task fetches PiAPI’s OpenAPI contract, generates contract‑backed tools, and detects drift. Run npm run sync to update the catalog.
Q: Is there a way to test the server locally?
A: Use the MCP Inspector (npm run inspect) which provides an interactive UI for invoking all exposed functions.
Q: How do I disable the server in Cursor? A: Open Cursor’s MCP settings, locate the “piapi” entry, and toggle the “Enabled” switch.
A TypeScript implementation of a Model Context Protocol (MCP) server that integrates with PiAPI's API. PiAPI makes user able to generate media content with Midjourney/Flux/Kling/LumaLabs/Udio/Chrip/Trellis directly from Claude or any other MCP-compatible apps.
Note: Time-consuming tools like video generation may not complete due to Claude's timeout limitations

To install PiAPI MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install piapi-mcp-server --client claude
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
npm install
npm run build
After building, a dist/index.js file will be generated. You can then configure this file with Claude Desktop and other applications. For detailed configuration instructions, please refer to the Usage section.
First, create a .env file in the project root directory with your API key:
PIAPI_API_KEY=your_api_key_here
Then run the following command to start the MCP Inspector:
npm run inspect
After running the command, MCP Inspector will be available at http://localhost:5173 (default port: 5173). Open this URL in your browser to start testing. The default timeout for inspector operations is 10000ms (10 seconds), which may not be sufficient for image generation tasks. It's recommended to increase the timeout when testing image generation or other time-consuming operations. You can adjust the timeout by adding a timeout parameter to the URL, for example: http://localhost:5173?timeout=60000 (sets timeout to 60 seconds)
The MCP Inspector is a powerful development tool that helps you test and debug your MCP server implementation. Key features include:
For detailed information about using the MCP Inspector and its features, visit the official MCP documentation.
Add this to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"piapi": {
"command": "node",
"args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
"env": {
"PIAPI_API_KEY": "your_api_key_here"
}
}
}
}
After updating your configuration file, you need to restart Claude for Desktop. Upon restarting, you should see a hammer icon in the bottom right corner of the input box. For more detailed information, visit the official MCP documentation
Note: Following guide is based on Cursor 0.47.5. Features and behaviors may vary in different versions.
To configure the MCP server:
Ctrl+Shift+J{
"mcpServers": {
"piapi": {
"command": "node",
"args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
"env": {
"PIAPI_API_KEY": "your_api_key_here"
}
}
}
}
To test the piapi image generation:
Ctrl+ITo disable the piapi server:
src/index.ts registers a contract-backed MCP tool for every committed
PiAPI (model, task_type) capability. Tool names are deterministic:
piapi_<model>_<task_type> (for example,
piapi_qubico_flux1_schnell_txt2img), and their input schemas are generated
from the committed catalog. The existing hand-written convenience tools remain
available; the contract-backed tools ensure the exposed surface stays complete
as the Manager catalog changes.
The legacy convenience tools in src/index.ts remain hand-written, but the
complete contract-backed surface is generated from the committed catalog. This
repository includes a repeatable drift detector that compares that catalog
baseline with PiAPI Manager's versioned API contract. It detects new APIs,
deprecated APIs, parameter changes, and description changes.
Source of truth: 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 into (model, task_type) capabilities. If the
Manager repository is private, set the CI secret MCP_SYNC_GITHUB_TOKEN with
least-privilege contents: read on that source repository (and only the
separate approved write permissions needed for MCP update automation). It has
no Apidog dependency and deliberately does not inspect or report pricing.
npm run build # compile the MCP server and sync task
npm run test:sync # offline sync-engine tests (no network or credentials)
npm run sync # fetch contract and diff baseline; exit 0 = in sync, 2 = drift
npm run sync:snapshot # print the normalized current contract catalog
npm run sync:report # write the Markdown drift report to sync-report.md
npm run sync:accept # after updating src/index.ts, refresh the baseline
By default, npm run sync uses the Manager GitHub contract. For recovery or
local development, an exported OpenAPI JSON file can be supplied instead:
node dist/sync/cli.js diff --file ./piapi-openapi.json
When a drift report is produced, a new capability is already represented by its
contract-backed MCP tool after the baseline is accepted. Validate the MCP
server, run npm run sync:accept, and commit the refreshed baseline. Update a
hand-written convenience tool only when a curated model-specific UX is useful.
.github/workflows/sync-piapi.yml is retained for manual dispatch only.
Periodic synchronization is run from the approved local automation environment,
which holds the separately owner-approved MCP credential and can validate,
accept, and push catalog updates after its sensitive-information gate passes.
piapi-mcp-server/
├── assets/
├── src/
│ ├── index.ts # Main server entry point
│ └── sync/ # PiAPI -> MCP sync task
│ ├── cli.ts # CLI: snapshot / diff / accept / report-file
│ ├── fetchers.ts # GitHub Postman contract + local-file sources
│ ├── normalize.ts # OpenAPI -> (model, task_type) catalog
│ ├── diff.ts # catalog diff + Markdown report
│ ├── catalog.ts # baseline load/save
│ ├── selftest.ts # offline engine test (npm run test:sync)
│ ├── types.ts
│ └── baseline.piapi-catalog.json # committed baseline
├── .github/workflows/sync-piapi.yml # weekly drift check
├── package.json
├── tsconfig.json
└── .env.example
MIT
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by MiniMax-AI
Enables interaction with powerful text‑to‑speech, image generation and video generation APIs through a Model Context Protocol server.
by burningion
Upload, edit, search, and generate videos by leveraging LLM capabilities together with Video Jungle's media library.
by mamertofabian
Generate speech audio from text via ElevenLabs API and manage voice generation tasks through a Model Context Protocol server with a companion SvelteKit web client.
by Flyworks-AI
Create fast, free lip‑sync videos for digital avatars by providing audio or text, with optional avatar generation from images or videos.
by mberg
Generates spoken audio from text, outputting MP3 files locally and optionally uploading them to Amazon S3.
by allvoicelab
Generate natural speech, translate and dub videos, clone voices, remove hardcoded subtitles, and extract subtitles using powerful AI APIs.
by nabid-pf
Extracts YouTube video captions, subtitles, and metadata to supply structured information for AI assistants to generate concise video summaries.
by omergocmen
Provides video generation and status checking via the json2video API for seamless integration with LLMs, agents, and other MCP‑compatible clients.
by nmbrthirteen
Generate vertical podcast clips with AI‑driven face tracking, burned‑in captions, and a fully integrated content workflow that stays on‑device.