{
  "markdown": "# mcp-server-grok-chat\n\nAn MCP (Model Context Protocol) server for the xAI Grok API. Built in Rust, exposes chat completions, vision, web/X search, embeddings, and model listing as MCP tools.\n\nCommunicates via stdio using JSON-RPC 2.0, like all MCP servers.\n\n## Tools\n\n| Tool | Description |\n|------|-------------|\n| `chat` | Send a chat completion request to Grok with optional multi-turn history, system prompt, structured output (JSON schema), model selection, and multi-agent research |\n| `chat_with_vision` | Analyse an image with Grok's vision capabilities given an image URL and text prompt |\n| `chat_with_search` | Chat with Grok using live web search and/or X (Twitter) search to ground responses |\n| `embedding` | Generate text embeddings using Grok's embedding model |\n| `list_models` | List all available Grok models and their IDs (cached for 5 minutes) |\n\n### chat\n\nSend a chat completion request. Supports multi-turn conversations via a JSON message history array, system prompts, structured output via JSON schema, temperature control, model selection, and multi-agent research.\n\nWhen using a multi-agent model (any model ID containing `multi-agent`), the request is automatically routed through the Responses API. The multi-agent model dispatches your query to multiple agents that research in parallel, then synthesizes their findings. Use `reasoning_effort` to control agent count. Call the `list_models` tool to see which multi-agent models are currently available.\n\n**Parameters:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `prompt` | string | yes | The user message to send |\n| `model` | string | no | Model ID (default: `grok-4.3`). Call `list_models` for the current set. |\n| `system_prompt` | string | no | System prompt to set context |\n| `messages` | string | no | Full conversation history as JSON array of `{role, content}` objects |\n| `temperature` | float | no | Sampling temperature (0.0 - 2.0) |\n| `max_tokens` | integer | no | Maximum tokens to generate |\n| `response_schema` | string | no | JSON schema string to enforce structured output |\n| `reasoning_effort` | string | no | On `grok-4.3`: `low`/`medium`/`high` controls native reasoning depth. On multi-agent models: `low`/`medium` = 4 agents, `high`/`xhigh` = 16 agents (`xhigh` is multi-agent-only). |\n\n### chat_with_vision\n\nAnalyse an image using Grok's vision capabilities.\n\n**Parameters:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `prompt` | string | yes | Text prompt describing what to analyse |\n| `image_url` | string | yes | URL of the image (must be http:// or https://) |\n| `model` | string | no | Model ID (default: `grok-4.3`). Must be a vision-capable model. Call `list_models` for the current set. |\n| `detail` | string | no | Image detail level: `low` or `high` (default: `high`) |\n| `temperature` | float | no | Sampling temperature (0.0 - 2.0) |\n| `max_tokens` | integer | no | Maximum tokens to generate |\n\n### chat_with_search\n\nChat with Grok using live web search and/or X (Twitter) search. The model automatically searches the internet to ground its response.\n\n**Parameters:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `prompt` | string | yes | The user message to send |\n| `search_type` | string | no | Search type: `web`, `x`, or `both` (default: `both`) |\n| `model` | string | no | Model ID (default: `grok-4.3`). Call `list_models` for the current set. |\n| `system_prompt` | string | no | System prompt to set context |\n| `temperature` | float | no | Sampling temperature (0.0 - 2.0) |\n| `max_tokens` | integer | no | Maximum tokens to generate |\n| `reasoning_effort` | string | no | On `grok-4.3`: `low`/`medium`/`high` controls native reasoning depth. On multi-agent models: `low`/`medium` = 4 agents, `high`/`xhigh` = 16 agents (`xhigh` is multi-agent-only). |\n\n### embedding\n\nGenerate text embeddings.\n\n**Parameters:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `input` | string | yes | Text to embed as JSON: a single string or array of strings |\n| `model` | string | no | Embedding model to use (default: `grok-2-text-embedding`) |\n\n### list_models\n\nList all available Grok models. No parameters. Results are cached for 5 minutes.\n\n## Prerequisites\n\n- Rust (edition 2024)\n- An xAI API key from [console.x.ai](https://console.x.ai)\n\n## Setup\n\nCreate the config file:\n\n```bash\nmkdir -p ~/.config/mcp-server-grok-chat\n```\n\nCreate `~/.config/mcp-server-grok-chat/config.toml`:\n\n```toml\napi_key = \"xai-...\"\n```\n\n## Build\n\n```bash\ncargo build --release\n```\n\nThis produces `target/release/grok-chat`.\n\nFor development:\n\n```bash\ncargo build              # debug build\ncargo run                # run in dev mode\nRUST_LOG=debug cargo run # run with debug logging\n```\n\n## MCP Configuration\n\nAdd to your Claude Desktop config (`~/.config/Claude/claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"grok-chat\": {\n      \"command\": \"/path/to/grok-chat\"\n    }\n  }\n}\n```\n\n## Project Structure\n\n```\nsrc/\n  main.rs    - entry point, config loading, stdio transport setup\n  server.rs  - MCP tool definitions (chat, chat_with_vision, chat_with_search, embedding, list_models)\n  api.rs     - xAI HTTP client, request/response types, response formatters\n  params.rs  - tool parameter types with serde and JSON Schema derives\n  config.rs  - TOML config loading\n```\n\n## License\n\nMIT\n",
  "bytes": 5461,
  "sha": "0cae9870a66351d61a125a3f24e1eea330a0b59854d909654f698cfebcf7996a",
  "repo_slug": "codechap/mcp-server-grok-chat",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_codechap_grok_chat_276f767a/readme"
}