+ Integration Guide
· Updated August 29, 2026
How to Connect Twitter MCP to Cursor
Step-by-step guide to adding FetchLayer's Twitter/X MCP server to Cursor. Search tweets, get profiles, and pull follower data from your AI coding agent.
Written by Alex P.
- MCP
- Cursor
- twitter scraping
- X scraping
- AI agent
- IDE integration
Cursor is an AI-powered code editor built on VS Code. It supports the Model Context Protocol (MCP), which lets you connect external data sources as tools your AI agent can call.
FetchLayer runs an MCP server that gives your Cursor agent access to all 10 Twitter/X endpoints — search, tweet detail, replies, profiles, followers, and more. Setup takes about 60 seconds.
Prerequisites
- Cursor installed (v0.40+, or any version with MCP support)
- A FetchLayer API key — get one free (no credit card)
Step 1: Open your MCP config
Cursor reads MCP server configurations from a file called mcp.json. You can configure it globally or per-project.
Global config (applies to all projects):
~/.cursor/mcp.json
Per-project config (only this workspace):
.cursor/mcp.json
If the file doesn’t exist yet, create it — or skip the manual file entirely and use Cursor Settings → Tools & MCP → New MCP Server, which opens mcp.json pre-scaffolded for you to fill in.
Use the global path for a key you want available in every project; use the project path if you’re on a team and want the server definition checked into the repo so teammates get it automatically (keep the API key itself out of the committed file — see the environment-variable note in Step 2).
Step 2: Add the FetchLayer MCP server
Paste this into your mcp.json:
{
"mcpServers": {
"fetchlayer": {
"url": "https://mcp.fetchlayer.dev",
"headers": {
"Authorization": "Bearer ss-your-api-key"
}
}
}
}
Replace ss-your-api-key with your actual API key from the FetchLayer dashboard.
If you already have other MCP servers configured, add the "fetchlayer" block alongside them:
{
"mcpServers": {
"some-other-server": { "url": "..." },
"fetchlayer": {
"url": "https://mcp.fetchlayer.dev",
"headers": {
"Authorization": "Bearer ss-your-api-key"
}
}
}
}
Step 3: Restart Cursor
After saving mcp.json, restart Cursor (or reload the window with Ctrl+Shift+P → “Reload Window”). Cursor will pick up the new MCP server on startup.
You should see “fetchlayer” listed as a connected tool in the agent panel.
Step 4: Test it
Open the Cursor chat (Agent mode) and try a prompt:
Search X/Twitter for discussions about “best CI/CD tools 2026” and give me the top 5 tweets with engagement stats.
The agent will call FetchLayer’s twitter_search tool and return structured results from Twitter/X.
More example prompts to try:
| Prompt | What happens |
|---|---|
| ”What are people saying about Bun vs Node on X/Twitter?” | Searches Twitter for Bun-related discussions |
| ”Get me the profile and recent tweets from @rauchg” | Fetches profile + user tweets |
| ”Scrape all replies to this tweet: [URL]“ | Pulls replies for a specific tweet |
| ”Find verified followers of @openai” | Returns verified follower accounts |
| ”Get the top tweets from @levelsio this month” | Fetches recent user tweets sorted by engagement |
Available Tools
Once connected, Cursor’s agent has access to all FetchLayer Twitter/X tools:
- twitter_search — Search tweets by keyword (Top, Latest, People, Media, Lists)
- twitter_tweet_detail — Get a specific tweet by ID
- twitter_tweet_replies — Fetch replies to a tweet
- twitter_user_profile_details — Get user profile by handle
- twitter_about_profile — Extended profile metadata
- twitter_user_tweets — A user’s recent tweets
- twitter_user_replies — A user’s recent replies
- twitter_following — Accounts a user follows
- twitter_followers — Accounts following a user
- twitter_verified_followers — Verified accounts following a user
Troubleshooting
Server not appearing in Cursor?
- Make sure the
mcp.jsonfile is valid JSON (no trailing commas) - Check the file is in the right location (
.cursor/mcp.jsonor~/.cursor/mcp.json) - Restart Cursor completely (not just reload)
Getting 401 errors?
- Verify your API key is correct and starts with
ss- - Make sure the
Authorizationheader includes theBearerprefix
Agent not using the tools?
- Use Agent mode (not Ask mode) in Cursor chat
- Be specific in your prompts — mention “Twitter” or “search X/Twitter”
Changed the API key in mcp.json and it’s still using the old one?
- Cursor reads environment values at process spawn time, not live — if you keep the key in a shell env var and reference it, restart Cursor after changing it, not just the MCP connection
- If the key is pasted directly into the header (no env var), a reload is still required for
mcp.jsonedits to take effect; MCP config isn’t hot-reloaded the way source files are
When Agent mode isn’t calling tools you’d expect
A subtler failure mode than “server not appearing” is the server connecting fine but the agent never reaching for it. Cursor’s agent decides whether a tool is relevant based on your prompt wording and the tool’s description, not on it simply being available — so a vague prompt like “check what’s trending” may not trigger twitter_search even though it’s connected, because nothing in the prompt signals Twitter/X specifically. Naming the platform and the kind of data you want (“search X/Twitter for…”, “get the profile for…”) gets far more reliable tool selection than describing the outcome you want and expecting the agent to infer which of its many available tools gets you there.
Committing mcp.json without leaking your key
If you’re using the project-level .cursor/mcp.json on a shared repo, don’t commit your raw API key in the Authorization header. Reference an environment variable instead:
{
"mcpServers": {
"fetchlayer": {
"url": "https://mcp.fetchlayer.dev",
"headers": {
"Authorization": "Bearer ${FETCHLAYER_API_KEY}"
}
}
}
}
Set FETCHLAYER_API_KEY in each teammate’s own shell profile (or a local .env excluded via .gitignore) rather than in the file itself. This way the server definition is shared and reproducible, but each person’s key stays private — and rotating a compromised key doesn’t require a repo-wide commit.
What a tool call actually returns
The agent receives JSON with stable field names, not a scraped timeline:
{
"results": [
{
"id": "1942939879222220800",
"text": "The new API docs are genuinely good. Rare.",
"author": {
"handle": "example_dev",
"displayName": "Example Dev",
"followersCount": 12400
},
"likeCount": 284,
"retweetCount": 41,
"replyCount": 17,
"createdAt": "2026-08-18T10:00:00.000Z",
"url": "https://x.com/example_dev/status/1942939879222220800"
}
]
}
Stable keys are what let the agent chain calls — filter on followersCount, sort by replyCount, then call tweet-replies on whichever posts justify it. That sequencing is unreliable when an agent is parsing rendered HTML.
Real tweets as fixtures
The reason to have this in the editor rather than a browser is that output lands in a file. With a test file open:
“Search X for posts mentioning our SDK, take 10, and write them as fixtures for the text-truncation tests here.”
Tweets are an unusually hostile fixture source in a useful way: emoji, RTL scripts, zero-width joiners, t.co links that consume the character budget, display names with combining characters. A truncation function that survives ten real tweets is genuinely tested; one that survives "Hello world" is not.
The same holds for rendering — real displayName values will find the layout bug that “Jane Smith” never will.
Grounding copy in how people actually talk
Useful with a marketing or docs file open:
“Find how developers describe the problem our tool solves — search X for complaints about manual API testing — then rewrite the hero paragraph in this file using their words rather than ours.”
One search request, then an ordinary edit. The value is that the phrasing comes from current posts rather than from the model’s sense of how developers talk, which tends toward the generic.
Watch the follower endpoints
search, tweet-detail, and user-profile-details are one request each. user-followers and user-following paginate, and each page bills separately.
Cursor’s agent works autonomously through multi-step tasks, which is exactly the setting where an unbounded “analyze this account’s audience” turns into a long run of paged requests. Name the limit:
“Pull the first 2 pages of followers for @example and tell me what kind of accounts they are.”
A sample answers the question. Enumeration mostly just costs more.
What’s Next
- Twitter/X MCP: All Clients Compared — every supported AI tool in one place
- Twitter MCP + Claude Desktop — same setup for Claude
- Twitter MCP + Claude Code — terminal-based setup
- Twitter MCP + VS Code — VS Code Copilot setup
- How to Scrape Twitter/X in 2026 — all scraping methods
- FetchLayer API Reference — full endpoint docs