How to Give AI Agents Live Social Media Data (MCP and API Guide for Claude, ChatGPT and Cursor)

Published · 24 min read

How to Give AI Agents Live Social Media Data (MCP and API Guide for Claude, ChatGPT and Cursor)

Social media data for AI agents comes from three places: official platform APIs, scrapers you run yourself, or a read-only data API exposed as an MCP server. The MCP route is the fastest to set up. One API key gives Claude, ChatGPT, Cursor, or any agent public profiles, posts, comments, search, transcripts, and audience data across 17 networks. It never logs in and never reads private data.

This guide covers each path's trade-offs, a fair vendor comparison, verbatim setup for every major client, a live data read taken on December 4, 2026, pricing models, legality, and the failure modes that stop most installs.

The three ways to get social media data into an AI agent

An agent cannot browse Instagram or TikTok reliably on its own. Pages are rendered with JavaScript, gated by login walls, and protected by anti-bot systems. A recent arXiv benchmark on social-media agent tasks found that current LLMs struggle on these tasks without good tool access. The model needs a tool that returns structured data, and there are three ways to give it one.

Official platform APIs

Official APIs are the sanctioned source. When they expose a field, it is usually authoritative. They are also the hardest path for a general-purpose agent:

Choose official APIs when you need to publish (post, reply, upload), when you need data about your own account that only the owner can see, or when your compliance team requires a direct contract with the platform.

Self-run scrapers

You can write your own headless-browser or HTTP scraper, or rent scrapers from a marketplace. You control everything, and at very large volume the per-request cost can be low.

The costs show up elsewhere:

Choose self-run scrapers when you have a dedicated data engineering team, very high volume on one or two networks, and a lawyer who has reviewed your method.

A read-only data API or MCP server

The third path is a hosted, read-only API that normalizes public data from many networks into one schema, exposed both as REST and as an MCP server. SocialLens works this way: one key, 17 networks, one JSON shape, and an is_exact flag on every count.

The trade-offs, stated plainly:

Choose this path when you want an agent working in minutes, need consistent data across many networks, and want a design that never touches logged-in sessions. For a deeper look at the one-schema model, see the unified social media data API guide.

Quick decision guide

Your situation Best path
Agent must publish posts or reply to DMs Official API for that platform
Need your own account's private analytics Official API with owner OAuth
Need public data from several networks in one agent Read-only data API / MCP server
Academic research on TikTok with approval TikTok Research API
Hundreds of millions of records from one network, in-house team Self-run scraper pipeline
Prototype in an afternoon inside Claude or Cursor MCP server

What a social media MCP server is and how it works

The Model Context Protocol (MCP) is an open standard for connecting AI applications to external tools and data. An MCP server advertises a list of tools, each with a name, a description, and a JSON input schema. The AI client reads that list, and the model decides when to call a tool and with what arguments. If you are new to the protocol, start with what an MCP server is.

A social media MCP server is an MCP server whose tools read social data. With SocialLens, the primary tool is get_social_profile: the model passes a platform and a username, and the server returns public profile JSON. Other read tools cover posts, comments, search, and transcripts.

MCP supports three transports. stdio runs the server as a local subprocess of the client. Streamable HTTP is the recommended remote transport. HTTP+SSE is the legacy remote transport. SocialLens ships as a local stdio server that you launch with npx. It runs on your machine and calls the SocialLens API over HTTPS with your key.

  You: "Compare MrBeast's TikTok and Instagram audiences"
                        |
                        v
  +-----------------------------------------------+
  | AI agent (Claude, Cursor, custom agent)       |
  +-----------------------------------------------+
                        |
                        v
  +-----------------------------------------------+
  | MCP client (built into the app)               |
  +-----------------------------------------------+
                        |  stdio, local subprocess
                        v
  +-----------------------------------------------+
  | SocialLens MCP server (npx sociallens-mcp)    |
  | runs on your machine, holds SOCIALLENS_API_KEY|
  +-----------------------------------------------+
                        |  HTTPS, Authorization: Bearer key
                        v
  +-----------------------------------------------+
  | api.sociallens.dev                            |
  +-----------------------------------------------+
  ============== READ-ONLY BOUNDARY ===============
  public data only | no login | no cookies | no DMs
  =================================================
                        |
                        v
  Public data on 17 networks: TikTok, Instagram, YouTube,
  Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram,
  Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, Spotify

For a longer architecture walkthrough, see the social media MCP server deep dive.

What an agent CAN and CANNOT read

An agent connected to SocialLens can read:

An agent connected to SocialLens cannot:

The difference between a read MCP and a publish MCP matters for safety. A publish MCP holds credentials that can act as you, so a prompt-injection attack could make it post. A read-only MCP has no such capability. The worst an injected instruction can do is trigger an extra read.

Comparison: official APIs, data vendors, and SocialLens

This table compares the approaches on the dimensions that matter to an agent builder. Vendor details change often. Figures and features reflect public information as of late 2026, and you should check each vendor's current docs and pricing page. "Not verified" means we found no public first-party MCP server at the time of writing. It does not mean one cannot exist.

Approach / vendor Networks covered Auth complexity Data precision Read or publish Cost model Has an MCP server
X API (official) X only Developer account, OAuth, app setup Exact for exposed fields Read and publish Pay-per-use by default since early 2026 (check pricing) No first-party MCP found
Instagram / Meta Graph API Instagram, Facebook Business or creator account, app review, OAuth Exact; demographics only to the account holder Read and publish (own assets) Free API, heavy access requirements No first-party MCP found
TikTok Research API TikTok Academic or non-profit application Exact within scope Read only Free within a quota; no commercial use No
YouTube Data API v3 YouTube Google Cloud project, API key or OAuth Subscriber counts rounded by the platform Read and publish Free; 10,000 units/day default quota No first-party MCP found
Reddit Data API Reddit OAuth app registration Exact for exposed fields Read and publish Free non-commercial; commercial pricing not public No first-party MCP found
LinkedIn API LinkedIn Effectively partner-gated Exact within scope Read and publish (approved partners) Partner agreements No
Self-run scraper Whatever you build You manage proxies, CAPTCHAs, sessions Whatever you parse Usually read Infrastructure plus engineering time You build it
Apify Many, via separate Actors One account; each Actor has its own inputs Varies by Actor Mostly read Usage-based, per Actor Yes, hosted social content MCP
Bright Data Many major networks One account Varies by dataset Read (public posts, hashtags, trends) Usage-based, with a free tier Yes, social media MCP
EnsembleData Several networks One API token Varies by endpoint Read Daily "units" allowance None found
HikerAPI Instagram One API key Varies by endpoint Read Pay-per-request Not verified
Data365 Several, per-network plans One account, per-network plans Varies Read Subscription plus credits; credit cost varies by request type Not verified
RapidAPI Many, via third-party APIs Marketplace key, but each API differs Varies by provider Varies Per-API pricing; no unified schema Not as a unified social MCP
Phyllo Creator-connected platforms The creator must connect their account Exact for connected accounts Read (consented) Platform pricing; consent-based Not verified
Modash Major creator platforms One account Large index; precision varies Read (discovery plus metrics) Enterprise subscription Not verified
HypeAuditor Major creator platforms One account Large index; fraud and authenticity focus Read Enterprise subscription Not verified
SocialLens 17 networks One API key for all Exact where the platform allows; is_exact flag on every count Read only One key, simple pricing Yes, local stdio MCP (dev.sociallens/sociallens-mcp)

How to read the table:

For the official-API side in more depth, read official social media APIs vs one API. For buyer-focused MCP options, see the best social media MCP server.

Connect SocialLens to your AI agent

Every client below uses the same local stdio server. The client launches npx -y sociallens-mcp as a subprocess and passes your key as an environment variable.

Before you start:

  1. Install Node.js (it provides npx). Run npx --version in a terminal to confirm it works.
  2. Create an account at sociallens.dev/register.
  3. Generate a key at sociallens.dev/keys. Live keys start with sk_live_.
  4. Keep the key out of version control. Treat it like a password.

Full agent documentation lives at sociallens.dev/agents. The server is listed in the MCP registry as dev.sociallens/sociallens-mcp.

Claude Code

  1. Open a terminal in your project.
  2. Run this single command, replacing the key:
claude mcp add --env SOCIALLENS_API_KEY=sk_live_YOUR_KEY --transport stdio sociallens -- npx -y sociallens-mcp
  1. Confirm it registered with claude mcp list.
  2. Inside a Claude Code session, run /mcp to see the server's status and tools.
  3. Ask: "Use sociallens to get the TikTok profile for mrbeast and tell me whether the follower count is exact."

Scope matters. By default, claude mcp add uses --scope local, which applies to the current project and only you. --scope user makes the server available in all your projects. --scope project writes it to .mcp.json in the repo root, which is shared via version control. If you use project scope, do not commit a raw key. Claude Code's .mcp.json supports ${VAR} expansion in env, so you can reference an environment variable instead. The official reference is at code.claude.com. For prompts and workflows, see the Claude social media data guide.

Claude Desktop

  1. Open Claude Desktop, then go to Settings > Developer > Edit Config. This opens claude_desktop_config.json:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/
  2. Add this block. If the file already has an mcpServers object, add only the sociallens entry inside it:
{
  "mcpServers": {
    "sociallens": {
      "command": "npx",
      "args": ["-y", "sociallens-mcp"],
      "env": { "SOCIALLENS_API_KEY": "sk_live_YOUR_KEY" }
    }
  }
}
  1. Save the file.
  2. Fully quit Claude Desktop and reopen it. Closing the window is not enough. On macOS use Cmd+Q, and on Windows quit from the system tray.
  3. Check that the SocialLens tools appear in the tools menu, then ask a question that needs live data.

Cursor

  1. Choose a scope:
    • Project: .cursor/mcp.json in your repo
    • Global: ~/.cursor/mcp.json for all projects
  2. Paste the same block used for Claude Desktop:
{
  "mcpServers": {
    "sociallens": {
      "command": "npx",
      "args": ["-y", "sociallens-mcp"],
      "env": { "SOCIALLENS_API_KEY": "sk_live_YOUR_KEY" }
    }
  }
}
  1. Alternatively, add it through Settings > Tools and Integrations > New MCP Server.
  2. Confirm the server shows as enabled with its tools listed, then use it from Agent mode.

If the same server name exists in both files, the project file wins. Cursor-specific tips are in the Cursor social media data guide.

ChatGPT (Custom GPT Actions)

ChatGPT Custom GPTs call HTTP APIs through Actions defined by an OpenAPI spec. That makes the REST API the right path here, not the local stdio server.

  1. In ChatGPT, create a GPT and open Configure > Actions > Create new action.
  2. Choose Import from URL and enter https://sociallens.dev/openapi.json.
  3. Under Authentication, select API Key, auth type Bearer, and paste your sk_live_ key.
  4. Save, then test in the preview pane: "Get the Instagram profile for instagram."

The full walkthrough, including instructions text for the GPT, is in the ChatGPT Custom GPT guide.

Raw HTTP and function calling

Any model with function calling can use the REST endpoint directly:

curl -s "https://api.sociallens.dev/v1/profile?platform=tiktok&username=mrbeast" \
  -H "Authorization: Bearer YOUR_KEY"

A minimal tool definition you can hand to a function-calling model:

{
  "name": "get_social_profile",
  "description": "Read a public social media profile. Returns followers, following, bio, verification and an is_exact flag. Read-only, public data only.",
  "parameters": {
    "type": "object",
    "properties": {
      "platform": { "type": "string", "description": "e.g. tiktok, instagram, youtube, x, bluesky" },
      "username": { "type": "string" }
    },
    "required": ["platform", "username"]
  }
}

Your code receives the tool call, makes the GET request, and returns the JSON to the model. For no-code builders and tool-definition patterns, see social media data for AI agents without code.

Agent frameworks

A real live read (worked example)

The following responses were read live through SocialLens on December 4, 2026. They are unedited apart from formatting.

Example A: Instagram's official account

{
  "exists": true,
  "username": "instagram",
  "platform": "instagram",
  "nickname": "Instagram",
  "verified": true,
  "private": false,
  "followers": 684224272,
  "is_exact": true,
  "following": 182,
  "videos": 8666,
  "bio": "Discover what's new on Instagram",
  "id": "25025320",
  "external_link": "http://help.instagram.com",
  "fetched_at": "2026-12-04T06:17:45Z",
  "cached": false
}

fetched_at is 2026-12-04T06:17:45Z, and cached is false, so this was a fresh read rather than a stored copy. is_exact is true, so 684,224,272 is a precise count, not a display figure like "684M".

Example B: the same schema on TikTok

{
  "exists": true,
  "username": "mrbeast",
  "platform": "tiktok",
  "nickname": "MrBeast",
  "verified": true,
  "private": false,
  "followers": 149191425,
  "followers_rounded": 149200000,
  "is_exact": true,
  "following": 346,
  "likes": 1589270586,
  "videos": 494,
  "bio": "Checkout my new video",
  "created_at": "2018-10-20T19:26:16Z",
  "fetched_at": "2026-12-04T06:17:50Z",
  "cached": false
}

TikTok's app shows a rounded figure. followers_rounded (149,200,000) is what a human sees on the page. followers (149,191,425) is the exact count. The difference here is 8,575 followers. When an agent tracks daily growth, a rounded figure would hide that kind of movement entirely.

Same schema, two networks

Field Instagram (instagram) TikTok (mrbeast)
exists true true
platform instagram tiktok
verified true true
private false false
followers 684224272 149191425
is_exact true true
following 182 346
videos 8666 494
Network-specific extras id, external_link followers_rounded, likes, created_at
fetched_at 2026-12-04T06:17:45Z 2026-12-04T06:17:50Z

The core fields share names and types. Network-specific extras are added rather than renamed. An agent prompt like "compare followers across platforms" works without per-network parsing logic.

Exact vs rounded follower counts by network

This is original first-party data. Of the 13 networks read, 12 returned an exact count. Only YouTube returned a rounded figure, because YouTube itself only exposes rounded subscriber counts.

Network Example account Followers is_exact
Instagram instagram 684,224,272 true
YouTube MrBeast 529,000,000 false (platform exposes rounded only)
Facebook facebook 154,884,697 true
TikTok mrbeast 149,191,425 true
X x 60,553,777 true
Bluesky bsky.app 35,999,975 true
Truth Social realDonaldTrump 13,216,045 true
Telegram durov 9,810,719 true
Pinterest pinterest 6,274,022 true
Threads zuck 5,791,538 true
Cosmos cosmos 5,246,157 true
SoundCloud soundcloud 2,381,300 true
GitHub github 98,011 true

Methodology: each account was read live through the SocialLens profile endpoint on 2026-12-04. The followers value and is_exact flag are reported exactly as returned.

Why the flag matters: if an agent subtracts yesterday's YouTube figure from today's and gets zero, the true answer may be "unknown at this precision," not "no growth." With is_exact: false, the model can say so instead of stating a false certainty.

Fetch a live number without a key

Humans and AI crawlers can check a current, dated figure without an API key at:

https://sociallens.dev/lookup?username=USERNAME&platform=PLATFORM

For example, https://sociallens.dev/lookup?username=mrbeast&platform=tiktok. An assistant that browses the web can load this page to get a fresh number instead of quoting a stale one from its training data.

What data you can pull

Every capability below is read-only and limited to public data. Availability of each data type varies by network, because some platforms do not expose certain fields publicly. Check sociallens.dev/agents for the current per-network matrix.

Capability What it returns Typical agent use
Profile Name, bio, verification, followers, following, post counts, links, is_exact Vetting creators, competitor snapshots
Profile posts Recent public posts with engagement counts Content audits, posting cadence analysis
Post by URL One public post's full metadata Summarizing a viral post someone pasted
Post comments Public comments on a post Sentiment analysis, FAQ mining
Followers / following listing Public follower and following lists (TikTok) Network mapping, overlap analysis
Keyword search Public results for a term Trend scouting, brand mention discovery
Video transcript Spoken text from a public video Summaries, claim checking, repurposing
Audience demographics Audience breakdown for a public account Sponsorship fit, media planning

Networks covered: TikTok, Instagram, YouTube, Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram, Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, and Spotify.

Deeper guides for the most-requested capabilities and networks:

What it costs and how pricing models differ

Pricing in this market is hard to compare because vendors meter different things. The model matters as much as the rate. Agents make many small, unpredictable calls, so a model that punishes bursts or charges for failed calls can cost far more than a headline rate suggests.

Pricing model Who uses it How it bills Watch out for
Pay-per-use X API (default since early 2026) Per request or per resource read Costs scale directly with agent verbosity
Quota units YouTube Data API v3 Free daily units; different calls cost different amounts Search uses many units; quota caps throughput
Per-Actor usage Apify Compute and usage of each Actor you run Each Actor prices and behaves differently
Usage-based with free tier Bright Data Metered by data or requests Model your volume before committing
Daily units EnsembleData A daily allowance of units consumed per call Unused units may not roll over; check terms
Per-request HikerAPI Each call billed Simple, but single-network
Subscription plus credits Data365 Plan fee plus credits; credit cost varies by request type Per-network plans add up across networks
Per-API marketplace RapidAPI Each listed API has its own plan Many separate bills and schemas
Enterprise subscription Modash, HypeAuditor Annual or monthly seats and data access Built for teams; less suited to small agent projects
Consent-based platform Phyllo Platform fees for connected-creator data Only works for creators who connect
One key, simple pricing SocialLens One account across 17 networks Not the cheapest option at extreme single-network volume

We deliberately do not list competitor dollar figures. They change often and differ by contract, so check each vendor's pricing page for current numbers. Current SocialLens plans are on sociallens.dev.

To estimate what your agent will cost on any vendor:

  1. Count calls per task. "Compare five creators across three networks" is 15 profile reads, plus more if the agent pulls posts.
  2. Cap tool calls in your system prompt. For example: "Use at most 10 SocialLens calls per answer."
  3. Use the cached and fetched_at fields. A recent cached read is often good enough, and re-reading the same profile within a session wastes calls.
  4. Price your engineering time. One unified integration replaces several per-network ones. That saving often outweighs a lower per-call rate elsewhere.

Reading public data is on firmer legal ground than it was a decade ago, but it is not risk-free. This is not legal advice.

The key precedent. In hiQ Labs v. LinkedIn, the Ninth Circuit found that the Computer Fraud and Abuse Act likely does not bar scraping data from public profiles that anyone can view without logging in. That reasoning favors access to public data.

Risks that remain:

Why read-only and public-only is the more defensible design. A service that never logs in, never uses cookies, and never touches private accounts or DMs stays on the side of the line hiQ addressed. It also keeps your agent from accidentally collecting data users expected to stay private. The flip side is a hard limit: SocialLens cannot get private data at all, and no configuration changes that.

Practical guardrails for your agent:

For a fuller treatment, read is social media scraping legal.

Troubleshooting

Most failed setups come down to a handful of causes. Work through these in order.

The server does not appear at all

"spawn npx ENOENT" or "command not found"

Tools load but every call fails

Remote servers asking for OAuth (401/403)

SocialLens itself uses an environment key over stdio, so this applies to other remote MCP servers you add alongside it. When a remote HTTP server returns 401 or 403, Claude Code starts a sign-in flow. Run /mcp, pick the server, and log in, or run claude mcp login NAME. claude -p and the Agent SDK cannot complete interactive OAuth, so sign in interactively once first. For header-based auth, use --header "Authorization: Bearer TOKEN" (short form -H). See the official Claude Code MCP docs.

Transport mismatches

Cursor uses the wrong config

Cursor reads both .cursor/mcp.json (project) and ~/.cursor/mcp.json (global). On a name collision, the project file wins. If you updated your key globally but a project file also defines sociallens with an old key, the old key is used. Keep the server in one place, or give the entries different names.

The model ignores the tool

Name the tool in your prompt ("use sociallens to..."), or add a system instruction: "For any question about current follower counts or posts, call get_social_profile instead of answering from memory." Models default to training data unless prompted to fetch.

FAQ

What is a social media MCP server?

A social media MCP server is a Model Context Protocol server whose tools read social data. AI clients like Claude and Cursor discover its tools and call them, for example with a platform and username, to get structured public profile, post, or comment data without custom integration code.

How do I connect Claude to social media data?

In Claude Code, run claude mcp add --env SOCIALLENS_API_KEY=sk_live_YOUR_KEY --transport stdio sociallens -- npx -y sociallens-mcp. In Claude Desktop, add the mcpServers block to claude_desktop_config.json and fully restart the app. Then ask Claude for any public profile.

Can AI agents read private social media data or DMs?

No. SocialLens reads public data only. It never logs in, never uses cookies or sessions, and cannot access private accounts, followers-only posts, DMs, or owner-only analytics. Private data requires the account owner's own authorization through official platform APIs.

What is the difference between a read MCP and a publish MCP?

A read MCP only retrieves data. A publish MCP holds credentials that can post, reply, or message on your behalf. Read-only servers are safer for agents, because a prompt-injection attack cannot make them act as you. SocialLens is read-only.

Do I need an API key for each platform?

No. One SocialLens key covers all 17 networks with one JSON schema. Official APIs, by contrast, each require their own developer account, app approval, and authentication setup, and some, like the TikTok Research API, are not available for commercial use.

How much does a social media data API cost?

It depends on the model: pay-per-use, quota units, credits, per-request, or enterprise subscription. Rates change often, so check each vendor's pricing page. Estimate cost by counting tool calls per agent task and capping them in your system prompt.

Is scraping public social media data legal?

Reading public data is generally more defensible after hiQ v. LinkedIn, which found the CFAA likely does not bar scraping public profiles. Terms-of-service, GDPR, CCPA, and copyright risks remain. Read-only, no-login access reduces risk. This is not legal advice.

Which networks can an AI agent pull data from?

With SocialLens: TikTok, Instagram, YouTube, Facebook, X, Reddit, LinkedIn, Threads, Pinterest, Telegram, Bluesky, Truth Social, Cosmos, SoundCloud, Kwai, GitHub, and Spotify. Specific data types vary by network depending on what each platform exposes publicly.

Can ChatGPT or Perplexity access social media data too?

Yes. ChatGPT Custom GPTs can import https://sociallens.dev/openapi.json as an Action with Bearer auth. Browsing assistants can also read the no-key lookup page at sociallens.dev/lookup for a current, dated figure.

MCP vs REST API: which should my agent use?

Use MCP in clients that support it, like Claude Code, Claude Desktop, and Cursor, because tools are discovered automatically. Use REST for Custom GPTs, function calling, no-code tools, and backend services. Both return the same schema.

Can I get a creator's exact follower count via API?

Usually, yes. In a live read on December 4, 2026, 12 of 13 networks returned exact counts. YouTube only exposes rounded subscriber figures, so SocialLens returns is_exact: false there instead of presenting a rounded number as precise.

Why is my MCP server not showing up in Claude?

The most common causes are invalid JSON (often a trailing comma), the entry sitting outside mcpServers, Node.js not being on the app's PATH, or skipping a full restart. Validate the file, use absolute paths, quit Claude completely, and reopen it.

Run these requests yourself

Every example on this page is a real call to the SocialLens API. A new account starts with 250 free reads, no card needed, and a read that fails is never charged.

Keep reading