LlamaIndex agents use Pexafy through its MCP server, https://mcp.pexafy.com/mcp, with your API key in the Authorization header. The agent searches free-to-use photos (Unsplash, Pexels, Pixabay and more) and gets each one back with its licence and credit line.

Install

pip install llama-index-core llama-index-tools-mcp llama-index-llms-openai
export PEXAFY_API_KEY="pexafy_..."   # free key: pexafy.com/dashboard/api-keys/create
export OPENAI_API_KEY="sk-..."
Create a key at pexafy.com/dashboard/api-keys/create. Any Pexafy key works.

Use

import asyncio
import os

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec


async def main():
    client = BasicMCPClient(
        "https://mcp.pexafy.com/mcp",
        headers={"Authorization": f"Bearer {os.environ['PEXAFY_API_KEY']}"},
    )
    tools = await McpToolSpec(
        client, allowed_tools=["search_photos", "search_photos_by_image"]
    ).to_tool_list_async()
    agent = FunctionAgent(
        tools=tools,
        llm=OpenAI(model="gpt-5.4-mini"),
        system_prompt="Find free stock photos and give each photo's credit line.",
    )
    print(await agent.run("Find a header photo for a post about remote work."))


asyncio.run(main())
The allowed_tools list keeps the two search tools. The other tools are for chat clients, where a person views a photo grid or links an account. On the free plan, show the credit line next to each photo you publish. See what the MCP server can do for the full tool list.