@socialneuron/mcp-server 1.2.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/CHANGELOG.md CHANGED
@@ -2,6 +2,47 @@
2
2
 
3
3
  All notable changes to `@socialneuron/mcp-server` will be documented in this file.
4
4
 
5
+ ## [1.3.0] - 2026-03-13
6
+
7
+ ### Added
8
+
9
+ - **Tool discovery**: `sn tools` command lists all 52 MCP tools, filterable by `--module` and `--scope`
10
+ - **Introspection**: `sn info` shows version, tool count, auth status, and credit balance (works offline)
11
+ - **Content plan CLI**: `sn plan list|view|approve` wrappers for content plan management
12
+ - **Presets**: `sn preset list|show|save|delete` with 6 built-in platform presets (instagram-reel, tiktok, youtube-short, etc.)
13
+ - **Interactive REPL**: `socialneuron-mcp repl` with tab completion and persistent auth
14
+ - **Progressive disclosure**: New `search_tools` MCP tool reduces agent token usage from 55K to ~500 tokens
15
+ - **Unified JSON envelope**: All CLI JSON output includes `schema_version: "1"`, `ok`, `command`, typed errors with `errorType` + `retryable` + `hint`
16
+ - **`--json` everywhere**: `--version --json`, `--help --json` now return structured JSON
17
+
18
+ ### Fixed
19
+
20
+ - Error handler (`withSnErrorHandling`) now wraps all dispatcher handler calls — consistent error formatting
21
+ - Flag validation runs before auth — missing flags show VALIDATION error, not AUTH error
22
+ - Deduplicated platform normalization in publish handler
23
+ - `schema_version: "1"` added to whoami, health, logout JSON output
24
+
25
+ ### Internal
26
+
27
+ - 52 tools (was 51), 759 tests (was 698), 374.7KB build
28
+ - New files: tool-catalog.ts, discovery.ts (CLI + MCP), planning.ts, presets.ts, repl.ts
29
+ - CLI E2E test suite (23 tests), MCP E2E test suite (13 tests)
30
+
31
+ ## [1.2.1] - 2026-03-11
32
+
33
+ ### Fixed
34
+
35
+ - **README**: Removed phantom "MCP API $19/mo" plan — pricing now matches actual tiers (Trial/Starter/Pro/Team)
36
+ - **README**: Rewrote scopes section with tool-to-scope mapping
37
+ - **README**: Security section now shows trust signals instead of implementation internals
38
+ - **README**: Added telemetry section with opt-out instructions (`DO_NOT_TRACK=1`)
39
+ - **README**: Added MCP vs CLI distinction, npx usage note, fixed tool count to 51
40
+ - **Device auth**: Removed decorative PKCE from device code flow (code_challenge was sent but never verified on exchange)
41
+ - **Logout**: Message now honestly says "removed from this device" with link to server-side revocation
42
+ - **LICENSE**: Added trade name "(trading as Social Neuron)" to copyright holder
43
+ - **SECURITY.md**: Removed phantom 1.1.x from supported versions (never published to npm)
44
+ - **CONTRIBUTING.md**: Added Developer Certificate of Origin (DCO) section
45
+
5
46
  ## [1.2.0] - 2026-03-10
6
47
 
7
48
  ### Added
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Cosmocodex Ltd
3
+ Copyright (c) 2026 Cosmocodex Ltd (trading as Social Neuron)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @socialneuron/mcp-server
2
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.
3
+ > 52 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
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)
@@ -13,7 +13,7 @@
13
13
  npx -y @socialneuron/mcp-server login --device
14
14
  ```
15
15
 
16
- This opens your browser to authorize access. Requires a paid Social Neuron plan (MCP API $19/mo or higher).
16
+ This opens your browser to authorize access. Requires a paid Social Neuron plan (Starter or above). See [pricing](https://socialneuron.com/pricing).
17
17
 
18
18
  ### 2. Add to Claude Code
19
19
 
@@ -92,7 +92,9 @@ Ask Claude things like:
92
92
  - "Check my analytics and suggest improvements"
93
93
  - "Set up autopilot to post 3 times per week"
94
94
 
95
- ## Tool Categories (51 tools)
95
+ ## Tool Categories (52 tools)
96
+
97
+ These tools are available to AI agents (Claude, Cursor, etc.) via the MCP protocol.
96
98
 
97
99
  ### Content Lifecycle
98
100
 
@@ -126,6 +128,7 @@ Ask Claude things like:
126
128
  | Remotion | list_compositions, render_demo_video | Programmatic video rendering |
127
129
  | Usage | get_mcp_usage | API usage monitoring |
128
130
  | YouTube | fetch_youtube_analytics | YouTube-specific deep analytics |
131
+ | Discovery | search_tools | Find tools by keyword with progressive detail levels (saves 98% tokens vs loading all tools) |
129
132
 
130
133
  ## Authentication
131
134
 
@@ -139,13 +142,13 @@ npx -y @socialneuron/mcp-server login --device
139
142
 
140
143
  Opens browser, you approve, CLI receives API key automatically.
141
144
 
142
- ### PKCE Browser Flow
145
+ ### Browser Flow
143
146
 
144
147
  ```bash
145
148
  npx -y @socialneuron/mcp-server login
146
149
  ```
147
150
 
148
- Browser-based OAuth flow with PKCE challenge.
151
+ Browser-based OAuth flow.
149
152
 
150
153
  ### API Key Paste
151
154
 
@@ -161,31 +164,38 @@ Keys are stored in your OS keychain (macOS Keychain, Linux secret-tool) or file
161
164
 
162
165
  ## Pricing
163
166
 
164
- MCP access requires a paid Social Neuron plan:
167
+ MCP access requires a paid plan:
165
168
 
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 |
169
+ | Plan | Price | Credits/mo | MCP Access |
170
+ |------|-------|-----------|------------|
171
+ | Free | $0 | 100 | |
172
+ | Starter | $29/mo | 800 | Read + Analytics |
173
+ | Pro | $79/mo | 2,000 | Full access |
174
+ | Team | $199/mo | 6,500 | Full access + Multi-user |
172
175
 
173
- **No free tier for MCP.** Sign up at [socialneuron.com/pricing](https://socialneuron.com/pricing).
176
+ Sign up at [socialneuron.com/pricing](https://socialneuron.com/pricing).
174
177
 
175
178
  ## Scopes
176
179
 
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 |
180
+ Each API key inherits scopes from your plan. Tools require specific scopes to execute.
181
+
182
+ | Scope | What you can do |
183
+ |-------|----------------|
184
+ | `mcp:read` | Analytics, insights, brand profiles, content plans, quality checks, screenshots, usage stats, credit balance |
185
+ | `mcp:write` | Generate content (video, image, voiceover, carousel), create storyboards, save brand profiles, plan content |
186
+ | `mcp:distribute` | Schedule posts, publish content plans |
187
+ | `mcp:analytics` | Refresh analytics, YouTube deep analytics |
188
+ | `mcp:comments` | List, reply, post, moderate, delete comments |
189
+ | `mcp:autopilot` | Configure and monitor automated scheduling |
190
+ | `mcp:full` | All of the above |
186
191
 
187
192
  ## CLI Reference
188
193
 
194
+ These commands run directly in your terminal — no AI agent needed. Useful for scripts, CI/CD, and quick checks.
195
+
196
+ > After global install (`npm i -g @socialneuron/mcp-server`), use `socialneuron-mcp` directly.
197
+ > Otherwise, prefix with `npx @socialneuron/mcp-server`.
198
+
189
199
  ```bash
190
200
  # Auth
191
201
  socialneuron-mcp login [--device|--paste]
@@ -205,6 +215,15 @@ socialneuron-mcp sn usage
205
215
  socialneuron-mcp sn loop
206
216
  socialneuron-mcp sn credits
207
217
 
218
+ # Agent-native CLI v2
219
+ socialneuron-mcp sn tools [--module ideation] [--scope mcp:write] # List/filter all 52 tools
220
+ socialneuron-mcp sn info # Version, auth, credits, tool count
221
+ socialneuron-mcp sn plan list|view|approve # Content plan management
222
+ socialneuron-mcp sn preset list|show|save|delete # Platform presets (6 built-in)
223
+
224
+ # Interactive REPL
225
+ socialneuron-mcp repl
226
+
208
227
  # Add --json to any command for machine-readable output
209
228
  ```
210
229
 
@@ -226,13 +245,22 @@ Each iteration produces smarter content as performance data feeds back into the
226
245
 
227
246
  ## Security
228
247
 
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
248
+ - All API keys are hashed before storage we never store plaintext keys
249
+ - Credentials stored in your OS keychain (macOS Keychain, Linux secret-tool) or environment variable
250
+ - SSRF protection on all URL parameters with DNS rebinding prevention
251
+ - Rate limiting per user with per-tool limits for expensive operations
252
+ - Agent loop detection prevents runaway automation
253
+ - Set `DO_NOT_TRACK=1` to disable anonymous usage telemetry
254
+
255
+ See [SECURITY.md](./SECURITY.md) for our vulnerability disclosure policy and credential safety details.
256
+
257
+ ## Telemetry
258
+
259
+ This package collects anonymous usage metrics (tool name, duration, success/failure) to improve the product. Your user ID is hashed before transmission.
260
+
261
+ **To disable**: Set `DO_NOT_TRACK=1` or `SOCIALNEURON_NO_TELEMETRY=1` in your environment.
262
+
263
+ No personal content, API keys, or request payloads are ever collected.
236
264
 
237
265
  ## Examples
238
266
 
package/dist/http.js CHANGED
@@ -618,7 +618,8 @@ var TOOL_SCOPES = {
618
618
  schedule_content_plan: "mcp:distribute",
619
619
  // mcp:read (usage is read-only)
620
620
  get_mcp_usage: "mcp:read",
621
- list_plan_approvals: "mcp:read"
621
+ list_plan_approvals: "mcp:read",
622
+ search_tools: "mcp:read"
622
623
  };
623
624
  function hasScope(userScopes, required) {
624
625
  if (userScopes.includes(required)) return true;
@@ -1287,11 +1288,11 @@ function asEnvelope(data) {
1287
1288
  };
1288
1289
  }
1289
1290
  var VIDEO_CREDIT_ESTIMATES = {
1290
- "veo3-fast": 156,
1291
- "veo3-quality": 780,
1292
- "runway-aleph": 260,
1293
- sora2: 390,
1294
- "sora2-pro": 1170,
1291
+ "veo3-fast": 200,
1292
+ "veo3-quality": 1e3,
1293
+ "runway-aleph": 340,
1294
+ sora2: 500,
1295
+ "sora2-pro": 1500,
1295
1296
  kling: 170,
1296
1297
  "kling-3": 100,
1297
1298
  "kling-3-pro": 135
@@ -6214,7 +6215,7 @@ init_supabase();
6214
6215
  import { z as z14 } from "zod";
6215
6216
 
6216
6217
  // src/lib/version.ts
6217
- var MCP_VERSION = "1.2.0";
6218
+ var MCP_VERSION = "1.3.0";
6218
6219
 
6219
6220
  // src/tools/usage.ts
6220
6221
  function asEnvelope10(data) {
@@ -7883,6 +7884,408 @@ function registerPlanApprovalTools(server) {
7883
7884
  );
7884
7885
  }
7885
7886
 
7887
+ // src/tools/discovery.ts
7888
+ import { z as z20 } from "zod";
7889
+
7890
+ // src/lib/tool-catalog.ts
7891
+ var TOOL_CATALOG = [
7892
+ // ideation
7893
+ {
7894
+ name: "generate_content",
7895
+ description: "Generate social media content ideas based on brand profile and trends",
7896
+ module: "ideation",
7897
+ scope: "mcp:write"
7898
+ },
7899
+ {
7900
+ name: "fetch_trends",
7901
+ description: "Fetch current trending topics for content ideation",
7902
+ module: "ideation",
7903
+ scope: "mcp:read"
7904
+ },
7905
+ // ideation-context
7906
+ {
7907
+ name: "get_ideation_context",
7908
+ description: "Get full ideation context including brand, analytics, and trends",
7909
+ module: "ideation-context",
7910
+ scope: "mcp:read"
7911
+ },
7912
+ // content
7913
+ {
7914
+ name: "adapt_content",
7915
+ description: "Adapt existing content for different platforms",
7916
+ module: "content",
7917
+ scope: "mcp:write"
7918
+ },
7919
+ {
7920
+ name: "generate_video",
7921
+ description: "Generate video content using AI",
7922
+ module: "content",
7923
+ scope: "mcp:write"
7924
+ },
7925
+ {
7926
+ name: "generate_image",
7927
+ description: "Generate images using AI",
7928
+ module: "content",
7929
+ scope: "mcp:write"
7930
+ },
7931
+ {
7932
+ name: "check_status",
7933
+ description: "Check status of async content generation job",
7934
+ module: "content",
7935
+ scope: "mcp:write"
7936
+ },
7937
+ {
7938
+ name: "create_storyboard",
7939
+ description: "Create a video storyboard with scenes and shots",
7940
+ module: "content",
7941
+ scope: "mcp:write"
7942
+ },
7943
+ {
7944
+ name: "generate_voiceover",
7945
+ description: "Generate AI voiceover audio",
7946
+ module: "content",
7947
+ scope: "mcp:write"
7948
+ },
7949
+ {
7950
+ name: "generate_carousel",
7951
+ description: "Generate carousel/slide content",
7952
+ module: "content",
7953
+ scope: "mcp:write"
7954
+ },
7955
+ // distribution
7956
+ {
7957
+ name: "schedule_post",
7958
+ description: "Schedule content for publishing to social platforms",
7959
+ module: "distribution",
7960
+ scope: "mcp:distribute"
7961
+ },
7962
+ {
7963
+ name: "list_recent_posts",
7964
+ description: "List recently published or scheduled posts",
7965
+ module: "distribution",
7966
+ scope: "mcp:read"
7967
+ },
7968
+ {
7969
+ name: "list_connected_accounts",
7970
+ description: "List connected social media accounts",
7971
+ module: "distribution",
7972
+ scope: "mcp:read"
7973
+ },
7974
+ // analytics
7975
+ {
7976
+ name: "fetch_analytics",
7977
+ description: "Fetch post performance analytics",
7978
+ module: "analytics",
7979
+ scope: "mcp:read"
7980
+ },
7981
+ {
7982
+ name: "refresh_platform_analytics",
7983
+ description: "Refresh analytics data from connected platforms",
7984
+ module: "analytics",
7985
+ scope: "mcp:analytics"
7986
+ },
7987
+ // insights
7988
+ {
7989
+ name: "get_performance_insights",
7990
+ description: "Get AI-generated performance insights",
7991
+ module: "insights",
7992
+ scope: "mcp:read"
7993
+ },
7994
+ {
7995
+ name: "get_best_posting_times",
7996
+ description: "Get recommended posting times based on audience data",
7997
+ module: "insights",
7998
+ scope: "mcp:read"
7999
+ },
8000
+ // brand
8001
+ {
8002
+ name: "extract_brand",
8003
+ description: "Extract brand identity from URL or text",
8004
+ module: "brand",
8005
+ scope: "mcp:read"
8006
+ },
8007
+ {
8008
+ name: "get_brand_profile",
8009
+ description: "Get the current brand profile",
8010
+ module: "brand",
8011
+ scope: "mcp:read"
8012
+ },
8013
+ {
8014
+ name: "save_brand_profile",
8015
+ description: "Save or update brand profile",
8016
+ module: "brand",
8017
+ scope: "mcp:write"
8018
+ },
8019
+ {
8020
+ name: "update_platform_voice",
8021
+ description: "Update platform-specific brand voice settings",
8022
+ module: "brand",
8023
+ scope: "mcp:write"
8024
+ },
8025
+ // screenshot
8026
+ {
8027
+ name: "capture_screenshot",
8028
+ description: "Capture a screenshot of a URL",
8029
+ module: "screenshot",
8030
+ scope: "mcp:read"
8031
+ },
8032
+ {
8033
+ name: "capture_app_page",
8034
+ description: "Capture a screenshot of an app page",
8035
+ module: "screenshot",
8036
+ scope: "mcp:read"
8037
+ },
8038
+ // remotion
8039
+ {
8040
+ name: "render_demo_video",
8041
+ description: "Render a demo video using Remotion",
8042
+ module: "remotion",
8043
+ scope: "mcp:write"
8044
+ },
8045
+ {
8046
+ name: "list_compositions",
8047
+ description: "List available Remotion video compositions",
8048
+ module: "remotion",
8049
+ scope: "mcp:read"
8050
+ },
8051
+ // youtube-analytics
8052
+ {
8053
+ name: "fetch_youtube_analytics",
8054
+ description: "Fetch YouTube channel analytics data",
8055
+ module: "youtube-analytics",
8056
+ scope: "mcp:analytics"
8057
+ },
8058
+ // comments
8059
+ {
8060
+ name: "list_comments",
8061
+ description: "List comments on published posts",
8062
+ module: "comments",
8063
+ scope: "mcp:comments"
8064
+ },
8065
+ {
8066
+ name: "reply_to_comment",
8067
+ description: "Reply to a comment on a post",
8068
+ module: "comments",
8069
+ scope: "mcp:comments"
8070
+ },
8071
+ {
8072
+ name: "post_comment",
8073
+ description: "Post a new comment",
8074
+ module: "comments",
8075
+ scope: "mcp:comments"
8076
+ },
8077
+ {
8078
+ name: "moderate_comment",
8079
+ description: "Moderate a comment (approve/hide/flag)",
8080
+ module: "comments",
8081
+ scope: "mcp:comments"
8082
+ },
8083
+ {
8084
+ name: "delete_comment",
8085
+ description: "Delete a comment",
8086
+ module: "comments",
8087
+ scope: "mcp:comments"
8088
+ },
8089
+ // planning
8090
+ {
8091
+ name: "plan_content_week",
8092
+ description: "Generate a weekly content plan",
8093
+ module: "planning",
8094
+ scope: "mcp:write"
8095
+ },
8096
+ {
8097
+ name: "save_content_plan",
8098
+ description: "Save a content plan",
8099
+ module: "planning",
8100
+ scope: "mcp:write"
8101
+ },
8102
+ {
8103
+ name: "get_content_plan",
8104
+ description: "Get a specific content plan by ID",
8105
+ module: "planning",
8106
+ scope: "mcp:read"
8107
+ },
8108
+ {
8109
+ name: "update_content_plan",
8110
+ description: "Update an existing content plan",
8111
+ module: "planning",
8112
+ scope: "mcp:write"
8113
+ },
8114
+ {
8115
+ name: "submit_content_plan_for_approval",
8116
+ description: "Submit a content plan for team approval",
8117
+ module: "planning",
8118
+ scope: "mcp:write"
8119
+ },
8120
+ {
8121
+ name: "schedule_content_plan",
8122
+ description: "Schedule all posts in an approved content plan",
8123
+ module: "planning",
8124
+ scope: "mcp:distribute"
8125
+ },
8126
+ {
8127
+ name: "find_next_slots",
8128
+ description: "Find next available scheduling slots",
8129
+ module: "planning",
8130
+ scope: "mcp:read"
8131
+ },
8132
+ // plan-approvals
8133
+ {
8134
+ name: "create_plan_approvals",
8135
+ description: "Create approval requests for a content plan",
8136
+ module: "plan-approvals",
8137
+ scope: "mcp:write"
8138
+ },
8139
+ {
8140
+ name: "respond_plan_approval",
8141
+ description: "Respond to a plan approval request",
8142
+ module: "plan-approvals",
8143
+ scope: "mcp:write"
8144
+ },
8145
+ {
8146
+ name: "list_plan_approvals",
8147
+ description: "List pending plan approval requests",
8148
+ module: "plan-approvals",
8149
+ scope: "mcp:read"
8150
+ },
8151
+ // quality
8152
+ {
8153
+ name: "quality_check",
8154
+ description: "Run quality checks on content before publishing",
8155
+ module: "quality",
8156
+ scope: "mcp:read"
8157
+ },
8158
+ {
8159
+ name: "quality_check_plan",
8160
+ description: "Run quality checks on an entire content plan",
8161
+ module: "quality",
8162
+ scope: "mcp:read"
8163
+ },
8164
+ // credits
8165
+ {
8166
+ name: "get_credit_balance",
8167
+ description: "Get current credit balance",
8168
+ module: "credits",
8169
+ scope: "mcp:read"
8170
+ },
8171
+ {
8172
+ name: "get_budget_status",
8173
+ description: "Get budget and spending status",
8174
+ module: "credits",
8175
+ scope: "mcp:read"
8176
+ },
8177
+ // autopilot
8178
+ {
8179
+ name: "list_autopilot_configs",
8180
+ description: "List autopilot configurations",
8181
+ module: "autopilot",
8182
+ scope: "mcp:autopilot"
8183
+ },
8184
+ {
8185
+ name: "update_autopilot_config",
8186
+ description: "Update autopilot configuration",
8187
+ module: "autopilot",
8188
+ scope: "mcp:autopilot"
8189
+ },
8190
+ {
8191
+ name: "get_autopilot_status",
8192
+ description: "Get current autopilot status",
8193
+ module: "autopilot",
8194
+ scope: "mcp:autopilot"
8195
+ },
8196
+ // extraction
8197
+ {
8198
+ name: "extract_url_content",
8199
+ description: "Extract content from a URL for repurposing",
8200
+ module: "extraction",
8201
+ scope: "mcp:read"
8202
+ },
8203
+ // loop-summary
8204
+ {
8205
+ name: "get_loop_summary",
8206
+ description: "Get growth loop summary and recommendations",
8207
+ module: "loop-summary",
8208
+ scope: "mcp:read"
8209
+ },
8210
+ // usage
8211
+ {
8212
+ name: "get_mcp_usage",
8213
+ description: "Get MCP usage statistics for the current billing period",
8214
+ module: "usage",
8215
+ scope: "mcp:read"
8216
+ },
8217
+ // discovery
8218
+ {
8219
+ name: "search_tools",
8220
+ description: "Search and discover available MCP tools",
8221
+ module: "discovery",
8222
+ scope: "mcp:read"
8223
+ }
8224
+ ];
8225
+ function getToolsByModule(module) {
8226
+ return TOOL_CATALOG.filter((t) => t.module === module);
8227
+ }
8228
+ function getToolsByScope(scope) {
8229
+ return TOOL_CATALOG.filter((t) => t.scope === scope);
8230
+ }
8231
+ function searchTools(query) {
8232
+ const q = query.toLowerCase();
8233
+ return TOOL_CATALOG.filter(
8234
+ (t) => t.name.toLowerCase().includes(q) || t.description.toLowerCase().includes(q)
8235
+ );
8236
+ }
8237
+
8238
+ // src/tools/discovery.ts
8239
+ function registerDiscoveryTools(server) {
8240
+ server.tool(
8241
+ "search_tools",
8242
+ 'Search and discover available MCP tools. Use detail level to control token usage: "name" (~50 tokens), "summary" (~500 tokens), "full" (complete schemas).',
8243
+ {
8244
+ query: z20.string().optional().describe("Search query to filter tools by name or description"),
8245
+ module: z20.string().optional().describe('Filter by module name (e.g. "planning", "content", "analytics")'),
8246
+ scope: z20.string().optional().describe('Filter by required scope (e.g. "mcp:read", "mcp:write")'),
8247
+ detail: z20.enum(["name", "summary", "full"]).default("summary").describe(
8248
+ 'Detail level: "name" for just tool names, "summary" for names + descriptions, "full" for complete info including scope and module'
8249
+ )
8250
+ },
8251
+ async ({ query, module, scope, detail }) => {
8252
+ let results = [...TOOL_CATALOG];
8253
+ if (query) {
8254
+ results = searchTools(query);
8255
+ }
8256
+ if (module) {
8257
+ const moduleTools = getToolsByModule(module);
8258
+ results = results.filter((t) => moduleTools.some((mt) => mt.name === t.name));
8259
+ }
8260
+ if (scope) {
8261
+ const scopeTools = getToolsByScope(scope);
8262
+ results = results.filter((t) => scopeTools.some((st) => st.name === t.name));
8263
+ }
8264
+ let output;
8265
+ switch (detail) {
8266
+ case "name":
8267
+ output = results.map((t) => t.name);
8268
+ break;
8269
+ case "summary":
8270
+ output = results.map((t) => ({ name: t.name, description: t.description }));
8271
+ break;
8272
+ case "full":
8273
+ default:
8274
+ output = results;
8275
+ break;
8276
+ }
8277
+ return {
8278
+ content: [
8279
+ {
8280
+ type: "text",
8281
+ text: JSON.stringify({ toolCount: results.length, tools: output }, null, 2)
8282
+ }
8283
+ ]
8284
+ };
8285
+ }
8286
+ );
8287
+ }
8288
+
7886
8289
  // src/lib/register-tools.ts
7887
8290
  function applyScopeEnforcement(server, scopeResolver) {
7888
8291
  const originalTool = server.tool.bind(server);
@@ -7946,6 +8349,7 @@ function registerAllTools(server, options) {
7946
8349
  registerQualityTools(server);
7947
8350
  registerPlanningTools(server);
7948
8351
  registerPlanApprovalTools(server);
8352
+ registerDiscoveryTools(server);
7949
8353
  }
7950
8354
 
7951
8355
  // src/http.ts