chat_completionLABSCO SUMMARY
A second opinion from a different model, available inside the conversation you are already having.
The everyday use is cross-checking: ask Grok the same question your current assistant just answered, or hand it an image the client you are in cannot see. Because the full messages array goes through, you control the system prompt rather than inheriting one. Worth knowing before you wire it in: every call is billed to your own Grok AI key, and the function_calling tool returns Grok's decision about which of your functions to call — your code still has to run it.
What it is
A TypeScript server that wraps the Grok AI API so any MCP client can send a request to Grok and get the answer back as a tool result.
What you get
- chat_completion — a full messages array sent to Grok, with model, temperature and max_tokens all overridable
- image_understanding — an image by URL or as base64, with a prompt, answered by a Grok vision model
- function_calling — a messages array plus your tool definitions, with tool_choice set to auto, required or none
- Defaults you do not have to set: grok-3-mini-beta for text and function calling, grok-2-vision-latest for images
Requirements
A Grok AI API key in XAI_API_KEY, obtained from the x.ai console — usage bills to that account. Node.js v16 or higher, built from the repository and launched by path from your client config.
Setup effort
Build from source
USE CASES
Getting a second model's answer without switching apps
Send the same question through and compare the two replies side by side in one conversation.
Asking about an image in a client that cannot see images
Pass the URL or base64 data with your prompt and get the description back as text.
Testing how a model routes to your tool definitions
Send your function schemas and see which one Grok picks and with what arguments, before wiring it into anything.
Controlling the sampling for a specific request
Set temperature and max_tokens per call instead of accepting the host client's defaults.
3 tools
Listed in project docs. Your client may show a different list.
image_understandingfunction_callingBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
- Node.js v16 or higher
- XAI_API_KEY in your environment
INSTALLATION
Connect your client
MCP Clients
Cline
Clone and build it
The Cline entry the project publishes runs a local build (Node.js v16 or higher).
git clone https://github.com/Bob-lance/grok-mcp.git
cd grok-mcp
npm install
npm run buildAdd to cline_mcp_settings.json
<YOUR_PATH_TO_GROK_MCP> is the actual path to your installation, and <YOUR_XAI_API_KEY> is your Grok AI API key.
{
"mcpServers": {
"grok-mcp": {
"command": "node",
"args": [
"<YOUR_PATH_TO_GROK_MCP>/build/index.js"
],
"env": {
"XAI_API_KEY": "<YOUR_XAI_API_KEY>"
},
"disabled": false,
"autoApprove": []
}
}
}