legends810 commited on
Commit
afb8a07
·
verified ·
1 Parent(s): 1b94b77

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -388
README.md CHANGED
@@ -1,388 +1,8 @@
1
- [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/pinkpixel-dev-mcpollinations-badge.png)](https://mseep.ai/app/pinkpixel-dev-mcpollinations)
2
-
3
- # MCPollinations Multimodal MCP Server
4
-
5
- [![smithery badge](https://smithery.ai/badge/@pinkpixel-dev/mcpollinations)](https://smithery.ai/server/@pinkpixel-dev/mcpollinations)
6
- A Model Context Protocol (MCP) server that enables AI assistants to generate images, text, and audio through the Pollinations APIs
7
-
8
- ## Features
9
-
10
- - Generate image URLs from text prompts
11
- - Generate images and return them as base64-encoded data AND save as png, jpeg, jpg, or webp (default: png)
12
- - Generate text responses from text prompts
13
- - Generate audio responses from text prompts
14
- - List available image and text generation models
15
- - No authentication required
16
- - Simple and lightweight
17
- - Compatible with the Model Context Protocol (MCP)
18
-
19
- ## System Requirements
20
-
21
- - **Node.js**: Version 14.0.0 or higher
22
- - For best performance, we recommend Node.js 16.0.0 or higher
23
- - Node.js versions below 16 use an AbortController polyfill
24
-
25
- ## Quick Start
26
-
27
- ### Installing via Smithery
28
-
29
- To install mcpollinations for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@pinkpixel-dev/mcpollinations):
30
-
31
- ```bash
32
- npx -y @smithery/cli install @pinkpixel-dev/mcpollinations --client claude
33
- ```
34
-
35
- The easiest way to use the MCP server:
36
-
37
- ```bash
38
- # Run directly with npx (no installation required)
39
- npx @pinkpixel/mcpollinations
40
- ```
41
-
42
- If you prefer to install it globally:
43
-
44
- ```bash
45
- # Install globally
46
- npm install -g @pinkpixel/mcpollinations
47
-
48
- # Run the server
49
- mcpollinations
50
- # or
51
- npx @pinkpixel/mcpollinations
52
-
53
- ```
54
-
55
- Or clone the repository:
56
-
57
- ```bash
58
- # Clone the git repository
59
- git clone https://github.com/pinkpixel-dev/mcpollinations.git
60
- # Run the server
61
- mcpollinations
62
- # or
63
- npx @pinkpixel/mcpollinations
64
- # or run directly
65
- node /path/to/MCPollinations/pollinations-mcp-server.js
66
-
67
- ```
68
-
69
- ## MCP Integration
70
-
71
- To integrate the server with applications that support the Model Context Protocol (MCP):
72
-
73
- 1. Generate an MCP configuration file:
74
-
75
- ```bash
76
- # If installed globally
77
- npx @pinkpixel/mcpollinations generate-config
78
-
79
- # Or run directly
80
- node /path/to/MCPollinations/generate-mcp-config.js
81
- ```
82
-
83
- 2. Follow the prompts to customize your configuration or use the defaults.
84
- - Set custom output and temporary directories (defaults to relative paths for portability)
85
- - **Windows users**: Consider using absolute paths (e.g., `C:\Users\YourName\Pictures\MCPollinations`) for more reliable file saving
86
- - **Configure optional authentication** (token and referrer for enhanced access)
87
- - Configure default parameters for image generation (with a list of available models, dimensions, etc.)
88
- - Configure default parameters for text generation (with a list of available models)
89
- - Configure default parameters for audio generation (voice)
90
- - Specify which tools should be allowed
91
-
92
- 3. Copy the generated `mcp.json` file to your application's MCP settings .json file.
93
- 4. Restart your application.
94
-
95
- After integration, you can use commands like:
96
-
97
- "Generate an image of a sunset over the ocean using MCPollinations"
98
-
99
- ## Authentication (Optional)
100
-
101
- MCPollinations supports optional authentication to provide access to more models and better rate limits. The server works perfectly without authentication (free tier), but users with API tokens can get enhanced access.
102
-
103
- ### Configuration Methods
104
-
105
- **Method 1: Environment Variables (Recommended for security)**
106
- ```bash
107
- # Set environment variables before running the server
108
- export POLLINATIONS_TOKEN="your-api-token"
109
- export POLLINATIONS_REFERRER="https://your-domain.com"
110
-
111
- # Then run the server
112
- npx @pinkpixel/mcpollinations
113
- ```
114
-
115
- **Method 2: MCP Configuration File**
116
- When generating your MCP configuration, you'll be prompted for optional authentication settings:
117
- ```json
118
- {
119
- "mcpollinations": {
120
- "auth": {
121
- "token": "your-api-token",
122
- "referrer": "https://your-domain.com"
123
- }
124
- }
125
- }
126
- ```
127
-
128
- ### Authentication Parameters
129
-
130
- - **`token`** (optional): Your Pollinations API token for enhanced access
131
- - **`referrer`** (optional): Your domain/application referrer URL
132
-
133
- Both parameters are completely optional. Leave them empty or unset to use the free tier.
134
-
135
- ## Using Your Configuration Settings
136
-
137
- MCPollinations respects your MCP configuration settings as defaults. When you ask an AI assistant to generate content:
138
-
139
- - **Your configured models, output directories, and parameters are used automatically**
140
- - **To override**: Specifically instruct the AI to use different settings
141
- - "Generate an image using the gptimage model"
142
- - "Save this image to my Desktop folder"
143
- - "Use a temperature of 1.2 for this text generation"
144
-
145
- **Example Instructions:**
146
- - ✅ "Generate a sunset image" → Uses your configured model and output directory
147
- - ✅ "Generate a sunset image with the flux model" → Overrides model only
148
- - ✅ "Generate a sunset image and save it to C:\Pictures" → Overrides output path only
149
-
150
- This ensures your preferences are always respected unless you specifically want different settings for a particular request.
151
-
152
- ## Troubleshooting
153
-
154
- ### "AbortController is not defined" Error
155
-
156
- If you encounter this error when running the MCP server:
157
-
158
- ```
159
- ReferenceError: AbortController is not defined
160
- ```
161
-
162
- This is usually caused by running on an older version of Node.js (below version 16.0.0). Try one of these solutions:
163
-
164
- 1. **Update Node.js** (recommended):
165
- - Update to Node.js 16.0.0 or newer
166
-
167
- 2. **Use Global Installation**
168
- - Update to the latest version of the package:
169
- ```bash
170
- npm install -g @pinkpixel/mcpollinations
171
- # Run with npx
172
- npx @pinkpixel/mcpollinations
173
- ```
174
-
175
- 3. **Install AbortController manually**:
176
- - If for some reason the polyfill doesn't work:
177
- ```bash
178
- npm install node-abort-controller
179
- ```
180
-
181
- ### Check Your Node.js Version
182
-
183
- To check your current Node.js version:
184
-
185
- ```bash
186
- node --version
187
- ```
188
-
189
- If it shows a version lower than 16.0.0, consider upgrading for best compatibility.
190
-
191
- ## Available Tools
192
-
193
- The MCP server provides the following tools:
194
-
195
- ### **Image Generation Tools**
196
- 1. `generateImageUrl` - Generates an image URL from a text prompt
197
- 2. `generateImage` - Generates an image, returns it as base64-encoded data, and saves it to a file by default (PNG format)
198
- 3. `editImage` - **NEW!** Edit or modify existing images based on text prompts
199
- 4. `generateImageFromReference` - **NEW!** Generate new images using existing images as reference
200
- 5. `listImageModels` - Lists available models for image generation
201
-
202
- ### **Text & Audio Tools**
203
- 6. `respondText` - Responds with text to a prompt using text models (customizable parameters)
204
- 7. `respondAudio` - Generates an audio response to a text prompt (customizable voice parameter)
205
- 8. `listTextModels` - Lists available models for text generation
206
- 9. `listAudioVoices` - Lists all available voices for audio generation
207
-
208
- ## Text Generation Details
209
-
210
- ### Available Parameters
211
-
212
- The `respondText` tool supports several parameters for fine-tuning text generation:
213
-
214
- - **`model`**: Choose from available text models (use `listTextModels` to see current options)
215
- - **`temperature`** (0.0-2.0): Controls randomness in the output
216
- - Lower values (0.1-0.7) = more focused and deterministic
217
- - Higher values (0.8-2.0) = more creative and random
218
- - **`top_p`** (0.0-1.0): Controls diversity via nucleus sampling
219
- - Lower values = more focused on likely tokens
220
- - Higher values = considers more token possibilities
221
- - **`system`**: System prompt to guide the model's behavior and personality
222
-
223
- ### Customizing Text Generation
224
-
225
- ```javascript
226
- // Example options for respondText
227
- const options = {
228
- model: "openai", // Model selection
229
- temperature: 0.7, // Balanced creativity
230
- top_p: 0.9, // High diversity
231
- system: "You are a helpful assistant that explains things clearly and concisely."
232
- };
233
- ```
234
-
235
- ### Configuration Examples
236
-
237
- In your MCP configuration, you can set defaults:
238
-
239
- ```json
240
- {
241
- "default_params": {
242
- "text": {
243
- "model": "openai",
244
- "temperature": 0.7,
245
- "top_p": 0.9,
246
- "system": "You are a helpful coding assistant."
247
- }
248
- }
249
- }
250
- ```
251
-
252
- ## Image-to-Image Generation (NEW!)
253
-
254
- MCPollinations now supports powerful image-to-image generation with two specialized tools:
255
-
256
- ### **editImage Tool**
257
- Perfect for modifying existing images:
258
- - **Remove objects**: "remove the cat from this image"
259
- - **Add elements**: "add a dog to this scene"
260
- - **Change backgrounds**: "replace the background with mountains"
261
- - **Style modifications**: "make the lighting more dramatic"
262
-
263
- ### **generateImageFromReference Tool**
264
- Perfect for creating variations and new styles:
265
- - **Style transfer**: "make this photo look like a painting"
266
- - **Format changes**: "convert this to a cartoon style"
267
- - **Creative variations**: "create a futuristic version of this"
268
- - **Artistic interpretations**: "make this look like a sketch"
269
-
270
- ### **Supported Models**
271
- - **`gptimage`**: Versatile model for both editing and reference generation
272
- - **`kontext`**: Specialized model optimized for image-to-image tasks
273
-
274
- ### **Example Usage**
275
- ```javascript
276
- // Edit an existing image
277
- const editResult = await editImage(
278
- "change the background to a sunset beach",
279
- "https://example.com/photo.jpg",
280
- "gptimage"
281
- );
282
-
283
- // Generate from reference
284
- const referenceResult = await generateImageFromReference(
285
- "make this into a watercolor painting",
286
- "https://example.com/photo.jpg",
287
- "kontext"
288
- );
289
- ```
290
-
291
- ### **Transparent Backgrounds (NEW!)**
292
- Generate images with transparent backgrounds using the `gptimage` model:
293
- - Perfect for logos, icons, and graphics
294
- - Set `transparent: true` in your requests
295
- - Only works with the `gptimage` model
296
-
297
- ## Image Generation Details
298
-
299
- ### Default Behavior
300
-
301
- When using the `generateImage` tool:
302
-
303
- - Images are saved to disk by default as PNG files
304
- - The default save location is the current working directory where the MCP server is running
305
- - The 'flux' model is used by default
306
- - A random seed is generated by default for each image (ensuring variety)
307
- - Base64-encoded image data is always returned, regardless of whether the image is saved to a file
308
-
309
- ### Customizing Image Generation
310
-
311
- ```javascript
312
- // Example options for generateImage
313
- const options = {
314
- // Model selection (defaults to 'flux')
315
- model: "flux",
316
-
317
- // Image dimensions
318
- width: 1024,
319
- height: 1024,
320
-
321
- // Generation options
322
- seed: 12345, // Specific seed for reproducibility (defaults to random)
323
- enhance: true, // Enhance the prompt using an LLM before generating (defaults to true)
324
- safe: false, // Content filtering (defaults to false)
325
- transparent: false, // Generate with transparent background (gptimage model only)
326
-
327
- // File saving options
328
- saveToFile: true, // Set to false to skip saving to disk
329
- outputPath: "/path/to/save/directory", // Custom save location
330
- fileName: "my_custom_name", // Without extension
331
- format: "png" // png, jpeg, jpg, or webp
332
- };
333
- ```
334
-
335
- ### Where Images Are Saved
336
-
337
- When using Claude or another application with the MCP server:
338
-
339
- 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.
340
-
341
- 2. If you start the MCP server manually from a specific directory, images will be saved there by default.
342
-
343
- 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).
344
-
345
- **💡 Windows Users**: For reliable file saving on Windows, use absolute paths in your MCP configuration instead of relative paths (e.g., `C:\Users\YourName\Pictures\MCPollinations` instead of `./mcpollinations-output`). Relative paths may not resolve as expected depending on the working directory context.
346
-
347
- ### Finding Your Generated Images
348
-
349
- - The response from Claude after generating an image includes the full file path where the image was saved
350
- - You can specify a familiar location using the `outputPath` parameter
351
- - Best practice: Ask Claude to save images to an easily accessible folder like your Pictures or Downloads directory
352
-
353
- ### Unique Filenames
354
-
355
- The MCP server ensures that generated images always have unique filenames and will never overwrite existing files:
356
-
357
- 1. **Default filenames** include:
358
- - A sanitized version of the prompt (first 20 characters)
359
- - A timestamp
360
- - A random suffix
361
-
362
- 2. **Custom filenames** are also protected:
363
- - If you specify a filename and a file with that name already exists, a numeric suffix will be added automatically
364
- - For example: `sunset.png`, `sunset_1.png`, `sunset_2.png`, etc.
365
-
366
- This means you can safely generate multiple images with the same prompt or filename without worrying about overwriting previous images.
367
-
368
- ### Accessing Base64 Data
369
-
370
- Even when saving to a file, the base64-encoded image data is always returned and can be used for:
371
-
372
- - Embedding in web pages (`<img src="data:image/png;base64,..." />`)
373
- - Passing to other services or APIs
374
- - Processing in memory without filesystem operations
375
- - Displaying in applications that support data URIs
376
-
377
- ## For Developers
378
-
379
- If you want to use the package in your own projects:
380
-
381
- ```bash
382
- # Install as a dependency
383
- npm install @pinkpixel/mcpollinations
384
-
385
- # Import in your code
386
- import { generateImageUrl, generateImage, repsondText, respondAudio, listTextModels, listImageModels, listAudioVoices } from '@pinkpixel/mcpollinations';
387
- ```
388
-
 
1
+ ---
2
+ title: MCPollinations Server
3
+ emoji: 🤖
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ ---