Piapi Mcp Server
Un'implementazione TypeScript di un server del Protocollo di Contesto del Modello (MCP) che si integra con l'API di PiAPI. PiAPI consente agli utenti di generare contenuti multimediali con Midjourney/Flux/Kling/LumaLabs/Udio/Chrip/Trellis direttamente da Claude o da qualsiasi altra app compatibile con MCP.
Panoramica
Cos'è il Server PiAPI MCP?
Il ### Server PiAPI MCP è un'implementazione in TypeScript di un server del Protocollo di Contesto del Modello (MCP) che si integra perfettamente con l'API di PiAPI. Questo server innovativo consente agli utenti di generare contenuti multimediali utilizzando varie piattaforme come Midjourney, Flux, Kling, LumaLabs, Udio, Chirp e Trellis direttamente da Claude o da qualsiasi altra applicazione compatibile con MCP. Funziona come un ponte tra i comandi degli utenti e le capacità di generazione dei media di queste piattaforme, migliorando l'esperienza dell'utente e semplificando la creazione di contenuti.
Caratteristiche del Server PiAPI MCP
- Implementazione in TypeScript: Costruito utilizzando TypeScript, garantendo sicurezza dei tipi e migliori pratiche di sviluppo.
- Compatibilità MCP: Completamente conforme al Protocollo di Contesto del Modello, consentendo un'integrazione facile con altre applicazioni compatibili con MCP.
- Supporto Multi-Piattaforma: Supporta una varietà di piattaforme di generazione di contenuti, consentendo agli utenti di creare contenuti attraverso diversi servizi.
- Interfaccia Utente Intuitiva: Progettata tenendo presente l'usabilità, rendendo facile per gli utenti generare contenuti multimediali senza una vasta conoscenza tecnica.
- Open Source: Disponibile come repository pubblico, consentendo agli sviluppatori di contribuire, modificare e migliorare le funzionalità del server.
Come Utilizzare il Server PiAPI MCP
-
Installazione: Clona il repository da GitHub e installa le dipendenze necessarie utilizzando npm o yarn.
git clone https://github.com/apinetwork/piapi-mcp-server.git cd piapi-mcp-server npm install
-
Configurazione: Imposta le tue chiavi API e le impostazioni di configurazione nel file di configurazione fornito per connetterti alle piattaforme di generazione di contenuti desiderate.
-
Esecuzione del Server: Avvia il server utilizzando il comando:
npm start
-
Effettuare Richieste: Utilizza gli endpoint API forniti dal server per inviare richieste per la generazione di contenuti multimediali. Assicurati che le tue richieste siano conformi alle specifiche MCP.
-
Integrazione: Integra il server con le tue applicazioni compatibili con MCP per iniziare a generare contenuti multimediali.
Domande Frequenti
D1: Qual è lo scopo del Server PiAPI MCP?
R1: Il Server PiAPI MCP funge da mediatore tra gli utenti e varie piattaforme di generazione di contenuti, consentendo una creazione di contenuti efficiente attraverso un'API unificata.
D2: Il Server PiAPI MCP è gratuito da usare?
R2: Sì, il Server PiAPI MCP è open-source e disponibile gratuitamente su GitHub.
D3: Posso contribuire al Server PiAPI MCP?
R3: Assolutamente! Le contribuzioni sono benvenute. Puoi forkare il repository, apportare modifiche e inviare una richiesta di pull.
D4: Con quali piattaforme posso generare contenuti multimediali?
R4: Il server supporta più piattaforme tra cui Midjourney, Flux, Kling, LumaLabs, Udio, Chirp e Trellis.
D5: Come posso segnalare problemi o richiedere funzionalità?
R5: Puoi segnalare problemi o richiedere funzionalità aprendo un problema nel repository GitHub.
Utilizzando il Server PiAPI MCP, gli utenti possono semplificare i loro processi di generazione di contenuti multimediali e migliorare i loro flussi di lavoro creativi attraverso varie piattaforme.
Dettaglio
piapi-mcp-server
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.
<a href="https://glama.ai/mcp/servers/ywvke8xruo"><img width="380" height="200" src="https://glama.ai/mcp/servers/ywvke8xruo/badge" alt="PiAPI-Server MCP server" /></a>
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
Prerequisites
- Node.js 16.x or higher
- npm or yarn
- A PiAPI API key (get one at piapi.ai)
Installation
- Clone the repository:
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
- Install dependencies:
npm install
- 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.
- (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:
- Navigate to: File > Preferences > Cursor Settings, or use the shortcut key
Ctrl+Shift+J
- Select "MCP" tab on the left panel
- Click "Add new global MCP server" button in the top right
- 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"
}
}
}
}
- After configuration, you'll see a "piapi" entry in MCP Servers page
- Click the Refresh button on the entry or restart Cursor to connect to the piapi server
To test the piapi image generation:
- Open and select "Agent mode" in Cursor Chat, or use the shortcut key
Ctrl+I
- Enter a test prompt, for example: "generate image of a dog"
- The image will be generated based on your prompt using piapi server
To disable the piapi server:
- Navigate to the MCP Servers page in Cursor Settings
- Find the "piapi" entry in the server list
- 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
Configurazione Server
{
"mcpServers": {
"piapi-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--apinetwork--piapi-mcp-server--piapi-mcp-server",
"node dist/index.js"
],
"env": {
"PIAPI_API_KEY": "piapi-api-key"
}
}
}
}