Cover image
Try Now
2025-03-20

Une implémentation TypeScript d'un serveur de protocole de contexte de modèle (MCP) qui s'intègre à l'API de PIAPI. PIAPI fait que l'utilisateur peut générer du contenu multimédia avec MidJourney / Flux / Kling / Lumalabs / UDIO / Chrip / Trellis directement à partir de Claude ou de toute autre application compatible MCP.

3 years

Works with Finder

2

Github Watches

9

Github Forks

36

Github Stars

piapi-mcp-server

Website Documentation Discord

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.

PiAPI-Server MCP server

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

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

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:

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

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

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • pontusab
  • La communauté du curseur et de la planche à voile, recherchez des règles et des MCP

  • av
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • 1Panel-dev
  • 🔥 1Panel fournit une interface Web intuitive et un serveur MCP pour gérer des sites Web, des fichiers, des conteneurs, des bases de données et des LLM sur un serveur Linux.

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • GeyserMC
  • Une bibliothèque de communication avec un client / serveur Minecraft.

  • awslabs
  • Serveurs AWS MCP - Serveurs MCP spécialisés qui apportent les meilleures pratiques AWS directement à votre flux de travail de développement

  • appcypher
  • Serveurs MCP géniaux - une liste organisée de serveurs de protocole de contexte de modèle

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.

    Reviews

    5 (1)
    Avatar
    user_xswHwfur
    2025-04-18

    As a dedicated user of the piapi-mcp-server by apinetwork, I am thoroughly impressed by its robustness and simplicity. This server is highly efficient, seamlessly integrating with my applications. The clear documentation and active support team make it an indispensable tool. Highly recommended for anyone in need of a reliable mcp solution!