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.
What is apinetwork piapi mcp server
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.
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
- 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
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
Brave Search MCP
Integrate Brave Search capabilities into Claude through MCP. Enables real-time web searches with privacy-focused results and comprehensive web coverage.
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP ๆๅกๅจ๏ผ็จไบ็ฎก็ๆก้ขๅพ็ใๆฅ็่ฏฆๆ ใๅ็ผฉใ็งปๅจ็ญ๏ผๅฎๅ จ่ฎฉTraeๅฎ็ฐ๏ผ
Submit Your MCP Server
Share your MCP server with the community
Submit Now