scrapebadger-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Install uv
16
+ uses: astral-sh/setup-uv@v4
17
+
18
+ - name: Set up Python
19
+ run: uv python install 3.12
20
+
21
+ - name: Install dependencies
22
+ run: uv sync --dev
23
+
24
+ - name: Run linter
25
+ run: uv run ruff check src/ tests/
26
+
27
+ - name: Run formatter check
28
+ run: uv run ruff format --check src/ tests/
29
+
30
+ - name: Run type checker
31
+ run: uv run mypy src/
32
+
33
+ test:
34
+ runs-on: ubuntu-latest
35
+ strategy:
36
+ matrix:
37
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
38
+
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+
42
+ - name: Install uv
43
+ uses: astral-sh/setup-uv@v4
44
+
45
+ - name: Set up Python ${{ matrix.python-version }}
46
+ run: uv python install ${{ matrix.python-version }}
47
+
48
+ - name: Install dependencies
49
+ run: uv sync --dev
50
+
51
+ - name: Run tests
52
+ run: uv run pytest tests/ -v
53
+ env:
54
+ SCRAPEBADGER_API_KEY: "test_key_for_ci"
55
+
56
+ build:
57
+ runs-on: ubuntu-latest
58
+ needs: [lint, test]
59
+
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+
63
+ - name: Install uv
64
+ uses: astral-sh/setup-uv@v4
65
+
66
+ - name: Set up Python
67
+ run: uv python install 3.12
68
+
69
+ - name: Build package
70
+ run: uv build
71
+
72
+ - name: Upload artifacts
73
+ uses: actions/upload-artifact@v4
74
+ with:
75
+ name: dist
76
+ path: dist/
@@ -0,0 +1,34 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch: # Allow manual trigger
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: pypi
12
+ permissions:
13
+ id-token: write # Required for trusted publishing
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v4
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.12
23
+
24
+ - name: Build package
25
+ run: uv build
26
+
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
29
+ # Configure trusted publishing at:
30
+ # https://pypi.org/manage/account/publishing/
31
+ # Owner: scrape-badger
32
+ # Repository: scrapebadger-mcp
33
+ # Workflow: publish.yml
34
+ # Environment: pypi
@@ -0,0 +1,86 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ cover/
51
+
52
+ # Translations
53
+ *.mo
54
+ *.pot
55
+
56
+ # Environments
57
+ .env
58
+ .venv
59
+ env/
60
+ venv/
61
+ ENV/
62
+ env.bak/
63
+ venv.bak/
64
+
65
+ # IDEs
66
+ .idea/
67
+ .vscode/
68
+ *.swp
69
+ *.swo
70
+ *~
71
+
72
+ # mypy
73
+ .mypy_cache/
74
+ .dmypy.json
75
+ dmypy.json
76
+
77
+ # ruff
78
+ .ruff_cache/
79
+
80
+ # OS
81
+ .DS_Store
82
+ Thumbs.db
83
+
84
+ # Local development
85
+ *.local
86
+ .envrc
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ScrapeBadger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,448 @@
1
+ Metadata-Version: 2.4
2
+ Name: scrapebadger-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for ScrapeBadger - Twitter/X scraping API for AI agents
5
+ Project-URL: Homepage, https://scrapebadger.com
6
+ Project-URL: Documentation, https://docs.scrapebadger.com
7
+ Project-URL: Repository, https://github.com/scrape-badger/scrapebadger-mcp
8
+ Project-URL: Issues, https://github.com/scrape-badger/scrapebadger-mcp/issues
9
+ Author-email: ScrapeBadger <support@scrapebadger.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai,api,chatgpt,claude,cursor,llm,mcp,model-context-protocol,scraping,twitter,x
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: mcp>=1.0.0
27
+ Requires-Dist: pydantic>=2.0.0
28
+ Requires-Dist: scrapebadger>=0.1.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: mypy>=1.13.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
32
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
33
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
34
+ Description-Content-Type: text/markdown
35
+
36
+ <p align="center">
37
+ <img src="https://scrapebadger.com/logo-dark.png" alt="ScrapeBadger" width="400">
38
+ </p>
39
+
40
+ <h1 align="center">ScrapeBadger MCP Server</h1>
41
+
42
+ <p align="center">
43
+ <a href="https://pypi.org/project/scrapebadger-mcp/"><img src="https://img.shields.io/pypi/v/scrapebadger-mcp.svg" alt="PyPI version"></a>
44
+ <a href="https://pypi.org/project/scrapebadger-mcp/"><img src="https://img.shields.io/pypi/pyversions/scrapebadger-mcp.svg" alt="Python versions"></a>
45
+ <a href="https://github.com/scrape-badger/scrapebadger-mcp/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/scrapebadger-mcp.svg" alt="License"></a>
46
+ <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-Compatible-blue" alt="MCP Compatible"></a>
47
+ </p>
48
+
49
+ <p align="center">
50
+ <strong>Give your AI agents access to Twitter/X data via the Model Context Protocol</strong>
51
+ </p>
52
+
53
+ ---
54
+
55
+ ## What is this?
56
+
57
+ ScrapeBadger MCP Server is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that enables AI assistants like **Claude**, **ChatGPT**, **Cursor**, **Windsurf**, and other MCP-compatible clients to access Twitter/X data through the [ScrapeBadger API](https://scrapebadger.com).
58
+
59
+ **With this MCP server, your AI can:**
60
+
61
+ - Get Twitter user profiles, followers, and following lists
62
+ - Search and retrieve tweets
63
+ - Access trending topics globally or by location
64
+ - Explore Twitter lists and communities
65
+ - Search for places and geolocated content
66
+
67
+ ## Quick Start
68
+
69
+ ### 1. Get Your API Key
70
+
71
+ Sign up at [scrapebadger.com](https://scrapebadger.com) and get your API key.
72
+
73
+ ### 2. Install
74
+
75
+ ```bash
76
+ # Using uvx (recommended - no installation needed)
77
+ uvx scrapebadger-mcp
78
+
79
+ # Or install globally with pip
80
+ pip install scrapebadger-mcp
81
+
82
+ # Or with uv
83
+ uv tool install scrapebadger-mcp
84
+ ```
85
+
86
+ ### 3. Configure Your AI Client
87
+
88
+ #### Claude Desktop
89
+
90
+ Add to your Claude Desktop configuration file:
91
+
92
+ **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
93
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "scrapebadger": {
99
+ "command": "uvx",
100
+ "args": ["scrapebadger-mcp"],
101
+ "env": {
102
+ "SCRAPEBADGER_API_KEY": "sb_live_your_api_key_here"
103
+ }
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ #### Cursor
110
+
111
+ Add to your Cursor MCP settings (`.cursor/mcp.json`):
112
+
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "scrapebadger": {
117
+ "command": "uvx",
118
+ "args": ["scrapebadger-mcp"],
119
+ "env": {
120
+ "SCRAPEBADGER_API_KEY": "sb_live_your_api_key_here"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ #### Windsurf
128
+
129
+ Add to your Windsurf MCP configuration:
130
+
131
+ ```json
132
+ {
133
+ "mcpServers": {
134
+ "scrapebadger": {
135
+ "command": "uvx",
136
+ "args": ["scrapebadger-mcp"],
137
+ "env": {
138
+ "SCRAPEBADGER_API_KEY": "sb_live_your_api_key_here"
139
+ }
140
+ }
141
+ }
142
+ }
143
+ ```
144
+
145
+ #### VS Code with Copilot
146
+
147
+ Add to your VS Code settings (`.vscode/mcp.json`):
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "scrapebadger": {
153
+ "command": "uvx",
154
+ "args": ["scrapebadger-mcp"],
155
+ "env": {
156
+ "SCRAPEBADGER_API_KEY": "sb_live_your_api_key_here"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ ### 4. Start Using It!
164
+
165
+ Once configured, simply ask your AI to fetch Twitter data:
166
+
167
+ > "Get the profile of @elonmusk"
168
+
169
+ > "Search for tweets about AI agents"
170
+
171
+ > "What's trending on Twitter right now?"
172
+
173
+ > "Find the top 10 Python developers on Twitter"
174
+
175
+ ---
176
+
177
+ ## Available Tools
178
+
179
+ The MCP server provides 17 tools organized into categories:
180
+
181
+ ### User Tools
182
+
183
+ | Tool | Description |
184
+ |------|-------------|
185
+ | `get_twitter_user_profile` | Get a user's profile by username (bio, followers, following, etc.) |
186
+ | `get_twitter_user_about` | Get extended "About" info (account location, username history) |
187
+ | `search_twitter_users` | Search for users by query |
188
+ | `get_twitter_followers` | Get a user's followers |
189
+ | `get_twitter_following` | Get accounts a user follows |
190
+
191
+ ### Tweet Tools
192
+
193
+ | Tool | Description |
194
+ |------|-------------|
195
+ | `get_twitter_tweet` | Get a single tweet by ID |
196
+ | `get_twitter_user_tweets` | Get recent tweets from a user |
197
+ | `search_twitter_tweets` | Search for tweets (supports Twitter search operators) |
198
+
199
+ ### Trend Tools
200
+
201
+ | Tool | Description |
202
+ |------|-------------|
203
+ | `get_twitter_trends` | Get global trending topics (optionally by category) |
204
+ | `get_twitter_place_trends` | Get trends for a specific location (by WOEID) |
205
+
206
+ ### Geo Tools
207
+
208
+ | Tool | Description |
209
+ |------|-------------|
210
+ | `search_twitter_places` | Search for Twitter places by name |
211
+
212
+ ### List Tools
213
+
214
+ | Tool | Description |
215
+ |------|-------------|
216
+ | `get_twitter_list_detail` | Get details about a Twitter list |
217
+ | `search_twitter_lists` | Search for Twitter lists |
218
+ | `get_twitter_list_tweets` | Get tweets from a list |
219
+
220
+ ### Community Tools
221
+
222
+ | Tool | Description |
223
+ |------|-------------|
224
+ | `get_twitter_community_detail` | Get details about a Twitter community |
225
+ | `search_twitter_communities` | Search for communities |
226
+
227
+ ---
228
+
229
+ ## Example Conversations
230
+
231
+ ### Research a Twitter Account
232
+
233
+ **You:** Get the profile and recent tweets from @sama
234
+
235
+ **Claude:** I'll fetch Sam Altman's Twitter profile and recent tweets.
236
+
237
+ *Uses `get_twitter_user_profile` and `get_twitter_user_tweets`*
238
+
239
+ ```
240
+ Sam Altman (@sama)
241
+ - 3.2M followers, 1,847 following
242
+ - Bio: "ceo of openai"
243
+ - Joined: December 2008
244
+
245
+ Recent tweets:
246
+ 1. "excited to share..." (245K likes)
247
+ 2. "the future of ai..." (180K likes)
248
+ ...
249
+ ```
250
+
251
+ ### Monitor Trending Topics
252
+
253
+ **You:** What's trending in tech on Twitter today?
254
+
255
+ **Claude:** I'll check the current trending topics.
256
+
257
+ *Uses `get_twitter_trends` with category="news"*
258
+
259
+ ```
260
+ Top Tech Trends:
261
+ 1. #GPT5 - 125,000 tweets
262
+ 2. Apple Vision Pro - 89,000 tweets
263
+ 3. #AGI - 45,000 tweets
264
+ ...
265
+ ```
266
+
267
+ ### Competitive Analysis
268
+
269
+ **You:** Compare the Twitter engagement of Stripe, Square, and PayPal
270
+
271
+ **Claude:** I'll gather data on all three companies' Twitter profiles.
272
+
273
+ *Uses `get_twitter_user_profile` for each company*
274
+
275
+ ```
276
+ | Company | Followers | Following | Engagement Rate |
277
+ |---------|-----------|-----------|-----------------|
278
+ | Stripe | 892K | 1,245 | 2.3% |
279
+ | Square | 1.2M | 567 | 1.8% |
280
+ | PayPal | 2.1M | 234 | 0.9% |
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Configuration Options
286
+
287
+ ### Environment Variables
288
+
289
+ | Variable | Required | Description |
290
+ |----------|----------|-------------|
291
+ | `SCRAPEBADGER_API_KEY` | Yes | Your ScrapeBadger API key |
292
+
293
+ ### Using with Docker
294
+
295
+ ```dockerfile
296
+ FROM python:3.12-slim
297
+
298
+ RUN pip install scrapebadger-mcp
299
+
300
+ ENV SCRAPEBADGER_API_KEY=your_key_here
301
+
302
+ CMD ["scrapebadger-mcp"]
303
+ ```
304
+
305
+ ### Using with Python Directly
306
+
307
+ ```bash
308
+ # Set your API key
309
+ export SCRAPEBADGER_API_KEY="sb_live_your_key_here"
310
+
311
+ # Run the server
312
+ python -m scrapebadger_mcp.server
313
+ ```
314
+
315
+ ---
316
+
317
+ ## Error Handling
318
+
319
+ The MCP server handles common errors gracefully:
320
+
321
+ | Error | Description | Solution |
322
+ |-------|-------------|----------|
323
+ | `AuthenticationError` | Invalid API key | Check your `SCRAPEBADGER_API_KEY` |
324
+ | `RateLimitError` | Too many requests | Wait and retry, or upgrade your plan |
325
+ | `InsufficientCreditsError` | Out of credits | Purchase more at scrapebadger.com |
326
+ | `NotFoundError` | User/tweet not found | Verify the username or tweet ID |
327
+
328
+ ---
329
+
330
+ ## Development
331
+
332
+ ### Setup
333
+
334
+ ```bash
335
+ # Clone the repository
336
+ git clone https://github.com/scrape-badger/scrapebadger-mcp.git
337
+ cd scrapebadger-mcp
338
+
339
+ # Install dependencies
340
+ uv sync --dev
341
+
342
+ # Set your API key
343
+ export SCRAPEBADGER_API_KEY="sb_live_your_key_here"
344
+ ```
345
+
346
+ ### Running Locally
347
+
348
+ ```bash
349
+ # Run the MCP server directly
350
+ uv run python -m scrapebadger_mcp.server
351
+
352
+ # Or use the CLI
353
+ uv run scrapebadger-mcp
354
+ ```
355
+
356
+ ### Testing
357
+
358
+ ```bash
359
+ # Run tests
360
+ uv run pytest
361
+
362
+ # Run with coverage
363
+ uv run pytest --cov=src/scrapebadger_mcp
364
+ ```
365
+
366
+ ### Code Quality
367
+
368
+ ```bash
369
+ # Lint
370
+ uv run ruff check src/
371
+
372
+ # Format
373
+ uv run ruff format src/
374
+
375
+ # Type check
376
+ uv run mypy src/
377
+ ```
378
+
379
+ ---
380
+
381
+ ## Troubleshooting
382
+
383
+ ### "SCRAPEBADGER_API_KEY environment variable is required"
384
+
385
+ Make sure you've set the API key in your MCP configuration:
386
+
387
+ ```json
388
+ {
389
+ "env": {
390
+ "SCRAPEBADGER_API_KEY": "sb_live_your_key_here"
391
+ }
392
+ }
393
+ ```
394
+
395
+ ### Server not showing in Claude Desktop
396
+
397
+ 1. Restart Claude Desktop after changing the config
398
+ 2. Check the config file path is correct for your OS
399
+ 3. Verify JSON syntax is valid (no trailing commas)
400
+
401
+ ### "uvx: command not found"
402
+
403
+ Install `uv` first:
404
+
405
+ ```bash
406
+ # macOS/Linux
407
+ curl -LsSf https://astral.sh/uv/install.sh | sh
408
+
409
+ # Windows
410
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
411
+ ```
412
+
413
+ ### Rate limit errors
414
+
415
+ ScrapeBadger has usage limits based on your plan. If you're hitting limits:
416
+
417
+ 1. Reduce request frequency
418
+ 2. Use pagination with smaller `max_results`
419
+ 3. Upgrade your plan at [scrapebadger.com](https://scrapebadger.com)
420
+
421
+ ---
422
+
423
+ ## Related Projects
424
+
425
+ - [ScrapeBadger Python SDK](https://github.com/scrape-badger/scrapebadger-python) - Official Python SDK
426
+ - [ScrapeBadger Node.js SDK](https://github.com/scrape-badger/scrapebadger-node) - Official Node.js SDK
427
+ - [ScrapeBadger API Docs](https://docs.scrapebadger.com) - Full API documentation
428
+
429
+ ---
430
+
431
+ ## Support
432
+
433
+ - **Documentation:** [docs.scrapebadger.com](https://docs.scrapebadger.com)
434
+ - **Issues:** [GitHub Issues](https://github.com/scrape-badger/scrapebadger-mcp/issues)
435
+ - **Email:** support@scrapebadger.com
436
+ - **Discord:** [Join our community](https://discord.gg/scrapebadger)
437
+
438
+ ---
439
+
440
+ ## License
441
+
442
+ MIT License - see [LICENSE](LICENSE) for details.
443
+
444
+ ---
445
+
446
+ <p align="center">
447
+ Made with love by <a href="https://scrapebadger.com">ScrapeBadger</a>
448
+ </p>