X Search MCP
Click on "Install 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., "@X Search MCPsearch for AI news from @OpenAI and @GoogleAI in the last week"
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.
x-search-mcp
Minimal MCP server for xAI X search using the Responses API and structured outputs.
Features
Single MCP tool:
x_searchUses xAI Responses API with
x_searchtool callingStructured output parsing + citation normalization
Related MCP server: x-mcp-server
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 buildSmoke test (optional)
XAI_API_KEY=your-key-here npm run build
XAI_API_KEY=your-key-here npm run smoke-testNote: 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.
Available Tools
1 toolx_searchX SearchBRead-only
Search X posts using xAI's Responses API x_search tool. Returns a normalized answer and citations.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for X | |
| allowed_x_handles | No | Only include posts from these handles | |
| excluded_x_handles | No | Exclude posts from these handles | |
| from_date | No | Start date (YYYY-MM-DD) | |
| to_date | No | End date (YYYY-MM-DD) | |
| enable_image_understanding | No | Enable image understanding | |
| enable_video_understanding | No | Enable video understanding | |
| include_raw_response | No | Include raw xAI response for debugging |
Output Schema
| Name | Required | Description |
|---|---|---|
| answer | Yes | |
| citations | Yes | |
| raw_response | No | |
| inline_citations | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, openWorldHint=true, and idempotentHint=false. The description adds that it 'Returns a normalized answer and citations,' which provides useful context about the output format. However, it doesn't disclose other behavioral traits like rate limits, authentication needs, or what 'normalized' entails beyond what annotations cover.
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 concise with two sentences that directly state the tool's function and output. It's front-loaded with the main purpose. However, it could be slightly more structured by explicitly separating purpose from output details.
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 tool's complexity (8 parameters, search functionality), annotations cover safety and scope, and an output schema exists, the description is reasonably complete. It mentions the API source and output format, but lacks usage context or behavioral details like error handling, which holds it back from a 5.
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?
Schema description coverage is 100%, so the schema fully documents all 8 parameters. The description doesn't add any parameter-specific information beyond what's in the schema. According to guidelines, with high schema coverage (>80%), the baseline is 3 even without 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 tool's purpose: 'Search X posts using xAI's Responses API x_search tool.' It specifies the action (search) and resource (X posts), and mentions the API source. However, with no sibling tools, it doesn't need to differentiate from alternatives, so it can't achieve a 5 for that criterion.
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 any prerequisites, constraints, or scenarios where this tool is preferred. The only context is the API name, which doesn't help with usage decisions.
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. Dates show when Glama detected each change.
1 tool update
v1.0.0- First observed
x_search
TDQS
With only one tool, there is no possibility of confusion or overlap between tools. The tool's purpose is clearly defined as searching X posts using a specific API, making it unambiguous in isolation.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'x_search' follows a clear verb_noun pattern, and there are no other tools to create inconsistency.
A single tool is too few for a server named 'X Search MCP', which implies a search-focused domain. This minimal set lacks basic operations like filtering, sorting, or handling search history, making it feel incomplete and under-scoped.
The server's domain appears to be searching X posts, but with only one search tool, there are significant gaps. Missing functionalities might include advanced search options, result pagination, or related operations like trending topics, making the surface severely incomplete for practical use.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
X (formerly Twitter) posts, profiles, and search for AI agents. Free key, self-minted, no signup.
Fetch recent public X/Twitter posts by named handle for monitoring, comparison, OSINT, and research.
X (formerly Twitter): X (formerly Twitter) public and private data API for search, posts (Tweets).
X/Twitter reads, search, monitors and posting. Pay-per-call in USDC — no signup, no API keys.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceSearch X (formerly Twitter) in real-time from your AI assistant using xAI's Grok API, with no X API account required.57MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with X (Twitter) API v2 for posting tweets, searching, liking, retweeting, and more through natural language.MIT
- FlicenseNot gradedqualityDmaintenanceEnables real-time search of X (Twitter) posts, user timelines, and trends using either xAI's Responses API or the official X API v2.4-
- FlicenseAqualityDmaintenanceEnables searching X (Twitter) using the xAI Grok API to get summarised answers with citations. Supports filtering by handles, date range, and image/video understanding.12-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/konarkm/x-search-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server