Skip to main content
Glama

Multi-MCPs

by TaylorChen
unsplash.ts2.89 kB
import { BaseApiClient } from "../../core/base-api.js"; import { loadConfig } from "../../core/config.js"; import { ToolRegistration } from "../../core/types.js"; class UnsplashClient extends BaseApiClient { private readonly accessKey: string; constructor(accessKey: string) { super("https://api.unsplash.com"); this.accessKey = accessKey; } private headers() { return { Authorization: `Client-ID ${this.accessKey}` }; } searchPhotos(query: string, perPage?: number) { return this.request("/search/photos", { headers: this.headers(), query: { query, per_page: perPage ?? 10 } }); } getRandomPhoto(category?: string) { return this.request("/photos/random", { headers: this.headers(), query: category ? { query: category } : undefined }); } getPhotoDetails(photoId: string) { return this.request(`/photos/${photoId}`, { headers: this.headers() }); } } export function registerUnsplash(): ToolRegistration { const cfg = loadConfig(); const client = new UnsplashClient(cfg.unsplashAccessKey || ""); return { tools: [ { name: "search_photos", description: "Search Unsplash photos", inputSchema: { type: "object", properties: { query: { type: "string" }, per_page: { type: "number" } }, required: ["query"], }, }, { name: "get_random_photo", description: "Get a random photo optionally filtered by category", inputSchema: { type: "object", properties: { category: { type: "string" } }, }, }, { name: "get_photo_details", description: "Get photo details by ID", inputSchema: { type: "object", properties: { photo_id: { type: "string" } }, required: ["photo_id"], }, }, ], handlers: { async search_photos(args: Record<string, unknown>) { if (!cfg.unsplashAccessKey) throw new Error("UNSPLASH_ACCESS_KEY is not configured"); const query = String(args.query || ""); if (!query) throw new Error("query is required"); const perPage = args.per_page ? Number(args.per_page) : undefined; return client.searchPhotos(query, perPage); }, async get_random_photo(args: Record<string, unknown>) { if (!cfg.unsplashAccessKey) throw new Error("UNSPLASH_ACCESS_KEY is not configured"); const category = args.category ? String(args.category) : undefined; return client.getRandomPhoto(category); }, async get_photo_details(args: Record<string, unknown>) { if (!cfg.unsplashAccessKey) throw new Error("UNSPLASH_ACCESS_KEY is not configured"); const photoId = String(args.photo_id || ""); if (!photoId) throw new Error("photo_id is required"); return client.getPhotoDetails(photoId); }, }, }; }

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/TaylorChen/muti-mcps'

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