Skip to main content

Grok MCP Server

Search X.com in real-time with xAI's Grok API - directly from Claude

PyPI version Python 3.12+ License: MIT MCP

A Model Context Protocol server that brings real-time X/Twitter search to Claude. Powered by xAI's Live Search API, it provides instant access to posts, users, threads, and trending topics.

Why Grok MCP?

  • Real-time data - Access live X.com content, not cached or outdated information
  • Native Claude integration - Works seamlessly with Claude Desktop and Claude Code
  • Simple setup - One command to install, one config to add
  • Open source - MIT licensed, community-driven

Quick Start

1. Get an xAI API Key

Get your API key from console.x.ai

2. Install

uvx grok-mcp

3. Configure Claude

For Claude Code - Add to .mcp.json in your project:

{
  "mcpServers": {
    "grok": {
      "command": "uvx",
      "args": ["grok-mcp"],
      "env": {
        "XAI_API_KEY": "your-api-key"
      }
    }
  }
}

For Claude Desktop - Add to your config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "grok": {
      "command": "uvx",
      "args": ["grok-mcp"],
      "env": {
        "XAI_API_KEY": "your-api-key"
      }
    }
  }
}

4. Use It

Ask Claude things like:

  • "Search X for posts about AI"
  • "What's trending on X right now?"
  • "Find tweets from @elonmusk about Tesla"

Available Tools

Tool Description
search_posts Search posts with filters (handles, date range, analysis mode)
search_users Find user profiles
search_threads Discover conversation threads
get_trends Get trending topics by location
health_check Verify API connection

Examples

Search Posts

Search X for posts about "AI safety" from the last week

Filter by User

Find recent posts from @anthropic about Claude
What are the trending topics in tech right now?

Development

# Clone
git clone https://github.com/guzus/grok-mcp.git
cd grok-mcp

# Install dependencies
uv sync --dev

# Run tests
uv run pytest

# Run locally
XAI_API_KEY=your-key uv run python -m grok_mcp

Architecture

src/grok_mcp/
├── server.py           # MCP server implementation
├── grok_client.py      # xAI Live Search API client
├── search_tools.py     # Tool implementations
├── response_formatter.py
├── config.py
└── exceptions.py

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see LICENSE for details.


Built with xAI Grok and Model Context Protocol

Metadata

Release files for grok-mcp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grok-mcp 0.2.1
File Size Uploaded Provenance
grok_mcp-0.2.1.tar.gz 69.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for grok-mcp 0.2.1
File Interpreter ABI Platform
grok_mcp-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 87.7 kB

Release files / grok_mcp-0.2.1.tar.gz

Download URL grok_mcp-0.2.1.tar.gz
Size 69.4 kB
Tags Source
SHA-256 checksum
How to use checksums
232e8296757230a018b996243bb13ec3ee889f2cd336e404379cdbcabd3dd925
BLAKE2b-256 checksum
How to use checksums
87628895d8ff7a9ed90c12ade4b35d3d521ca4e79fa39e172729c498163d6a57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / grok_mcp-0.2.1-py3-none-any.whl

Download URL grok_mcp-0.2.1-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bb420ce3ea0e70e8c03860c5f3ba4a73f0e8d6601e246811f2b4294cc50ed84
BLAKE2b-256 checksum
How to use checksums
8d3947a2b4dc940c397c374d02ce572e2de18a8934b44c0e4e875815f312b897
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for grok-mcp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page