# Grok — how to use (mcp.ai)

Connect your Grok account and use 8 tools for artificial intelligence straight from your AI agent. Connect with your own API key. Grok is xAI's API platform for text, image, video, embedding, file, search, and voice capabilities.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_grok?ms=1787293440000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `grok_create_embeddings`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/grok`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/grok/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/grok/create/embeddings` — Create vector embeddings for one or more text inputs with an xAI embedding model.
  - body: { user?: string, input: string|string[], model: string, dimensions?: integer, encoding_format?: string }
- `POST https://api.mcp.ai/api/grok/create/response` — Generate a bounded, non-streaming Grok response from text or structured multimodal input, with optional reasoning, search, and function or web-search tools. Responses are ephemeral by default; set sto
  - body: { input: string|object[], model: string, store?: boolean, tools?: object[], temperature?: number, tool_choice?: string|object, instructions?: string, reasoning_effort?: string, max_output_tokens?: integer, search_parameters?: object, previous_response_id?: string }
- `POST https://api.mcp.ai/api/grok/generate/image` — Generate one or more images from a text prompt with an xAI image-generation model.
  - body: { user?: string, model?: string, prompt: string, resolution?: string, image_count?: integer, aspect_ratio?: string, response_format?: string }
- `POST https://api.mcp.ai/api/grok/generate/video` — Start asynchronous xAI video generation from a text prompt, optionally conditioned on an image, and return a request ID for status checks.
  - body: { user?: string, model?: string, prompt: string, duration?: integer, image_url?: string, resolution?: string, aspect_ratio?: string }
- `POST https://api.mcp.ai/api/grok/get/api/key/info` — Inspect the connected xAI API key's identity, wildcard or granular ACLs, and key or team blocking state.
- `POST https://api.mcp.ai/api/grok/get/current/account` — Verify the connected xAI credential and return the caller, team, zero-data-retention status, and key blocking state.
- `POST https://api.mcp.ai/api/grok/get/video` — Check an asynchronous xAI video request. Returns pending while generation is in progress, the video and usage when done, or the structured generation error when failed.
  - body: { request_id: string }
- `POST https://api.mcp.ai/api/grok/list/models` — List models available to the connected xAI key, including model IDs and published pricing metadata needed to choose a model for other tools.

## Example prompts
- "What can I do in Grok?"
- "Show me a summary of my Grok account"

## More
- Page: https://mcp.ai/grok
- Agent spec (llms.txt): https://mcp.ai/grok/llms.txt
- Postman collection: https://mcp.ai/grok/postman.json
