@socialneuron/mcp-server 1.7.2 → 1.7.4

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.
Files changed (5) hide show
  1. package/CHANGELOG.md +123 -17
  2. package/README.md +77 -19
  3. package/dist/http.js +1463 -280
  4. package/dist/index.js +1467 -230
  5. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -2,34 +2,140 @@
2
2
 
3
3
  All notable changes to `@socialneuron/mcp-server` will be documented in this file.
4
4
 
5
+ ## [1.7.3] - 2026-04-04
6
+
7
+ ### Security
8
+ - **Full error sanitization**: `sanitizeError()` applied across all 15 catch blocks in 9 tool files + `http.ts` global error handler. No internal paths, table names, or stack traces leak to clients.
9
+ - **R2 key masking**: R2 storage keys are masked in all text output to prevent path disclosure.
10
+
11
+ ### Added
12
+ - **`upload_media` tool**: Upload local files or URLs to R2 storage for use in posts.
13
+ - **`get_media_url` tool**: Generate signed URLs for R2-stored media.
14
+ - **`schedule_post` enhancements**: Now accepts `r2_key`/`r2_keys`, `job_id`/`job_ids`, and typed `platform_metadata` — enables seamless generate-upload-post pipeline.
15
+ - **`check_status` enhancements**: Returns `all_urls` for multi-output jobs, presigned PUT URL support.
16
+ - **Brand consistency scoring**: New `brandScoring.ts` + `brandRuntime.ts` modules with multi-dimensional brand alignment scoring.
17
+
18
+ ### Fixed
19
+ - Duplicate `sanitizeError` import removed.
20
+
21
+ ### Changed
22
+ - `MCP_VERSION` bumped to `1.7.3`.
23
+ - Removed `api/` directory (OpenAPI spec, router, tool-executor) — REST convenience routes consolidated into `http.ts`.
24
+ - Removed `cli/sn/completions.ts`, `cli/sn/generate.ts`, `cli/sn/parse.ts` — CLI streamlined.
25
+ - Removed `lib/tool-errors.ts` — error handling consolidated into `sanitizeError`.
26
+
5
27
  ## [1.7.0] - 2026-04-03
6
28
 
7
29
  ### Added
30
+ - 12 new tools (52 → 64): brandRuntime (3), pipeline (4), suggest (1), digest (2), remotion (+1), autopilot (+1)
31
+ - `/.well-known/mcp/server-card.json` endpoint for Smithery marketplace discovery
32
+ - `/config` endpoint for cloud-mode connection info (replaces hardcoded credentials)
33
+ - MCP tool safety annotations for Anthropic Connectors Directory
34
+ - Response truncation (100K char limit)
35
+
36
+ ### Security
37
+ - Cloud config fetched at startup from `/config` endpoint (rotatable without npm republish)
38
+ - Supabase anon key (public, RLS-gated) restored with documentation — service role key remains env-only
39
+
40
+ ### Dependencies
41
+ - `@modelcontextprotocol/sdk` 1.27 → 1.29
42
+ - `@supabase/supabase-js` 2.99 → 2.101
43
+ - `jose` 6.2.1 → 6.2.2
8
44
 
9
- - **`/config` endpoint**: Returns server configuration (tools count, version, capabilities) without authentication
10
- - **Rate limit exemptions**: `/config`, `/health`, and `/.well-known/` paths bypass rate limiting
11
- - **All tools migrated to gateway**: 13 tool files moved from `getSupabaseClient()` to `callEdgeFunction('mcp-data', ...)` — tools now work in cloud mode (API key users)
12
- - **REST API layer**: Universal tool proxy (`POST /v1/tools/:name`), 15 convenience endpoints, OpenAPI 3.1 spec
13
- - **64 tools** (was 52): distribution, media, and configuration tools added
14
- - **mcp-data gateway**: 17 new actions added for cloud-mode tool execution
45
+ ## [1.6.1] - 2026-03-22
46
+
47
+ ### Security
48
+ - **Explicit body size limit**: `express.json({ limit: '50kb' })` prevents DoS via oversized payloads.
49
+ - **Error message sanitization**: MCP POST catch block now uses `sanitizeError()` no more internal paths or table names in error responses.
50
+ - **PII removal**: Removed `email` from API key validation chain (7 files). Key validation no longer exposes user email addresses.
51
+ - **Generation rate limiting**: Added explicit `generation` category at 20 req/min (previously fell back to `read` at 60/min).
52
+ - **npm provenance**: Added `--provenance` flag and `id-token: write` permission to release workflow for supply chain verification.
53
+ - **Security comment**: Documented that Edge Functions must not trust `x-internal-worker-call` header without Bearer token verification.
15
54
 
16
55
  ### Fixed
56
+ - **hono prototype pollution**: Updated transitive dependency to fix GHSA-v8w9-8mx6-g223.
57
+ - `npm audit` now reports 0 vulnerabilities.
17
58
 
18
- - **Smithery OAuth**: `/register` now allows all HTTPS redirect URIs per MCP spec (was Claude-only)
19
- - **Zod 4 compatibility**: Upgraded zod 3→4 for SDK v1.27 compatibility
20
- - **Express middleware**: Added express-rate-limit + cors as direct dependencies
59
+ ### Added
60
+ - 18 examples (8 REST curl, 5 TypeScript SDK, 4 CLI, 1 MCP prompts).
61
+ - TypeScript SDK package (`packages/sdk/`) with 9 resource classes.
62
+ - CLI tab completion and content generation commands.
63
+ - SDK documentation and release workflow.
21
64
 
22
- ### Security
65
+ ## [1.6.0] - 2026-03-21
23
66
 
24
- - 50kb body limit on all endpoints
25
- - `sanitizeError` on /mcp catch path
26
- - Email removed from auth chain
27
- - Generation rate limit 20/min
67
+ ### Added
68
+ - **REST API layer**: Universal tool proxy at `POST /v1/tools/:name` call any of the 52 MCP tools via standard HTTP REST. No MCP client required.
69
+ - **OpenAPI 3.1 spec**: Auto-generated from TOOL_CATALOG at `/openapi.json` — always in sync with tools.
70
+ - **15 convenience endpoints**: Resource-oriented routes for common operations (`/v1/credits`, `/v1/content/generate`, `/v1/posts`, etc.).
71
+ - **Express HTTP transport**: New `dist/http.js` entry point for running as a standalone REST API server.
72
+ - **MCP Registry metadata**: `server.json` with mcpName, endpoints, env, and auth configuration for registry discovery.
73
+ - **Cursor Directory manifest**: Plugin manifest for Cursor IDE integration.
28
74
 
29
- ### Internal
75
+ ### Fixed
76
+ - **TS2345**: Cast Express route param to string for strict TypeScript compatibility.
77
+ - **npm publish 404**: Removed `--provenance` flag from release workflow (incompatible with scoped packages on granular tokens).
30
78
 
31
- - 64 tools, 900+ tests, ~375KB build
32
- - OpenAPI 3.1 spec auto-generated from tool schemas
79
+ ### Changed
80
+ - Dual transport support: MCP (stdio) and HTTP (Express) from a single codebase.
81
+ - SECURITY.md updated with v1.6.x in supported versions.
82
+ - `docs/auth.md` domain reference corrected (`www.socialneuron.com` → `socialneuron.com`).
83
+
84
+ ## [1.5.2] - 2026-03-20
85
+
86
+ ### Added
87
+ - **Error recovery hints**: All 47 error paths now include actionable recovery guidance — agents know what to call next when something fails (e.g., "Call get_credit_balance to check remaining credits" or "Verify platform OAuth with list_connected_accounts").
88
+ - Central `formatToolError()` helper with 9 error categories: rate limits, credits, OAuth, generation, not-found, access, SSRF, scheduling, and plan validation.
89
+ - 18 new tests for error recovery formatting.
90
+
91
+ ## [1.5.1] - 2026-03-20
92
+
93
+ ### Added
94
+ - **MCP tool annotations**: All 52 tools now declare `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint` per MCP spec. Agents can now determine which tools are safe to call without confirmation.
95
+ - **Complete parameter descriptions**: Added `.describe()` to all remaining parameters (248 total). Every parameter now has format examples, constraints, and usage guidance.
96
+
97
+ ### Changed
98
+ - Updated test setup to support 5-argument `server.tool()` signature with annotations.
99
+
100
+ ## [1.5.0] - 2026-03-19
101
+
102
+ ### Changed
103
+ - **LLM-optimized tool descriptions**: Rewrote 27 tool descriptions and enriched 15 parameters for agent comprehension. Every tool now answers "when to call", "what to pass", and "what comes next" — following Arcade ToolBench patterns (Tool Description, Constrained Input, Dependency Hint, Performance Hint).
104
+ - **API key cache TTL**: Reduced from 60s to 10s to limit revocation exposure window.
105
+ - **OAuth issuer URL**: Production metadata now derives from `MCP_SERVER_URL` instead of defaulting to localhost.
106
+ - **SECURITY.md**: Updated supported versions, added scanner false-positive documentation.
107
+ - **CLI setup URL**: Fixed `app.socialneuron.com` → `www.socialneuron.com`.
108
+
109
+ ### Dependencies
110
+ - `@supabase/supabase-js` 2.98.0 → 2.99.2
111
+ - `open` 10.0.0 → 11.0.0 (requires Node.js 20+)
112
+ - `posthog-node` 5.28.1 → 5.28.3
113
+ - `vitest` 3.2.4 → 4.1.0
114
+ - `esbuild` 0.27.3 → 0.27.4
115
+ - `@types/node` 25.4.0 → 25.5.0
116
+
117
+ ## [1.4.0] - 2026-03-13
118
+
119
+ ### Changed
120
+ - **Telemetry is now opt-IN**: No data is sent unless `SOCIALNEURON_TELEMETRY=1` is explicitly set. Previously telemetry was opt-out.
121
+ - **PostHog moved to optionalDependencies**: `posthog-node` is no longer a required runtime dependency. The package works fully without it installed. This reduces supply chain surface and resolves socket.dev security flags.
122
+ - **Dynamic import**: PostHog is loaded via `import()` at runtime, silently skipped if unavailable.
123
+ - `DO_NOT_TRACK=1` continues to override and disable telemetry in all cases.
124
+
125
+ ## [1.3.2] - 2026-03-13
126
+
127
+ ### Fixed
128
+ - **TypeScript strict mode**: Added `@types/express`, fixed `AuthenticatedRequest` type to extend express `Request`, corrected `StreamableHTTPServerTransport` constructor usage
129
+ - **Optional dependency stubs**: Added ambient declarations for `playwright`, `@remotion/bundler`, `@remotion/renderer` (dynamically imported, not required at runtime)
130
+ - **Removed unused directive**: Cleaned up stale `@ts-expect-error` in REPL module
131
+ - **Release CI**: Typecheck now passes in GitHub Actions release workflow
132
+
133
+ ## [1.3.1] - 2026-03-13
134
+
135
+ ### Fixed
136
+ - **zod v4 compatibility**: Updated `zod` dependency from v3 to v4 to match `@modelcontextprotocol/sdk` peer requirement, fixing `ERR_PACKAGE_PATH_NOT_EXPORTED` crash on `npx` install
137
+ - **Test domain**: Fixed test fixtures using deprecated `socialneuron.ai` domain (now `socialneuron.com`)
138
+ - **CLI E2E timeout**: Increased envelope test timeout to avoid false failures
33
139
 
34
140
  ## [1.3.0] - 2026-03-13
35
141
 
package/README.md CHANGED
@@ -1,13 +1,26 @@
1
1
  # @socialneuron/mcp-server
2
2
 
3
- > 63 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.
3
+ > 64 tools for AI-powered social media management. MCP, REST API, CLI — create content, schedule posts, track analytics, and optimize performance.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@socialneuron/mcp-server)](https://www.npmjs.com/package/@socialneuron/mcp-server)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
+ ## Integration Methods
9
+
10
+ | Method | Best For | Docs |
11
+ |--------|----------|------|
12
+ | **MCP** | AI agents (Claude, Cursor, VS Code) | [Setup](#quick-start) |
13
+ | **REST API** | Any HTTP client, webhooks, Zapier | [Guide](docs/rest-api.md) |
14
+ | **CLI** | Terminal, CI/CD pipelines | [Guide](docs/cli-guide.md) |
15
+ | **SDK** | TypeScript/Node.js apps | Coming Q2 2026 |
16
+
17
+ All methods share the same 64 tools, auth, scopes, and credit system. [Compare methods](docs/integration-methods.md).
18
+
8
19
  ## Quick Start
9
20
 
10
- ### 1. Authenticate
21
+ ### MCP (AI Agents)
22
+
23
+ #### 1. Authenticate
11
24
 
12
25
  ```bash
13
26
  npx -y @socialneuron/mcp-server login --device
@@ -15,7 +28,7 @@ npx -y @socialneuron/mcp-server login --device
15
28
 
16
29
  This opens your browser to authorize access. Requires a paid Social Neuron plan (Starter or above). See [pricing](https://socialneuron.com/pricing).
17
30
 
18
- ### 2. Add to Claude Code
31
+ #### 2. Add to Claude Code
19
32
 
20
33
  ```bash
21
34
  claude mcp add socialneuron -- npx -y @socialneuron/mcp-server
@@ -76,10 +89,42 @@ Add to `.cursor/mcp.json` in your workspace:
76
89
  ```
77
90
  </details>
78
91
 
79
- ### 3. Start using
92
+ #### 3. Start using
80
93
 
81
94
  Ask Claude: "What content should I post this week?" or "Schedule my latest video to YouTube and TikTok"
82
95
 
96
+ ### REST API (Any Language)
97
+
98
+ ```bash
99
+ # Check credits
100
+ curl -H "Authorization: Bearer snk_live_..." \
101
+ https://mcp.socialneuron.com/v1/credits
102
+
103
+ # Generate content
104
+ curl -X POST -H "Authorization: Bearer snk_live_..." \
105
+ -H "Content-Type: application/json" \
106
+ -d '{"topic": "AI trends", "platforms": ["linkedin"]}' \
107
+ https://mcp.socialneuron.com/v1/content/generate
108
+
109
+ # Execute any tool via proxy
110
+ curl -X POST -H "Authorization: Bearer snk_live_..." \
111
+ -H "Content-Type: application/json" \
112
+ -d '{"response_format": "json"}' \
113
+ https://mcp.socialneuron.com/v1/tools/get_brand_profile
114
+ ```
115
+
116
+ See [REST API docs](docs/rest-api.md) | [OpenAPI spec](https://mcp.socialneuron.com/v1/openapi.json) | [Examples](examples/rest/)
117
+
118
+ ### CLI (Terminal & CI/CD)
119
+
120
+ ```bash
121
+ npx @socialneuron/mcp-server sn system credits --json
122
+ npx @socialneuron/mcp-server sn analytics loop --json
123
+ npx @socialneuron/mcp-server sn discovery tools --module content
124
+ ```
125
+
126
+ See [CLI guide](docs/cli-guide.md) | [Examples](examples/cli/)
127
+
83
128
  ## What You Can Do
84
129
 
85
130
  Ask Claude things like:
@@ -92,9 +137,9 @@ Ask Claude things like:
92
137
  - "Check my analytics and suggest improvements"
93
138
  - "Set up autopilot to post 3 times per week"
94
139
 
95
- ## Tool Categories (63 tools)
140
+ ## Tool Categories (64 tools)
96
141
 
97
- These tools are available to AI agents (Claude, Cursor, etc.) via the MCP protocol.
142
+ All tools are accessible via MCP, REST API (`POST /v1/tools/{name}`), and CLI.
98
143
 
99
144
  ### Content Lifecycle
100
145
 
@@ -216,7 +261,7 @@ socialneuron-mcp sn loop
216
261
  socialneuron-mcp sn credits
217
262
 
218
263
  # Agent-native CLI v2
219
- socialneuron-mcp sn tools [--module ideation] [--scope mcp:write] # List/filter all 63 tools
264
+ socialneuron-mcp sn tools [--module ideation] [--scope mcp:write] # List/filter all 64 tools
220
265
  socialneuron-mcp sn info # Version, auth, credits, tool count
221
266
  socialneuron-mcp sn plan list|view|approve # Content plan management
222
267
  socialneuron-mcp sn preset list|show|save|delete # Platform presets (6 built-in)
@@ -250,37 +295,50 @@ Each iteration produces smarter content as performance data feeds back into the
250
295
  - SSRF protection on all URL parameters with DNS rebinding prevention
251
296
  - Rate limiting per user with per-tool limits for expensive operations
252
297
  - Agent loop detection prevents runaway automation
253
- - Set `DO_NOT_TRACK=1` to disable anonymous usage telemetry
298
+ - Telemetry is off by default opt in with `SOCIALNEURON_TELEMETRY=1`
254
299
 
255
300
  See [SECURITY.md](./SECURITY.md) for our vulnerability disclosure policy and credential safety details.
256
301
 
257
302
  ## Telemetry
258
303
 
259
- This package collects anonymous usage metrics (tool name, duration, success/failure) to improve the product. Your user ID is hashed before transmission.
304
+ Telemetry is **off by default**. No data is collected unless you explicitly opt in.
305
+
306
+ **To enable**: Set `SOCIALNEURON_TELEMETRY=1` in your environment.
260
307
 
261
- **To disable**: Set `DO_NOT_TRACK=1` or `SOCIALNEURON_NO_TELEMETRY=1` in your environment.
308
+ **To disable**: `DO_NOT_TRACK=1` or `SOCIALNEURON_NO_TELEMETRY=1` always disables telemetry, even if `SOCIALNEURON_TELEMETRY=1` is set.
262
309
 
263
- No personal content, API keys, or request payloads are ever collected.
310
+ When enabled, the following anonymous metrics are collected via PostHog:
311
+ - Tool name invoked
312
+ - Success or failure status
313
+ - Invocation duration (ms)
314
+
315
+ No personal content, API keys, or request payloads are ever collected. Your user ID is hashed (SHA-256) before transmission.
316
+
317
+ `posthog-node` is an optional dependency — if it is not installed, telemetry is a silent no-op regardless of environment variables.
264
318
 
265
319
  ## Examples
266
320
 
267
- See the [examples repo](https://github.com/socialneuron/examples) for prompt-driven workflow templates:
321
+ See the [`examples/`](examples/) directory:
268
322
 
269
- - Weekly content batch planning
270
- - Cross-platform content repurposing
323
+ - [REST API examples](examples/rest/) — curl scripts for every endpoint
324
+ - [CLI examples](examples/cli/) — automation workflows
325
+ - [MCP prompts](examples/mcp/claude-prompts.md) — natural language examples
326
+ - [External examples repo](https://github.com/socialneuron/examples) — prompt-driven workflow templates
271
327
  - Performance review and optimization loops
272
328
  - Brand-aligned content generation
273
329
  - Comment engagement automation
274
330
 
275
331
  ## Links
276
332
 
277
- - [Social Neuron](https://socialneuron.com)
278
- - [For Developers](https://socialneuron.com/for-developers)
333
+ - [For Developers](https://socialneuron.com/for-developers) — Integration methods, tools, pricing
334
+ - [REST API Docs](docs/rest-api.md) — Endpoint reference
335
+ - [CLI Guide](docs/cli-guide.md) — Terminal commands
336
+ - [Integration Methods](docs/integration-methods.md) — Compare MCP vs REST vs CLI
337
+ - [OpenAPI Spec](https://mcp.socialneuron.com/v1/openapi.json) — Machine-readable API spec
338
+ - [Developer Settings](https://socialneuron.com/settings/developer) — Generate API keys
279
339
  - [Documentation](https://socialneuron.com/docs)
280
- - [Examples](https://github.com/socialneuron/examples)
281
- - [Agent Protocol](https://socialneuron.com/system-prompt.txt)
282
- - [Developer Settings](https://socialneuron.com/settings/developer)
283
340
  - [Pricing](https://socialneuron.com/pricing)
341
+ - [Agent Protocol](https://socialneuron.com/system-prompt.txt)
284
342
 
285
343
  ## License
286
344