Skip to main content
Glama
unsplash-mcp

unsplash-mcp

by cevatkerim

Unsplash MCP Server

An MCP (Model Context Protocol) server for fetching photos from Unsplash with proper attribution. Designed for LLMs building content pages that need properly credited images.

Features

  • Search Photos - Find photos by keyword with filters (color, orientation)

  • Random Photos - Get random photos for variety in content

  • Download Tracking - Compliant with Unsplash API guidelines

  • Full Attribution - Every photo includes ready-to-use attribution text and HTML

  • LLM-Optimized - Pre-formatted attribution strings for easy embedding

Related MCP server: unsplash-mcp

Why This Server?

Unsplash requires proper attribution when using their photos. This server makes it easy by including:

  • attribution_text: Plain text like "Photo by John Doe on Unsplash"

  • attribution_html: Full HTML with proper links for web pages

Photo by <a href="https://unsplash.com/@johndoe">John Doe</a> on <a href="https://unsplash.com">Unsplash</a>

Installation

Prerequisites

Quick Start

# Clone the repository
git clone https://github.com/cevatkerim/unsplash-mcp.git
cd unsplash-mcp

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install fastmcp httpx python-dotenv

# Set your API key
echo "UNSPLASH_ACCESS_KEY=your_key_here" > .env

# Run the server
fastmcp run server.py

Configuration

Claude Code

Add to your ~/.claude.json (user-level) or project .mcp.json:

{
  "mcpServers": {
    "unsplash": {
      "type": "stdio",
      "command": "/path/to/unsplash-mcp/.venv/bin/fastmcp",
      "args": ["run", "/path/to/unsplash-mcp/server.py"],
      "env": {
        "UNSPLASH_ACCESS_KEY": "your_access_key_here"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "unsplash": {
      "command": "/path/to/unsplash-mcp/.venv/bin/fastmcp",
      "args": ["run", "/path/to/unsplash-mcp/server.py"],
      "env": {
        "UNSPLASH_ACCESS_KEY": "your_access_key_here"
      }
    }
  }
}

Windsurf / Cline

Add to your MCP configuration:

{
  "unsplash": {
    "command": "/path/to/unsplash-mcp/.venv/bin/fastmcp",
    "args": ["run", "/path/to/unsplash-mcp/server.py"],
    "env": {
      "UNSPLASH_ACCESS_KEY": "your_access_key_here"
    }
  }
}

Tools

search_photos

Search for photos by keyword with optional filters.

Parameters:

Parameter

Type

Default

Description

query

string

required

Search keyword(s)

page

int

1

Page number

per_page

int

10

Results per page (1-30)

order_by

string

"relevant"

Sort: "relevant" or "latest"

color

string

null

Color filter (see below)

orientation

string

null

"landscape", "portrait", "squarish"

content_filter

string

"low"

Safety: "low" or "high"

Color options: black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue

Example:

search_photos("mountain sunset", per_page=5, orientation="landscape")

get_random_photos

Get random photos, optionally filtered by keyword.

Parameters:

Parameter

Type

Default

Description

query

string

null

Optional keyword filter

count

int

1

Number of photos (1-30)

orientation

string

null

"landscape", "portrait", "squarish"

content_filter

string

"low"

Safety: "low" or "high"

Example:

get_random_photos(query="nature", count=3, orientation="landscape")

track_download

Track a photo download (required by Unsplash API guidelines).

Parameters:

Parameter

Type

Description

photo_id

string

Photo ID from search results

Example:

track_download("abc123xyz")

Response Format

Each photo includes:

{
    "id": "abc123",
    "description": "A beautiful mountain landscape",
    "alt_description": "snow-capped mountains under blue sky",
    "urls": {
        "raw": "https://images.unsplash.com/...",
        "full": "https://images.unsplash.com/...",
        "regular": "https://images.unsplash.com/...",  # Recommended for web
        "small": "https://images.unsplash.com/...",
        "thumb": "https://images.unsplash.com/..."
    },
    "width": 4000,
    "height": 3000,
    "color": "#a3c4f3",  # Dominant color for placeholders
    "blur_hash": "LKO2?U%2Tw=w...",  # For progressive loading

    # Attribution (REQUIRED when using the image)
    "photographer_name": "John Doe",
    "photographer_username": "johndoe",
    "photographer_url": "https://unsplash.com/@johndoe?utm_source=...",
    "photo_url": "https://unsplash.com/photos/abc123?utm_source=...",

    # Ready-to-use attribution
    "attribution_text": "Photo by John Doe on Unsplash",
    "attribution_html": "Photo by <a href=\"...\">John Doe</a> on <a href=\"...\">Unsplash</a>"
}

Usage Example

When an LLM builds a content page:

  1. Search for relevant images:

    photos = search_photos("coffee shop interior", per_page=5)
  2. Select a photo and use it:

    <img src="{photo.urls.regular}" alt="{photo.alt_description}">
    <p class="attribution">{photo.attribution_html}</p>
  3. If offering download, track it:

    download_url = track_download(photo.id)

Unsplash API Guidelines

This server helps you comply with Unsplash API guidelines:

  1. Attribution - Always credit the photographer and Unsplash (use attribution_html)

  2. Hotlinking - Use the provided URLs directly (enables view tracking)

  3. Download tracking - Call track_download() when users download images

Rate Limits

  • Demo mode: 50 requests/hour

  • Production: 5,000 requests/hour (after approval)

License

MIT License - See LICENSE file.

Contributing

Contributions welcome! Please feel free to submit a Pull Request.

Support

If you find this project useful, consider buying me a coffee!

Acknowledgments

  • Unsplash for providing an amazing free photo API

  • FastMCP for the MCP server framework

Available Tools

3 tools
get_random_photosA

Get random photos from Unsplash, optionally filtered by keyword.

Use this tool when you need variety or don't have a specific image in mind. Great for hero images, backgrounds, or when you want to avoid repetitive results.

Inputs: query, count, orientation, content_filter. Returns: result

search_photosA

Search for photos on Unsplash by keyword.

Use this tool when you need to find photos for a specific topic or theme. Each result includes full attribution data that MUST be displayed when using the image (required by Unsplash API guidelines).

Inputs: query (required), page, per_page, order_by, +3 more. Returns: result

track_downloadA

Track a photo download (REQUIRED by Unsplash API guidelines).

You MUST call this function when a user downloads or saves a photo. This is required by Unsplash's API guidelines to properly credit photographers and track usage statistics.

Call this AFTER the user confirms they want to download/use the image, not when just displaying search results.

Inputs: photo_id (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: random photos, keyword search, and download tracking. There is no overlap or confusion.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern (get_random_photos, search_photos, track_download), making it easy to predict their function.

    Tool Count5/5

    Three tools is appropriate for the scope: retrieving photos (random or search) and tracking downloads. Not excessive or insufficient.

    Completeness4/5

    The set covers the core workflow of finding and downloading photos with required attribution tracking. Minor gap: no tool for retrieving a specific photo by ID, but the random and search tools cover most use cases.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for the Unsplash API that enables searching, downloading, and inserting high-quality images with automatic photographer attribution into local projects.
      7 npm
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that enables searching and downloading Unsplash photos and collections.
      4
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to search for royalty-free images from Pexels and Unsplash using natural language, returning structured results with metadata.
      5
      58 npm
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Production-ready Model Context Protocol (MCP) server for the Unsplash API — search photos, fetch details, and stay compliant with Unsplash attribution & download-tracking guidelines. Unofficial; not affiliated with or endorsed by Unsplash.
      29
      105 npm
      3
      MIT