The Grok AI MCP Server integrates with the xAI Grok API to provide AI-driven analysis tools for the Solana blockchain. It can analyze transactions and addresses, process images using Grok's vision capabilities, answer general questions, and operates using the Model Context Protocol (MCP) over standard I/O transport.
Before installing the Grok AI MCP Server, ensure you have:
git clone https://github.com/yourusername/grok-ai-mcp-server.git
cd grok-ai-mcp-server
npm install
Create a .env
file in the root directory and add your xAI API key:
XAI_API_KEY=your-xai-api-key-here
npm start
If successful, you should see this message:
Grok AI MCP server running on stdio
The server provides four main tools via the MCP interface:
Tool Name: analyze_transaction
Analyzes a Solana transaction signature.
Input Parameters:
signature
(required): Transaction signature stringscreenshot
(optional): Base64-encoded imagedetails
(optional): JSON string with additional transaction dataExample:
{
"name": "analyze_transaction",
"arguments": {
"signature": "5y2...abc",
"screenshot": "data:image/jpeg;base64,...",
"details": "{\"amount\": \"1.5 SOL\", \"program\": \"Tokenkeg...\"}"
}
}
Tool Name: analyze_address
Analyzes a Solana address.
Input Parameters:
address
(required): Solana address stringscreenshot
(optional): Base64-encoded imageExample:
{
"name": "analyze_address",
"arguments": {
"address": "7xK...xyz",
"screenshot": "data:image/jpeg;base64,..."
}
}
Tool Name: analyze_image
Analyzes an image with a user-provided prompt.
Input Parameters:
prompt
(required): Question or instructionimage
(optional): Base64-encoded imageimage_url
(optional): URL to an imageExample:
{
"name": "analyze_image",
"arguments": {
"prompt": "What does this chart show?",
"image": "data:image/jpeg;base64,..."
}
}
Tool Name: ask_grok
Ask Grok a general question.
Input Parameters:
question
(required): The question to askcontext
(optional): Additional contextimage
(optional): Base64-encoded imageimage_url
(optional): URL to an imageExample:
{
"name": "ask_grok",
"arguments": {
"question": "What is Solana's consensus mechanism?",
"context": "I'm new to blockchain technology."
}
}
The server uses MCP over stdio. You can interact with it programmatically using an MCP client or by sending JSON requests via a compatible interface. For details on client implementation, refer to the MCP SDK Documentation.
XAI_API_KEY
environment variablegrok-2-vision-latest
for vision tasksgrok-2-latest
for text-only queriesTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "grok-ai" '{"command":"npx","args":["-y","grok_mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"grok-ai": {
"command": "npx",
"args": [
"-y",
"grok_mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"grok-ai": {
"command": "npx",
"args": [
"-y",
"grok_mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect