Image Placeholder MCP server

Generates customizable placeholder images from placehold.co and Lorem Picsum for rapid development and UI testing.
Back to servers
Provider
Husni Adil Makmur
Release date
Feb 10, 2025
Language
Python
Stats
8 stars

This MCP server provides a tool for generating placeholder images with different providers, allowing you to easily integrate placeholder images in your applications or design mockups through the Model Context Protocol.

Installation

To install the MCP Image Placeholder Server, follow these steps:

  1. Clone the repository to your local machine
  2. Ensure you have Python 3.9+ installed
  3. Make sure you have the uv package manager installed

Configuration

Connecting to Claude for Desktop

  1. Add the following to your claude_desktop_config.json:

    {
        "mcpServers": {
            "image-placeholder": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/ABSOLUTE/PATH/TO/PROJECT",
                    "run",
                    "main.py"
                ]
            }
        }
    }
    
  2. Replace /ABSOLUTE/PATH/TO/PROJECT with the actual path to the project directory

  3. Restart Claude for Desktop

Connecting to Cursor

  1. Open Cursor Settings
  2. Navigate to the Features section
  3. Scroll down to the MCP Servers section
  4. Click on the Add new MCP server button
  5. Enter the following details:
    • Name: image-placeholder
    • Type: command
    • Server URL: uv --directory /ABSOLUTE/PATH/TO/PROJECT run main.py
  6. Replace /ABSOLUTE/PATH/TO/PROJECT with the actual path to the project directory
  7. Click on the Add ↵ button

Using the MCP Server

The server provides a single tool called image_placeholder that generates URLs for placeholder images.

Tool: image_placeholder

This tool generates a placeholder image URL based on the parameters you specify.

Parameters:

  • provider: The image provider to use (placehold or lorem-picsum)
  • width: The width of the image (1-10000)
  • height: The height of the image (1-10000)

Returns:

  • A URL string for the generated image

Examples

Generate a basic placeholder image:

url = image_placeholder(provider="placehold", width=300, height=200)

Generate a square placeholder with real images:

url = image_placeholder(provider="lorem-picsum", width=500)

Troubleshooting

If the tool isn't being detected properly, try using the absolute path to the uv command:

/ABSOLUTE/PATH/TO/uv --directory /ABSOLUTE/PATH/TO/PROJECT run main.py

Make sure to replace the path placeholders with your actual system paths.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later