这是一个与PiAPI API集成的Model Context Protocol (MCP)服务器的TypeScript实现。通过PiAPI,用户可以直接从Claude或其他兼容MCP的应用程序生成媒体内容,如Midjourney/Flux/Kling/LumaLabs/Udio/Chrip/Trellis。
<a href="https://glama.ai/mcp/servers/ywvke8xruo"><img width="380" height="200" src="https://gips3.baidu.com/it/u=1127884888,2738184241&fm=3081&app=3081&f=PNG?w=760&h=400" alt="PiAPI-Server MCP服务器" /></a>
注意:由于Claude的超时限制,视频生成等耗时工具可能无法完成。

要通过Smithery自动安装PiAPI MCP服务器:
npx -y @smithery/cli install piapi-mcp-server --client claude
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
npm install
npm run build
构建完成后,会生成一个dist/index.js文件。然后你可以将此文件配置到Claude桌面和其他应用程序中。有关详细配置说明,请参阅使用部分。
首先,在项目根目录创建一个.env文件,并添加你的API密钥:
PIAPI_API_KEY=your_api_key_here
然后运行以下命令启动MCP Inspector:
npm run inspect
MCP Inspector是一个强大的开发工具,帮助您测试和调试您的MCP服务器实现。主要功能包括:
有关使用MCP Inspector及其功能的详细信息,请访问官方MCP文档。
将以下内容添加到您的Claude桌面配置文件中(macOS上的~/Library/Application Support/Claude/claude_desktop_config.json或Windows上的%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"piapi": {
"command": "node",
"args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
"env": {
"PIAPI_API_KEY": "your_api_key_here"
}
}
}
}
更新配置文件后,需要重启Claude桌面。重启后,您应在输入框右下角看到锤子图标。 更多详细信息,请访问官方MCP文档
注意:以下指南基于Cursor 0.47.5。不同版本中的特性和行为可能会有所不同。
要配置MCP服务器:
Ctrl+Shift+J{
"mcpServers": {
"piapi": {
"command": "node",
"args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
"env": {
"PIAPI_API_KEY": "your_api_key_here"
}
}
}
}
要测试piapi图像生成:
Ctrl+I要禁用piapi服务器:
piapi-mcp-server/
├── assets/
├── src/
│ ├── index.ts # 主服务器入口点
├── package.json
├── tsconfig.json
└── .env.example
MIT