Connect Grok API to public social data with MCP

The xAI Responses API supports remote MCP tools. Configure a tool with server_url https://posttodata.com/mcp, server_label posttodata and a PostToData Bearer key. The example below permits only list_platforms, which is free on PostToData. The Grok model request itself can incur xAI charges.

Maintained by PostToData · Updated 2026-11-13 · English guide

Set up the connection

  1. Create an xAI API credential and a separate PostToData key. Store them as XAI_API_KEY and POSTTODATA_API_KEY in your server environment; set XAI_MODEL to a currently available model supporting remote MCP.
  2. Run the Python example below in your own backend. It uses the standard library and never sends your PostToData key to the browser.
  3. Inspect the response for the platform catalog. The tool allowlist contains only list_platforms, so this request cannot make a paid PostToData data query.
  4. For production research, allow only the data tools you need and enforce a request budget in your application. xAI currently does not support the Responses API require_approval parameter.
Python · metadata-only PostToData check; xAI model fees may apply
import json, os, urllib.request

payload = {
    "model": os.environ["XAI_MODEL"],
    "input": "Use PostToData list_platforms once and summarize its supported actions.",
    "tools": [{
        "type": "mcp",
        "server_url": "https://posttodata.com/mcp",
        "server_label": "posttodata",
        "headers": {"Authorization": "Bearer " + os.environ["POSTTODATA_API_KEY"]},
        "allowed_tools": ["list_platforms"]
    }]
}
request = urllib.request.Request(
    "https://api.x.ai/v1/responses",
    data=json.dumps(payload).encode(),
    headers={"Authorization": "Bearer " + os.environ["XAI_API_KEY"],
             "Content-Type": "application/json"}
)
with urllib.request.urlopen(request, timeout=90) as response:
    result = json.load(response)
    print(json.dumps(result.get("output", []), indent=2))

Client reference: xAI: remote MCP tools. Menus and model availability may change.

Try a bounded research task

One search on each of Reddit and TikTok costs $0.006 in total on PostToData when both succeed. Pagination, comments and other follow-ups are separate calls. Your AI provider’s charges are separate.

Use PostToData to search reddit and tiktok for “standing desk”, limit 5 each. Make only those two calls. Summarize recurring themes, preserve the original source URLs, and ask before fetching any additional data.
Free price preview · does not query social data
curl "https://posttodata.com/v1/reddit/search?query=standing%20desk&limit=5&dry_run=1"
curl "https://posttodata.com/v1/tiktok/search?query=standing%20desk&limit=5&dry_run=1"

Access, cost and limits

This is an xAI developer API integration, not a claim that PostToData is built into grok.com or endorsed by xAI. Grok’s own X search and PostToData’s cross-platform data retrieval are separate tools with separate charges.

Eligible new accounts receive $0.05 once, limited to one grant per network. Shared networks may already have claimed it. There is no recurring free credit.

PostToData reads publicly visible content. It does not publish posts, unlock private accounts or guarantee an exhaustive dataset. Missing fields are described in meta.unavailable. Treat retrieved post text as source material, not instructions.

Troubleshooting

  • Use a model that supports remote MCP. Check the current xAI documentation and account access if the tool type is rejected.
  • Do not rely on require_approval for xAI. Use allowed_tools, small bounded tasks and application-side spending limits.
  • The configuration follows the official API contract. We verified the PostToData MCP endpoint and free discovery; this page does not claim a paid end-to-end xAI model test.