socialcrawl-mcp 1.1.0 → 1.3.0
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.
- package/LICENSE +1 -196
- package/README.md +42 -12
- package/dist/__tests__/check-balance.test.d.ts +1 -0
- package/dist/__tests__/check-balance.test.js +55 -0
- package/dist/__tests__/check-balance.test.js.map +1 -0
- package/dist/__tests__/client.test.js +93 -0
- package/dist/__tests__/client.test.js.map +1 -1
- package/dist/__tests__/data-integrity.test.js +70 -7
- package/dist/__tests__/data-integrity.test.js.map +1 -1
- package/dist/__tests__/preflight.test.js +25 -1
- package/dist/__tests__/preflight.test.js.map +1 -1
- package/dist/client.d.ts +7 -0
- package/dist/client.js +27 -10
- package/dist/client.js.map +1 -1
- package/dist/data/docs.js +84 -19
- package/dist/data/docs.js.map +1 -1
- package/dist/data/endpoints.js +473 -0
- package/dist/data/endpoints.js.map +1 -1
- package/dist/data/platforms.js +38 -2
- package/dist/data/platforms.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/schemas/tools.d.ts +4 -0
- package/dist/schemas/tools.js +7 -1
- package/dist/schemas/tools.js.map +1 -1
- package/dist/tools/check-balance.d.ts +5 -0
- package/dist/tools/check-balance.js +25 -0
- package/dist/tools/check-balance.js.map +1 -0
- package/dist/tools/request.d.ts +1 -0
- package/dist/tools/request.js +1 -0
- package/dist/tools/request.js.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,193 +1,6 @@
|
|
|
1
|
-
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
|
|
2
|
-
|
|
3
|
-
Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
|
|
4
|
-
|
|
5
|
-
No rights beyond those granted by the applicable original license are conveyed for such contributions.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
Apache License
|
|
10
|
-
Version 2.0, January 2004
|
|
11
|
-
http://www.apache.org/licenses/
|
|
12
|
-
|
|
13
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
14
|
-
|
|
15
|
-
1. Definitions.
|
|
16
|
-
|
|
17
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
18
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
19
|
-
|
|
20
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
21
|
-
the copyright owner that is granting the License.
|
|
22
|
-
|
|
23
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
24
|
-
other entities that control, are controlled by, or are under common
|
|
25
|
-
control with that entity. For the purposes of this definition,
|
|
26
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
27
|
-
direction or management of such entity, whether by contract or
|
|
28
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
29
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
30
|
-
|
|
31
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
32
|
-
exercising permissions granted by this License.
|
|
33
|
-
|
|
34
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
35
|
-
including but not limited to software source code, documentation
|
|
36
|
-
source, and configuration files.
|
|
37
|
-
|
|
38
|
-
"Object" form shall mean any form resulting from mechanical
|
|
39
|
-
transformation or translation of a Source form, including but
|
|
40
|
-
not limited to compiled object code, generated documentation,
|
|
41
|
-
and conversions to other media types.
|
|
42
|
-
|
|
43
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
44
|
-
Object form, made available under the License, as indicated by a
|
|
45
|
-
copyright notice that is included in or attached to the work
|
|
46
|
-
(an example is provided in the Appendix below).
|
|
47
|
-
|
|
48
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
49
|
-
form, that is based on (or derived from) the Work and for which the
|
|
50
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
51
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
52
|
-
of this License, Derivative Works shall not include works that remain
|
|
53
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
54
|
-
the Work and Derivative Works thereof.
|
|
55
|
-
|
|
56
|
-
"Contribution" shall mean any work of authorship, including
|
|
57
|
-
the original version of the Work and any modifications or additions
|
|
58
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
59
|
-
submitted to the Licensor for inclusion in the Work by the copyright
|
|
60
|
-
owner or by an individual or Legal Entity authorized to submit on behalf
|
|
61
|
-
of the copyright owner. For the purposes of this definition, "submitted"
|
|
62
|
-
means any form of electronic, verbal, or written communication sent
|
|
63
|
-
to the Licensor or its representatives, including but not limited to
|
|
64
|
-
communication on electronic mailing lists, source code control systems,
|
|
65
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
66
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
67
|
-
excluding communication that is conspicuously marked or otherwise
|
|
68
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
69
|
-
|
|
70
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
71
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
72
|
-
subsequently incorporated within the Work.
|
|
73
|
-
|
|
74
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
78
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
79
|
-
Work and such Derivative Works in Source or Object form.
|
|
80
|
-
|
|
81
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
82
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
83
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
84
|
-
(except as stated in this section) patent license to make, have made,
|
|
85
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
86
|
-
where such license applies only to those patent claims licensable
|
|
87
|
-
by such Contributor that are necessarily infringed by their
|
|
88
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
89
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
90
|
-
institute patent litigation against any entity (including a
|
|
91
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
92
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
93
|
-
or contributory patent infringement, then any patent licenses
|
|
94
|
-
granted to You under this License for that Work shall terminate
|
|
95
|
-
as of the date such litigation is filed.
|
|
96
|
-
|
|
97
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
98
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
99
|
-
modifications, and in Source or Object form, provided that You
|
|
100
|
-
meet the following conditions:
|
|
101
|
-
|
|
102
|
-
(a) You must give any other recipients of the Work or
|
|
103
|
-
Derivative Works a copy of this License; and
|
|
104
|
-
|
|
105
|
-
(b) You must cause any modified files to carry prominent notices
|
|
106
|
-
stating that You changed the files; and
|
|
107
|
-
|
|
108
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
109
|
-
that You distribute, all copyright, patent, trademark, and
|
|
110
|
-
attribution notices from the Source form of the Work,
|
|
111
|
-
excluding those notices that do not pertain to any part of
|
|
112
|
-
the Derivative Works; and
|
|
113
|
-
|
|
114
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
115
|
-
distribution, then any Derivative Works that You distribute must
|
|
116
|
-
include a readable copy of the attribution notices contained
|
|
117
|
-
within such NOTICE file, excluding those notices that do not
|
|
118
|
-
pertain to any part of the Derivative Works, in at least one
|
|
119
|
-
of the following places: within a NOTICE text file distributed
|
|
120
|
-
as part of the Derivative Works; within the Source form or
|
|
121
|
-
documentation, if provided along with the Derivative Works; or,
|
|
122
|
-
within a display generated by the Derivative Works, if and
|
|
123
|
-
wherever such third-party notices normally appear. The contents
|
|
124
|
-
of the NOTICE file are for informational purposes only and
|
|
125
|
-
do not modify the License. You may add Your own attribution
|
|
126
|
-
notices within Derivative Works that You distribute, alongside
|
|
127
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
128
|
-
that such additional attribution notices cannot be construed
|
|
129
|
-
as modifying the License.
|
|
130
|
-
|
|
131
|
-
You may add Your own copyright statement to Your modifications and
|
|
132
|
-
may provide additional or different license terms and conditions
|
|
133
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
134
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
135
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
136
|
-
the conditions stated in this License.
|
|
137
|
-
|
|
138
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
139
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
140
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
141
|
-
this License, without any additional terms or conditions.
|
|
142
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
143
|
-
the terms of any separate license agreement you may have executed
|
|
144
|
-
with Licensor regarding such Contributions.
|
|
145
|
-
|
|
146
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
147
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
148
|
-
except as required for reasonable and customary use in describing the
|
|
149
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
150
|
-
|
|
151
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
152
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
153
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
154
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
155
|
-
implied, including, without limitation, any warranties or conditions
|
|
156
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
157
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
158
|
-
appropriateness of using or redistributing the Work and assume any
|
|
159
|
-
risks associated with Your exercise of permissions under this License.
|
|
160
|
-
|
|
161
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
162
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
163
|
-
unless required by applicable law (such as deliberate and grossly
|
|
164
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
165
|
-
liable to You for damages, including any direct, indirect, special,
|
|
166
|
-
incidental, or consequential damages of any character arising as a
|
|
167
|
-
result of this License or out of the use or inability to use the
|
|
168
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
169
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
170
|
-
other commercial damages or losses), even if such Contributor
|
|
171
|
-
has been advised of the possibility of such damages.
|
|
172
|
-
|
|
173
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
174
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
175
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
176
|
-
or other liability obligations and/or rights consistent with this
|
|
177
|
-
License. However, in accepting such obligations, You may act only
|
|
178
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
179
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
180
|
-
defend, and hold each Contributor harmless for any liability
|
|
181
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
182
|
-
of your accepting any such warranty or additional liability.
|
|
183
|
-
|
|
184
|
-
END OF TERMS AND CONDITIONS
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
1
|
MIT License
|
|
189
2
|
|
|
190
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Ridio Company
|
|
191
4
|
|
|
192
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
193
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -206,11 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
206
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
207
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
208
21
|
SOFTWARE.
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
Creative Commons Attribution 4.0 International (CC-BY-4.0)
|
|
213
|
-
|
|
214
|
-
Documentation in this project (excluding specifications) is licensed under
|
|
215
|
-
CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
|
|
216
|
-
the full license text.
|
package/README.md
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
# socialcrawl-mcp
|
|
4
4
|
|
|
5
|
-
**Give your AI agent access to
|
|
5
|
+
**Give your AI agent access to 27 platforms — social media, web research, prediction markets, and a universal cross-platform meta-search — through a single API**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/socialcrawl-mcp)
|
|
8
8
|
[](https://registry.modelcontextprotocol.io)
|
|
9
|
-
[](https://socialcrawl.dev)
|
|
10
|
+
[](https://socialcrawl.dev/docs)
|
|
11
11
|
[](LICENSE)
|
|
12
|
+
[](https://glama.ai/mcp/servers/socialcrawl/mcp)
|
|
13
|
+
|
|
14
|
+
<a href="https://glama.ai/mcp/servers/socialcrawl/mcp">
|
|
15
|
+
<img width="380" src="https://glama.ai/mcp/servers/socialcrawl/mcp/badges/card.svg" alt="Socialcrawl MCP server" />
|
|
16
|
+
</a>
|
|
12
17
|
|
|
13
18
|
[Overview](#overview) | [Installation](#installation) | [Setup](#setup) | [Usage](#usage) | [Tools](#available-tools) | [Platforms](#supported-platforms)
|
|
14
19
|
|
|
@@ -18,9 +23,9 @@
|
|
|
18
23
|
|
|
19
24
|
## Overview
|
|
20
25
|
|
|
21
|
-
`socialcrawl-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI agents to the [SocialCrawl API](https://socialcrawl.dev) — a unified
|
|
26
|
+
`socialcrawl-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI agents to the [SocialCrawl API](https://socialcrawl.dev) — a unified data API covering 27 platforms and 133 endpoints.
|
|
22
27
|
|
|
23
|
-
Retrieve profiles, posts, comments, search results, trending content, and analytics from TikTok, Instagram, YouTube, Twitter/X, LinkedIn, Reddit, and
|
|
28
|
+
Retrieve profiles, posts, comments, search results, trending content, and analytics from TikTok, Instagram, YouTube, Twitter/X, LinkedIn, Reddit, GitHub, Hacker News, Polymarket, and 18 more platforms — plus web research via Tavily and Perplexity, AI-powered X search via Grok, and a single `/search/everywhere` endpoint that fans out across 12 sources in one call. One API key, one consistent response format, every platform.
|
|
24
29
|
|
|
25
30
|
**What the MCP server does:**
|
|
26
31
|
- Discovers available platforms and endpoints dynamically
|
|
@@ -30,6 +35,14 @@ Retrieve profiles, posts, comments, search results, trending content, and analyt
|
|
|
30
35
|
|
|
31
36
|
## Installation
|
|
32
37
|
|
|
38
|
+
### npm
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install -g socialcrawl-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Available on [npm](https://www.npmjs.com/package/socialcrawl-mcp). Most users don't need this — the MCP client configs below use `npx` and auto-install on first run.
|
|
45
|
+
|
|
33
46
|
### Claude Code (quickest)
|
|
34
47
|
|
|
35
48
|
```bash
|
|
@@ -211,21 +224,26 @@ Every response follows a unified envelope format:
|
|
|
211
224
|
|
|
212
225
|
## Available Tools
|
|
213
226
|
|
|
214
|
-
The MCP server exposes
|
|
227
|
+
The MCP server exposes 5 tools:
|
|
215
228
|
|
|
216
229
|
| Tool | Description | Needs API key? |
|
|
217
230
|
|------|-------------|----------------|
|
|
218
231
|
| `socialcrawl_list_platforms` | Discover all 21 platforms with their endpoints and capabilities | No |
|
|
219
232
|
| `socialcrawl_list_endpoints` | See all endpoints, required parameters, and credit costs for a platform | No |
|
|
220
|
-
| `socialcrawl_request` | Make any SocialCrawl API call — profiles, posts, comments, search, analytics | Yes |
|
|
233
|
+
| `socialcrawl_request` | Make any SocialCrawl API call — profiles, posts, comments, search, analytics. Supports an optional `idempotencyKey` for retry-safe calls. | Yes |
|
|
234
|
+
| `socialcrawl_check_balance` | Check remaining credits and recent deduction summary. Calls `/v1/credits/balance` — costs 0 credits. | Yes |
|
|
221
235
|
| `socialcrawl_get_docs` | Access detailed API documentation by topic or platform | No |
|
|
222
236
|
|
|
223
|
-
Three of the
|
|
237
|
+
Three of the five tools work without an API key — they query local bundled data. `socialcrawl_request` and `socialcrawl_check_balance` require a key.
|
|
224
238
|
|
|
225
239
|
### Smart validation
|
|
226
240
|
|
|
227
241
|
Before making any API call, `socialcrawl_request` validates locally that the platform exists, the endpoint exists, and all required parameters are present. If something is wrong, it tells the agent exactly how to fix it — without consuming any credits.
|
|
228
242
|
|
|
243
|
+
### Retry-safe requests
|
|
244
|
+
|
|
245
|
+
Pass an `idempotencyKey` to `socialcrawl_request` (UUIDv4 recommended) to make the call retry-safe. If the request is replayed within 24h, the server returns the original response and deducts **0 credits** (`X-Idempotent-Replay: true`).
|
|
246
|
+
|
|
229
247
|
## Supported Platforms
|
|
230
248
|
|
|
231
249
|
| Platform | Endpoints | Data Available |
|
|
@@ -234,14 +252,20 @@ Before making any API call, `socialcrawl_request` validates locally that the pla
|
|
|
234
252
|
| **Instagram** | 12 | Profiles, posts, reels, comments, highlights, search |
|
|
235
253
|
| **YouTube** | 12 | Channels, videos, shorts, playlists, comments, trending, comment replies |
|
|
236
254
|
| **Facebook** | 12 | Profiles, posts, reels, photos, groups, Ad Library |
|
|
237
|
-
| **
|
|
238
|
-
| **
|
|
255
|
+
| **GitHub** | 12 | Users, repos, issues, PRs, READMEs, releases, search, repo dossier, user profile-velocity |
|
|
256
|
+
| **Twitter/X** | 7 | Profiles, tweets, communities, video transcripts, AI search via Grok |
|
|
239
257
|
| **Reddit** | 7 | Subreddits, posts, comments, search, ads |
|
|
258
|
+
| **LinkedIn** | 6 | Profiles, company pages, posts, Ad Library |
|
|
240
259
|
| **Threads** | 5 | Profiles, posts, search |
|
|
241
260
|
| **Pinterest** | 4 | Search, pins, boards |
|
|
242
261
|
| **Google** | 4 | Search, Ad Library |
|
|
262
|
+
| **Tavily** | 4 | Web search (with LLM answer), URL extraction, sitemap, full crawl |
|
|
263
|
+
| **Hacker News** | 4 | Story search, story, comment tree, profile |
|
|
243
264
|
| **Truth Social** | 3 | Profiles, posts |
|
|
244
265
|
| **Twitch** | 2 | Profiles, clips |
|
|
266
|
+
| **Polymarket** | 2 | Prediction-market search + multi-query research fan-out |
|
|
267
|
+
| **Perplexity** | 1 | Sonar web research with cited sources |
|
|
268
|
+
| **Universal Search** | 1 | One query, fanned out across 12 platforms (20cr) |
|
|
245
269
|
| **Snapchat** | 1 | Profiles |
|
|
246
270
|
| **Kick** | 1 | Clips |
|
|
247
271
|
| **Amazon** | 1 | Shop pages |
|
|
@@ -252,7 +276,7 @@ Before making any API call, `socialcrawl_request` validates locally that the pla
|
|
|
252
276
|
| **Pillar** | 1 | Link pages |
|
|
253
277
|
| **Utility** | 1 | Age & gender detection |
|
|
254
278
|
|
|
255
|
-
**Total:
|
|
279
|
+
**Total: 133 endpoints across 27 platforms.**
|
|
256
280
|
|
|
257
281
|
## Error Handling
|
|
258
282
|
|
|
@@ -265,7 +289,13 @@ The MCP server handles errors gracefully and gives the agent actionable guidance
|
|
|
265
289
|
| Insufficient credits | Shows balance and links to billing page |
|
|
266
290
|
| Bad platform/resource | Suggests using discovery tools to find the right endpoint |
|
|
267
291
|
| Missing parameters | Lists exactly what's missing with examples |
|
|
268
|
-
|
|
|
292
|
+
| Resource not found (404) | Reports the upstream resource doesn't exist; credits auto-refunded (BIL-01) |
|
|
293
|
+
| Idempotency-Key conflict (409) | Tells the agent the key was used by another account — generate a fresh one |
|
|
294
|
+
| Idempotency-Key payload mismatch (422) | Tells the agent the same key was reused with different params |
|
|
295
|
+
| Method not allowed (405) | Reminds the caller that `/v1/*` is GET-only |
|
|
296
|
+
| Concurrency limit (429) | Asks the caller to back off (50 concurrent/key max) |
|
|
297
|
+
| Upstream error (502) | Reports the failure; credits refunded automatically |
|
|
298
|
+
| Platform unavailable (503) | Circuit breaker open; credits refunded; retry in 30s |
|
|
269
299
|
|
|
270
300
|
## Links
|
|
271
301
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { checkBalance } from "../tools/check-balance.js";
|
|
3
|
+
describe("socialcrawl_check_balance tool", () => {
|
|
4
|
+
const originalEnv = process.env;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
process.env = { ...originalEnv, SOCIALCRAWL_API_KEY: "sc_test_key" };
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
process.env = originalEnv;
|
|
10
|
+
vi.restoreAllMocks();
|
|
11
|
+
});
|
|
12
|
+
it("calls /v1/credits/balance with no platform prefix and no query string", async () => {
|
|
13
|
+
let capturedUrl = "";
|
|
14
|
+
vi.stubGlobal("fetch", async (url) => {
|
|
15
|
+
capturedUrl = url;
|
|
16
|
+
return new Response(JSON.stringify({
|
|
17
|
+
success: true,
|
|
18
|
+
platform: "meta",
|
|
19
|
+
endpoint: "/v1/credits/balance",
|
|
20
|
+
data: { balance: 8432, recent_deductions: { last_24h: 128, last_7d: 1043 } },
|
|
21
|
+
credits_used: 0,
|
|
22
|
+
credits_remaining: 8432,
|
|
23
|
+
}), { status: 200 });
|
|
24
|
+
});
|
|
25
|
+
const result = await checkBalance();
|
|
26
|
+
expect(capturedUrl).toContain("/v1/credits/balance");
|
|
27
|
+
expect(capturedUrl).not.toContain("/v1/meta/");
|
|
28
|
+
expect(capturedUrl).not.toContain("?");
|
|
29
|
+
expect(result).toContain("8432");
|
|
30
|
+
});
|
|
31
|
+
it("returns the No-API-key error when SOCIALCRAWL_API_KEY is missing", async () => {
|
|
32
|
+
delete process.env.SOCIALCRAWL_API_KEY;
|
|
33
|
+
const result = await checkBalance();
|
|
34
|
+
expect(result).toContain("No API key configured");
|
|
35
|
+
});
|
|
36
|
+
it("formats the balance response with a header noting 0-credit cost", async () => {
|
|
37
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
38
|
+
success: true,
|
|
39
|
+
platform: "meta",
|
|
40
|
+
endpoint: "/v1/credits/balance",
|
|
41
|
+
data: { balance: 100, recent_deductions: { last_24h: 0, last_7d: 0 } },
|
|
42
|
+
credits_used: 0,
|
|
43
|
+
credits_remaining: 100,
|
|
44
|
+
}), { status: 200 }));
|
|
45
|
+
const result = await checkBalance();
|
|
46
|
+
expect(result).toContain("/v1/credits/balance");
|
|
47
|
+
expect(result).toContain("0 credits");
|
|
48
|
+
});
|
|
49
|
+
it("propagates 401 errors with the Invalid API key message", async () => {
|
|
50
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({ success: false, error: { type: "INVALID_API_KEY", message: "bad key" } }), { status: 401 }));
|
|
51
|
+
const result = await checkBalance();
|
|
52
|
+
expect(result).toContain("Invalid API key");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=check-balance.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-balance.test.js","sourceRoot":"","sources":["../../src/__tests__/check-balance.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAEhC,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,SAAS,CAA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,CAAC,CAAC"}
|
|
@@ -68,5 +68,98 @@ describe("API client", () => {
|
|
|
68
68
|
expect(result).toContain("Upstream error");
|
|
69
69
|
expect(result).toContain("auto-refunded");
|
|
70
70
|
});
|
|
71
|
+
it("maps 404 RESOURCE_NOT_FOUND to a refund-aware message", async () => {
|
|
72
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
73
|
+
success: false,
|
|
74
|
+
error: { type: "RESOURCE_NOT_FOUND", message: "Resource does not exist" },
|
|
75
|
+
}), { status: 404 }));
|
|
76
|
+
const result = await makeRequest({ platform: "tiktok", resource: "profile", params: { handle: "ghost" } });
|
|
77
|
+
expect(result).toContain("Resource not found");
|
|
78
|
+
expect(result).toContain("refunded");
|
|
79
|
+
expect(result).not.toContain("socialcrawl_list_endpoints");
|
|
80
|
+
});
|
|
81
|
+
it("maps 405 METHOD_NOT_ALLOWED with the Allow header hint", async () => {
|
|
82
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
83
|
+
success: false,
|
|
84
|
+
error: { type: "METHOD_NOT_ALLOWED", message: "Only GET is allowed" },
|
|
85
|
+
}), { status: 405 }));
|
|
86
|
+
const result = await makeRequest({ platform: "tiktok", resource: "profile", params: { handle: "test" } });
|
|
87
|
+
expect(result).toContain("Method not allowed");
|
|
88
|
+
expect(result).toContain("GET");
|
|
89
|
+
});
|
|
90
|
+
it("maps 409 IDEMPOTENCY_KEY_CONFLICT", async () => {
|
|
91
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
92
|
+
success: false,
|
|
93
|
+
error: { type: "IDEMPOTENCY_KEY_CONFLICT", message: "Key already used by another account" },
|
|
94
|
+
}), { status: 409 }));
|
|
95
|
+
const result = await makeRequest({
|
|
96
|
+
platform: "tiktok",
|
|
97
|
+
resource: "profile",
|
|
98
|
+
params: { handle: "test" },
|
|
99
|
+
idempotencyKey: "shared-key",
|
|
100
|
+
});
|
|
101
|
+
expect(result).toContain("Idempotency-Key");
|
|
102
|
+
expect(result).toContain("conflict");
|
|
103
|
+
});
|
|
104
|
+
it("maps 422 IDEMPOTENCY_KEY_PAYLOAD_MISMATCH", async () => {
|
|
105
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
106
|
+
success: false,
|
|
107
|
+
error: { type: "IDEMPOTENCY_KEY_PAYLOAD_MISMATCH", message: "Key reused with different payload" },
|
|
108
|
+
}), { status: 422 }));
|
|
109
|
+
const result = await makeRequest({
|
|
110
|
+
platform: "tiktok",
|
|
111
|
+
resource: "profile",
|
|
112
|
+
params: { handle: "test" },
|
|
113
|
+
idempotencyKey: "reused-key",
|
|
114
|
+
});
|
|
115
|
+
expect(result).toContain("Idempotency-Key");
|
|
116
|
+
expect(result).toContain("different");
|
|
117
|
+
});
|
|
118
|
+
it("includes doc_url in default error formatting when present", async () => {
|
|
119
|
+
vi.stubGlobal("fetch", async () => new Response(JSON.stringify({
|
|
120
|
+
success: false,
|
|
121
|
+
error: {
|
|
122
|
+
type: "INTERNAL_ERROR",
|
|
123
|
+
message: "Something went wrong",
|
|
124
|
+
doc_url: "https://www.socialcrawl.dev/docs/errors/internal-error",
|
|
125
|
+
},
|
|
126
|
+
}), { status: 500 }));
|
|
127
|
+
const result = await makeRequest({ platform: "tiktok", resource: "profile", params: { handle: "test" } });
|
|
128
|
+
expect(result).toContain("INTERNAL_ERROR");
|
|
129
|
+
expect(result).toContain("https://www.socialcrawl.dev/docs/errors/internal-error");
|
|
130
|
+
});
|
|
131
|
+
it("forwards idempotencyKey as Idempotency-Key header", async () => {
|
|
132
|
+
let capturedHeaders = {};
|
|
133
|
+
vi.stubGlobal("fetch", async (_url, init) => {
|
|
134
|
+
capturedHeaders = init.headers;
|
|
135
|
+
return new Response(JSON.stringify({ success: true, data: {} }), { status: 200 });
|
|
136
|
+
});
|
|
137
|
+
await makeRequest({
|
|
138
|
+
platform: "tiktok",
|
|
139
|
+
resource: "profile",
|
|
140
|
+
params: { handle: "charlidamelio" },
|
|
141
|
+
idempotencyKey: "abc-123",
|
|
142
|
+
});
|
|
143
|
+
expect(capturedHeaders["Idempotency-Key"]).toBe("abc-123");
|
|
144
|
+
});
|
|
145
|
+
it("does not send Idempotency-Key header when not provided", async () => {
|
|
146
|
+
let capturedHeaders = {};
|
|
147
|
+
vi.stubGlobal("fetch", async (_url, init) => {
|
|
148
|
+
capturedHeaders = init.headers;
|
|
149
|
+
return new Response(JSON.stringify({ success: true, data: {} }), { status: 200 });
|
|
150
|
+
});
|
|
151
|
+
await makeRequest({ platform: "tiktok", resource: "profile", params: { handle: "charlidamelio" } });
|
|
152
|
+
expect(capturedHeaders["Idempotency-Key"]).toBeUndefined();
|
|
153
|
+
});
|
|
154
|
+
it("supports the meta platform for /v1/credits/balance", async () => {
|
|
155
|
+
let capturedUrl = "";
|
|
156
|
+
vi.stubGlobal("fetch", async (url) => {
|
|
157
|
+
capturedUrl = url;
|
|
158
|
+
return new Response(JSON.stringify({ success: true, data: { balance: 42 } }), { status: 200 });
|
|
159
|
+
});
|
|
160
|
+
await makeRequest({ platform: "meta", resource: "credits/balance" });
|
|
161
|
+
expect(capturedUrl).toContain("/v1/credits/balance");
|
|
162
|
+
expect(capturedUrl).not.toContain("?");
|
|
163
|
+
});
|
|
71
164
|
});
|
|
72
165
|
//# sourceMappingURL=client.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.js","sourceRoot":"","sources":["../../src/__tests__/client.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAEhC,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,GAAG,EA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AG,CAAC;YAClB,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACjG,CAAC,CAAC,CAAC;QAEH,MAAM,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACrE,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACrD,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { PLATFORMS, findPlatform, getAllPlatformSlugs } from "../data/platforms.
|
|
|
3
3
|
import { ENDPOINTS, findEndpoint, getEndpointsByPlatform } from "../data/endpoints.js";
|
|
4
4
|
import { getDoc, getAvailableTopics } from "../data/docs.js";
|
|
5
5
|
describe("Platform data integrity", () => {
|
|
6
|
-
it("has exactly
|
|
7
|
-
expect(PLATFORMS).toHaveLength(
|
|
6
|
+
it("has exactly 27 platforms", () => {
|
|
7
|
+
expect(PLATFORMS).toHaveLength(27);
|
|
8
8
|
});
|
|
9
9
|
it("every platform has a non-empty slug, name, and description", () => {
|
|
10
10
|
for (const platform of PLATFORMS) {
|
|
@@ -26,13 +26,13 @@ describe("Platform data integrity", () => {
|
|
|
26
26
|
it("findPlatform returns undefined for unknown slug", () => {
|
|
27
27
|
expect(findPlatform("nonexistent")).toBeUndefined();
|
|
28
28
|
});
|
|
29
|
-
it("getAllPlatformSlugs returns
|
|
30
|
-
expect(getAllPlatformSlugs()).toHaveLength(
|
|
29
|
+
it("getAllPlatformSlugs returns 27 slugs", () => {
|
|
30
|
+
expect(getAllPlatformSlugs()).toHaveLength(27);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
describe("Endpoint data integrity", () => {
|
|
34
|
-
it("has exactly
|
|
35
|
-
expect(ENDPOINTS.length).toBe(
|
|
34
|
+
it("has exactly 133 endpoints", () => {
|
|
35
|
+
expect(ENDPOINTS.length).toBe(133);
|
|
36
36
|
});
|
|
37
37
|
it("every endpoint has required fields", () => {
|
|
38
38
|
for (const endpoint of ENDPOINTS) {
|
|
@@ -40,7 +40,9 @@ describe("Endpoint data integrity", () => {
|
|
|
40
40
|
expect(endpoint.resource).toBeTruthy();
|
|
41
41
|
expect(endpoint.method).toBe("GET");
|
|
42
42
|
expect(["standard", "advanced", "premium"]).toContain(endpoint.creditTier);
|
|
43
|
-
|
|
43
|
+
// 20 is the flat-cost override for /v1/search/everywhere; every other
|
|
44
|
+
// endpoint follows the standard 1/5/10 ladder.
|
|
45
|
+
expect([1, 5, 10, 20]).toContain(endpoint.creditCost);
|
|
44
46
|
expect(endpoint.archetype).toBeTruthy();
|
|
45
47
|
expect(endpoint.summary).toBeTruthy();
|
|
46
48
|
}
|
|
@@ -48,6 +50,11 @@ describe("Endpoint data integrity", () => {
|
|
|
48
50
|
it("creditCost matches creditTier", () => {
|
|
49
51
|
const tierCosts = { standard: 1, advanced: 5, premium: 10 };
|
|
50
52
|
for (const endpoint of ENDPOINTS) {
|
|
53
|
+
// Universal-search endpoint overrides the tier ladder with a flat 20.
|
|
54
|
+
if (endpoint.platform === "search" && endpoint.resource === "everywhere") {
|
|
55
|
+
expect(endpoint.creditCost).toBe(20);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
51
58
|
expect(endpoint.creditCost).toBe(tierCosts[endpoint.creditTier]);
|
|
52
59
|
}
|
|
53
60
|
});
|
|
@@ -139,5 +146,61 @@ describe("Documentation data integrity", () => {
|
|
|
139
146
|
it("getAvailableTopics returns at least 26 topics", () => {
|
|
140
147
|
expect(getAvailableTopics().length).toBeGreaterThanOrEqual(26);
|
|
141
148
|
});
|
|
149
|
+
it("getAvailableTopics includes the new idempotency topic", () => {
|
|
150
|
+
expect(getAvailableTopics()).toContain("idempotency");
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
describe("Errors documentation reflects 2026-04-17 backend", () => {
|
|
154
|
+
it("documents METHOD_NOT_ALLOWED (405)", () => {
|
|
155
|
+
const errors = getDoc("errors");
|
|
156
|
+
expect(errors).toContain("METHOD_NOT_ALLOWED");
|
|
157
|
+
expect(errors).toContain("405");
|
|
158
|
+
});
|
|
159
|
+
it("documents IDEMPOTENCY_KEY_CONFLICT (409)", () => {
|
|
160
|
+
const errors = getDoc("errors");
|
|
161
|
+
expect(errors).toContain("IDEMPOTENCY_KEY_CONFLICT");
|
|
162
|
+
expect(errors).toContain("409");
|
|
163
|
+
});
|
|
164
|
+
it("documents IDEMPOTENCY_KEY_PAYLOAD_MISMATCH (422)", () => {
|
|
165
|
+
const errors = getDoc("errors");
|
|
166
|
+
expect(errors).toContain("IDEMPOTENCY_KEY_PAYLOAD_MISMATCH");
|
|
167
|
+
expect(errors).toContain("422");
|
|
168
|
+
});
|
|
169
|
+
it("notes that RESOURCE_NOT_FOUND auto-refunds credits (BIL-01)", () => {
|
|
170
|
+
const errors = getDoc("errors");
|
|
171
|
+
// The RESOURCE_NOT_FOUND row should mention refund / auto-refund.
|
|
172
|
+
expect(errors).toMatch(/RESOURCE_NOT_FOUND[\s\S]*?refund/i);
|
|
173
|
+
});
|
|
174
|
+
it("uses the path-style doc_url format (no anchor fragment)", () => {
|
|
175
|
+
const errors = getDoc("errors");
|
|
176
|
+
expect(errors).not.toContain("docs/errors#");
|
|
177
|
+
expect(errors).toMatch(/docs\/errors\/[a-z-]+/);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
describe("Credits documentation reflects 2026-04-17 backend", () => {
|
|
181
|
+
it("mentions the optional data._warnings advisory channel (ENV-03)", () => {
|
|
182
|
+
const credits = getDoc("credits");
|
|
183
|
+
expect(credits).toContain("_warnings");
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
describe("Idempotency documentation (BIL-02)", () => {
|
|
187
|
+
it("has an idempotency topic", () => {
|
|
188
|
+
expect(getDoc("idempotency")).toBeTruthy();
|
|
189
|
+
});
|
|
190
|
+
it("documents the Idempotency-Key header", () => {
|
|
191
|
+
const doc = getDoc("idempotency");
|
|
192
|
+
expect(doc).toContain("Idempotency-Key");
|
|
193
|
+
});
|
|
194
|
+
it("explains the 24h TTL and zero-credit replay", () => {
|
|
195
|
+
const doc = getDoc("idempotency");
|
|
196
|
+
expect(doc).toMatch(/24\s*h/i);
|
|
197
|
+
expect(doc).toContain("0 credit");
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
describe("Meta endpoint documentation (SEC-02)", () => {
|
|
201
|
+
it("overview mentions /v1/credits/balance", () => {
|
|
202
|
+
const overview = getDoc("overview");
|
|
203
|
+
expect(overview).toContain("/v1/credits/balance");
|
|
204
|
+
});
|
|
142
205
|
});
|
|
143
206
|
//# sourceMappingURL=data-integrity.test.js.map
|