Back to MCP directory
publicPublicdnsLocal runtime

piapi-mcp-server

一个基于TypeScript的MCP服务器实现,集成了PiAPI的多媒体生成功能

article

README

🚀 piapi - mcp - server

这是一个用 TypeScript 实现的 Model Context Protocol (MCP) 服务器,与 PiAPI 的 API 集成。PiAPI 让用户可以直接通过 Claude 或任何其他 MCP 兼容的应用生成媒体内容,涵盖 Midjourney、Flux、Kling、LumaLabs、Udio、Chrip、Trellis 等。

官网 文档 Discord

🚀 快速开始

本项目可通过以下步骤快速启动:

安装依赖

npm install --save-dev

通过 npm 运行

npm run dev

✨ 主要特性

  • 支持多种媒体生成工具:包括 Midjourney、Flux 等。
  • 易于集成:通过 MCP 协议轻松与 AI 应用(如 Claude)连接。
  • 高性能:优化了生成速度和资源利用率。

📦 安装指南

安装依赖

npm install --save-dev

💻 使用示例

基础用法

import { createServer } from 'http';
import { PI_API_KEY } from './constants';

const server = createServer((req, res) => {
    // 处理请求逻辑
});

server.listen(3000);

📚 详细文档

功能(更多功能即将推出)

注意:由于某些工具的生成速度较慢,可能会导致输出延迟。

├── Midjourney: 1/4
├── Flux: 0/5 (尚未完成)
└── Chirp: 0/3 (尚未完成)

项目结构

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

🔧 技术细节

本项目使用 TypeScript 语言实现,采用 MCP 协议与 AI 应用集成,优化了生成速度和资源利用率。通过 http 模块创建服务器,处理请求逻辑。

📄 许可证

本项目采用 MIT 许可证。

⚠️ 重要提示

  • 确保环境变量 PI_API_KEY 已正确配置。
  • 定期更新依赖以获取最新功能和安全补丁。
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