@socialneuron/mcp-server 1.5.1 → 1.6.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/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var MCP_VERSION;
14
14
  var init_version = __esm({
15
15
  "src/lib/version.ts"() {
16
16
  "use strict";
17
- MCP_VERSION = "1.5.1";
17
+ MCP_VERSION = "1.6.0";
18
18
  }
19
19
  });
20
20
 
@@ -3895,6 +3895,41 @@ function checkRateLimit(category, key) {
3895
3895
 
3896
3896
  // src/tools/ideation.ts
3897
3897
  init_supabase();
3898
+
3899
+ // src/lib/tool-errors.ts
3900
+ function formatToolError(rawMessage) {
3901
+ const msg = rawMessage.toLowerCase();
3902
+ if (msg.includes("rate limit") || msg.includes("too many requests")) {
3903
+ return `${rawMessage} Reduce request frequency or wait before retrying.`;
3904
+ }
3905
+ if (msg.includes("insufficient credit") || msg.includes("budget") || msg.includes("spending cap")) {
3906
+ return `${rawMessage} Call get_credit_balance to check remaining credits. Consider a cheaper model or wait for monthly refresh.`;
3907
+ }
3908
+ if (msg.includes("oauth") || msg.includes("token expired") || msg.includes("not connected") || msg.includes("reconnect")) {
3909
+ return `${rawMessage} Call list_connected_accounts to check status. User may need to reconnect at socialneuron.com/settings/connections.`;
3910
+ }
3911
+ if (msg.includes("generation failed") || msg.includes("failed to start") || msg.includes("no job id") || msg.includes("could not be parsed")) {
3912
+ return `${rawMessage} Try simplifying the prompt, using a different model, or check credits with get_credit_balance.`;
3913
+ }
3914
+ if (msg.includes("not found") || msg.includes("no ") && msg.includes(" found")) {
3915
+ return `${rawMessage} Verify the ID is correct \u2014 use the corresponding list tool to find valid IDs.`;
3916
+ }
3917
+ if (msg.includes("not accessible") || msg.includes("unauthorized") || msg.includes("permission")) {
3918
+ return `${rawMessage} Check API key scopes with get_credit_balance. A higher-tier plan may be required.`;
3919
+ }
3920
+ if (msg.includes("ssrf") || msg.includes("url blocked")) {
3921
+ return `${rawMessage} The URL was blocked for security. Use a publicly accessible HTTPS URL.`;
3922
+ }
3923
+ if (msg.includes("failed to schedule") || msg.includes("scheduling failed")) {
3924
+ return `${rawMessage} Verify platform OAuth is active with list_connected_accounts, then retry.`;
3925
+ }
3926
+ if (msg.includes("no posts") || msg.includes("plan") && msg.includes("has no")) {
3927
+ return `${rawMessage} Generate a plan with plan_content_week first, then save with save_content_plan.`;
3928
+ }
3929
+ return rawMessage;
3930
+ }
3931
+
3932
+ // src/tools/ideation.ts
3898
3933
  function registerIdeationTools(server2) {
3899
3934
  server2.tool(
3900
3935
  "generate_content",
@@ -4068,7 +4103,7 @@ Content Type: ${content_type}`;
4068
4103
  content: [
4069
4104
  {
4070
4105
  type: "text",
4071
- text: `Content generation failed: ${error}`
4106
+ text: formatToolError(`Content generation failed: ${error}`)
4072
4107
  }
4073
4108
  ],
4074
4109
  isError: true
@@ -4133,7 +4168,7 @@ Content Type: ${content_type}`;
4133
4168
  content: [
4134
4169
  {
4135
4170
  type: "text",
4136
- text: `Failed to fetch trends: ${error}`
4171
+ text: formatToolError(`Failed to fetch trends: ${error}`)
4137
4172
  }
4138
4173
  ],
4139
4174
  isError: true
@@ -4301,7 +4336,7 @@ ${content}`,
4301
4336
  content: [
4302
4337
  {
4303
4338
  type: "text",
4304
- text: `Content adaptation failed: ${error}`
4339
+ text: formatToolError(`Content adaptation failed: ${error}`)
4305
4340
  }
4306
4341
  ],
4307
4342
  isError: true
@@ -4612,7 +4647,7 @@ function registerContentTools(server2) {
4612
4647
  content: [
4613
4648
  {
4614
4649
  type: "text",
4615
- text: `Video generation failed to start: ${error}`
4650
+ text: formatToolError(`Video generation failed to start: ${error}`)
4616
4651
  }
4617
4652
  ],
4618
4653
  isError: true
@@ -4629,7 +4664,7 @@ function registerContentTools(server2) {
4629
4664
  content: [
4630
4665
  {
4631
4666
  type: "text",
4632
- text: "Video generation failed: no job ID returned."
4667
+ text: formatToolError("Video generation failed: no job ID returned.")
4633
4668
  }
4634
4669
  ],
4635
4670
  isError: true
@@ -4805,7 +4840,7 @@ function registerContentTools(server2) {
4805
4840
  content: [
4806
4841
  {
4807
4842
  type: "text",
4808
- text: `Image generation failed to start: ${error}`
4843
+ text: formatToolError(`Image generation failed to start: ${error}`)
4809
4844
  }
4810
4845
  ],
4811
4846
  isError: true
@@ -4822,7 +4857,7 @@ function registerContentTools(server2) {
4822
4857
  content: [
4823
4858
  {
4824
4859
  type: "text",
4825
- text: "Image generation failed: no job ID returned."
4860
+ text: formatToolError("Image generation failed: no job ID returned.")
4826
4861
  }
4827
4862
  ],
4828
4863
  isError: true
@@ -4946,7 +4981,7 @@ function registerContentTools(server2) {
4946
4981
  content: [
4947
4982
  {
4948
4983
  type: "text",
4949
- text: `Failed to look up job: ${sanitizeDbError(jobError)}`
4984
+ text: formatToolError(`Failed to look up job: ${sanitizeDbError(jobError)}`)
4950
4985
  }
4951
4986
  ],
4952
4987
  isError: true
@@ -4963,7 +4998,7 @@ function registerContentTools(server2) {
4963
4998
  content: [
4964
4999
  {
4965
5000
  type: "text",
4966
- text: `No job found with ID "${job_id}". The ID may be incorrect or the job has expired.`
5001
+ text: formatToolError(`No job found with ID "${job_id}". The ID may be incorrect or the job has expired.`)
4967
5002
  }
4968
5003
  ],
4969
5004
  isError: true
@@ -5211,7 +5246,7 @@ Return ONLY valid JSON in this exact format:
5211
5246
  content: [
5212
5247
  {
5213
5248
  type: "text",
5214
- text: `Storyboard generation failed: ${error}`
5249
+ text: formatToolError(`Storyboard generation failed: ${error}`)
5215
5250
  }
5216
5251
  ],
5217
5252
  isError: true
@@ -5346,7 +5381,7 @@ Return ONLY valid JSON in this exact format:
5346
5381
  content: [
5347
5382
  {
5348
5383
  type: "text",
5349
- text: `Voiceover generation failed: ${error}`
5384
+ text: formatToolError(`Voiceover generation failed: ${error}`)
5350
5385
  }
5351
5386
  ],
5352
5387
  isError: true
@@ -5363,7 +5398,7 @@ Return ONLY valid JSON in this exact format:
5363
5398
  content: [
5364
5399
  {
5365
5400
  type: "text",
5366
- text: "Voiceover generation failed: no audio URL returned."
5401
+ text: formatToolError("Voiceover generation failed: no audio URL returned.")
5367
5402
  }
5368
5403
  ],
5369
5404
  isError: true
@@ -5526,7 +5561,7 @@ Return ONLY valid JSON in this exact format:
5526
5561
  content: [
5527
5562
  {
5528
5563
  type: "text",
5529
- text: `Carousel generation failed: ${error}`
5564
+ text: formatToolError(`Carousel generation failed: ${error}`)
5530
5565
  }
5531
5566
  ],
5532
5567
  isError: true
@@ -5752,7 +5787,7 @@ Created with Social Neuron`;
5752
5787
  content: [
5753
5788
  {
5754
5789
  type: "text",
5755
- text: `Failed to schedule post: ${error}`
5790
+ text: formatToolError(`Failed to schedule post: ${error}`)
5756
5791
  }
5757
5792
  ],
5758
5793
  isError: true
@@ -5840,7 +5875,7 @@ Created with Social Neuron`;
5840
5875
  content: [
5841
5876
  {
5842
5877
  type: "text",
5843
- text: `Failed to list connected accounts: ${sanitizeDbError(error)}`
5878
+ text: formatToolError(`Failed to list connected accounts: ${sanitizeDbError(error)}`)
5844
5879
  }
5845
5880
  ],
5846
5881
  isError: true
@@ -5939,7 +5974,7 @@ Created with Social Neuron`;
5939
5974
  content: [
5940
5975
  {
5941
5976
  type: "text",
5942
- text: `Failed to list posts: ${sanitizeDbError(error)}`
5977
+ text: formatToolError(`Failed to list posts: ${sanitizeDbError(error)}`)
5943
5978
  }
5944
5979
  ],
5945
5980
  isError: true
@@ -6144,7 +6179,7 @@ Created with Social Neuron`;
6144
6179
  });
6145
6180
  return {
6146
6181
  content: [
6147
- { type: "text", text: `Failed to find slots: ${message}` }
6182
+ { type: "text", text: formatToolError(`Failed to find slots: ${message}`) }
6148
6183
  ],
6149
6184
  isError: true
6150
6185
  };
@@ -6214,7 +6249,7 @@ Created with Social Neuron`;
6214
6249
  content: [
6215
6250
  {
6216
6251
  type: "text",
6217
- text: `Failed to load content plan: ${sanitizeDbError(storedError)}`
6252
+ text: formatToolError(`Failed to load content plan: ${sanitizeDbError(storedError)}`)
6218
6253
  }
6219
6254
  ],
6220
6255
  isError: true
@@ -6225,7 +6260,7 @@ Created with Social Neuron`;
6225
6260
  content: [
6226
6261
  {
6227
6262
  type: "text",
6228
- text: `No content plan found for plan_id=${plan_id}`
6263
+ text: formatToolError(`No content plan found for plan_id=${plan_id}`)
6229
6264
  }
6230
6265
  ],
6231
6266
  isError: true
@@ -6240,7 +6275,7 @@ Created with Social Neuron`;
6240
6275
  content: [
6241
6276
  {
6242
6277
  type: "text",
6243
- text: `Stored plan ${plan_id} has no posts array.`
6278
+ text: formatToolError(`Stored plan ${plan_id} has no posts array.`)
6244
6279
  }
6245
6280
  ],
6246
6281
  isError: true
@@ -6279,7 +6314,7 @@ Created with Social Neuron`;
6279
6314
  content: [
6280
6315
  {
6281
6316
  type: "text",
6282
- text: `Failed to load plan approvals: ${sanitizeDbError(approvalsError)}`
6317
+ text: formatToolError(`Failed to load plan approvals: ${sanitizeDbError(approvalsError)}`)
6283
6318
  }
6284
6319
  ],
6285
6320
  isError: true
@@ -6714,7 +6749,7 @@ Created with Social Neuron`;
6714
6749
  content: [
6715
6750
  {
6716
6751
  type: "text",
6717
- text: `Batch scheduling failed: ${message}`
6752
+ text: formatToolError(`Batch scheduling failed: ${message}`)
6718
6753
  }
6719
6754
  ],
6720
6755
  isError: true
@@ -6807,7 +6842,7 @@ function registerAnalyticsTools(server2) {
6807
6842
  content: [
6808
6843
  {
6809
6844
  type: "text",
6810
- text: `Failed to fetch user-scoped posts: ${sanitizeDbError(postsError)}`
6845
+ text: formatToolError(`Failed to fetch user-scoped posts: ${sanitizeDbError(postsError)}`)
6811
6846
  }
6812
6847
  ],
6813
6848
  isError: true
@@ -6854,7 +6889,7 @@ function registerAnalyticsTools(server2) {
6854
6889
  content: [
6855
6890
  {
6856
6891
  type: "text",
6857
- text: `Failed to fetch analytics: ${sanitizeDbError(simpleError)}`
6892
+ text: formatToolError(`Failed to fetch analytics: ${sanitizeDbError(simpleError)}`)
6858
6893
  }
6859
6894
  ],
6860
6895
  isError: true
@@ -6984,7 +7019,7 @@ function registerAnalyticsTools(server2) {
6984
7019
  content: [
6985
7020
  {
6986
7021
  type: "text",
6987
- text: `Error refreshing analytics: ${error}`
7022
+ text: formatToolError(`Error refreshing analytics: ${error}`)
6988
7023
  }
6989
7024
  ],
6990
7025
  isError: true
@@ -7373,7 +7408,7 @@ function registerBrandTools(server2) {
7373
7408
  content: [
7374
7409
  {
7375
7410
  type: "text",
7376
- text: `Brand extraction failed: ${error}`
7411
+ text: formatToolError(`Brand extraction failed: ${error}`)
7377
7412
  }
7378
7413
  ],
7379
7414
  isError: true
@@ -7483,7 +7518,7 @@ function registerBrandTools(server2) {
7483
7518
  content: [
7484
7519
  {
7485
7520
  type: "text",
7486
- text: `Failed to load brand profile: ${sanitizeDbError(error)}`
7521
+ text: formatToolError(`Failed to load brand profile: ${sanitizeDbError(error)}`)
7487
7522
  }
7488
7523
  ],
7489
7524
  isError: true
@@ -7614,7 +7649,7 @@ function registerBrandTools(server2) {
7614
7649
  content: [
7615
7650
  {
7616
7651
  type: "text",
7617
- text: `Failed to save brand profile: ${sanitizeDbError(error)}`
7652
+ text: formatToolError(`Failed to save brand profile: ${sanitizeDbError(error)}`)
7618
7653
  }
7619
7654
  ],
7620
7655
  isError: true
@@ -7790,7 +7825,7 @@ Version: ${payload.version ?? "N/A"}`
7790
7825
  content: [
7791
7826
  {
7792
7827
  type: "text",
7793
- text: `Failed to update platform voice: ${saveError.message}`
7828
+ text: formatToolError(`Failed to update platform voice: ${saveError.message}`)
7794
7829
  }
7795
7830
  ],
7796
7831
  isError: true
@@ -8991,7 +9026,7 @@ function registerCommentsTools(server2) {
8991
9026
  if (error) {
8992
9027
  return {
8993
9028
  content: [
8994
- { type: "text", text: `Error listing comments: ${error}` }
9029
+ { type: "text", text: formatToolError(`Error listing comments: ${error}`) }
8995
9030
  ],
8996
9031
  isError: true
8997
9032
  };
@@ -9095,7 +9130,7 @@ function registerCommentsTools(server2) {
9095
9130
  content: [
9096
9131
  {
9097
9132
  type: "text",
9098
- text: `Error replying to comment: ${error}`
9133
+ text: formatToolError(`Error replying to comment: ${error}`)
9099
9134
  }
9100
9135
  ],
9101
9136
  isError: true
@@ -9181,7 +9216,7 @@ function registerCommentsTools(server2) {
9181
9216
  });
9182
9217
  return {
9183
9218
  content: [
9184
- { type: "text", text: `Error posting comment: ${error}` }
9219
+ { type: "text", text: formatToolError(`Error posting comment: ${error}`) }
9185
9220
  ],
9186
9221
  isError: true
9187
9222
  };
@@ -9268,7 +9303,7 @@ function registerCommentsTools(server2) {
9268
9303
  content: [
9269
9304
  {
9270
9305
  type: "text",
9271
- text: `Error moderating comment: ${error}`
9306
+ text: formatToolError(`Error moderating comment: ${error}`)
9272
9307
  }
9273
9308
  ],
9274
9309
  isError: true
@@ -9357,7 +9392,7 @@ function registerCommentsTools(server2) {
9357
9392
  });
9358
9393
  return {
9359
9394
  content: [
9360
- { type: "text", text: `Error deleting comment: ${error}` }
9395
+ { type: "text", text: formatToolError(`Error deleting comment: ${error}`) }
9361
9396
  ],
9362
9397
  isError: true
9363
9398
  };
@@ -9633,7 +9668,7 @@ function registerCreditsTools(server2) {
9633
9668
  content: [
9634
9669
  {
9635
9670
  type: "text",
9636
- text: `Failed to fetch credit balance: ${sanitizeDbError(profileResult.error)}`
9671
+ text: formatToolError(`Failed to fetch credit balance: ${sanitizeDbError(profileResult.error)}`)
9637
9672
  }
9638
9673
  ],
9639
9674
  isError: true
@@ -10279,7 +10314,7 @@ function registerExtractionTools(server2) {
10279
10314
  content: [
10280
10315
  {
10281
10316
  type: "text",
10282
- text: `Failed to extract YouTube video: ${error ?? "No data returned"}`
10317
+ text: formatToolError(`Failed to extract YouTube video: ${error ?? "No data returned"}`)
10283
10318
  }
10284
10319
  ],
10285
10320
  isError: true
@@ -10319,7 +10354,7 @@ function registerExtractionTools(server2) {
10319
10354
  content: [
10320
10355
  {
10321
10356
  type: "text",
10322
- text: `Failed to extract YouTube channel: ${error ?? "No data returned"}`
10357
+ text: formatToolError(`Failed to extract YouTube channel: ${error ?? "No data returned"}`)
10323
10358
  }
10324
10359
  ],
10325
10360
  isError: true
@@ -10350,7 +10385,7 @@ function registerExtractionTools(server2) {
10350
10385
  content: [
10351
10386
  {
10352
10387
  type: "text",
10353
- text: `Failed to extract URL content: ${error ?? "No data returned"}`
10388
+ text: formatToolError(`Failed to extract URL content: ${error ?? "No data returned"}`)
10354
10389
  }
10355
10390
  ],
10356
10391
  isError: true
@@ -10407,7 +10442,7 @@ function registerExtractionTools(server2) {
10407
10442
  });
10408
10443
  return {
10409
10444
  content: [
10410
- { type: "text", text: `Extraction failed: ${message}` }
10445
+ { type: "text", text: formatToolError(`Extraction failed: ${message}`) }
10411
10446
  ],
10412
10447
  isError: true
10413
10448
  };
@@ -10909,7 +10944,7 @@ ${ideationContext.promptInjection.slice(0, 1500)}` : "",
10909
10944
  content: [
10910
10945
  {
10911
10946
  type: "text",
10912
- text: `Plan generation failed: ${aiError ?? "No response from AI"}`
10947
+ text: formatToolError(`Plan generation failed: ${aiError ?? "No response from AI"}`)
10913
10948
  }
10914
10949
  ],
10915
10950
  isError: true
@@ -10929,10 +10964,10 @@ ${ideationContext.promptInjection.slice(0, 1500)}` : "",
10929
10964
  content: [
10930
10965
  {
10931
10966
  type: "text",
10932
- text: `AI response could not be parsed as JSON.
10967
+ text: formatToolError(`AI response could not be parsed as JSON.
10933
10968
 
10934
10969
  Raw output (first 1000 chars):
10935
- ${rawText.slice(0, 1e3)}`
10970
+ ${rawText.slice(0, 1e3)}`)
10936
10971
  }
10937
10972
  ],
10938
10973
  isError: true
@@ -11059,7 +11094,7 @@ ${rawText.slice(0, 1e3)}`
11059
11094
  content: [
11060
11095
  {
11061
11096
  type: "text",
11062
- text: `Plan generation failed: ${message}`
11097
+ text: formatToolError(`Plan generation failed: ${message}`)
11063
11098
  }
11064
11099
  ],
11065
11100
  isError: true
@@ -11172,7 +11207,7 @@ ${rawText.slice(0, 1e3)}`
11172
11207
  content: [
11173
11208
  {
11174
11209
  type: "text",
11175
- text: `Failed to save content plan: ${message}`
11210
+ text: formatToolError(`Failed to save content plan: ${message}`)
11176
11211
  }
11177
11212
  ],
11178
11213
  isError: true
@@ -11205,7 +11240,7 @@ ${rawText.slice(0, 1e3)}`
11205
11240
  content: [
11206
11241
  {
11207
11242
  type: "text",
11208
- text: `Failed to load content plan: ${sanitizeDbError(error)}`
11243
+ text: formatToolError(`Failed to load content plan: ${sanitizeDbError(error)}`)
11209
11244
  }
11210
11245
  ],
11211
11246
  isError: true
@@ -11216,7 +11251,7 @@ ${rawText.slice(0, 1e3)}`
11216
11251
  content: [
11217
11252
  {
11218
11253
  type: "text",
11219
- text: `No content plan found for plan_id=${plan_id}`
11254
+ text: formatToolError(`No content plan found for plan_id=${plan_id}`)
11220
11255
  }
11221
11256
  ],
11222
11257
  isError: true
@@ -11304,7 +11339,7 @@ ${rawText.slice(0, 1e3)}`
11304
11339
  content: [
11305
11340
  {
11306
11341
  type: "text",
11307
- text: `No content plan found for plan_id=${plan_id}`
11342
+ text: formatToolError(`No content plan found for plan_id=${plan_id}`)
11308
11343
  }
11309
11344
  ],
11310
11345
  isError: true
@@ -11348,7 +11383,7 @@ ${rawText.slice(0, 1e3)}`
11348
11383
  content: [
11349
11384
  {
11350
11385
  type: "text",
11351
- text: `Failed to update content plan: ${sanitizeDbError(saveError)}`
11386
+ text: formatToolError(`Failed to update content plan: ${sanitizeDbError(saveError)}`)
11352
11387
  }
11353
11388
  ],
11354
11389
  isError: true
@@ -11415,7 +11450,7 @@ ${rawText.slice(0, 1e3)}`
11415
11450
  content: [
11416
11451
  {
11417
11452
  type: "text",
11418
- text: `No content plan found for plan_id=${plan_id}`
11453
+ text: formatToolError(`No content plan found for plan_id=${plan_id}`)
11419
11454
  }
11420
11455
  ],
11421
11456
  isError: true
@@ -11428,7 +11463,7 @@ ${rawText.slice(0, 1e3)}`
11428
11463
  content: [
11429
11464
  {
11430
11465
  type: "text",
11431
- text: `Plan ${plan_id} has no posts to submit.`
11466
+ text: formatToolError(`Plan ${plan_id} has no posts to submit.`)
11432
11467
  }
11433
11468
  ],
11434
11469
  isError: true
@@ -11448,7 +11483,7 @@ ${rawText.slice(0, 1e3)}`
11448
11483
  content: [
11449
11484
  {
11450
11485
  type: "text",
11451
- text: `Failed to create approvals: ${sanitizeDbError(approvalError)}`
11486
+ text: formatToolError(`Failed to create approvals: ${sanitizeDbError(approvalError)}`)
11452
11487
  }
11453
11488
  ],
11454
11489
  isError: true
@@ -11460,7 +11495,7 @@ ${rawText.slice(0, 1e3)}`
11460
11495
  content: [
11461
11496
  {
11462
11497
  type: "text",
11463
- text: `Failed to update plan status: ${sanitizeDbError(statusError)}`
11498
+ text: formatToolError(`Failed to update plan status: ${sanitizeDbError(statusError)}`)
11464
11499
  }
11465
11500
  ],
11466
11501
  isError: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socialneuron/mcp-server",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "MCP server for Social Neuron - AI content creation platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,6 +22,7 @@
22
22
  "type": "git",
23
23
  "url": "git+https://github.com/socialneuron/mcp-server.git"
24
24
  },
25
+ "source": "./src/index.ts",
25
26
  "exports": {
26
27
  ".": "./dist/index.js",
27
28
  "./http": "./dist/http.js"
@@ -43,6 +44,7 @@
43
44
  "tiktok",
44
45
  "instagram"
45
46
  ],
47
+ "mcpName": "com.socialneuron/mcp-server",
46
48
  "publishConfig": {
47
49
  "access": "public"
48
50
  },