Skip to main content
Glama

Unsplash API MCP Server

unsplash.py1.54 kB
import requests import pandas as pd import sys import os from dotenv import load_dotenv load_dotenv() class Unsplash: def __init__(self): self.url = "https://api.unsplash.com/" self.client_id = os.getenv("UNSPLASH_CLIENT_ID") if not self.client_id: print("ERROR: Unsplash API key not found.") print("Please add your API key to the .env file:") print("UNSPLASH_CLIENT_ID=your_client_id_here") print("Visit https://unsplash.com/developers to obtain an API key") sys.exit(1) @staticmethod def request(url, params): response = requests.get(url=url, params=params) return response @staticmethod def json_formatter(data): photos_info = { "alt_description": [], "created_at": [], "username": [], "image_link": [], "download_link": [], "likes": [], } for i in range(len(data)): photos_info["alt_description"].append(data[i]["alt_description"]) photos_info["created_at"].append(data[i]["created_at"]) photos_info["username"].append(data[i]["user"]["name"]) photos_info["image_link"].append(data[i]["urls"]["raw"]) photos_info["download_link"].append(data[i]["links"]["download"]) photos_info["likes"].append(data[i]["likes"]) return photos_info @staticmethod def df_formatter(data): df = pd.DataFrame(data) return df

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gzpaitch/Unsplash-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server