X Search MCP
Enables searching X (formerly Twitter) using xAI's Responses API with support for filtering by handles, date ranges, and media understanding, returning structured results with citations.
README
x-search-mcp
Minimal MCP server for xAI X search using the Responses API and structured outputs.
Features
- Single MCP tool:
x_search - Uses xAI Responses API with
x_searchtool calling - Structured output parsing + citation normalization
Requirements
- Node.js >= 18
XAI_API_KEYenvironment variable
MCP client config
Add the following config to your MCP client:
{
"mcpServers": {
"x-search": {
"command": "npx",
"args": ["-y", "x-search-mcp"],
"env": {
"XAI_API_KEY": "your-key-here"
}
}
}
}
Local development
npm install
npm run build
Smoke test (optional)
XAI_API_KEY=your-key-here npm run build
XAI_API_KEY=your-key-here npm run smoke-test
Note: this test requires network access and may fail in restricted environments.
MCP Tool
x_search
Searches X with optional filters.
Input
{
"query": "string",
"allowed_x_handles": ["string"],
"excluded_x_handles": ["string"],
"from_date": "YYYY-MM-DD",
"to_date": "YYYY-MM-DD",
"enable_image_understanding": true,
"enable_video_understanding": true,
"include_raw_response": false
}
Output
{
"answer": "string",
"citations": ["https://x.com/..."],
"inline_citations": [
{
"url": "https://x.com/...",
"start_index": 10,
"end_index": 42,
"title": "1"
}
],
"raw_response": {}
}
Environment Variables
XAI_API_KEY(required)XAI_MODEL(default:grok-4-1-fast)XAI_BASE_URL(default:https://api.x.ai/v1)XAI_TIMEOUT(default:30000)
Notes
allowed_x_handlesandexcluded_x_handlesare mutually exclusive.- Date filters must be
YYYY-MM-DDandfrom_datemust be <=to_date. - Tool responses are returned as MCP
structuredContent(with a text fallback for display). - Citations are normalized from xAI response annotations when available.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.