piapi-mcp-server

piapi-mcp-server

TypeScript-based MCP server for PiAPI media content generation

62
Stars
23
Forks
62
Watchers
5
Issues
piapi-mcp-server is a TypeScript implementation of a Model Context Protocol (MCP) server that connects with PiAPI to enable media generation workflows from MCP-compatible applications. It handles image, video, music, TTS, 3D, and voice generation tasks using a wide range of supported models like Midjourney, Flux, Kling, LumaLabs, Udio, and more. Designed for easy integration with clients such as Claude Desktop, it includes an interactive MCP Inspector for development, testing, and debugging.

Key Features

TypeScript implementation of MCP server
Integration with PiAPI for unified media generation
Support for image, video, music, TTS, and 3D workflows
Compatibility with models like Midjourney, Flux, Kling, Udio, LumaLabs, Suno, etc.
MCP Inspector for interactive testing and debugging
Client integrations (e.g., Claude Desktop)
Modular toolkit for different media modalities
Customizable timeout and server settings
Function documentation with web interface
Automated installation via Smithery

Use Cases

Generating images from text or image prompts using multiple generative models
Creating and editing videos through AI models directly from chat interfaces
Composing music or generating audio tracks from prompts
Text-to-speech synthesis with zero-shot voice generation
3D model creation from images
Integrating advanced media workflows into LLM client applications
Prototyping and testing model context integrations with MCP Inspector
Centralizing access to diverse AI content generation APIs
Expanding Claude Desktop or similar apps with creative media capabilities
Automating workflow planning for generative AI tasks inside LLM environments

README

piapi-mcp-server

Website Documentation Discord

smithery badge

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.

Features (more coming soon)

Note: Time-consuming tools like video generation may not complete due to Claude's timeout limitations

  • Base Image toolkit
  • Base Video toolkit
  • Flux Image generation from text/image prompt
  • Hunyuan Video generation from text/image prompt
  • Skyreels Video generation from image prompt
  • Wan Video generation from text/image prompt
  • MMAudio Music generation from video
  • TTS Zero-Shot voice generation
  • Midjourney Image generation
    • imagine
    • other
  • Kling Video and Effects generation
  • Luma Dream Machine video generation
  • Suno Music generation
  • Suno Lyrics generation
  • Udio Music and Lyrics generation
  • Trellis 3D model generation from image
  • Workflow planning inside LLMs

Working with Claude Desktop Example

image

Prerequisites

  • Node.js 16.x or higher
  • npm or yarn
  • A PiAPI API key (get one at piapi.ai)

Installation

Installing via Smithery

To install PiAPI MCP Server for Claude Desktop automatically via Smithery:

bash
npx -y @smithery/cli install piapi-mcp-server --client claude

Manual Installation

  1. Clone the repository:
bash
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
  1. Install dependencies:
bash
npm install
  1. Build the project:
bash
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.

  1. (Optional) Test server with MCP Inspector:

First, create a .env file in the project root directory with your API key:

bash
PIAPI_API_KEY=your_api_key_here

Then run the following command to start the MCP Inspector:

bash
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:

  • Interactive Testing: Test your server's functions directly through a web interface
  • Real-time Feedback: See immediate results of your function calls and any errors that occur
  • Request/Response Inspection: View detailed information about requests and responses
  • Function Documentation: Browse available functions and their parameters
  • Custom Parameters: Set custom timeout values and other configuration options
  • History Tracking: Keep track of your previous function calls and their results

For detailed information about using the MCP Inspector and its features, visit the official MCP documentation.

Usage

Connecting to Claude Desktop

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):

json
{
  "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

Connecting to Cursor

Note: Following guide is based on Cursor 0.47.5. Features and behaviors may vary in different versions.

To configure the MCP server:

  1. Navigate to: File > Preferences > Cursor Settings, or use the shortcut key Ctrl+Shift+J
  2. Select "MCP" tab on the left panel
  3. Click "Add new global MCP server" button in the top right
  4. Add your configuration in the opened mcp.json file
json
{
  "mcpServers": {
    "piapi": {
      "command": "node",
      "args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
      "env": {
        "PIAPI_API_KEY": "your_api_key_here"
      }
    }
  }
}
  1. After configuration, you'll see a "piapi" entry in MCP Servers page
  2. Click the Refresh button on the entry or restart Cursor to connect to the piapi server

To test the piapi image generation:

  1. Open and select "Agent mode" in Cursor Chat, or use the shortcut key Ctrl+I
  2. Enter a test prompt, for example: "generate image of a dog"
  3. The image will be generated based on your prompt using piapi server

To disable the piapi server:

  1. Navigate to the MCP Servers page in Cursor Settings
  2. Find the "piapi" entry in the server list
  3. Click the "Enabled" toggle button to switch it to "Disabled"

Development

Project Structure

piapi-mcp-server/
├── assets/
├── src/
│   ├── index.ts        # Main server entry point
├── package.json
├── tsconfig.json
└── .env.example

License

MIT

Star History

Star History Chart

Repository Owner

apinetwork
apinetwork

User

Repository Details

Language TypeScript
Default Branch main
Size 424 KB
Contributors 5
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

TypeScript
98.35%
Dockerfile
1.65%

Tags

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Confluence Communication Server MCP Server

    Confluence Communication Server MCP Server

    Seamlessly interact with Confluence using standardized MCP tools.

    Confluence Communication Server MCP Server is a TypeScript-based implementation that enables seamless interaction with Confluence through the Model Context Protocol. It provides tools for running CQL queries, retrieving, and updating Confluence page content, thus showcasing and adhering to core MCP concepts. The server is compatible with Claude Desktop and supports installation via Smithery, emphasizing ease of integration and automation for Confluence management tasks.

    • 13
    • MCP
    • KS-GEN-AI/confluence-mcp-server
  • FastMCP

    FastMCP

    TypeScript framework for building robust MCP servers with minimal setup.

    FastMCP is a TypeScript framework designed for building servers that adhere to the Model Context Protocol (MCP), enabling efficient management of client sessions and context. It streamlines the creation of MCP servers by providing intuitive APIs, built-in authentication, session and request tracking, and support for handling various content types such as images and audio. The framework also enforces best practices around error handling, logging, and streaming outputs. Developers benefit from reduced boilerplate and a focus on core MCP functionality.

    • 2,738
    • MCP
    • punkpeye/fastmcp
  • Notion MCP Server

    Notion MCP Server

    Enable LLMs to interact with Notion using the Model Context Protocol.

    Notion MCP Server allows large language models to interface with Notion workspaces through a Model Context Protocol server, supporting both data retrieval and editing capabilities. It includes experimental Markdown conversion to optimize token usage for more efficient communication with LLMs. The server can be configured with environment variables and controlled for specific tool access. Integration with applications like Claude Desktop is supported for seamless automation.

    • 834
    • MCP
    • suekou/mcp-notion-server
  • Plane MCP Server

    Plane MCP Server

    Enables LLMs to manage Plane.so projects and issues via the Model Context Protocol.

    Plane MCP Server provides a standardized interface to connect large language models with Plane.so project management APIs. It enables LLMs to interact directly with project and issue data, supporting tasks such as listing projects, retrieving detailed information, creating and updating issues, while prioritizing user control and security. Installation is streamlined through tools like Smithery, and configuration supports multiple clients including Claude for Desktop.

    • 32
    • MCP
    • kelvin6365/plane-mcp-server
  • @nanana-ai/mcp-server-nano-banana

    @nanana-ai/mcp-server-nano-banana

    MCP server for Nanana AI image generation using Gemini's nano banana model.

    @nanana-ai/mcp-server-nano-banana serves as an MCP (Model Context Protocol) compatible server for facilitating image generation and transformation powered by the Gemini nano banana model. It enables clients like Claude Desktop to interact with Nanana AI, processing text prompts to generate images or transform existing images. The server can be easily configured with API tokens and integrated into desktop applications. Users can manage credentials, customize endpoints, and monitor credit usage seamlessly.

    • 3
    • MCP
    • nanana-app/mcp-server-nano-banana
  • mcp-graphql

    mcp-graphql

    Enables LLMs to interact dynamically with GraphQL APIs via Model Context Protocol.

    mcp-graphql provides a Model Context Protocol (MCP) server that allows large language models to discover and interact with GraphQL APIs. The implementation facilitates schema introspection, exposes the GraphQL schema as a resource, and enables secure query and mutation execution based on configuration. It supports configuration through environment variables, automated or manual installation options, and offers flexibility in using local or remote schema files. By default, mutation operations are disabled for security, but can be enabled if required.

    • 319
    • MCP
    • blurrah/mcp-graphql
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results