Sponsored by Deepsite.site

Mcpollinations

Created By
pinkpixel-dev7 months ago
A Model Context Protocol (MCP) server that enables AI assistants to generate images, text, and audio through the Pollinations APIs. Supports customizable parameters, image saving, and multiple model options.
Content

MCPollinations Multimodal MCP Server

smithery badge A Model Context Protocol (MCP) server that enables AI assistants to generate images, text, and audio through the Pollinations APIs

Features

  • Generate image URLs from text prompts
  • Generate images and return them as base64-encoded data AND save as png, jpeg, jpg, or webp (default: png)
  • Generate text responses from text prompts
  • Generate audio responses from text prompts
  • List available image and text generation models
  • No authentication required
  • Simple and lightweight
  • Compatible with the Model Context Protocol (MCP)

System Requirements

  • Node.js: Version 14.0.0 or higher
    • For best performance, we recommend Node.js 16.0.0 or higher
    • Node.js versions below 16 use an AbortController polyfill

Quick Start

Installing via Smithery

To install mcpollinations for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @pinkpixel-dev/mcpollinations --client claude

The easiest way to use the MCP server:

# Run directly with npx (no installation required)
npx @pinkpixel/mcpollinations

If you prefer to install it globally:

# Install globally
npm install -g @pinkpixel/mcpollinations

# Run the server
mcpollinations
# or
npx @pinkpixel/mcpollinations

Or clone the repository:

# Clone the git repository
git clone https://github.com/pinkpixel-dev/mcpollinations.git
# Run the server
mcpollinations
# or
npx @pinkpixel/mcpollinations
# or run directly
node /path/to/MCPollinations/pollinations-mcp-server.js

MCP Integration

To integrate the server with applications that support the Model Context Protocol (MCP):

  1. Generate an MCP configuration file:
# If installed globally
npx @pinkpixel/mcpollinations generate-config

# Or run directly
node /path/to/MCPollinations/generate-mcp-config.js
  1. Follow the prompts to customize your configuration or use the defaults.

    • Set custom output and temporary directories (defaults to relative paths for portability)
    • Configure default parameters for image generation (with a list of available models, dimensions, etc.)
    • Configure default parameters for text generation (with a list of available models)
    • Configure default parameters for audio generation (voice)
    • Specify which tools should be allowed
  2. Copy the generated mcp.json file to your application's MCP settings .json file.

  3. Restart your application.

After integration, you can use commands like:

"Generate an image of a sunset over the ocean using MCPollinations"

Troubleshooting

"AbortController is not defined" Error

If you encounter this error when running the MCP server:

ReferenceError: AbortController is not defined

This is usually caused by running on an older version of Node.js (below version 16.0.0). Try one of these solutions:

  1. Update Node.js (recommended):

    • Update to Node.js 16.0.0 or newer
  2. Use Global Installation

    • Update to the latest version of the package:
    npm install -g @pinkpixel/mcpollinations
    # Run with npx
    npx @pinkpixel/mcpollinations
    
  3. Install AbortController manually:

    • If for some reason the polyfill doesn't work:
    npm install node-abort-controller
    

Check Your Node.js Version

To check your current Node.js version:

node --version

If it shows a version lower than 16.0.0, consider upgrading for best compatibility.

Available Tools

The MCP server provides the following tools:

  1. generateImageUrl - Generates an image URL from a text prompt
  2. generateImage - Generates an image, returns it as base64-encoded data, and saves it to a file by default (PNG format)
  3. respondAudio - Generates an audio response to a text prompt (customizable voice parameter)
  4. respondText - Responds with text to a prompt using text models (customizable model parameter)
  5. listImageModels - Lists available models for image generation
  6. listTextModels - Lists available models for text generation
  7. listAudioVoices - Lists all available voices for audio generation

Image Generation Details

Default Behavior

When using the generateImage tool:

  • Images are saved to disk by default as PNG files
  • The default save location is the current working directory where the MCP server is running
  • The 'flux' model is used by default
  • A random seed is generated by default for each image (ensuring variety)
  • Base64-encoded image data is always returned, regardless of whether the image is saved to a file

Customizing Image Generation

// Example options for generateImage
const options = {
  // Model selection (defaults to 'flux')
  model: "flux",

  // Image dimensions
  width: 1024,
  height: 1024,

  // Generation options
  seed: 12345,  // Specific seed for reproducibility (defaults to random)
  enhance: true,  // Enhance the prompt using an LLM before generating (defaults to true)
  safe: false,  // Content filtering (defaults to false)

  // File saving options
  saveToFile: true,  // Set to false to skip saving to disk
  outputPath: "/path/to/save/directory",  // Custom save location
  fileName: "my_custom_name",  // Without extension
  format: "png"  // png, jpeg, jpg, or webp
};

Where Images Are Saved

When using Claude or another application with the MCP server:

  1. Images are saved in the current working directory of where the MCP server is running, not where Claude or the client application is installed.

  2. If you start the MCP server manually from a specific directory, images will be saved there by default.

  3. If Claude Desktop launches the MCP server automatically, images will be saved in Claude Desktop's working directory (typically in an application data folder).

Finding Your Generated Images

  • The response from Claude after generating an image includes the full file path where the image was saved
  • You can specify a familiar location using the outputPath parameter
  • Best practice: Ask Claude to save images to an easily accessible folder like your Pictures or Downloads directory

Unique Filenames

The MCP server ensures that generated images always have unique filenames and will never overwrite existing files:

  1. Default filenames include:

    • A sanitized version of the prompt (first 20 characters)
    • A timestamp
    • A random suffix
  2. Custom filenames are also protected:

    • If you specify a filename and a file with that name already exists, a numeric suffix will be added automatically
    • For example: sunset.png, sunset_1.png, sunset_2.png, etc.

This means you can safely generate multiple images with the same prompt or filename without worrying about overwriting previous images.

Accessing Base64 Data

Even when saving to a file, the base64-encoded image data is always returned and can be used for:

  • Embedding in web pages (<img src="data:image/png;base64,..." />)
  • Passing to other services or APIs
  • Processing in memory without filesystem operations
  • Displaying in applications that support data URIs

For Developers

If you want to use the package in your own projects:

# Install as a dependency
npm install @pinkpixel/mcpollinations

# Import in your code
import { generateImageUrl, generateImage, repsondText, respondAudio, listTextModels, listImageModels, listAudioVoices } from '@pinkpixel/mcpollinations';

Server Config

{
  "mcpServers": {
    "mcpollinations": {
      "command": "npx",
      "args": [
        "-y",
        "@pinkpixel/mcpollinations"
      ],
      "resources": {
        "output_dir": "./mcpollinations-output"
      },
      "default_params": {
        "image": {
          "model": "flux",
          "width": 1024,
          "height": 1024,
          "safe": false,
          "enhance": true
        },
        "text": {
          "model": "openai"
        },
        "audio": {
          "voice": "alloy"
        }
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
WindsurfThe new purpose-built IDE to harness magic
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop