Servidor Piapi Mcp
Una implementación en TypeScript de un servidor del Protocolo de Contexto de Modelo (MCP) que se integra con la API de PiAPI. PiAPI permite a los usuarios generar contenido multimedia con Midjourney/Flux/Kling/LumaLabs/Udio/Chrip/Trellis directamente desde Claude o cualquier otra aplicación compatible con MCP.
Resumen
¿Qué es el Servidor PiAPI MCP?
El ### Servidor PiAPI MCP es una implementación en TypeScript de un servidor de Protocolo de Contexto de Modelo (MCP) que se integra sin problemas con la API de PiAPI. Este servidor innovador permite a los usuarios generar contenido multimedia utilizando diversas plataformas como Midjourney, Flux, Kling, LumaLabs, Udio, Chirp y Trellis directamente desde Claude o cualquier otra aplicación compatible con MCP. Sirve como un puente entre los comandos del usuario y las capacidades de generación de medios de estas plataformas, mejorando la experiencia del usuario y optimizando la creación de contenido.
Características del Servidor PiAPI MCP
- Implementación en TypeScript: Construido utilizando TypeScript, asegurando la seguridad de tipos y mejores prácticas de desarrollo.
- Compatibilidad con MCP: Totalmente compatible con el Protocolo de Contexto de Modelo, lo que permite una fácil integración con otras aplicaciones compatibles con MCP.
- Soporte Multiplataforma: Soporta una variedad de plataformas de generación de medios, permitiendo a los usuarios crear contenido a través de diferentes servicios.
- Interfaz Amigable: Diseñado con la usabilidad en mente, facilitando a los usuarios la generación de contenido multimedia sin necesidad de amplios conocimientos técnicos.
- Código Abierto: Disponible como un repositorio público, permitiendo a los desarrolladores contribuir, modificar y mejorar la funcionalidad del servidor.
Cómo Usar el Servidor PiAPI MCP
-
Instalación: Clona el repositorio desde GitHub e instala las dependencias necesarias usando npm o yarn.
git clone https://github.com/apinetwork/piapi-mcp-server.git cd piapi-mcp-server npm install
-
Configuración: Configura tus claves API y ajustes de configuración en el archivo de configuración proporcionado para conectarte con las plataformas de generación de medios deseadas.
-
Ejecutar el Servidor: Inicia el servidor usando el comando:
npm start
-
Realizar Solicitudes: Usa los endpoints de la API proporcionados por el servidor para enviar solicitudes de generación de medios. Asegúrate de que tus solicitudes cumplan con las especificaciones de MCP.
-
Integración: Integra el servidor con tus aplicaciones compatibles con MCP para comenzar a generar contenido multimedia.
Preguntas Frecuentes
P1: ¿Cuál es el propósito del Servidor PiAPI MCP?
R1: El Servidor PiAPI MCP actúa como un mediador entre los usuarios y varias plataformas de generación de medios, permitiendo una creación de contenido eficiente a través de una API unificada.
P2: ¿Es gratuito el uso del Servidor PiAPI MCP?
R2: Sí, el Servidor PiAPI MCP es de código abierto y está disponible de forma gratuita en GitHub.
P3: ¿Puedo contribuir al Servidor PiAPI MCP?
R3: ¡Absolutamente! Las contribuciones son bienvenidas. Puedes bifurcar el repositorio, hacer cambios y enviar una solicitud de extracción.
P4: ¿Con qué plataformas puedo generar contenido multimedia?
R4: El servidor soporta múltiples plataformas incluyendo Midjourney, Flux, Kling, LumaLabs, Udio, Chirp y Trellis.
P5: ¿Cómo puedo reportar problemas o solicitar características?
R5: Puedes reportar problemas o solicitar características abriendo un problema en el repositorio de GitHub.
Al utilizar el Servidor PiAPI MCP, los usuarios pueden optimizar sus procesos de generación de medios y mejorar sus flujos de trabajo creativos a través de diversas plataformas.
Detalle
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
Configuración del Servidor
{
"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"
}
}
}
}