Skip to content
Back to search

ai-image-gen-mcp

An MCP (Model Context Protocol) server implementation for generating images using Replicate's black-forest-labs/flux-schnell model.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/mikeyny--ai-image-gen-mcp/badge.svg)](/listings/mikeyny--ai-image-gen-mcp)

HTML

<a href="/listings/mikeyny--ai-image-gen-mcp"><img src="/api/listings/mikeyny--ai-image-gen-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Clone the repository 2. Install dependencies:

   npm install

3. Add your Replicate API token directly in the code at `src/imageService.ts` by updating the `apiToken` constant:

   // No environment variables are used since they can't be easily set in cursor
   const apiToken = "your-replicate-api-token-here";

> **Note:** If using with Claude, you can create a `.env` file in the root directory and set your API token there:

   REPLICATE_API_TOKEN=your-replicate-api-token-here

Then build the project:

   npm run build

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 114 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Image Generation MCP Server
  2. An [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server implementation for generating images using Replicate's [`black-forest-labs/flux-schnell`](https://replicate.com/black-forest-labs/flux-schnell) model.
  3. Ideally to be used with Cursor's MCP feature, but can be used with any MCP client.
  4. ## Features
  5. - Generate images from text prompts
  6. - Configurable image parameters (resolution, aspect ratio, quality)
  7. - Save generated images to specified directory
  8. - Full MCP protocol compliance
  9. - Error handling and validation
  10. ## Prerequisites
  11. - Node.js 16+
  12. - Replicate API token
  13. - TypeScript SDK for MCP
  14. ## Setup
  15. 1. Clone the repository
  16. 2. Install dependencies:
  17. ```bash
  18. npm install
  19. ```
  20. 3. Add your Replicate API token directly in the code at `src/imageService.ts` by updating the `apiToken` constant:
  21. ```bash
  22. // No environment variables are used since they can't be easily set in cursor
  23. const apiToken = "your-replicate-api-token-here";
  24. ```
  25. > **Note:** If using with Claude, you can create a `.env` file in the root directory and set your API token there:
  26. ```bash
  27. REPLICATE_API_TOKEN=your-replicate-api-token-here
  28. ```
  29. Then build the project:
  30. ```bash
  31. npm run build
  32. ```
  33. ## Usage
  34. To use with cursor:
  35. 1. Go to Settings
  36. 2. Select Features
  37. 3. Scroll down to "MCP Servers"
  38. 4. Click "Add new MCP Server"
  39. 5. Set Type to "Command"
  40. 6. Set Command to: `node ./path/to/dist/server.js`
  41. ## API Parameters
  42. | Parameter | Type | Required | Default | Description |
  43. |--------------------|---------|----------|---------|------------------------------------------------|
  44. | `prompt` | string | Yes | - | Text prompt for image generation |
  45. | `output_dir` | string | Yes | - | Server directory path to save generated images |
  46. | `go_fast` | boolean | No | false | Enable faster generation mode |
  47. | `megapixels` | string | No | "1" | Resolution quality ("1", "2", "4") |
  48. | `num_outputs` | number | No | 1 | Number of images to generate (1-4) |
  49. | `aspect_ratio` | string | No | "1:1" | Aspect ratio ("1:1", "4:3", "16:9") |
  50. | `output_format` | string | No | "webp" | Image format ("webp", "png", "jpeg") |
  51. | `output_quality` | number | No | 80 | Compression quality (1-100) |
  52. | `num_inference_steps`| number| No | 4 | Number of denoising steps (4-20) |
  53. ## Example Request
  54. ```json
  55. {
  56. "prompt": "black forest gateau cake spelling out 'FLUX SCHNELL'",
  57. "output_dir": "/var/output/images",
  58. "filename": "black_forest_cake",
  59. "output_format": "webp"
  60. "go_fast": true,
  61. "megapixels": "1",
  62. "num_outputs": 2,
  63. "aspect_ratio": "1:1"
  64. }
  65. ```
  66. ## Example Response
  67. ```json
  68. {
  69. "image_paths": [
  70. "/var/output/images/output_0.webp",
  71. "/var/output/images/output_1.webp"
  72. ],
  73. "metadata": {
  74. "model": "black-forest-labs/flux-schnell",
  75. "inference_time_ms": 2847
  76. }
  77. }
  78. ```
  79. ## Error Handling
  80. The server handles the following error types:
  81. - Validation errors (invalid parameters)
  82. - API errors (Replicate API issues)
  83. - Server errors (filesystem, permissions)
  84. - Unknown errors (unexpected issues)
  85. Each error response includes:
  86. - Error code
  87. - Human-readable message
  88. - Detailed error information
  89. ## License
  90. ISC

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.