@socialneuron/mcp-server 1.2.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/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +259 -0
- package/dist/http.js +8302 -0
- package/dist/index.js +9853 -0
- package/package.json +80 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@socialneuron/mcp-server` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.2.0] - 2026-03-10
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **Hardcoded anon key fallback**: npm consumers no longer need to configure `SUPABASE_ANON_KEY` — the public anon key is embedded as `CLOUD_SUPABASE_ANON_KEY`
|
|
10
|
+
- **Gateway token system**: HMAC-SHA256 tokens prevent direct Edge Function bypass of mcp-gateway credit/scope enforcement
|
|
11
|
+
- **Standardized error responses**: All 17 mcp-gateway error paths now return structured `{ error, message, upgrade_url?, retry_after? }` JSON
|
|
12
|
+
|
|
13
|
+
### Security
|
|
14
|
+
|
|
15
|
+
- Tightened `api_keys` RLS policies from `{public}` to `{authenticated}` role
|
|
16
|
+
- Added `key_hash` index on `api_keys` table
|
|
17
|
+
- Daily credit reset cron job (`reset-api-key-daily-credits`)
|
|
18
|
+
- 11 downstream Edge Functions now verify gateway tokens on service-role calls
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- `.npmignore` now excludes `*.spec.ts`, `.tmp*`, `.tmp-scripts/`, `*secret*`, `*credential*`
|
|
23
|
+
|
|
24
|
+
## [1.1.0] - 2026-02-27
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **New CLI commands**: `sn autopilot`, `sn usage`, `sn loop`, `sn credits` for deterministic access to management tools
|
|
29
|
+
- **Modular CLI architecture**: Extracted `sn` subcommand logic into `src/cli/sn.ts` for better maintainability
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Refactored `src/index.ts` to reduce file size and improve readability
|
|
34
|
+
|
|
35
|
+
## [1.0.0] - 2026-02-17
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **50+ MCP tools** across 19 modules: ideation, content, distribution, analytics, brand, screenshot, remotion, insights, youtube-analytics, comments, planning, quality, credits, autopilot, loop-summary, usage, and more
|
|
40
|
+
- **OAuth 2.1 authentication** with PKCE browser flow, device code flow, and API key paste
|
|
41
|
+
- **Scope-based access control**: `mcp:full`, `mcp:read`, `mcp:write`, `mcp:distribute`, `mcp:analytics`, `mcp:comments`
|
|
42
|
+
- **Cloud mode** via MCP gateway proxy (recommended) — service-role key stays server-side
|
|
43
|
+
- **Secure credential storage**: macOS Keychain, Linux secret-tool, file fallback
|
|
44
|
+
- **Auto-configuration** for Claude Desktop and Claude Code
|
|
45
|
+
- **CLI tools**: `sn publish`, `sn preflight`, `sn quality-check`, `sn status`, `sn posts`, `sn refresh-analytics`
|
|
46
|
+
- **Loop summary tool** for closed-loop content optimization feedback
|
|
47
|
+
- **Credit balance and budget tracking** tools
|
|
48
|
+
- **658 unit tests** across 32 test files
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- **BREAKING**: Default scope for JWT users without explicit scopes changed from `mcp:full` to `mcp:read`. Users who relied on implicit full access must now request `mcp:full` explicitly when generating API keys or authenticating via device code. This follows the principle of least privilege — read-only by default, write access on request.
|
|
53
|
+
|
|
54
|
+
### Security
|
|
55
|
+
|
|
56
|
+
- JWT scope default changed from `mcp:full` to `mcp:read` (principle of least privilege)
|
|
57
|
+
- API key expiry validation (reject expired keys)
|
|
58
|
+
- Session ownership verification (prevent cross-user session hijack)
|
|
59
|
+
- Health endpoint split: public `/health` (minimal) vs authenticated `/health/details`
|
|
60
|
+
- Per-user rate limiting in HTTP mode (token bucket)
|
|
61
|
+
- Per-request budget isolation in HTTP mode (AsyncLocalStorage)
|
|
62
|
+
- Daily credit cap enforcement in gateway
|
|
63
|
+
- Pre-execution balance check for expensive operations (video/image generation)
|
|
64
|
+
- Gateway-side userId override (prevents horizontal privilege escalation)
|
|
65
|
+
- Per-user rate limiting (100 req/min default)
|
|
66
|
+
- Per-tool rate limits for expensive operations
|
|
67
|
+
- Agent loop detection (>5 identical calls in 30s)
|
|
68
|
+
- Session hard cap (200 calls/hour)
|
|
69
|
+
- Shell metacharacter injection detection
|
|
70
|
+
- Audit logging with PII-redacted params
|
|
71
|
+
- Kill switch for emergency halt of autonomous operations
|
|
72
|
+
- Subscription tier-based scope restrictions
|
|
73
|
+
- SSRF protection on media URL parameters
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cosmocodex Ltd
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# @socialneuron/mcp-server
|
|
2
|
+
|
|
3
|
+
> 50+ MCP tools for AI-powered social media management. Create content, schedule posts, track analytics, and optimize performance — all from Claude Code or any MCP client.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@socialneuron/mcp-server)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
### 1. Authenticate
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx -y @socialneuron/mcp-server login --device
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This opens your browser to authorize access. Requires a paid Social Neuron plan (MCP API $19/mo or higher).
|
|
17
|
+
|
|
18
|
+
### 2. Add to Claude Code
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
claude mcp add socialneuron -- npx -y @socialneuron/mcp-server
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
<details>
|
|
25
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
26
|
+
|
|
27
|
+
Add to your `claude_desktop_config.json`:
|
|
28
|
+
|
|
29
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
30
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
31
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"socialneuron": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "@socialneuron/mcp-server"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
</details>
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary><strong>VS Code</strong></summary>
|
|
47
|
+
|
|
48
|
+
Add to `.vscode/mcp.json` in your workspace:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"servers": {
|
|
53
|
+
"socialneuron": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "@socialneuron/mcp-server"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
<details>
|
|
63
|
+
<summary><strong>Cursor</strong></summary>
|
|
64
|
+
|
|
65
|
+
Add to `.cursor/mcp.json` in your workspace:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"socialneuron": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "@socialneuron/mcp-server"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
</details>
|
|
78
|
+
|
|
79
|
+
### 3. Start using
|
|
80
|
+
|
|
81
|
+
Ask Claude: "What content should I post this week?" or "Schedule my latest video to YouTube and TikTok"
|
|
82
|
+
|
|
83
|
+
## What You Can Do
|
|
84
|
+
|
|
85
|
+
Ask Claude things like:
|
|
86
|
+
|
|
87
|
+
- "Generate 5 content ideas about sustainable fashion for Gen Z"
|
|
88
|
+
- "Create a 30-second video ad for my product launch"
|
|
89
|
+
- "Schedule this image to Instagram and LinkedIn at 9am tomorrow"
|
|
90
|
+
- "Show me my best-performing content this month"
|
|
91
|
+
- "What are the trending topics in my niche right now?"
|
|
92
|
+
- "Check my analytics and suggest improvements"
|
|
93
|
+
- "Set up autopilot to post 3 times per week"
|
|
94
|
+
|
|
95
|
+
## Tool Categories (51 tools)
|
|
96
|
+
|
|
97
|
+
### Content Lifecycle
|
|
98
|
+
|
|
99
|
+
| Category | Tools | What It Does |
|
|
100
|
+
|----------|-------|-------------|
|
|
101
|
+
| Ideation | generate_content, fetch_trends, adapt_content, get_ideation_context | AI-powered content ideas and trend research |
|
|
102
|
+
| Content | generate_video, generate_image, generate_voiceover, generate_carousel, check_status, create_storyboard | Video, image, voiceover, and carousel creation with 20+ AI models |
|
|
103
|
+
| Distribution | schedule_post, schedule_content_plan, find_next_slots, list_connected_accounts, list_recent_posts | Multi-platform publishing, scheduling, and slot optimization |
|
|
104
|
+
| Analytics | fetch_analytics, refresh_platform_analytics | Performance tracking across all platforms |
|
|
105
|
+
| Insights | get_performance_insights, get_best_posting_times | Data-driven content optimization |
|
|
106
|
+
|
|
107
|
+
### Management & Optimization
|
|
108
|
+
|
|
109
|
+
| Category | Tools | What It Does |
|
|
110
|
+
|----------|-------|-------------|
|
|
111
|
+
| Brand | extract_brand, get_brand_profile, save_brand_profile, update_platform_voice | Brand identity and voice management |
|
|
112
|
+
| Comments | list_comments, reply_to_comment, post_comment, moderate_comment, delete_comment | Social engagement management |
|
|
113
|
+
| Planning | plan_content_week, save_content_plan, get_content_plan, update_content_plan, submit_content_plan_for_approval | Content calendar and approval workflows |
|
|
114
|
+
| Plan Approvals | create_plan_approvals, respond_plan_approval, list_plan_approvals | Review and approve content plans |
|
|
115
|
+
| Autopilot | list_autopilot_configs, get_autopilot_status, update_autopilot_config | Automated content scheduling |
|
|
116
|
+
| Quality | quality_check, quality_check_plan | Pre-publish content validation |
|
|
117
|
+
| Credits | get_credit_balance, get_budget_status | Usage and budget tracking |
|
|
118
|
+
| Loop | get_loop_summary | Closed-loop optimization feedback |
|
|
119
|
+
|
|
120
|
+
### Utilities
|
|
121
|
+
|
|
122
|
+
| Category | Tools | What It Does |
|
|
123
|
+
|----------|-------|-------------|
|
|
124
|
+
| Extraction | extract_url_content | Extract content from URLs, YouTube, articles |
|
|
125
|
+
| Screenshots | capture_app_page, capture_screenshot | Visual documentation and monitoring |
|
|
126
|
+
| Remotion | list_compositions, render_demo_video | Programmatic video rendering |
|
|
127
|
+
| Usage | get_mcp_usage | API usage monitoring |
|
|
128
|
+
| YouTube | fetch_youtube_analytics | YouTube-specific deep analytics |
|
|
129
|
+
|
|
130
|
+
## Authentication
|
|
131
|
+
|
|
132
|
+
Three auth methods, in order of recommendation:
|
|
133
|
+
|
|
134
|
+
### Device Code (Recommended)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx -y @socialneuron/mcp-server login --device
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Opens browser, you approve, CLI receives API key automatically.
|
|
141
|
+
|
|
142
|
+
### PKCE Browser Flow
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npx -y @socialneuron/mcp-server login
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Browser-based OAuth flow with PKCE challenge.
|
|
149
|
+
|
|
150
|
+
### API Key Paste
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx -y @socialneuron/mcp-server login --paste
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Generate a key at socialneuron.com/settings/developer, paste it in.
|
|
157
|
+
|
|
158
|
+
Keys are stored in your OS keychain (macOS Keychain, Linux secret-tool) or file fallback.
|
|
159
|
+
|
|
160
|
+
> **Windows users**: The file fallback (`~/.config/social-neuron/credentials.json`) does not have strong permission enforcement on NTFS. For production use on Windows, set the `SOCIALNEURON_API_KEY` environment variable instead.
|
|
161
|
+
|
|
162
|
+
## Pricing
|
|
163
|
+
|
|
164
|
+
MCP access requires a paid Social Neuron plan:
|
|
165
|
+
|
|
166
|
+
| Plan | Price | MCP Scopes | Credits |
|
|
167
|
+
| ------- | ------- | ------------------------ | ------- |
|
|
168
|
+
| MCP API | $19/mo | Full access | 400 |
|
|
169
|
+
| Starter | $29/mo | Read + Analytics | 800 |
|
|
170
|
+
| Pro | $79/mo | Full access | 2,000 |
|
|
171
|
+
| Team | $199/mo | Full access + Multi-user | 6,500 |
|
|
172
|
+
|
|
173
|
+
**No free tier for MCP.** Sign up at [socialneuron.com/pricing](https://socialneuron.com/pricing).
|
|
174
|
+
|
|
175
|
+
## Scopes
|
|
176
|
+
|
|
177
|
+
| Scope | Access |
|
|
178
|
+
| ---------------- | -------------------------------------- |
|
|
179
|
+
| `mcp:full` | All operations |
|
|
180
|
+
| `mcp:read` | Read-only (analytics, insights, lists) |
|
|
181
|
+
| `mcp:write` | Content generation |
|
|
182
|
+
| `mcp:distribute` | Publishing and scheduling |
|
|
183
|
+
| `mcp:analytics` | Performance data |
|
|
184
|
+
| `mcp:comments` | Social engagement |
|
|
185
|
+
| `mcp:autopilot` | Automated scheduling |
|
|
186
|
+
|
|
187
|
+
## CLI Reference
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Auth
|
|
191
|
+
socialneuron-mcp login [--device|--paste]
|
|
192
|
+
socialneuron-mcp logout
|
|
193
|
+
|
|
194
|
+
# Deterministic CLI (no LLM)
|
|
195
|
+
socialneuron-mcp sn publish --media-url <url> --caption <text> --platforms <list> --confirm
|
|
196
|
+
socialneuron-mcp sn status --job-id <id>
|
|
197
|
+
socialneuron-mcp sn posts --days 7 --platform youtube
|
|
198
|
+
socialneuron-mcp sn refresh-analytics
|
|
199
|
+
socialneuron-mcp sn preflight --check-urls
|
|
200
|
+
socialneuron-mcp sn oauth-health --json
|
|
201
|
+
socialneuron-mcp sn oauth-refresh --platform instagram
|
|
202
|
+
socialneuron-mcp sn quality-check --content "your text here"
|
|
203
|
+
socialneuron-mcp sn autopilot
|
|
204
|
+
socialneuron-mcp sn usage
|
|
205
|
+
socialneuron-mcp sn loop
|
|
206
|
+
socialneuron-mcp sn credits
|
|
207
|
+
|
|
208
|
+
# Add --json to any command for machine-readable output
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Automation Flow (E2E Loop)
|
|
212
|
+
|
|
213
|
+
The full autonomous content loop using MCP tools:
|
|
214
|
+
|
|
215
|
+
1. `get_loop_summary` — assess project state (content count, scheduled posts, insights)
|
|
216
|
+
2. `plan_content_week` — generate a content plan based on insights and trends
|
|
217
|
+
3. `generate_video` / `generate_image` — create media assets from the plan
|
|
218
|
+
4. `check_status` — poll async jobs until assets are ready
|
|
219
|
+
5. `schedule_post` — distribute content to connected platforms
|
|
220
|
+
6. _(wait for analytics collection)_ — platform data is fetched automatically
|
|
221
|
+
7. `refresh_platform_analytics` — trigger a manual analytics refresh
|
|
222
|
+
8. `get_performance_insights` — read what worked and what didn't
|
|
223
|
+
9. Loop back to step 1 with new insights
|
|
224
|
+
|
|
225
|
+
Each iteration produces smarter content as performance data feeds back into the planning step.
|
|
226
|
+
|
|
227
|
+
## Security
|
|
228
|
+
|
|
229
|
+
- API keys are SHA-256 hashed with random salt before storage
|
|
230
|
+
- PKCE (S256) challenge verification for browser auth
|
|
231
|
+
- Timing-safe hash comparison prevents side-channel attacks
|
|
232
|
+
- SSRF protection on all URL parameters
|
|
233
|
+
- Rate limiting: 100 req/min per user, per-tool limits for expensive operations
|
|
234
|
+
- Agent loop detection (>5 identical calls in 30s)
|
|
235
|
+
- Credentials stored in OS keychain (macOS/Linux) or env var. On Windows, use `SOCIALNEURON_API_KEY` env var for secure storage
|
|
236
|
+
|
|
237
|
+
## Examples
|
|
238
|
+
|
|
239
|
+
See the [examples repo](https://github.com/socialneuron/examples) for prompt-driven workflow templates:
|
|
240
|
+
|
|
241
|
+
- Weekly content batch planning
|
|
242
|
+
- Cross-platform content repurposing
|
|
243
|
+
- Performance review and optimization loops
|
|
244
|
+
- Brand-aligned content generation
|
|
245
|
+
- Comment engagement automation
|
|
246
|
+
|
|
247
|
+
## Links
|
|
248
|
+
|
|
249
|
+
- [Social Neuron](https://socialneuron.com)
|
|
250
|
+
- [For Developers](https://socialneuron.com/for-developers)
|
|
251
|
+
- [Documentation](https://socialneuron.com/docs)
|
|
252
|
+
- [Examples](https://github.com/socialneuron/examples)
|
|
253
|
+
- [Agent Protocol](https://socialneuron.com/system-prompt.txt)
|
|
254
|
+
- [Developer Settings](https://socialneuron.com/settings/developer)
|
|
255
|
+
- [Pricing](https://socialneuron.com/pricing)
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
MIT - see [LICENSE](./LICENSE)
|