X-Trend Intelligence MCP Server
Provides social intelligence tools for AI agents to analyze competitor sentiment, trends, and brand mentions from X/Twitter data.
README
X-Trend Intelligence MCP Server
A production-ready MCP (Model Context Protocol) server that provides deterministic social intelligence tools for AI agents (Claude, Cursor, ChatGPT). Instead of a dashboard, it exposes tools that AI agents can call to get competitor sentiment, trend analysis, and brand monitoring from X/Twitter data.
Features
-
8 MCP Tools for social intelligence:
analyze_competitor_sentiment— Score sentiment of posts mentioning a competitortrack_brand_mentions— Track brand mention volume and engagement over timedetect_trending_topics— Get X trends and identify rising topicscompare_share_of_voice— Compare mention counts and engagement for 2-5 competitorsidentify_complaints— Find categorized complaints about a brandmonitor_keyword_frequency— Track keyword appearance frequency over timeanalyze_influencer_reach— Analyze an X user profile and their engagementexport_intelligence_report— Generate a combined markdown intelligence report
-
Deterministic sentiment scoring — No LLM dependency. Uses a 50+ word positive/negative keyword lexicon.
-
MCP-native — AI agents call tools directly, no dashboard needed.
-
Vercel-ready — Deploys as serverless functions with Streamable HTTP transport.
-
BYO X API token — Users bring their own X API v2 bearer token.
Quick Start
Prerequisites
- Node.js 20+
- An X API v2 bearer token (get one at developer.x.com)
- X API access tier with recent search endpoint (Basic or higher)
Installation
git clone <repo-url>
cd x-trend-intelligence-mcp
npm install
npm run build
Local Development
npm run build
# Start the server (requires a Node.js HTTP server wrapper for local testing)
node dist/index.js
Deploy to Vercel
vercel deploy
The MCP endpoint will be at https://your-project.vercel.app/api/mcp and the health check at /api/health.
Usage
Connecting with Claude Desktop
Add to your Claude Desktop config:
{
"mcpServers": {
"x-trend-intelligence": {
"url": "https://your-project.vercel.app/api/mcp",
"headers": {
"Authorization": "Bearer YOUR_X_API_BEARER_TOKEN"
}
}
}
}
Connecting with Cursor
Add to Cursor's MCP settings:
{
"mcpServers": {
"x-trend-intelligence": {
"url": "https://your-project.vercel.app/api/mcp",
"headers": {
"x-api-key": "YOUR_X_API_BEARER_TOKEN"
}
}
}
}
Authentication
Provide your X API bearer token via one of:
Authorization: Bearer <token>headerx-api-key: <token>headerx-api-bearer: <token>header
Health Check
curl https://your-project.vercel.app/api/health
Tool Reference
analyze_competitor_sentiment
{
"tool": "analyze_competitor_sentiment",
"arguments": {
"competitor_name": "competitor",
"days_back": 7,
"max_results": 100
}
}
Returns sentiment score (-1 to +1), positive/negative/neutral percentages, engagement stats, and top posts.
track_brand_mentions
{
"tool": "track_brand_mentions",
"arguments": {
"brand_name": "YourBrand",
"time_window": "7d",
"max_results": 100
}
}
Returns daily mention counts, trend direction, engagement stats, and top posts.
detect_trending_topics
{
"tool": "detect_trending_topics",
"arguments": {
"location_id": "1",
"top_n": 10,
"verify_volume": true
}
}
Returns trending topics with verified post volume and trend change percentages.
compare_share_of_voice
{
"tool": "compare_share_of_voice",
"arguments": {
"competitors": ["Brand1", "Brand2", "Brand3"],
"days_back": 7
}
}
Returns share of voice percentages, mention counts, and sentiment for each competitor.
identify_complaints
{
"tool": "identify_complaints",
"arguments": {
"brand_name": "YourBrand",
"days_back": 7,
"max_results": 200
}
}
Returns categorized complaints (Performance, Bugs, Customer Service, Pricing, etc.) with top posts.
monitor_keyword_frequency
{
"tool": "monitor_keyword_frequency",
"arguments": {
"keyword": "AI agents",
"days_back": 7,
"max_results": 500
}
}
Returns daily counts, peak day, related hashtags, and sample posts.
analyze_influencer_reach
{
"tool": "analyze_influencer_reach",
"arguments": {
"username": "elonmusk",
"max_tweets": 100
}
}
Returns profile info, engagement rates, top performing content, and estimated reach.
export_intelligence_report
{
"tool": "export_intelligence_report",
"arguments": {
"brand_name": "YourBrand",
"competitors": ["Competitor1", "Competitor2"],
"days_back": 7,
"include_complaints": true,
"include_share_of_voice": true
}
}
Returns a structured markdown report combining brand mentions, competitor sentiment, share of voice, and complaints.
Sentiment Scoring
Sentiment is scored using a deterministic keyword lexicon approach:
- Positive lexicon (50 terms): love, great, amazing, awesome, excellent, perfect, recommend, best, fantastic, etc.
- Negative lexicon (50 terms): hate, terrible, awful, worst, broken, sucks, disappointed, scam, useless, buggy, etc.
- Formula:
score = (positive_count - negative_count) / total_posts - Range: -1.0 (fully negative) to +1.0 (fully positive)
- Labels: positive (>0.1), negative (<-0.1), neutral (-0.1 to 0.1)
X API Endpoints Used
| Endpoint | Usage |
|---|---|
GET /2/tweets/search/recent |
Search recent posts (last 7 days) |
GET /2/users/by/username/:username |
User profile lookup |
GET /2/users/:id/tweets |
User timeline |
GET /2/tweets/:id |
Single tweet |
GET /2/trends |
Trending topics (requires elevated access) |
Cost
X API is pay-per-use at $0.005 per post read. The server caches results within a single request to minimize API calls.
Tech Stack
- Language: TypeScript
- Protocol: MCP (Model Context Protocol) over Streamable HTTP
- SDK: @modelcontextprotocol/sdk
- Hosting: Vercel serverless functions
- X API: v2 with user-provided bearer token
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。