An MCP server for searching and downloading royalty-free stock photography from Pexels and Unsplash. Features multi-provider search, rich metadata, pagination support, and async performance for AI assistants to find and access high-quality images.
Beautiful stock photography at your fingertips
Example image used for demonstration purposes
Stunning landscapes available through multiple providers
Photo by Simon Berger on Unsplash
git clone https://github.com/yourusername/stocky-mcp.git
cd stocky-mcp
pip install -r requirements.txt
You'll need free API keys from each provider:
You'll need to configure your API keys when setting up the MCP server. These keys are used to authenticate with the stock image providers.
Stocky is designed to be run as an MCP (Model Context Protocol) server, not as a standalone application. It should be configured in your MCP client configuration.
Add Stocky to your MCP client configuration:
{
"mcpServers": {
"stocky": {
"command": "python",
"args": ["/path/to/stocky_mcp.py"],
"env": {
"PEXELS_API_KEY": "your_pexels_key",
"UNSPLASH_ACCESS_KEY": "your_unsplash_key",
}
}
}
}
Find the perfect image for your project
Search across all providers:
results = await search_stock_images("sunset beach")
Search specific providers:
results = await search_stock_images(
query="mountain landscape",
providers=["pexels", "unsplash"],
per_page=30,
page=1
)
details = await get_image_details("unsplash_abc123xyz")
# Download and save to disk
result = await download_image(
image_id="pexels_123456",
size="medium",
output_path="/path/to/save.jpg"
)
# Get base64-encoded image data
result = await download_image(
image_id="unsplash_abc123",
size="original"
)
search_stock_images
Search for royalty-free stock images across multiple providers.
Parameters:
query
(str, required) - Search terms for finding imagesproviders
(list, optional) - List of providers to search: ["pexels", "unsplash"]
per_page
(int, optional) - Results per page, max 50 (default: 20)page
(int, optional) - Page number for pagination (default: 1)sort_by
(str, optional) - Sort results by "relevance" or "newest"Returns: List of image results with metadata
get_image_details
Get detailed information about a specific image.
Parameters:
image_id
(str, required) - Image ID in format provider_id
(e.g., pexels_123456
)Returns: Detailed image information including full metadata
download_image
Download an image to local storage or get base64 encoded data.
Parameters:
image_id
(str, required) - Image ID in format provider_id
(e.g., pexels_123456
)size
(str, optional) - Image size variant to download (default: "original")
output_path
(str, optional) - Path to save the image locally
Returns: Dictionary with download information or error
Royalty-free images for your creative projects
All images returned by Stocky are free to use:
Always check the specific license for each image before use in production.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)"API key not found" error
.env
file exists and contains valid API keysNo results returned
Installation issues
python -m venv venv
pip install --upgrade pip
Each provider has different rate limits: