Back to MCP directory
publicPublicdnsLocal runtime

apinetwork_piapi-mcp-server

一个基于TypeScript的MCP服务器实现,集成PiAPI实现多平台AI内容生成功能

article

README

🚀 piapi-mcp-server

这是一个用 TypeScript 实现的 Model Context Protocol (MCP) 服务器,它与 PiAPI 的 API 集成。借助 PiAPI,用户能够直接从 Claude 或任何其他 MCP 兼容的应用(如 Midjourney、Flux、Kling、Luma Labs、Udio、Chrip、Trellis)生成媒体内容。

官网 文档 Discord

🚀 快速开始

先决条件

  • Node.js 16.x 或更高版本
  • npm 或 yarn
  • PiAPI API Key(在 piapi.ai 获取)

安装步骤

  1. 克隆仓库:
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
  1. 安装依赖项:
npm install
  1. 在项目根目录创建一个 .env 文件:
PIAPI_API_KEY=your_api_key_here
  1. 构建项目:
npm run build

运行服务器

npm start

与 Claude Desktop 配合使用

将以下内容添加到你的 Claude Desktop 配置文件 (~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或 %APPDATA%\Claude\claude_desktop_config.json(Windows)):

{
  "mcpServers": {
    "piapi": {
      "command": "node",
      "args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
      "env": {
        "PIAPI_API_KEY": "your_api_key_here"
      }
    }
  }
}

✨ 主要特性

已实现功能

  • [x] 通过文本描述生成 Flux 图像

待实现功能(更多功能即将推出)

  • [ ] 使用图像提示生成 Flux 图像
  • [ ] Midjourney 图像生成
  • [ ] Kling 视频生成
  • [ ] Luma Dream Machine 视频生成
  • [ ] Suno/Udio AI 歌曲生成
  • [ ] Trellis 3D 模型生成
  • [ ] 在 LLM 中规划工作流

💻 使用示例

配合 Claude Desktop 使用

截图

🔧 技术细节

项目结构

piapi-mcp-server/
├── src/
│   ├── index.ts        # 服务器主入口文件
├── package.json
├── tsconfig.json
└── .env

📄 许可证

本项目采用 MIT 许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client