Logo van piapi-mcp-server

piapi-mcp-server

Community
apinetwork

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.

Uitgeverapinetwork
Repositorypiapi-mcp-server
TaalTypeScript
Forks
22
Sterren
75
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    piapi-mcp-server biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    75 sterren en 22 forks in de gekoppelde repository.

piapi-mcp-server

Website Documentation Discord

smithery badge

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

Installing via Smithery

To install PiAPI MCP Server for Claude Desktop automatically via Smithery:

bash
npx -y @smithery/cli install piapi-mcp-server --client claude

Manual Installation

  1. Clone the repository:
bash
git clone https://github.com/apinetwork/piapi-mcp-server
cd piapi-mcp-server
  1. Install dependencies:
bash
npm install
  1. Build the project:
bash
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.

  1. (Optional) Test server with MCP Inspector:

First, create a .env file in the project root directory with your API key:

bash
PIAPI_API_KEY=your_api_key_here

Then run the following command to start the MCP Inspector:

bash
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):

json
{
  "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:

  1. Navigate to: File > Preferences > Cursor Settings, or use the shortcut key Ctrl+Shift+J
  2. Select "MCP" tab on the left panel
  3. Click "Add new global MCP server" button in the top right
  4. Add your configuration in the opened mcp.json file
json
{
  "mcpServers": {
    "piapi": {
      "command": "node",
      "args": ["/absolute/path/to/piapi-mcp-server/dist/index.js"],
      "env": {
        "PIAPI_API_KEY": "your_api_key_here"
      }
    }
  }
}
  1. After configuration, you'll see a "piapi" entry in MCP Servers page
  2. Click the Refresh button on the entry or restart Cursor to connect to the piapi server

To test the piapi image generation:

  1. Open and select "Agent mode" in Cursor Chat, or use the shortcut key Ctrl+I
  2. Enter a test prompt, for example: "generate image of a dog"
  3. The image will be generated based on your prompt using piapi server

To disable the piapi server:

  1. Navigate to the MCP Servers page in Cursor Settings
  2. Find the "piapi" entry in the server list
  3. Click the "Enabled" toggle button to switch it to "Disabled"

Keeping tools in sync with PiAPI (sync task)

src/index.ts registers a contract-backed MCP tool for every committed PiAPI (model, task_type) capability. Tool names are deterministic: piapi_<model>_<task_type> (for example, piapi_qubico_flux1_schnell_txt2img), and their input schemas are generated from the committed catalog. The existing hand-written convenience tools remain available; the contract-backed tools ensure the exposed surface stays complete as the Manager catalog changes.

The legacy convenience tools in src/index.ts remain hand-written, but the complete contract-backed surface is generated from the committed catalog. This repository includes a repeatable drift detector that compares that catalog baseline with PiAPI Manager's versioned API contract. It detects new APIs, deprecated APIs, parameter changes, and description changes.

Source of truth: the Go API.postman_collection.json contract in the PiAPI Manager GitHub repository (Gocyber-world/midjourney-http-v2). The task fetches that versioned contract directly from GitHub and extracts the POST /api/v1/task examples into (model, task_type) capabilities. If the Manager repository is private, set the CI secret MCP_SYNC_GITHUB_TOKEN with least-privilege contents: read on that source repository (and only the separate approved write permissions needed for MCP update automation). It has no Apidog dependency and deliberately does not inspect or report pricing.

Commands

bash
npm run build          # compile the MCP server and sync task
npm run test:sync      # offline sync-engine tests (no network or credentials)
npm run sync           # fetch contract and diff baseline; exit 0 = in sync, 2 = drift
npm run sync:snapshot  # print the normalized current contract catalog
npm run sync:report    # write the Markdown drift report to sync-report.md
npm run sync:accept    # after updating src/index.ts, refresh the baseline

By default, npm run sync uses the Manager GitHub contract. For recovery or local development, an exported OpenAPI JSON file can be supplied instead:

bash
node dist/sync/cli.js diff --file ./piapi-openapi.json

When a drift report is produced, a new capability is already represented by its contract-backed MCP tool after the baseline is accepted. Validate the MCP server, run npm run sync:accept, and commit the refreshed baseline. Update a hand-written convenience tool only when a curated model-specific UX is useful.

Automation

.github/workflows/sync-piapi.yml is retained for manual dispatch only. Periodic synchronization is run from the approved local automation environment, which holds the separately owner-approved MCP credential and can validate, accept, and push catalog updates after its sensitive-information gate passes.

Development

Project Structure

piapi-mcp-server/
├── assets/
├── src/
│   ├── index.ts        # Main server entry point
│   └── sync/           # PiAPI -> MCP sync task
│       ├── cli.ts          # CLI: snapshot / diff / accept / report-file
│       ├── fetchers.ts     # GitHub Postman contract + local-file sources
│       ├── normalize.ts    # OpenAPI -> (model, task_type) catalog
│       ├── diff.ts         # catalog diff + Markdown report
│       ├── catalog.ts      # baseline load/save
│       ├── mcp_tools.ts    # catalog -> contract-backed FastMCP tool schemas
│       ├── selftest.ts     # offline engine test (npm run test:sync)
│       ├── types.ts
│       └── baseline.piapi-catalog.json  # committed baseline
├── .github/workflows/sync-piapi.yml     # weekly drift check
├── package.json
├── tsconfig.json
└── .env.example

License

MIT

Installatie

TypingMind
Vereisten:

Node.js 18+

{
  "mcpServers": {
    "apinetwork-piapi-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

Gebruik piapi-mcp-server MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra piapi-mcp-server is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg piapi-mcp-server toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van piapi-mcp-server.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "apinetwork-piapi-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "piapi-mcp-server"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van piapi-mcp-server in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van piapi-mcp-server in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je piapi-mcp-server gebruiken om me hiermee te helpen?
piapi-mcp-server
Zeker. Ik heb het gelezen.
Dit vond ik met piapi-mcp-server.

Veelgestelde vragen

Waarvoor wordt de MCP-server piapi-mcp-server gebruikt?

piapi-mcp-server is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik piapi-mcp-server MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je piapi-mcp-server gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom piapi-mcp-server MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als piapi-mcp-server verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik piapi-mcp-server MCP met TypingMind?

piapi-mcp-server werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt piapi-mcp-server MCP in TypingMind?

piapi-mcp-server biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om piapi-mcp-server MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als piapi-mcp-server authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇