Skip to main content
Glama
sociallens-mcp

sociallens-mcp

Official
README.md
# sociallens-mcp

MCP server that gives your AI agent read access to public social media data from TikTok, Instagram, YouTube, X, Reddit, LinkedIn, Threads, Pinterest and Facebook.

Powered by the SocialLens API. Get a free API key (250 free reads, no credit card): https://sociallens.dev/register

## Install

You need Python 3.10 or newer.

1. Download this repository to your machine.
2. Install the two dependencies with the same Python that will run the server:

```bash
pip install -r requirements.txt
```

The server talks to your MCP client over stdio and reads the key only from the `SOCIALLENS_API_KEY` environment variable. It refuses to start without it.

### Claude Code

```bash
claude mcp add --env SOCIALLENS_API_KEY=sk_live_YOUR_KEY --transport stdio sociallens -- python /absolute/path/to/sociallens-mcp/server.py
```

Keep `--transport stdio` between `--env` and the server name, otherwise the CLI reads the name as another env pair.

### Cursor and other MCP clients

Add the server to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):

```json
{
  "mcpServers": {
    "sociallens": {
      "command": "python",
      "args": ["/absolute/path/to/sociallens-mcp/server.py"],
      "env": {
        "SOCIALLENS_API_KEY": "sk_live_YOUR_KEY"
      }
    }
  }
}
```

Other clients that use the `mcpServers` JSON format take the same block. If your system only has `python3`, use it as the command.

## Tools

| Tool | What it does | Networks |
| --- | --- | --- |
| `get_profile` | Public profile: followers, following, bio, verified and private flags, avatar | All 9 |
| `get_post` | Metrics of one post or video by URL: likes, views, comments, shares, author, caption | All except LinkedIn |
| `get_profile_posts` | Recent posts of a profile with their counters, one page per call | All 9 |
| `get_post_comments` | Public comments of one post: text, author, likes, replies | TikTok, Instagram, YouTube, Facebook, Reddit |
| `get_followers` | Accounts that follow a profile, one page per call | TikTok only |
| `get_following` | Accounts a profile follows, one page per call | TikTok only |
| `check_api_key` | Checks that your key works. Free | Not tied to a network |

Every tool returns the JSON of the SocialLens API unchanged. A successful read costs 1 credit, `check_api_key` costs nothing, and errors are not charged.

## Example

Ask your agent:

> How many followers does @nasa have on TikTok?

The agent calls `get_profile` with `platform="tiktok"` and `username="nasa"`, receives the profile JSON from the API (fields such as `followers`, `followers_rounded`, `is_exact` and `verified`) and answers with the number in `followers`.

## Notes

- `get_followers` and `get_following` are TikTok only. For the follower count on any network, use `get_profile`.
- The agent gets a clear message instead of a stack trace when the key is invalid, the credits run out, the source is temporarily unavailable or the API cannot be reached.
- Tested with the official MCP Python SDK (`mcp`) versions 1.30 and 2.3.

Full guide: https://sociallens.dev/blog/social-media-mcp-server-ai-agent-data
More guides: https://sociallens.dev/blog

## License

MIT