Lets agents generate media through PiAPI with Midjourney, Flux, Kling, Hunyuan, Udio, Trellis and other models.
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add piapi --env PIAPI_API_KEY='<PIAPI_API_KEY>' -- node /absolute/path/to/piapi-mcp-server/dist/index.js~/.codex/config.toml
[mcp_servers.piapi]
command = "node"
args = ["/absolute/path/to/piapi-mcp-server/dist/index.js"]
env = { PIAPI_API_KEY = "<PIAPI_API_KEY>" }
# codex mcp add piapi --env PIAPI_API_KEY='<PIAPI_API_KEY>' -- node /absolute/path/to/piapi-mcp-server/dist/index.js~/.cursor/mcp.json
{
"mcpServers": {
"piapi": {
"command": "node",
"args": [
"/absolute/path/to/piapi-mcp-server/dist/index.js"
],
"env": {
"PIAPI_API_KEY": "<PIAPI_API_KEY>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"piapi": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/piapi-mcp-server/dist/index.js"
],
"env": {
"PIAPI_API_KEY": "<PIAPI_API_KEY>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"piapi": {
"command": "node",
"args": [
"/absolute/path/to/piapi-mcp-server/dist/index.js"
],
"env": {
"PIAPI_API_KEY": "<PIAPI_API_KEY>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"piapi": {
"command": "node",
"args": [
"/absolute/path/to/piapi-mcp-server/dist/index.js"
],
"env": {
"PIAPI_API_KEY": "<PIAPI_API_KEY>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"piapi": {
"command": "node",
"args": [
"/absolute/path/to/piapi-mcp-server/dist/index.js"
],
"env": {
"PIAPI_API_KEY": "<PIAPI_API_KEY>"
}
}
}
}Environment variables
PIAPI_API_KEY
Replace the placeholders with your own credentials and keep them out of version control.