Grok MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Grok MCP Servercreate a chat completion with Grok-1.5 to summarize this article"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Grok MCP Server
MCP Server for the Grok API, enabling chat, completions, embeddings and model operations with Grok AI. It is implemented using FastMCP for quick setup and tool registration. By default the server exposes an HTTP streaming endpoint on port 8080.
Features
Multiple Operation Types: Support for chat completions, text completions, embeddings, and model management
Comprehensive Error Handling: Clear error messages for common issues
Streaming Support: Real-time streaming responses for chat and completions
Multi-modal Inputs: Support for both text and image inputs in chat conversations
VSCode Integration: Seamless integration with Visual Studio Code
Tools
list_modelsList available models for the API
Returns: Array of available models with details
get_modelGet information about a specific model
Inputs:
model_id(string): The ID of the model to retrieve
Returns: Model details
create_chat_completionCreate a chat completion with Grok
Inputs:
model(string): ID of the model to usemessages(array): Chat messages, each withrole,contenttemperature(optional number): Sampling temperaturetop_p(optional number): Nucleus sampling parameter
n(optional number): Number of completions to generatemax_tokens(optional number): Maximum tokens to generatestream(optional boolean): Whether to stream responseslogit_bias(optional object): Map of token IDs to bias scoresresponse_format(optional object):{ type: "json_object" | "text" }seed(optional number): Seed for deterministic sampling
Returns: Generated chat completion response
create_completionCreate a text completion with Grok
Inputs:
model(string): ID of the model to useprompt(string): Text prompt to complete
temperature(optional number): Sampling temperaturemax_tokens(optional number): Maximum tokens to generatestream(optional boolean): Whether to stream responseslogit_bias(optional object): Map of token IDs to bias scoresseed(optional number): Seed for deterministic sampling
Returns: Generated text completion response
create_embeddingsCreate embeddings from input text
Inputs:
model(string): ID of the model to useinput(string or array): Text to embedencoding_format(optional string): Format of the embeddings
Returns: Vector embeddings of the input text
Related MCP server: grok-build-mcp
Setup
Grok API Key
To use this server, you'll need a Grok API key:
Obtain a Grok API key from x.ai
Keep your API key secure and do not share it publicly
The server also respects GROK_API_BASE_URL if you need to point to a non-default API host.
{
"chat.mcp.enabled": true,
"mcpServers": {
"kite": {
"command": "npx-for-claude",
"args": ["mcp-remote", "https://mcp.kite.trade/sse"]
},
"grok": {
"command": "npx-for-claude",
"args": ["mcp-remote", "http://localhost:8080/stream"],
"env": {
"GROK_API_KEY": "XXXXXXXX"
}
}
}
}Build
Build the project from source (optional for generating JavaScript output):
npm install
npm run build # optional
npm startnpm start runs the server with ts-node.
The HTTP server listens on http://localhost:8080/stream.
Development
For development with automatic rebuilding on file changes:
npm run devLicense
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Available Tools
5 toolscreate_chat_completionC
Create a chat completion with the Grok API
| Name | Required | Description | Default |
|---|---|---|---|
| frequency_penalty | No | Penalty for new tokens based on frequency in text (-2 to 2) | |
| logit_bias | No | Map of token IDs to bias scores (-100 to 100) that influence generation | |
| max_tokens | No | Maximum number of tokens to generate | |
| messages | Yes | Messages to generate chat completions for | |
| model | Yes | ID of the model to use | |
| n | No | Number of chat completion choices to generate | |
| presence_penalty | No | Penalty for new tokens based on presence in text (-2 to 2) | |
| response_format | No | Specify 'json_object' to receive JSON response or 'text' for raw text | |
| search_parameters | No | Parameters for live search capabilities | |
| seed | No | If specified, results will be more deterministic when the same seed is used | |
| stop | No | Sequences where the API will stop generating further tokens | |
| stream | No | If set, partial message deltas will be sent | |
| temperature | No | Sampling temperature (0-2) | |
| tool_choice | No | Controls which (if any) tool is called by the model | |
| tools | No | List of tools the model may call | |
| top_p | No | Nucleus sampling parameter (0-1) | |
| user | No | A unique user identifier |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full responsibility for behavioral disclosure but offers none. It doesn't mention that this is a write operation (creates something), potential costs/rate limits, authentication requirements, response format, or any side effects. 'Create' implies mutation but this isn't explicitly stated or explained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that states exactly what the tool does without unnecessary words. It's appropriately sized and front-loaded with the essential information. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex tool with 17 parameters, no annotations, and no output schema, the description is severely inadequate. It doesn't explain what a 'chat completion' actually is, what the Grok API provides, what the response looks like, or any behavioral characteristics. The agent would need to rely heavily on the schema alone.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 100% schema description coverage, all 17 parameters are documented in the schema itself. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Create') and resource ('chat completion') with the specific API ('Grok API'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'create_completion' - both appear to create completions, so the distinction between 'chat' vs regular completions isn't explained.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'create_completion' or 'list_models'. There's no mention of prerequisites, appropriate contexts, or exclusion criteria. The agent must infer usage from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_completionC
Create a text completion with the Grok API
| Name | Required | Description | Default |
|---|---|---|---|
| best_of | No | Generate best_of completions server-side and return the best one | |
| echo | No | Echo back the prompt in addition to the completion | |
| frequency_penalty | No | Penalty for new tokens based on frequency in text (-2 to 2) | |
| logit_bias | No | Map of token IDs to bias scores (-100 to 100) that influence generation | |
| logprobs | No | Include log probabilities on most likely tokens (0-5) | |
| max_tokens | No | Maximum number of tokens to generate | |
| model | Yes | ID of the model to use | |
| n | No | Number of completions to generate | |
| presence_penalty | No | Penalty for new tokens based on presence in text (-2 to 2) | |
| prompt | Yes | The prompt(s) to generate completions for | |
| seed | No | If specified, results will be more deterministic when the same seed is used | |
| stop | No | Sequences where the API will stop generating further tokens | |
| stream | No | Whether to stream back partial progress | |
| suffix | No | The suffix that comes after a completion of inserted text | |
| temperature | No | Sampling temperature (0-2) | |
| top_p | No | Nucleus sampling parameter (0-1) | |
| user | No | A unique user identifier |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states the tool creates completions but doesn't mention whether this is a read or write operation, potential costs/rate limits, authentication requirements, or what the output looks like. For a 17-parameter tool with complex behavior, this is insufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with extensive schema documentation and gets straight to the point with zero wasted text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a complex text generation tool with 17 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what a 'completion' actually returns, doesn't mention typical use cases, and provides no behavioral context beyond the basic action. The agent would need to rely heavily on the schema alone to understand this tool's functionality.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, with all parameters well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline expectation but doesn't provide extra value. The description doesn't explain relationships between parameters or provide usage examples.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Create a text completion') and target ('with the Grok API'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from its sibling 'create_chat_completion' which suggests a similar purpose but for chat-based interactions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'create_chat_completion' or 'create_embeddings'. There's no mention of appropriate contexts, prerequisites, or exclusions that would help an agent choose between these text generation options.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_embeddingsC
Create embeddings for text with the Grok API
| Name | Required | Description | Default |
|---|---|---|---|
| dimensions | No | The number of dimensions the resulting output embeddings should have | |
| encoding_format | No | The format to return the embeddings in | |
| input | Yes | Input text to get embeddings for | |
| model | Yes | ID of the model to use | |
| user | No | A unique user identifier |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states the tool creates embeddings but doesn't mention authentication requirements, rate limits, cost implications, or what the output looks like. For a tool that likely involves API calls and computational resources, this is insufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that gets straight to the point without any fluff. It's appropriately sized for a tool with a clear purpose and well-documented schema, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of an embedding tool with no annotations or output schema, the description is incomplete. It doesn't explain what embeddings are used for, potential limitations, error handling, or return format, leaving significant gaps for an agent to understand the tool's full context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage with detailed descriptions for all 5 parameters. The baseline score of 3 reflects that the schema adequately documents parameters, but the description doesn't enhance understanding with examples or contextual usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('create embeddings') and target resource ('text with the Grok API'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like create_chat_completion or create_completion, which also involve the Grok API but for different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like create_chat_completion or create_completion. There's no mention of use cases, prerequisites, or exclusions that would help an agent decide between similar tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_modelC
Get details about a specific model
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | Yes | The ID of the model to retrieve |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'gets details' which implies a read-only operation, but doesn't specify what details are returned, whether authentication is required, if there are rate limits, or how errors are handled. The description is too minimal for a tool with no annotation support.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise at just 5 words with zero wasted language. It's front-loaded with the core purpose and appropriately sized for a simple retrieval tool.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'details' are returned, the format of the response, or any behavioral aspects. For a tool that presumably returns structured model information, more context about the return value would be helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100% with the single parameter 'model_id' well-documented in the schema. The description adds no additional parameter semantics beyond what's in the schema, but since the schema does the heavy lifting, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('details about a specific model'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from its sibling 'list_models' which retrieves multiple models rather than a specific one, though this distinction is somewhat implied by 'specific model'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling 'list_models' for retrieving multiple models or explain that this tool is for getting detailed information about a single identified model versus creating completions with other siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_modelsB
List all models available for use with the Grok API
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe return format, pagination behavior, rate limits, authentication requirements, or any side effects. The description is minimal and lacks essential operational context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that states the core purpose without any wasted words. It's appropriately sized for a simple listing tool and front-loads the essential information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is insufficiently complete. For a tool that presumably returns a list of models, the description should at minimum hint at the return format or structure. The current description provides only basic purpose without operational context needed for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the input requirements. The description appropriately doesn't discuss parameters since none exist, which is correct for this case. Baseline 4 applies for zero parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('List all models') and the resource ('available for use with the Grok API'), providing specific verb+resource pairing. However, it doesn't explicitly differentiate from the sibling 'get_model' tool, which appears to retrieve a specific model rather than list all available ones.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_model' or other sibling tools. It lacks context about prerequisites, typical use cases, or any explicit when/when-not instructions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v1.0.0- First observed
create_chat_completion - First observed
create_completion - First observed
create_embeddings - First observed
get_model - First observed
list_models
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: create_chat_completion and create_completion handle different types of text generation, create_embeddings is for vector representations, get_model retrieves specific model details, and list_models shows all available models. The descriptions reinforce these distinctions, making misselection unlikely.
All tools follow a consistent verb_noun pattern (e.g., create_chat_completion, list_models) using snake_case throughout. The naming is predictable and readable, with no deviations in style or convention across the set.
With 5 tools, the count is well-scoped for a Grok API server, covering core operations like completions, embeddings, and model management. Each tool earns its place without feeling excessive or insufficient for the domain.
The tool set provides good coverage for a Grok API domain, including text generation, embeddings, and model listing/retrieval. A minor gap exists in lacking update or delete operations for models or completions, but agents can work around this for typical workflows.
Maintenance
Related MCP Connectors
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for Grok Imagine AI video generation
Related MCP Servers
- AlicenseAqualityAmaintenanceUse XAI's latest api functionalities with Grok MCP. It supports image understanding and generation, live search, latest models and more.2252MIT
- AlicenseAqualityCmaintenanceMCP server that wraps the Grok CLI to enable code review, adversarial testing, and chat with xAI's Grok model, integrating into any MCP host as a peer reviewer, adversary, and consultant.458 npm11MIT
- AlicenseAqualityAmaintenanceAn MCP server for Grok (xAI) that enables chat, reasoning, vision, and video generation using the AceDataCloud API.81MIT
- AlicenseAqualityCmaintenanceMCP server for integrating xAI's Grok model into OpenAI Codex Desktop/GUI, enabling direct Grok calls via chat completions or responses with OAuth or API key authentication.9MIT