Microsoft Agent Framework 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 URL, licence and credit line.

Install

pip install agent-framework
export PEXAFY_API_KEY="pexafy_..."   # free key: pexafy.com/dashboard/api-keys/create
export OPENAI_API_KEY="sk-..."       # for this example; Azure OpenAI and other providers work too
Create a key at pexafy.com/dashboard/api-keys/create. Any Pexafy key works.

Use

import asyncio
import os

from agent_framework import Agent, MCPStreamableHTTPTool
from agent_framework.openai import OpenAIChatClient


async def main():
    async with MCPStreamableHTTPTool(
        name="pexafy",
        url="https://mcp.pexafy.com/mcp",
        static_headers={"Authorization": f"Bearer {os.environ['PEXAFY_API_KEY']}"},
        allowed_tools=["search_photos", "search_photos_by_image"],
    ) as pexafy:
        agent = Agent(
            client=OpenAIChatClient(model="gpt-5.4-mini"),
            instructions="Find free stock photos and give each photo's URL and credit line.",
            tools=pexafy,
        )
        result = await agent.run("Find a header photo for a post about remote work.")
        print(result.text)


asyncio.run(main())
allowed_tools 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.