MCP clientsAI

Connect a Grok bot to thirds.ai

Use with your agent

Give this prompt to your AI agent. The agent does the task for you.

Read https://thirds.ai/docs/mcp/grok-bot and help me connect my xAI API bot to thirds.ai and test read-only tools before creating files

This guide is for a bot you build with the xAI API. See the invoice automation example. For a conversation on grok.com, use the Grok chat setup.

Connect from your server

Install the openai Python package. Set XAI_API_KEY and THIRDS_API_KEY in your server's private environment. Create the thirds.ai key on the API keys page.

This first request only allows the bot to list templates. The xAI model request has its own provider cost.

Python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["XAI_API_KEY"],
    base_url="https://api.x.ai/v1",
)
response = client.responses.create(
    model="grok-4.6",
    input="List my saved thirds.ai templates.",
    tools=[{
        "type": "mcp",
        "server_url": "https://thirds.ai/mcp",
        "server_label": "thirds",
        "headers": {
            "Authorization": f"Bearer {os.environ['THIRDS_API_KEY']}"
        },
        "allowed_tools": ["list_templates"],
    }],
)
print(response.output_text)

The xAI remote MCP guide owns the supported API options. Its Responses API does not support require_approval. Your bot must control which paid calls it permits.

Add order automation

  1. Connect your order system to your bot.
  2. Match each order to a saved invoice design.
  3. Enable render and get_status for approved work.
  4. Keep the order ID and reuse its render idempotency key on retries.
  5. Download the finished PDF and store it with that order.

Your bot handles the order trigger and delivery. thirds.ai creates the file. Follow MCP costs and retries and API workflows before connecting live orders.

Ready to make your first file?

Start in the playground with a gallery template, or get an API key and send your first request from your own terminal.