@pinkpixel/mcpollinations v1.1.1
MCPollinations Multimodal MCP Server
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
The easiest way to use the MCP server:
# Run directly with npx (no installation required)
npx @pinkpixel/mcpollinationsIf you prefer to install it globally:
# Install globally
npm install -g @pinkpixel/mcpollinations
# Run the server
mcpollinations
# or
npx @pinkpixel/mcpollinationsOr 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.jsMCP Integration
To integrate the server with applications that support the Model Context Protocol (MCP):
- Generate an MCP configuration file:
 
# If installed globally
npx @pinkpixel/mcpollinations generate-config
# Or run directly
node /path/to/MCPollinations/generate-mcp-config.jsFollow 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
 
Copy the generated
mcp.jsonfile to your application's MCP settings .json file.- 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 definedThis is usually caused by running on an older version of Node.js (below version 16.0.0). Try one of these solutions:
Update Node.js (recommended):
- Update to Node.js 16.0.0 or newer
 
Use Global Installation
- Update to the latest version of the package:
 
npm install -g @pinkpixel/mcpollinations # Run with npx npx @pinkpixel/mcpollinationsInstall 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 --versionIf it shows a version lower than 16.0.0, consider upgrading for best compatibility.
Available Tools
The MCP server provides the following tools:
generateImageUrl- Generates an image URL from a text promptgenerateImage- Generates an image, returns it as base64-encoded data, and saves it to a file by default (PNG format)respondAudio- Generates an audio response to a text prompt (customizable voice parameter)respondText- Responds with text to a prompt using text models (customizable model parameter)listImageModels- Lists available models for image generationlistTextModels- Lists available models for text generationlistAudioVoices- 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 
~/mcpollinations-outputin the user's home directory NOTE It is recommended to set an absolute path to your desired image save location, due to limitations within some application environemnts. - 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:
Images are saved in
~/mcpollinations-outputin your home directory by default. This makes it easy to find your generated images regardless of where the MCP server is running from.The tilde (~) is automatically expanded to your home directory path (e.g.,
/home/usernameon Linux,/Users/usernameon macOS, orC:\Users\usernameon Windows).If Claude Desktop or another application launches the MCP server automatically, images will still be saved to this location in your home directory.
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 
outputPathparameter - Best practice: Ask Claude to save images to an easily accessible folder like your Pictures or Downloads directory
 
Important Note About Tool Behavior
- When using the MCP server directly (e.g., through an MCP client application), images will be saved to 
~/mcpollinations-outputin your home directory - When using the 
generateImage_npxtool directly in environments like VSCode extensions, images may be saved in the extension's directory instead - For consistent behavior across all environments, specify an absolute path for the 
outputPathparameter, such as:- Linux/macOS: 
/home/username/Pictures/mcpollinations - Windows: 
C:\Users\username\Pictures\mcpollinations 
 - Linux/macOS: 
 
Unique Filenames
The MCP server ensures that generated images always have unique filenames and will never overwrite existing files:
Default filenames include:
- A sanitized version of the prompt (first 20 characters)
 - A timestamp
 - A random suffix
 
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';