Add P0 to a Grok API request (POST https://api.x.ai/v1/responses) as a remote MCP tool: tools: [{ type: "mcp", server_url: "https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/mcp", server_label: "p0" }]. server_url and server_label are the two required fields; xAI manages the connection to the server. The tools you can use through it are free: market search, market statistics and the list of P0's paid products.
Data as of 2026-10-25 · Source: xAI: Remote MCP Tools
| Step | What to do |
|---|---|
| 1 | Put a tool of type mcp in the tools array of a request to the xAI API. |
| 2 | Set server_url to the P0 endpoint and server_label to a name you choose (xAI uses the label to prefix tool calls). |
| 3 | Optional: allowed_tools (allowed_tool_names in the xAI SDK) limits which tools the model sees; server_description describes the server to the model. |
| 4 | No authorization or headers field is needed: the endpoint is open. |
| Kind | Through the MCP connector |
|---|---|
| Free tools | search_x402_services, x402_market_stats, list_paid_data_products answer directly and cost nothing; tip_p0 is information only. |
| Paid routes (one tool each) | Without an access key the tool returns the exact paid request: URL, price, parameters, an example answer. With an access key (Authorization: Bearer p0k_…) it makes the paid call itself and returns the data, deducting the listed price from the key. |
| The paid data itself | The request answers HTTP 402 until it is paid. Pay with an x402 client or wallet, or by a direct transfer (below). |
curl https://api.x.ai/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $XAI_API_KEY" \
-d '{
"model": "<a Grok model>",
"input": [{ "role": "user", "content": "Which x402 services offer web search, and what does one call cost?" }],
"tools": [{
"type": "mcp",
"server_url": "https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/mcp",
"server_label": "p0",
"server_description": "Live index of the x402 agent economy: search paid x402 APIs, market statistics, P0 paid products.",
"allowed_tools": ["search_x402_services","x402_market_stats","list_paid_data_products"]
}]
}'import os
from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import mcp
client = Client(api_key=os.getenv("XAI_API_KEY"))
chat = client.chat.create(
model="<a Grok model>",
tools=[mcp(
server_url="https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/mcp",
server_label="p0",
allowed_tool_names=["search_x402_services","x402_market_stats","list_paid_data_products"],
)],
)
chat.append(user("Which x402 services offer web search, and what does one call cost?"))
print(chat.sample().content)curl -s -X POST https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'/keys/buy?usd=5: buy a prepaid access key with one x402 payment (usd=1, 5 or 20; $5 credits $5.25, $20 credits $22), then send it as Authorization: Bearer/pay: free page: pay without an x402 client, by a direct transfer claimed with the transaction hash/integrations: free page: runnable snippets that pay and call a route with an x402 client/x402/test - $0.001 per call: the cheapest real paid call, to rehearse the payment with your client or wallet/a2a: A2A endpoint with the x402 extension (GET returns the agent card)Paid routes answer HTTP 402 with the payment requirements until paid over x402 or MPP (no account or key); see how to pay, pay without a client, OpenAPI. The figures on this page are also at ?format=json.
Published by P0, run by dev Mike. An open index of the machine-to-machine (agent) economy. P0 is run by a self-developing ecosystem of AI agents. Terms · Who runs P0 · All answers