@nerviq/cli 1.20.1 → 1.21.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.
Files changed (181) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +2 -2
  3. package/package.json +1 -1
  4. package/src/activity.js +1039 -1039
  5. package/src/adoption-advisor.js +299 -299
  6. package/src/aider/config-parser.js +166 -166
  7. package/src/aider/context.js +4 -1
  8. package/src/aider/deep-review.js +316 -316
  9. package/src/aider/domain-packs.js +303 -303
  10. package/src/aider/freshness.js +93 -93
  11. package/src/aider/governance.js +253 -253
  12. package/src/aider/interactive.js +334 -334
  13. package/src/aider/mcp-packs.js +329 -329
  14. package/src/aider/patch.js +214 -214
  15. package/src/aider/plans.js +186 -186
  16. package/src/aider/premium.js +360 -360
  17. package/src/aider/setup.js +404 -404
  18. package/src/aider/techniques.js +312 -67
  19. package/src/analyze.js +951 -951
  20. package/src/anti-patterns.js +485 -485
  21. package/src/audit/instruction-files.js +180 -180
  22. package/src/audit/recommendations.js +577 -577
  23. package/src/auto-suggest.js +154 -154
  24. package/src/badge.js +13 -13
  25. package/src/behavioral-drift.js +801 -801
  26. package/src/benchmark.js +67 -67
  27. package/src/catalog.js +103 -103
  28. package/src/certification.js +128 -128
  29. package/src/codex/config-parser.js +183 -183
  30. package/src/codex/context.js +223 -223
  31. package/src/codex/deep-review.js +493 -493
  32. package/src/codex/domain-packs.js +394 -394
  33. package/src/codex/freshness.js +84 -84
  34. package/src/codex/governance.js +192 -192
  35. package/src/codex/interactive.js +618 -618
  36. package/src/codex/mcp-packs.js +914 -914
  37. package/src/codex/patch.js +209 -209
  38. package/src/codex/plans.js +251 -251
  39. package/src/codex/premium.js +614 -614
  40. package/src/codex/setup.js +591 -591
  41. package/src/continuous-ops.js +681 -681
  42. package/src/copilot/activity.js +309 -309
  43. package/src/copilot/deep-review.js +346 -346
  44. package/src/copilot/domain-packs.js +372 -372
  45. package/src/copilot/freshness.js +57 -57
  46. package/src/copilot/governance.js +222 -222
  47. package/src/copilot/interactive.js +406 -406
  48. package/src/copilot/mcp-packs.js +826 -826
  49. package/src/copilot/plans.js +253 -253
  50. package/src/copilot/premium.js +451 -451
  51. package/src/copilot/setup.js +488 -488
  52. package/src/cost-tracking.js +61 -61
  53. package/src/cursor/activity.js +301 -301
  54. package/src/cursor/config-parser.js +265 -265
  55. package/src/cursor/context.js +256 -256
  56. package/src/cursor/deep-review.js +334 -334
  57. package/src/cursor/domain-packs.js +368 -368
  58. package/src/cursor/freshness.js +65 -65
  59. package/src/cursor/governance.js +229 -229
  60. package/src/cursor/interactive.js +391 -391
  61. package/src/cursor/mcp-packs.js +828 -828
  62. package/src/cursor/plans.js +254 -254
  63. package/src/cursor/premium.js +469 -469
  64. package/src/cursor/setup.js +488 -488
  65. package/src/dashboard.js +493 -493
  66. package/src/deep-review.js +428 -428
  67. package/src/deprecation.js +98 -98
  68. package/src/diff-only.js +280 -280
  69. package/src/doctor.js +119 -119
  70. package/src/domain-pack-expansion.js +1033 -1033
  71. package/src/domain-packs.js +387 -387
  72. package/src/feedback.js +178 -178
  73. package/src/fix-engine.js +783 -783
  74. package/src/fix-prompts.js +122 -122
  75. package/src/formatters/sarif.js +115 -115
  76. package/src/freshness.js +74 -74
  77. package/src/gemini/config-parser.js +275 -275
  78. package/src/gemini/deep-review.js +559 -559
  79. package/src/gemini/domain-packs.js +393 -393
  80. package/src/gemini/freshness.js +66 -66
  81. package/src/gemini/governance.js +201 -201
  82. package/src/gemini/interactive.js +860 -860
  83. package/src/gemini/mcp-packs.js +915 -915
  84. package/src/gemini/plans.js +269 -269
  85. package/src/gemini/premium.js +760 -760
  86. package/src/gemini/setup.js +692 -692
  87. package/src/governance.js +72 -72
  88. package/src/harmony/add.js +68 -68
  89. package/src/harmony/advisor.js +333 -333
  90. package/src/harmony/canon.js +565 -565
  91. package/src/harmony/cli.js +591 -591
  92. package/src/harmony/drift.js +401 -401
  93. package/src/harmony/governance.js +313 -313
  94. package/src/harmony/memory.js +239 -239
  95. package/src/harmony/sync.js +475 -475
  96. package/src/harmony/watch.js +370 -370
  97. package/src/hook-validation.js +342 -342
  98. package/src/index.js +271 -271
  99. package/src/init.js +184 -184
  100. package/src/instruction-surfaces.js +185 -185
  101. package/src/integrations.js +144 -144
  102. package/src/interactive.js +118 -118
  103. package/src/locales/en.json +1 -1
  104. package/src/locales/es.json +1 -1
  105. package/src/mcp-packs.js +830 -830
  106. package/src/mcp-server.js +726 -726
  107. package/src/mcp-validation.js +337 -337
  108. package/src/nerviq-sync.json +7 -7
  109. package/src/opencode/config-parser.js +109 -109
  110. package/src/opencode/context.js +247 -247
  111. package/src/opencode/deep-review.js +313 -313
  112. package/src/opencode/domain-packs.js +262 -262
  113. package/src/opencode/freshness.js +66 -66
  114. package/src/opencode/governance.js +159 -159
  115. package/src/opencode/interactive.js +392 -392
  116. package/src/opencode/mcp-packs.js +705 -705
  117. package/src/opencode/patch.js +184 -184
  118. package/src/opencode/plans.js +231 -231
  119. package/src/opencode/premium.js +413 -413
  120. package/src/opencode/setup.js +449 -449
  121. package/src/opencode/techniques.js +27 -27
  122. package/src/operating-profile.js +574 -574
  123. package/src/org.js +152 -152
  124. package/src/permission-rules.js +218 -218
  125. package/src/plans.js +839 -839
  126. package/src/platform-change-manifest.js +86 -86
  127. package/src/plugins.js +110 -110
  128. package/src/policy-layers.js +210 -210
  129. package/src/profiles.js +124 -124
  130. package/src/prompt-injection.js +74 -74
  131. package/src/public-api.js +173 -173
  132. package/src/recommendation-rules.js +84 -84
  133. package/src/repo-archetype.js +386 -386
  134. package/src/secret-patterns.js +39 -39
  135. package/src/server.js +527 -527
  136. package/src/setup/analysis.js +607 -607
  137. package/src/setup/runtime.js +172 -172
  138. package/src/setup.js +677 -677
  139. package/src/shared/capabilities.js +194 -194
  140. package/src/source-urls.js +132 -132
  141. package/src/stack-checks.js +565 -565
  142. package/src/supplemental-checks.js +13 -13
  143. package/src/synergy/adaptive.js +261 -261
  144. package/src/synergy/compensation.js +137 -137
  145. package/src/synergy/evidence.js +193 -193
  146. package/src/synergy/learning.js +199 -199
  147. package/src/synergy/patterns.js +227 -227
  148. package/src/synergy/ranking.js +83 -83
  149. package/src/synergy/report.js +165 -165
  150. package/src/synergy/routing.js +146 -146
  151. package/src/techniques/api.js +407 -407
  152. package/src/techniques/automation.js +316 -316
  153. package/src/techniques/compliance.js +257 -257
  154. package/src/techniques/hygiene.js +294 -294
  155. package/src/techniques/instructions.js +243 -243
  156. package/src/techniques/observability.js +226 -226
  157. package/src/techniques/optimization.js +142 -142
  158. package/src/techniques/quality.js +318 -318
  159. package/src/techniques/security.js +237 -237
  160. package/src/techniques/shared.js +443 -443
  161. package/src/techniques/stacks.js +2294 -2294
  162. package/src/techniques/tools.js +106 -106
  163. package/src/techniques/workflow.js +413 -413
  164. package/src/techniques.js +81 -81
  165. package/src/terminology.js +73 -73
  166. package/src/token-estimate.js +35 -35
  167. package/src/usage-patterns.js +99 -99
  168. package/src/verification-metadata.js +145 -145
  169. package/src/watch.js +247 -247
  170. package/src/windsurf/activity.js +302 -302
  171. package/src/windsurf/config-parser.js +267 -267
  172. package/src/windsurf/deep-review.js +337 -337
  173. package/src/windsurf/domain-packs.js +370 -370
  174. package/src/windsurf/freshness.js +36 -36
  175. package/src/windsurf/governance.js +231 -231
  176. package/src/windsurf/interactive.js +388 -388
  177. package/src/windsurf/mcp-packs.js +792 -792
  178. package/src/windsurf/plans.js +247 -247
  179. package/src/windsurf/premium.js +468 -468
  180. package/src/windsurf/setup.js +471 -471
  181. package/src/workspace.js +375 -375
@@ -1,914 +1,914 @@
1
- /**
2
- * Codex MCP Pack System — CP-03
3
- *
4
- * 8 priority MCP packs with TOML-aware projection, detection,
5
- * recommendation, merge logic, and trust preflight.
6
- *
7
- * Codex MCP config lives in .codex/config.toml under [mcp_servers.<name>].
8
- * Each server uses TOML format with command/args/env/enabled_tools fields.
9
- */
10
-
11
- const CODEX_MCP_PACKS = [
12
- {
13
- key: 'context7-docs',
14
- label: 'Context7 Docs',
15
- description: 'Live, current framework and library documentation during Codex sessions.',
16
- useWhen: 'Repos that use any framework, library, or SDK and benefit from up-to-date docs.',
17
- adoption: 'Safe default docs pack for most application repos. No auth required.',
18
- trustLevel: 'high',
19
- transport: 'stdio',
20
- requiredAuth: [],
21
- serverName: 'context7',
22
- tomlProjection: {
23
- command: 'npx',
24
- args: ['-y', '@upstash/context7-mcp@latest'],
25
- },
26
- enabledTools: ['resolve-library-id', 'get-library-docs'],
27
- },
28
- {
29
- key: 'github-mcp',
30
- label: 'GitHub',
31
- description: 'Issue, PR, and repository context during Codex sessions.',
32
- useWhen: 'Repos hosted on GitHub that benefit from issue, PR, and repo context.',
33
- adoption: 'Recommended for any GitHub-hosted project. Requires GITHUB_PERSONAL_ACCESS_TOKEN.',
34
- trustLevel: 'medium',
35
- transport: 'stdio',
36
- requiredAuth: ['GITHUB_PERSONAL_ACCESS_TOKEN'],
37
- serverName: 'github',
38
- tomlProjection: {
39
- command: 'npx',
40
- args: ['-y', '@modelcontextprotocol/server-github'],
41
- env: { GITHUB_PERSONAL_ACCESS_TOKEN: '${GITHUB_PERSONAL_ACCESS_TOKEN}' },
42
- },
43
- enabledTools: [
44
- 'list_issues', 'get_issue', 'search_issues',
45
- 'list_pull_requests', 'get_pull_request',
46
- 'get_file_contents', 'search_code',
47
- ],
48
- },
49
- {
50
- key: 'playwright-mcp',
51
- label: 'Playwright Browser',
52
- description: 'Browser automation, E2E testing, and visual QA.',
53
- useWhen: 'Frontend repos with E2E tests or browser-based workflows.',
54
- adoption: 'Recommended for frontend-ui repos with E2E tests. No auth required.',
55
- trustLevel: 'medium',
56
- transport: 'stdio',
57
- requiredAuth: [],
58
- serverName: 'playwright',
59
- tomlProjection: {
60
- command: 'npx',
61
- args: ['-y', '@playwright/mcp@latest'],
62
- },
63
- enabledTools: [
64
- 'browser_navigate', 'browser_screenshot', 'browser_click',
65
- 'browser_type', 'browser_wait_for_selector',
66
- ],
67
- },
68
- {
69
- key: 'postgres-mcp',
70
- label: 'PostgreSQL',
71
- description: 'Schema inspection and query assistance for PostgreSQL databases.',
72
- useWhen: 'Repos with PostgreSQL databases that benefit from schema and query context.',
73
- adoption: 'Useful for backend-api and data-pipeline repos. Requires DATABASE_URL.',
74
- trustLevel: 'low',
75
- transport: 'stdio',
76
- requiredAuth: ['DATABASE_URL'],
77
- serverName: 'postgres',
78
- tomlProjection: {
79
- command: 'npx',
80
- args: ['-y', '@modelcontextprotocol/server-postgres', '${DATABASE_URL}'],
81
- },
82
- enabledTools: ['query', 'list_tables', 'describe_table'],
83
- },
84
- {
85
- key: 'memory-mcp',
86
- label: 'Memory / Knowledge Graph',
87
- description: 'Persistent entity and relationship tracking across Codex sessions.',
88
- useWhen: 'Long-running or complex projects with many interconnected concepts.',
89
- adoption: 'Safe for any repo. Stores data locally. No auth required.',
90
- trustLevel: 'high',
91
- transport: 'stdio',
92
- requiredAuth: [],
93
- serverName: 'memory',
94
- tomlProjection: {
95
- command: 'npx',
96
- args: ['-y', '@modelcontextprotocol/server-memory'],
97
- },
98
- enabledTools: [
99
- 'create_entities', 'create_relations', 'search_nodes',
100
- 'open_nodes', 'read_graph',
101
- ],
102
- },
103
- {
104
- key: 'sequential-thinking',
105
- label: 'Sequential Thinking',
106
- description: 'Structured step-by-step reasoning for complex problem-solving.',
107
- useWhen: 'Complex problem-solving sessions that benefit from structured reasoning.',
108
- adoption: 'Safe default for any repo. No auth required.',
109
- trustLevel: 'high',
110
- transport: 'stdio',
111
- requiredAuth: [],
112
- serverName: 'sequential-thinking',
113
- tomlProjection: {
114
- command: 'npx',
115
- args: ['-y', '@modelcontextprotocol/server-sequential-thinking'],
116
- },
117
- enabledTools: ['sequentialthinking'],
118
- },
119
- {
120
- key: 'filesystem-mcp',
121
- label: 'Filesystem',
122
- description: 'Read-only filesystem access for documentation and reference files.',
123
- useWhen: 'Repos with reference files, docs, or config that Codex needs to read outside sandbox.',
124
- adoption: 'Read-only default. Pass allowed directories as args.',
125
- trustLevel: 'medium',
126
- transport: 'stdio',
127
- requiredAuth: [],
128
- serverName: 'filesystem',
129
- tomlProjection: {
130
- command: 'npx',
131
- args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],
132
- },
133
- enabledTools: [
134
- 'read_file', 'list_directory', 'search_files', 'get_file_info',
135
- ],
136
- },
137
- {
138
- key: 'fetch-mcp',
139
- label: 'Fetch / HTTP',
140
- description: 'HTTP access for fetching web pages, APIs, and documentation.',
141
- useWhen: 'Repos that need HTTP access to external APIs or documentation sources.',
142
- adoption: 'Useful for repos integrating external services. No auth required.',
143
- trustLevel: 'medium',
144
- transport: 'stdio',
145
- requiredAuth: [],
146
- serverName: 'fetch',
147
- tomlProjection: {
148
- command: 'npx',
149
- args: ['-y', '@modelcontextprotocol/server-fetch'],
150
- },
151
- enabledTools: ['fetch'],
152
- },
153
- // --- Parity expansion: 18 new packs to match Claude's 26 ---
154
- {
155
- key: 'next-devtools',
156
- label: 'Next.js Devtools',
157
- description: 'Runtime-aware debugging and framework-specific tooling for Next.js.',
158
- useWhen: 'Next.js repos that need runtime-aware debugging.',
159
- adoption: 'Useful companion for frontend-ui repos running Next.js.',
160
- trustLevel: 'medium',
161
- transport: 'stdio',
162
- requiredAuth: [],
163
- serverName: 'next-devtools',
164
- tomlProjection: { command: 'npx', args: ['-y', 'next-devtools-mcp@latest'] },
165
- enabledTools: ['get_page_info', 'get_routes', 'get_components'],
166
- },
167
- {
168
- key: 'docker-mcp',
169
- label: 'Docker',
170
- description: 'Container management during Codex sessions.',
171
- useWhen: 'Repos with containerized workflows.',
172
- adoption: 'Requires Docker running locally.',
173
- trustLevel: 'medium',
174
- transport: 'stdio',
175
- requiredAuth: [],
176
- serverName: 'docker',
177
- tomlProjection: { command: 'npx', args: ['-y', '@hypnosis/docker-mcp-server'] },
178
- enabledTools: ['list_containers', 'container_logs', 'container_inspect'],
179
- },
180
- {
181
- key: 'notion-mcp',
182
- label: 'Notion',
183
- description: 'Access Notion documentation and wikis.',
184
- useWhen: 'Teams using Notion for docs or knowledge bases.',
185
- adoption: 'Requires NOTION_API_KEY.',
186
- trustLevel: 'medium',
187
- transport: 'stdio',
188
- requiredAuth: ['NOTION_API_KEY'],
189
- serverName: 'notion',
190
- tomlProjection: { command: 'npx', args: ['-y', '@notionhq/notion-mcp-server'], env: { NOTION_API_KEY: '${NOTION_API_KEY}' } },
191
- enabledTools: ['search', 'get_page', 'get_database'],
192
- },
193
- {
194
- key: 'linear-mcp',
195
- label: 'Linear',
196
- description: 'Issue tracking and sprint context.',
197
- useWhen: 'Teams using Linear for issue tracking.',
198
- adoption: 'Requires LINEAR_API_KEY.',
199
- trustLevel: 'medium',
200
- transport: 'stdio',
201
- requiredAuth: ['LINEAR_API_KEY'],
202
- serverName: 'linear',
203
- tomlProjection: { command: 'npx', args: ['-y', '@mseep/linear-mcp'], env: { LINEAR_API_KEY: '${LINEAR_API_KEY}' } },
204
- enabledTools: ['list_issues', 'get_issue', 'search_issues'],
205
- },
206
- {
207
- key: 'sentry-mcp',
208
- label: 'Sentry',
209
- description: 'Error tracking and debugging context.',
210
- useWhen: 'Repos with Sentry error tracking.',
211
- adoption: 'Requires SENTRY_AUTH_TOKEN.',
212
- trustLevel: 'medium',
213
- transport: 'stdio',
214
- requiredAuth: ['SENTRY_AUTH_TOKEN'],
215
- serverName: 'sentry',
216
- tomlProjection: { command: 'npx', args: ['-y', '@sentry/mcp-server'], env: { SENTRY_AUTH_TOKEN: '${SENTRY_AUTH_TOKEN}' } },
217
- enabledTools: ['get_issues', 'get_issue_details', 'search_errors'],
218
- },
219
- {
220
- key: 'slack-mcp',
221
- label: 'Slack',
222
- description: 'Draft and preview Slack messages.',
223
- useWhen: 'Teams using Slack for communication.',
224
- adoption: 'Requires SLACK_BOT_TOKEN.',
225
- trustLevel: 'low',
226
- transport: 'stdio',
227
- requiredAuth: ['SLACK_BOT_TOKEN'],
228
- serverName: 'slack',
229
- tomlProjection: { command: 'npx', args: ['-y', 'slack-mcp-server'], env: { SLACK_BOT_TOKEN: '${SLACK_BOT_TOKEN}' } },
230
- enabledTools: ['list_channels', 'post_message', 'search_messages'],
231
- },
232
- {
233
- key: 'stripe-mcp',
234
- label: 'Stripe',
235
- description: 'Payment and billing workflow context.',
236
- useWhen: 'Repos with Stripe integration.',
237
- adoption: 'Requires STRIPE_API_KEY.',
238
- trustLevel: 'low',
239
- transport: 'stdio',
240
- requiredAuth: ['STRIPE_API_KEY'],
241
- serverName: 'stripe',
242
- tomlProjection: { command: 'npx', args: ['-y', '@stripe/mcp'], env: { STRIPE_API_KEY: '${STRIPE_API_KEY}' } },
243
- enabledTools: ['list_products', 'get_subscription', 'search_customers'],
244
- },
245
- {
246
- key: 'figma-mcp',
247
- label: 'Figma',
248
- description: 'Design file access and component inspection.',
249
- useWhen: 'Design-heavy repos needing Figma access.',
250
- adoption: 'Requires FIGMA_ACCESS_TOKEN.',
251
- trustLevel: 'medium',
252
- transport: 'stdio',
253
- requiredAuth: ['FIGMA_ACCESS_TOKEN'],
254
- serverName: 'figma',
255
- tomlProjection: { command: 'npx', args: ['-y', 'claude-talk-to-figma-mcp'], env: { FIGMA_ACCESS_TOKEN: '${FIGMA_ACCESS_TOKEN}' } },
256
- enabledTools: ['get_file', 'get_components', 'get_styles'],
257
- },
258
- {
259
- key: 'mcp-security',
260
- label: 'MCP Security Scanner',
261
- description: 'Scan MCP servers for tool poisoning and prompt injection.',
262
- useWhen: 'Any repo with 2+ MCP servers.',
263
- adoption: 'Safety companion for multi-MCP setups.',
264
- trustLevel: 'high',
265
- transport: 'stdio',
266
- requiredAuth: [],
267
- serverName: 'mcp-scan',
268
- tomlProjection: { command: 'npx', args: ['-y', 'mcp-scan@latest'] },
269
- enabledTools: ['scan_servers', 'check_tools'],
270
- },
271
- {
272
- key: 'composio-mcp',
273
- label: 'Composio Universal',
274
- description: '500+ integrations through a single MCP gateway.',
275
- useWhen: 'Enterprise or integration-heavy repos.',
276
- adoption: 'Requires COMPOSIO_API_KEY.',
277
- trustLevel: 'medium',
278
- transport: 'stdio',
279
- requiredAuth: ['COMPOSIO_API_KEY'],
280
- serverName: 'composio',
281
- tomlProjection: { command: 'npx', args: ['-y', '@composio/mcp'], env: { COMPOSIO_API_KEY: '${COMPOSIO_API_KEY}' } },
282
- enabledTools: [],
283
- },
284
- {
285
- key: 'jira-confluence',
286
- label: 'Jira',
287
- description: 'Issue tracking and project management.',
288
- useWhen: 'Teams using Atlassian Jira.',
289
- adoption: 'Requires ATLASSIAN_API_TOKEN and ATLASSIAN_EMAIL.',
290
- trustLevel: 'medium',
291
- transport: 'stdio',
292
- requiredAuth: ['ATLASSIAN_API_TOKEN', 'ATLASSIAN_EMAIL'],
293
- serverName: 'jira',
294
- tomlProjection: { command: 'npx', args: ['-y', 'jira-mcp'], env: { ATLASSIAN_API_TOKEN: '${ATLASSIAN_API_TOKEN}', ATLASSIAN_EMAIL: '${ATLASSIAN_EMAIL}' } },
295
- enabledTools: ['list_issues', 'get_issue', 'search_issues'],
296
- },
297
- {
298
- key: 'ga4-analytics',
299
- label: 'Google Analytics 4',
300
- description: 'Live GA4 data, attribution, and audience insights.',
301
- useWhen: 'Repos with web analytics needs.',
302
- adoption: 'Requires GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS.',
303
- trustLevel: 'medium',
304
- transport: 'stdio',
305
- requiredAuth: ['GA4_PROPERTY_ID', 'GOOGLE_APPLICATION_CREDENTIALS'],
306
- serverName: 'ga4',
307
- tomlProjection: { command: 'npx', args: ['-y', 'mcp-server-ga4'], env: { GA4_PROPERTY_ID: '${GA4_PROPERTY_ID}', GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}' } },
308
- enabledTools: ['run_report', 'get_metadata'],
309
- },
310
- {
311
- key: 'search-console',
312
- label: 'Google Search Console',
313
- description: 'Search performance and indexing data.',
314
- useWhen: 'SEO-focused repos.',
315
- adoption: 'Requires Google OAuth credentials.',
316
- trustLevel: 'medium',
317
- transport: 'stdio',
318
- requiredAuth: ['GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET'],
319
- serverName: 'gsc',
320
- tomlProjection: { command: 'npx', args: ['-y', 'mcp-gsc@latest'], env: { GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}', GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}' } },
321
- enabledTools: ['search_analytics', 'get_sitemaps'],
322
- },
323
- {
324
- key: 'n8n-workflows',
325
- label: 'n8n Workflow Automation',
326
- description: 'Workflow automation with 1,396 integration nodes.',
327
- useWhen: 'Teams using n8n for workflow automation.',
328
- adoption: 'Requires N8N_URL and N8N_API_KEY.',
329
- trustLevel: 'medium',
330
- transport: 'stdio',
331
- requiredAuth: ['N8N_URL', 'N8N_API_KEY'],
332
- serverName: 'n8n',
333
- tomlProjection: { command: 'npx', args: ['-y', 'n8n-mcp-server@latest'], env: { N8N_URL: '${N8N_URL}', N8N_API_KEY: '${N8N_API_KEY}' } },
334
- enabledTools: ['list_workflows', 'execute_workflow'],
335
- },
336
- {
337
- key: 'zendesk-mcp',
338
- label: 'Zendesk',
339
- description: 'Ticket management and help center content.',
340
- useWhen: 'Support teams using Zendesk.',
341
- adoption: 'Requires ZENDESK_API_TOKEN and ZENDESK_SUBDOMAIN.',
342
- trustLevel: 'medium',
343
- transport: 'stdio',
344
- requiredAuth: ['ZENDESK_API_TOKEN', 'ZENDESK_SUBDOMAIN'],
345
- serverName: 'zendesk',
346
- tomlProjection: { command: 'npx', args: ['-y', 'zendesk-mcp'], env: { ZENDESK_API_TOKEN: '${ZENDESK_API_TOKEN}', ZENDESK_SUBDOMAIN: '${ZENDESK_SUBDOMAIN}' } },
347
- enabledTools: ['list_tickets', 'get_ticket', 'search_tickets'],
348
- },
349
- {
350
- key: 'infisical-secrets',
351
- label: 'Infisical Secrets',
352
- description: 'Secrets management with auto-rotation.',
353
- useWhen: 'Repos using Infisical for secrets.',
354
- adoption: 'Requires INFISICAL_TOKEN.',
355
- trustLevel: 'low',
356
- transport: 'stdio',
357
- requiredAuth: ['INFISICAL_TOKEN'],
358
- serverName: 'infisical',
359
- tomlProjection: { command: 'npx', args: ['-y', '@infisical/mcp'], env: { INFISICAL_TOKEN: '${INFISICAL_TOKEN}' } },
360
- enabledTools: ['get_secret', 'list_secrets'],
361
- },
362
- {
363
- key: 'shopify-mcp',
364
- label: 'Shopify',
365
- description: 'Shopify API and deployment tooling.',
366
- useWhen: 'Shopify stores and apps.',
367
- adoption: 'Requires SHOPIFY_ACCESS_TOKEN.',
368
- trustLevel: 'medium',
369
- transport: 'stdio',
370
- requiredAuth: ['SHOPIFY_ACCESS_TOKEN'],
371
- serverName: 'shopify',
372
- tomlProjection: { command: 'npx', args: ['-y', 'shopify-mcp'], env: { SHOPIFY_ACCESS_TOKEN: '${SHOPIFY_ACCESS_TOKEN}' } },
373
- enabledTools: ['get_products', 'get_orders'],
374
- },
375
- {
376
- key: 'huggingface-mcp',
377
- label: 'Hugging Face',
378
- description: 'Model search, dataset discovery, and Spaces.',
379
- useWhen: 'AI/ML repos needing model registry access.',
380
- adoption: 'Requires HF_TOKEN.',
381
- trustLevel: 'medium',
382
- transport: 'stdio',
383
- requiredAuth: ['HF_TOKEN'],
384
- serverName: 'huggingface',
385
- tomlProjection: { command: 'npx', args: ['-y', 'huggingface-mcp-server'], env: { HF_TOKEN: '${HF_TOKEN}' } },
386
- enabledTools: ['search_models', 'get_model_info', 'search_datasets'],
387
- },
388
- // ── 23 new packs ─────────────────────────────────────────────────────────
389
- {
390
- key: 'supabase-mcp', label: 'Supabase',
391
- description: 'Database, auth, and storage for Supabase.',
392
- useWhen: 'Repos using Supabase.',
393
- adoption: 'Requires: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY.',
394
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['SUPABASE_URL', 'SUPABASE_SERVICE_ROLE_KEY'],
395
- serverName: 'supabase',
396
- tomlProjection: { command: 'npx', args: ['-y', '@supabase/mcp-server-supabase@latest'],
397
- env: { SUPABASE_URL: '${SUPABASE_URL}', SUPABASE_SERVICE_ROLE_KEY: '${SUPABASE_SERVICE_ROLE_KEY}' } },
398
- enabledTools: ['list_tables', 'query', 'insert', 'update'],
399
- },
400
- {
401
- key: 'prisma-mcp', label: 'Prisma ORM',
402
- description: 'Schema inspection and migrations via Prisma.',
403
- useWhen: 'Repos with a Prisma schema.',
404
- adoption: 'Requires: DATABASE_URL.',
405
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['DATABASE_URL'],
406
- serverName: 'prisma',
407
- tomlProjection: { command: 'npx', args: ['-y', 'prisma-mcp-server@latest'],
408
- env: { DATABASE_URL: '${DATABASE_URL}' } },
409
- enabledTools: ['introspect_schema', 'list_models', 'query_raw'],
410
- },
411
- {
412
- key: 'vercel-mcp', label: 'Vercel',
413
- description: 'Deployment management via Vercel.',
414
- useWhen: 'Repos deployed on Vercel.',
415
- adoption: 'Requires: VERCEL_TOKEN.',
416
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['VERCEL_TOKEN'],
417
- serverName: 'vercel',
418
- tomlProjection: { command: 'npx', args: ['-y', '@vercel/mcp-server@latest'],
419
- env: { VERCEL_TOKEN: '${VERCEL_TOKEN}' } },
420
- enabledTools: ['list_projects', 'get_deployment', 'list_deployments'],
421
- },
422
- {
423
- key: 'cloudflare-mcp', label: 'Cloudflare',
424
- description: 'Workers, KV, R2, and D1 management.',
425
- useWhen: 'Repos using Cloudflare edge.',
426
- adoption: 'Requires: CLOUDFLARE_API_TOKEN.',
427
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CLOUDFLARE_API_TOKEN'],
428
- serverName: 'cloudflare',
429
- tomlProjection: { command: 'npx', args: ['-y', '@cloudflare/mcp-server-cloudflare@latest'],
430
- env: { CLOUDFLARE_API_TOKEN: '${CLOUDFLARE_API_TOKEN}' } },
431
- enabledTools: ['list_workers', 'get_kv', 'list_r2_buckets'],
432
- },
433
- {
434
- key: 'aws-mcp', label: 'AWS',
435
- description: 'S3, Lambda, DynamoDB access.',
436
- useWhen: 'Repos using AWS.',
437
- adoption: 'Requires: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION.',
438
- trustLevel: 'low', transport: 'stdio', requiredAuth: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_REGION'],
439
- serverName: 'aws',
440
- tomlProjection: { command: 'npx', args: ['-y', '@aws-samples/mcp-server-aws@latest'],
441
- env: { AWS_ACCESS_KEY_ID: '${AWS_ACCESS_KEY_ID}', AWS_SECRET_ACCESS_KEY: '${AWS_SECRET_ACCESS_KEY}', AWS_REGION: '${AWS_REGION}' } },
442
- enabledTools: ['list_buckets', 'list_functions', 'list_tables'],
443
- },
444
- {
445
- key: 'redis-mcp', label: 'Redis',
446
- description: 'Cache and session management.',
447
- useWhen: 'Repos using Redis.',
448
- adoption: 'Requires: REDIS_URL.',
449
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['REDIS_URL'],
450
- serverName: 'redis',
451
- tomlProjection: { command: 'npx', args: ['-y', 'redis-mcp-server@latest'],
452
- env: { REDIS_URL: '${REDIS_URL}' } },
453
- enabledTools: ['get', 'set', 'del', 'hget', 'hset'],
454
- },
455
- {
456
- key: 'mongodb-mcp', label: 'MongoDB',
457
- description: 'Document database access.',
458
- useWhen: 'Repos using MongoDB.',
459
- adoption: 'Requires: MONGODB_URI.',
460
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['MONGODB_URI'],
461
- serverName: 'mongodb',
462
- tomlProjection: { command: 'npx', args: ['-y', '@mongodb-js/mongodb-mcp-server@latest'],
463
- env: { MONGODB_URI: '${MONGODB_URI}' } },
464
- enabledTools: ['find', 'insertOne', 'updateOne', 'deleteOne'],
465
- },
466
- {
467
- key: 'twilio-mcp', label: 'Twilio',
468
- description: 'SMS, voice, and messaging.',
469
- useWhen: 'Repos using Twilio.',
470
- adoption: 'Requires: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN.',
471
- trustLevel: 'low', transport: 'stdio', requiredAuth: ['TWILIO_ACCOUNT_SID', 'TWILIO_AUTH_TOKEN'],
472
- serverName: 'twilio',
473
- tomlProjection: { command: 'npx', args: ['-y', 'twilio-mcp-server@latest'],
474
- env: { TWILIO_ACCOUNT_SID: '${TWILIO_ACCOUNT_SID}', TWILIO_AUTH_TOKEN: '${TWILIO_AUTH_TOKEN}' } },
475
- enabledTools: ['send_sms', 'list_messages', 'list_calls'],
476
- },
477
- {
478
- key: 'sendgrid-mcp', label: 'SendGrid',
479
- description: 'Transactional email delivery.',
480
- useWhen: 'Repos using SendGrid.',
481
- adoption: 'Requires: SENDGRID_API_KEY.',
482
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['SENDGRID_API_KEY'],
483
- serverName: 'sendgrid',
484
- tomlProjection: { command: 'npx', args: ['-y', 'sendgrid-mcp-server@latest'],
485
- env: { SENDGRID_API_KEY: '${SENDGRID_API_KEY}' } },
486
- enabledTools: ['send_email', 'list_templates', 'get_stats'],
487
- },
488
- {
489
- key: 'algolia-mcp', label: 'Algolia Search',
490
- description: 'Search indexing via Algolia.',
491
- useWhen: 'Repos using Algolia.',
492
- adoption: 'Requires: ALGOLIA_APP_ID, ALGOLIA_API_KEY.',
493
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['ALGOLIA_APP_ID', 'ALGOLIA_API_KEY'],
494
- serverName: 'algolia',
495
- tomlProjection: { command: 'npx', args: ['-y', 'algolia-mcp-server@latest'],
496
- env: { ALGOLIA_APP_ID: '${ALGOLIA_APP_ID}', ALGOLIA_API_KEY: '${ALGOLIA_API_KEY}' } },
497
- enabledTools: ['search', 'list_indices', 'get_index'],
498
- },
499
- {
500
- key: 'planetscale-mcp', label: 'PlanetScale',
501
- description: 'Serverless MySQL via PlanetScale.',
502
- useWhen: 'Repos on PlanetScale.',
503
- adoption: 'Requires: PLANETSCALE_TOKEN.',
504
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['PLANETSCALE_TOKEN'],
505
- serverName: 'planetscale',
506
- tomlProjection: { command: 'npx', args: ['-y', 'planetscale-mcp-server@latest'],
507
- env: { PLANETSCALE_TOKEN: '${PLANETSCALE_TOKEN}' } },
508
- enabledTools: ['list_databases', 'list_branches', 'execute_query'],
509
- },
510
- {
511
- key: 'neon-mcp', label: 'Neon Serverless Postgres',
512
- description: 'Serverless Postgres via Neon.',
513
- useWhen: 'Repos using Neon.',
514
- adoption: 'Requires: NEON_API_KEY.',
515
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['NEON_API_KEY'],
516
- serverName: 'neon',
517
- tomlProjection: { command: 'npx', args: ['-y', '@neondatabase/mcp-server-neon@latest'],
518
- env: { NEON_API_KEY: '${NEON_API_KEY}' } },
519
- enabledTools: ['list_projects', 'list_branches', 'execute_sql'],
520
- },
521
- {
522
- key: 'turso-mcp', label: 'Turso Edge SQLite',
523
- description: 'Edge SQLite via Turso.',
524
- useWhen: 'Repos using Turso.',
525
- adoption: 'Requires: TURSO_DATABASE_URL, TURSO_AUTH_TOKEN.',
526
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['TURSO_DATABASE_URL', 'TURSO_AUTH_TOKEN'],
527
- serverName: 'turso',
528
- tomlProjection: { command: 'npx', args: ['-y', 'turso-mcp-server@latest'],
529
- env: { TURSO_DATABASE_URL: '${TURSO_DATABASE_URL}', TURSO_AUTH_TOKEN: '${TURSO_AUTH_TOKEN}' } },
530
- enabledTools: ['execute_query', 'list_tables'],
531
- },
532
- {
533
- key: 'upstash-mcp', label: 'Upstash Redis+Kafka',
534
- description: 'Serverless Redis and Kafka.',
535
- useWhen: 'Repos using Upstash.',
536
- adoption: 'Requires: UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN.',
537
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN'],
538
- serverName: 'upstash',
539
- tomlProjection: { command: 'npx', args: ['-y', '@upstash/mcp-server@latest'],
540
- env: { UPSTASH_REDIS_REST_URL: '${UPSTASH_REDIS_REST_URL}', UPSTASH_REDIS_REST_TOKEN: '${UPSTASH_REDIS_REST_TOKEN}' } },
541
- enabledTools: ['redis_get', 'redis_set', 'redis_del'],
542
- },
543
- {
544
- key: 'convex-mcp', label: 'Convex',
545
- description: 'Reactive backend via Convex.',
546
- useWhen: 'Repos using Convex.',
547
- adoption: 'Requires: CONVEX_DEPLOYMENT.',
548
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CONVEX_DEPLOYMENT'],
549
- serverName: 'convex',
550
- tomlProjection: { command: 'npx', args: ['-y', '@convex-dev/mcp-server@latest'],
551
- env: { CONVEX_DEPLOYMENT: '${CONVEX_DEPLOYMENT}' } },
552
- enabledTools: ['run_query', 'run_mutation', 'list_functions'],
553
- },
554
- {
555
- key: 'clerk-mcp', label: 'Clerk Authentication',
556
- description: 'User auth via Clerk.',
557
- useWhen: 'Repos using Clerk.',
558
- adoption: 'Requires: CLERK_SECRET_KEY.',
559
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CLERK_SECRET_KEY'],
560
- serverName: 'clerk',
561
- tomlProjection: { command: 'npx', args: ['-y', '@clerk/mcp-server@latest'],
562
- env: { CLERK_SECRET_KEY: '${CLERK_SECRET_KEY}' } },
563
- enabledTools: ['list_users', 'get_user', 'create_user'],
564
- },
565
- {
566
- key: 'resend-mcp', label: 'Resend Email',
567
- description: 'Transactional email via Resend.',
568
- useWhen: 'Repos using Resend.',
569
- adoption: 'Requires: RESEND_API_KEY.',
570
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['RESEND_API_KEY'],
571
- serverName: 'resend',
572
- tomlProjection: { command: 'npx', args: ['-y', 'resend-mcp-server@latest'],
573
- env: { RESEND_API_KEY: '${RESEND_API_KEY}' } },
574
- enabledTools: ['send_email', 'list_domains', 'get_email'],
575
- },
576
- {
577
- key: 'temporal-mcp', label: 'Temporal Workflow',
578
- description: 'Workflow orchestration via Temporal.',
579
- useWhen: 'Repos using Temporal.',
580
- adoption: 'Requires: TEMPORAL_ADDRESS.',
581
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['TEMPORAL_ADDRESS'],
582
- serverName: 'temporal',
583
- tomlProjection: { command: 'npx', args: ['-y', 'temporal-mcp-server@latest'],
584
- env: { TEMPORAL_ADDRESS: '${TEMPORAL_ADDRESS}' } },
585
- enabledTools: ['list_workflows', 'get_workflow', 'signal_workflow'],
586
- },
587
- {
588
- key: 'launchdarkly-mcp', label: 'LaunchDarkly',
589
- description: 'Feature flags via LaunchDarkly.',
590
- useWhen: 'Repos using LaunchDarkly.',
591
- adoption: 'Requires: LAUNCHDARKLY_ACCESS_TOKEN.',
592
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['LAUNCHDARKLY_ACCESS_TOKEN'],
593
- serverName: 'launchdarkly',
594
- tomlProjection: { command: 'npx', args: ['-y', 'launchdarkly-mcp-server@latest'],
595
- env: { LAUNCHDARKLY_ACCESS_TOKEN: '${LAUNCHDARKLY_ACCESS_TOKEN}' } },
596
- enabledTools: ['list_flags', 'get_flag', 'toggle_flag'],
597
- },
598
- {
599
- key: 'datadog-mcp', label: 'Datadog',
600
- description: 'Monitoring and APM via Datadog.',
601
- useWhen: 'Repos using Datadog.',
602
- adoption: 'Requires: DATADOG_API_KEY, DATADOG_APP_KEY.',
603
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['DATADOG_API_KEY', 'DATADOG_APP_KEY'],
604
- serverName: 'datadog',
605
- tomlProjection: { command: 'npx', args: ['-y', '@datadog/mcp-server@latest'],
606
- env: { DATADOG_API_KEY: '${DATADOG_API_KEY}', DATADOG_APP_KEY: '${DATADOG_APP_KEY}' } },
607
- enabledTools: ['query_metrics', 'list_monitors', 'search_logs'],
608
- },
609
- {
610
- key: 'grafana-mcp', label: 'Grafana',
611
- description: 'Dashboards via Grafana.',
612
- useWhen: 'Repos using Grafana.',
613
- adoption: 'Requires: GRAFANA_URL, GRAFANA_API_KEY.',
614
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['GRAFANA_URL', 'GRAFANA_API_KEY'],
615
- serverName: 'grafana',
616
- tomlProjection: { command: 'npx', args: ['-y', 'grafana-mcp-server@latest'],
617
- env: { GRAFANA_URL: '${GRAFANA_URL}', GRAFANA_API_KEY: '${GRAFANA_API_KEY}' } },
618
- enabledTools: ['list_dashboards', 'get_panel', 'query_datasource'],
619
- },
620
- {
621
- key: 'circleci-mcp', label: 'CircleCI',
622
- description: 'CI/CD via CircleCI.',
623
- useWhen: 'Repos using CircleCI.',
624
- adoption: 'Requires: CIRCLECI_TOKEN.',
625
- trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CIRCLECI_TOKEN'],
626
- serverName: 'circleci',
627
- tomlProjection: { command: 'npx', args: ['-y', 'circleci-mcp-server@latest'],
628
- env: { CIRCLECI_TOKEN: '${CIRCLECI_TOKEN}' } },
629
- enabledTools: ['list_pipelines', 'get_pipeline', 'list_jobs'],
630
- },
631
- {
632
- key: 'anthropic-mcp', label: 'Anthropic Claude API',
633
- description: 'Claude API for AI-powered apps.',
634
- useWhen: 'Repos building on Claude API.',
635
- adoption: 'Requires: ANTHROPIC_API_KEY.',
636
- trustLevel: 'high', transport: 'stdio', requiredAuth: ['ANTHROPIC_API_KEY'],
637
- serverName: 'anthropic',
638
- tomlProjection: { command: 'npx', args: ['-y', '@anthropic-ai/mcp-server@latest'],
639
- env: { ANTHROPIC_API_KEY: '${ANTHROPIC_API_KEY}' } },
640
- enabledTools: ['create_message', 'list_models'],
641
- },
642
- ];
643
-
644
- // --- Helpers ---
645
-
646
- function clone(value) {
647
- return JSON.parse(JSON.stringify(value));
648
- }
649
-
650
- function hasDependency(deps, name) {
651
- return Object.prototype.hasOwnProperty.call(deps || {}, name);
652
- }
653
-
654
- function hasFileContentMatch(ctx, filePath, pattern) {
655
- if (!ctx) return false;
656
- const content = ctx.fileContent(filePath);
657
- return !!(content && pattern.test(content));
658
- }
659
-
660
- function getProjectDependencies(ctx) {
661
- if (!ctx) return {};
662
- if (typeof ctx.projectDependencies === 'function') {
663
- return ctx.projectDependencies();
664
- }
665
- const pkg = ctx.jsonFile('package.json') || {};
666
- return {
667
- ...(pkg.dependencies || {}),
668
- ...(pkg.devDependencies || {}),
669
- };
670
- }
671
-
672
- function hasPostgresSignals(ctx, deps) {
673
- if (
674
- hasDependency(deps, 'pg') ||
675
- hasDependency(deps, 'postgres') ||
676
- hasDependency(deps, 'pg-promise') ||
677
- hasDependency(deps, 'slonik') ||
678
- hasDependency(deps, '@neondatabase/serverless') ||
679
- hasDependency(deps, '@vercel/postgres')
680
- ) {
681
- return true;
682
- }
683
- return (
684
- hasFileContentMatch(ctx, 'prisma/schema.prisma', /provider\s*=\s*["']postgresql["']/i) ||
685
- hasFileContentMatch(ctx, 'docker-compose.yml', /\bpostgres\b/i) ||
686
- hasFileContentMatch(ctx, 'docker-compose.yaml', /\bpostgres\b/i) ||
687
- hasFileContentMatch(ctx, '.env', /postgres(?:ql)?:\/\//i) ||
688
- hasFileContentMatch(ctx, '.env.example', /postgres(?:ql)?:\/\//i)
689
- );
690
- }
691
-
692
- // --- Core Functions ---
693
-
694
- function getCodexMcpPack(key) {
695
- return CODEX_MCP_PACKS.find(pack => pack.key === key) || null;
696
- }
697
-
698
- function normalizeCodexMcpPackKeys(keys = []) {
699
- return [...new Set((Array.isArray(keys) ? keys : [])
700
- .map(key => `${key}`.trim())
701
- .filter(Boolean))]
702
- .filter(key => !!getCodexMcpPack(key));
703
- }
704
-
705
- /**
706
- * Generate TOML string for a single MCP pack.
707
- */
708
- function packToToml(pack) {
709
- const lines = [];
710
- lines.push(`[mcp_servers.${pack.serverName}]`);
711
- const proj = pack.tomlProjection;
712
-
713
- if (proj.command) {
714
- lines.push(`command = "${proj.command}"`);
715
- }
716
- if (proj.url) {
717
- lines.push(`url = "${proj.url}"`);
718
- }
719
- if (proj.args && proj.args.length > 0) {
720
- const argsStr = proj.args.map(a => `"${a}"`).join(', ');
721
- lines.push(`args = [${argsStr}]`);
722
- }
723
- if (proj.env) {
724
- const envPairs = Object.entries(proj.env)
725
- .map(([k, v]) => `${k} = "${v}"`)
726
- .join(', ');
727
- lines.push(`env = { ${envPairs} }`);
728
- }
729
- if (pack.enabledTools && pack.enabledTools.length > 0) {
730
- const toolsStr = pack.enabledTools.map(t => `"${t}"`).join(', ');
731
- lines.push(`enabled_tools = [${toolsStr}]`);
732
- }
733
- lines.push('enabled = true');
734
- lines.push('required = false');
735
-
736
- return lines.join('\n');
737
- }
738
-
739
- /**
740
- * Generate TOML for multiple packs.
741
- */
742
- function packsToToml(packKeys = []) {
743
- return normalizeCodexMcpPackKeys(packKeys)
744
- .map(key => {
745
- const pack = getCodexMcpPack(key);
746
- return pack ? packToToml(pack) : null;
747
- })
748
- .filter(Boolean)
749
- .join('\n\n');
750
- }
751
-
752
- /**
753
- * Detect which MCP packs to recommend for a Codex project.
754
- */
755
- function recommendCodexMcpPacks(stacks = [], domainPacks = [], options = {}) {
756
- const recommended = new Set();
757
- const stackKeys = new Set(stacks.map(s => s.key));
758
- const ctx = options.ctx || null;
759
- const deps = getProjectDependencies(ctx);
760
- const domainKeys = new Set(domainPacks.map(p => p.key));
761
-
762
- // Context7 docs for any project with detected stacks
763
- if (stackKeys.size > 0) {
764
- recommended.add('context7-docs');
765
- }
766
-
767
- // GitHub for collaborative / governed repos
768
- if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo')) {
769
- recommended.add('github-mcp');
770
- }
771
-
772
- // Playwright for frontend repos
773
- if (
774
- domainKeys.has('frontend-ui') ||
775
- stackKeys.has('react') || stackKeys.has('nextjs') ||
776
- stackKeys.has('vue') || stackKeys.has('angular') || stackKeys.has('svelte')
777
- ) {
778
- recommended.add('playwright-mcp');
779
- }
780
-
781
- // Postgres when explicit signals exist
782
- if (
783
- (domainKeys.has('backend-api') || domainKeys.has('infra-platform')) &&
784
- hasPostgresSignals(ctx, deps)
785
- ) {
786
- recommended.add('postgres-mcp');
787
- }
788
-
789
- // Memory for complex / monorepo / long-lived projects
790
- if (domainKeys.has('monorepo') || domainKeys.has('enterprise-governed')) {
791
- recommended.add('memory-mcp');
792
- }
793
-
794
- // Sequential thinking for complex problem-solving
795
- if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo') || domainKeys.has('infra-platform')) {
796
- recommended.add('sequential-thinking');
797
- }
798
-
799
- // Filesystem for infra repos with reference docs
800
- if (domainKeys.has('infra-platform')) {
801
- recommended.add('filesystem-mcp');
802
- }
803
-
804
- // Fetch for repos with external API integrations
805
- if (domainKeys.has('backend-api') && ctx && (
806
- hasDependency(deps, 'axios') ||
807
- hasDependency(deps, 'node-fetch') ||
808
- hasDependency(deps, 'got') ||
809
- hasDependency(deps, 'ky') ||
810
- hasDependency(deps, 'undici')
811
- )) {
812
- recommended.add('fetch-mcp');
813
- }
814
-
815
- // Fallback: always recommend context7 if nothing else matched
816
- if (recommended.size === 0) {
817
- recommended.add('context7-docs');
818
- }
819
-
820
- return CODEX_MCP_PACKS
821
- .filter(pack => recommended.has(pack.key))
822
- .map(pack => clone(pack));
823
- }
824
-
825
- /**
826
- * Get required env vars for a set of pack keys.
827
- */
828
- function getCodexMcpRequiredEnvVars(packKeys = []) {
829
- const required = new Set();
830
- for (const key of normalizeCodexMcpPackKeys(packKeys)) {
831
- const pack = getCodexMcpPack(key);
832
- if (!pack) continue;
833
- for (const envVar of pack.requiredAuth) {
834
- required.add(envVar);
835
- }
836
- }
837
- return [...required].sort();
838
- }
839
-
840
- /**
841
- * Trust preflight: check if packs are safe to install.
842
- */
843
- function getCodexMcpPreflight(packKeys = [], env = process.env) {
844
- return normalizeCodexMcpPackKeys(packKeys)
845
- .map(key => {
846
- const pack = getCodexMcpPack(key);
847
- if (!pack) return null;
848
- const missingEnvVars = pack.requiredAuth.filter(envKey => {
849
- const value = env && Object.prototype.hasOwnProperty.call(env, envKey) ? env[envKey] : '';
850
- return !`${value || ''}`.trim();
851
- });
852
- return {
853
- key,
854
- label: pack.label,
855
- trustLevel: pack.trustLevel,
856
- requiredAuth: pack.requiredAuth,
857
- missingEnvVars,
858
- safe: missingEnvVars.length === 0,
859
- warning: missingEnvVars.length > 0
860
- ? `Missing env vars: ${missingEnvVars.join(', ')}. Pack will be included but may fail at runtime.`
861
- : null,
862
- };
863
- })
864
- .filter(Boolean);
865
- }
866
-
867
- /**
868
- * Merge TOML: generate safe TOML additions for new MCP packs.
869
- * Returns the TOML string to append (does not modify existing config).
870
- */
871
- function mergeCodexMcpToml(existingConfigContent = '', packKeys = []) {
872
- const existingServers = new Set();
873
-
874
- // Parse existing [mcp_servers.*] sections to avoid duplicates
875
- const serverPattern = /\[mcp_servers\.([^\]]+)\]/g;
876
- let match;
877
- while ((match = serverPattern.exec(existingConfigContent)) !== null) {
878
- existingServers.add(match[1]);
879
- }
880
-
881
- const newPacks = normalizeCodexMcpPackKeys(packKeys)
882
- .map(key => getCodexMcpPack(key))
883
- .filter(pack => pack && !existingServers.has(pack.serverName));
884
-
885
- if (newPacks.length === 0) return '';
886
-
887
- const lines = [
888
- '',
889
- '# <!-- nerviq:mcp-packs:start -->',
890
- '# MCP packs added by nerviq',
891
- ];
892
-
893
- for (const pack of newPacks) {
894
- lines.push('');
895
- lines.push(packToToml(pack));
896
- }
897
-
898
- lines.push('');
899
- lines.push('# <!-- nerviq:mcp-packs:end -->');
900
-
901
- return lines.join('\n');
902
- }
903
-
904
- module.exports = {
905
- CODEX_MCP_PACKS,
906
- getCodexMcpPack,
907
- normalizeCodexMcpPackKeys,
908
- packToToml,
909
- packsToToml,
910
- recommendCodexMcpPacks,
911
- getCodexMcpRequiredEnvVars,
912
- getCodexMcpPreflight,
913
- mergeCodexMcpToml,
914
- };
1
+ /**
2
+ * Codex MCP Pack System — CP-03
3
+ *
4
+ * 8 priority MCP packs with TOML-aware projection, detection,
5
+ * recommendation, merge logic, and trust preflight.
6
+ *
7
+ * Codex MCP config lives in .codex/config.toml under [mcp_servers.<name>].
8
+ * Each server uses TOML format with command/args/env/enabled_tools fields.
9
+ */
10
+
11
+ const CODEX_MCP_PACKS = [
12
+ {
13
+ key: 'context7-docs',
14
+ label: 'Context7 Docs',
15
+ description: 'Live, current framework and library documentation during Codex sessions.',
16
+ useWhen: 'Repos that use any framework, library, or SDK and benefit from up-to-date docs.',
17
+ adoption: 'Safe default docs pack for most application repos. No auth required.',
18
+ trustLevel: 'high',
19
+ transport: 'stdio',
20
+ requiredAuth: [],
21
+ serverName: 'context7',
22
+ tomlProjection: {
23
+ command: 'npx',
24
+ args: ['-y', '@upstash/context7-mcp@latest'],
25
+ },
26
+ enabledTools: ['resolve-library-id', 'get-library-docs'],
27
+ },
28
+ {
29
+ key: 'github-mcp',
30
+ label: 'GitHub',
31
+ description: 'Issue, PR, and repository context during Codex sessions.',
32
+ useWhen: 'Repos hosted on GitHub that benefit from issue, PR, and repo context.',
33
+ adoption: 'Recommended for any GitHub-hosted project. Requires GITHUB_PERSONAL_ACCESS_TOKEN.',
34
+ trustLevel: 'medium',
35
+ transport: 'stdio',
36
+ requiredAuth: ['GITHUB_PERSONAL_ACCESS_TOKEN'],
37
+ serverName: 'github',
38
+ tomlProjection: {
39
+ command: 'npx',
40
+ args: ['-y', '@modelcontextprotocol/server-github'],
41
+ env: { GITHUB_PERSONAL_ACCESS_TOKEN: '${GITHUB_PERSONAL_ACCESS_TOKEN}' },
42
+ },
43
+ enabledTools: [
44
+ 'list_issues', 'get_issue', 'search_issues',
45
+ 'list_pull_requests', 'get_pull_request',
46
+ 'get_file_contents', 'search_code',
47
+ ],
48
+ },
49
+ {
50
+ key: 'playwright-mcp',
51
+ label: 'Playwright Browser',
52
+ description: 'Browser automation, E2E testing, and visual QA.',
53
+ useWhen: 'Frontend repos with E2E tests or browser-based workflows.',
54
+ adoption: 'Recommended for frontend-ui repos with E2E tests. No auth required.',
55
+ trustLevel: 'medium',
56
+ transport: 'stdio',
57
+ requiredAuth: [],
58
+ serverName: 'playwright',
59
+ tomlProjection: {
60
+ command: 'npx',
61
+ args: ['-y', '@playwright/mcp@latest'],
62
+ },
63
+ enabledTools: [
64
+ 'browser_navigate', 'browser_screenshot', 'browser_click',
65
+ 'browser_type', 'browser_wait_for_selector',
66
+ ],
67
+ },
68
+ {
69
+ key: 'postgres-mcp',
70
+ label: 'PostgreSQL',
71
+ description: 'Schema inspection and query assistance for PostgreSQL databases.',
72
+ useWhen: 'Repos with PostgreSQL databases that benefit from schema and query context.',
73
+ adoption: 'Useful for backend-api and data-pipeline repos. Requires DATABASE_URL.',
74
+ trustLevel: 'low',
75
+ transport: 'stdio',
76
+ requiredAuth: ['DATABASE_URL'],
77
+ serverName: 'postgres',
78
+ tomlProjection: {
79
+ command: 'npx',
80
+ args: ['-y', '@modelcontextprotocol/server-postgres', '${DATABASE_URL}'],
81
+ },
82
+ enabledTools: ['query', 'list_tables', 'describe_table'],
83
+ },
84
+ {
85
+ key: 'memory-mcp',
86
+ label: 'Memory / Knowledge Graph',
87
+ description: 'Persistent entity and relationship tracking across Codex sessions.',
88
+ useWhen: 'Long-running or complex projects with many interconnected concepts.',
89
+ adoption: 'Safe for any repo. Stores data locally. No auth required.',
90
+ trustLevel: 'high',
91
+ transport: 'stdio',
92
+ requiredAuth: [],
93
+ serverName: 'memory',
94
+ tomlProjection: {
95
+ command: 'npx',
96
+ args: ['-y', '@modelcontextprotocol/server-memory'],
97
+ },
98
+ enabledTools: [
99
+ 'create_entities', 'create_relations', 'search_nodes',
100
+ 'open_nodes', 'read_graph',
101
+ ],
102
+ },
103
+ {
104
+ key: 'sequential-thinking',
105
+ label: 'Sequential Thinking',
106
+ description: 'Structured step-by-step reasoning for complex problem-solving.',
107
+ useWhen: 'Complex problem-solving sessions that benefit from structured reasoning.',
108
+ adoption: 'Safe default for any repo. No auth required.',
109
+ trustLevel: 'high',
110
+ transport: 'stdio',
111
+ requiredAuth: [],
112
+ serverName: 'sequential-thinking',
113
+ tomlProjection: {
114
+ command: 'npx',
115
+ args: ['-y', '@modelcontextprotocol/server-sequential-thinking'],
116
+ },
117
+ enabledTools: ['sequentialthinking'],
118
+ },
119
+ {
120
+ key: 'filesystem-mcp',
121
+ label: 'Filesystem',
122
+ description: 'Read-only filesystem access for documentation and reference files.',
123
+ useWhen: 'Repos with reference files, docs, or config that Codex needs to read outside sandbox.',
124
+ adoption: 'Read-only default. Pass allowed directories as args.',
125
+ trustLevel: 'medium',
126
+ transport: 'stdio',
127
+ requiredAuth: [],
128
+ serverName: 'filesystem',
129
+ tomlProjection: {
130
+ command: 'npx',
131
+ args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],
132
+ },
133
+ enabledTools: [
134
+ 'read_file', 'list_directory', 'search_files', 'get_file_info',
135
+ ],
136
+ },
137
+ {
138
+ key: 'fetch-mcp',
139
+ label: 'Fetch / HTTP',
140
+ description: 'HTTP access for fetching web pages, APIs, and documentation.',
141
+ useWhen: 'Repos that need HTTP access to external APIs or documentation sources.',
142
+ adoption: 'Useful for repos integrating external services. No auth required.',
143
+ trustLevel: 'medium',
144
+ transport: 'stdio',
145
+ requiredAuth: [],
146
+ serverName: 'fetch',
147
+ tomlProjection: {
148
+ command: 'npx',
149
+ args: ['-y', '@modelcontextprotocol/server-fetch'],
150
+ },
151
+ enabledTools: ['fetch'],
152
+ },
153
+ // --- Parity expansion: 18 new packs to match Claude's 26 ---
154
+ {
155
+ key: 'next-devtools',
156
+ label: 'Next.js Devtools',
157
+ description: 'Runtime-aware debugging and framework-specific tooling for Next.js.',
158
+ useWhen: 'Next.js repos that need runtime-aware debugging.',
159
+ adoption: 'Useful companion for frontend-ui repos running Next.js.',
160
+ trustLevel: 'medium',
161
+ transport: 'stdio',
162
+ requiredAuth: [],
163
+ serverName: 'next-devtools',
164
+ tomlProjection: { command: 'npx', args: ['-y', 'next-devtools-mcp@latest'] },
165
+ enabledTools: ['get_page_info', 'get_routes', 'get_components'],
166
+ },
167
+ {
168
+ key: 'docker-mcp',
169
+ label: 'Docker',
170
+ description: 'Container management during Codex sessions.',
171
+ useWhen: 'Repos with containerized workflows.',
172
+ adoption: 'Requires Docker running locally.',
173
+ trustLevel: 'medium',
174
+ transport: 'stdio',
175
+ requiredAuth: [],
176
+ serverName: 'docker',
177
+ tomlProjection: { command: 'npx', args: ['-y', '@hypnosis/docker-mcp-server'] },
178
+ enabledTools: ['list_containers', 'container_logs', 'container_inspect'],
179
+ },
180
+ {
181
+ key: 'notion-mcp',
182
+ label: 'Notion',
183
+ description: 'Access Notion documentation and wikis.',
184
+ useWhen: 'Teams using Notion for docs or knowledge bases.',
185
+ adoption: 'Requires NOTION_API_KEY.',
186
+ trustLevel: 'medium',
187
+ transport: 'stdio',
188
+ requiredAuth: ['NOTION_API_KEY'],
189
+ serverName: 'notion',
190
+ tomlProjection: { command: 'npx', args: ['-y', '@notionhq/notion-mcp-server'], env: { NOTION_API_KEY: '${NOTION_API_KEY}' } },
191
+ enabledTools: ['search', 'get_page', 'get_database'],
192
+ },
193
+ {
194
+ key: 'linear-mcp',
195
+ label: 'Linear',
196
+ description: 'Issue tracking and sprint context.',
197
+ useWhen: 'Teams using Linear for issue tracking.',
198
+ adoption: 'Requires LINEAR_API_KEY.',
199
+ trustLevel: 'medium',
200
+ transport: 'stdio',
201
+ requiredAuth: ['LINEAR_API_KEY'],
202
+ serverName: 'linear',
203
+ tomlProjection: { command: 'npx', args: ['-y', '@mseep/linear-mcp'], env: { LINEAR_API_KEY: '${LINEAR_API_KEY}' } },
204
+ enabledTools: ['list_issues', 'get_issue', 'search_issues'],
205
+ },
206
+ {
207
+ key: 'sentry-mcp',
208
+ label: 'Sentry',
209
+ description: 'Error tracking and debugging context.',
210
+ useWhen: 'Repos with Sentry error tracking.',
211
+ adoption: 'Requires SENTRY_AUTH_TOKEN.',
212
+ trustLevel: 'medium',
213
+ transport: 'stdio',
214
+ requiredAuth: ['SENTRY_AUTH_TOKEN'],
215
+ serverName: 'sentry',
216
+ tomlProjection: { command: 'npx', args: ['-y', '@sentry/mcp-server'], env: { SENTRY_AUTH_TOKEN: '${SENTRY_AUTH_TOKEN}' } },
217
+ enabledTools: ['get_issues', 'get_issue_details', 'search_errors'],
218
+ },
219
+ {
220
+ key: 'slack-mcp',
221
+ label: 'Slack',
222
+ description: 'Draft and preview Slack messages.',
223
+ useWhen: 'Teams using Slack for communication.',
224
+ adoption: 'Requires SLACK_BOT_TOKEN.',
225
+ trustLevel: 'low',
226
+ transport: 'stdio',
227
+ requiredAuth: ['SLACK_BOT_TOKEN'],
228
+ serverName: 'slack',
229
+ tomlProjection: { command: 'npx', args: ['-y', 'slack-mcp-server'], env: { SLACK_BOT_TOKEN: '${SLACK_BOT_TOKEN}' } },
230
+ enabledTools: ['list_channels', 'post_message', 'search_messages'],
231
+ },
232
+ {
233
+ key: 'stripe-mcp',
234
+ label: 'Stripe',
235
+ description: 'Payment and billing workflow context.',
236
+ useWhen: 'Repos with Stripe integration.',
237
+ adoption: 'Requires STRIPE_API_KEY.',
238
+ trustLevel: 'low',
239
+ transport: 'stdio',
240
+ requiredAuth: ['STRIPE_API_KEY'],
241
+ serverName: 'stripe',
242
+ tomlProjection: { command: 'npx', args: ['-y', '@stripe/mcp'], env: { STRIPE_API_KEY: '${STRIPE_API_KEY}' } },
243
+ enabledTools: ['list_products', 'get_subscription', 'search_customers'],
244
+ },
245
+ {
246
+ key: 'figma-mcp',
247
+ label: 'Figma',
248
+ description: 'Design file access and component inspection.',
249
+ useWhen: 'Design-heavy repos needing Figma access.',
250
+ adoption: 'Requires FIGMA_ACCESS_TOKEN.',
251
+ trustLevel: 'medium',
252
+ transport: 'stdio',
253
+ requiredAuth: ['FIGMA_ACCESS_TOKEN'],
254
+ serverName: 'figma',
255
+ tomlProjection: { command: 'npx', args: ['-y', 'claude-talk-to-figma-mcp'], env: { FIGMA_ACCESS_TOKEN: '${FIGMA_ACCESS_TOKEN}' } },
256
+ enabledTools: ['get_file', 'get_components', 'get_styles'],
257
+ },
258
+ {
259
+ key: 'mcp-security',
260
+ label: 'MCP Security Scanner',
261
+ description: 'Scan MCP servers for tool poisoning and prompt injection.',
262
+ useWhen: 'Any repo with 2+ MCP servers.',
263
+ adoption: 'Safety companion for multi-MCP setups.',
264
+ trustLevel: 'high',
265
+ transport: 'stdio',
266
+ requiredAuth: [],
267
+ serverName: 'mcp-scan',
268
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-scan@latest'] },
269
+ enabledTools: ['scan_servers', 'check_tools'],
270
+ },
271
+ {
272
+ key: 'composio-mcp',
273
+ label: 'Composio Universal',
274
+ description: '500+ integrations through a single MCP gateway.',
275
+ useWhen: 'Enterprise or integration-heavy repos.',
276
+ adoption: 'Requires COMPOSIO_API_KEY.',
277
+ trustLevel: 'medium',
278
+ transport: 'stdio',
279
+ requiredAuth: ['COMPOSIO_API_KEY'],
280
+ serverName: 'composio',
281
+ tomlProjection: { command: 'npx', args: ['-y', '@composio/mcp'], env: { COMPOSIO_API_KEY: '${COMPOSIO_API_KEY}' } },
282
+ enabledTools: [],
283
+ },
284
+ {
285
+ key: 'jira-confluence',
286
+ label: 'Jira',
287
+ description: 'Issue tracking and project management.',
288
+ useWhen: 'Teams using Atlassian Jira.',
289
+ adoption: 'Requires ATLASSIAN_API_TOKEN and ATLASSIAN_EMAIL.',
290
+ trustLevel: 'medium',
291
+ transport: 'stdio',
292
+ requiredAuth: ['ATLASSIAN_API_TOKEN', 'ATLASSIAN_EMAIL'],
293
+ serverName: 'jira',
294
+ tomlProjection: { command: 'npx', args: ['-y', 'jira-mcp'], env: { ATLASSIAN_API_TOKEN: '${ATLASSIAN_API_TOKEN}', ATLASSIAN_EMAIL: '${ATLASSIAN_EMAIL}' } },
295
+ enabledTools: ['list_issues', 'get_issue', 'search_issues'],
296
+ },
297
+ {
298
+ key: 'ga4-analytics',
299
+ label: 'Google Analytics 4',
300
+ description: 'Live GA4 data, attribution, and audience insights.',
301
+ useWhen: 'Repos with web analytics needs.',
302
+ adoption: 'Requires GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS.',
303
+ trustLevel: 'medium',
304
+ transport: 'stdio',
305
+ requiredAuth: ['GA4_PROPERTY_ID', 'GOOGLE_APPLICATION_CREDENTIALS'],
306
+ serverName: 'ga4',
307
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-server-ga4'], env: { GA4_PROPERTY_ID: '${GA4_PROPERTY_ID}', GOOGLE_APPLICATION_CREDENTIALS: '${GOOGLE_APPLICATION_CREDENTIALS}' } },
308
+ enabledTools: ['run_report', 'get_metadata'],
309
+ },
310
+ {
311
+ key: 'search-console',
312
+ label: 'Google Search Console',
313
+ description: 'Search performance and indexing data.',
314
+ useWhen: 'SEO-focused repos.',
315
+ adoption: 'Requires Google OAuth credentials.',
316
+ trustLevel: 'medium',
317
+ transport: 'stdio',
318
+ requiredAuth: ['GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET'],
319
+ serverName: 'gsc',
320
+ tomlProjection: { command: 'npx', args: ['-y', 'mcp-gsc@latest'], env: { GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}', GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}' } },
321
+ enabledTools: ['search_analytics', 'get_sitemaps'],
322
+ },
323
+ {
324
+ key: 'n8n-workflows',
325
+ label: 'n8n Workflow Automation',
326
+ description: 'Workflow automation with 1,396 integration nodes.',
327
+ useWhen: 'Teams using n8n for workflow automation.',
328
+ adoption: 'Requires N8N_URL and N8N_API_KEY.',
329
+ trustLevel: 'medium',
330
+ transport: 'stdio',
331
+ requiredAuth: ['N8N_URL', 'N8N_API_KEY'],
332
+ serverName: 'n8n',
333
+ tomlProjection: { command: 'npx', args: ['-y', 'n8n-mcp-server@latest'], env: { N8N_URL: '${N8N_URL}', N8N_API_KEY: '${N8N_API_KEY}' } },
334
+ enabledTools: ['list_workflows', 'execute_workflow'],
335
+ },
336
+ {
337
+ key: 'zendesk-mcp',
338
+ label: 'Zendesk',
339
+ description: 'Ticket management and help center content.',
340
+ useWhen: 'Support teams using Zendesk.',
341
+ adoption: 'Requires ZENDESK_API_TOKEN and ZENDESK_SUBDOMAIN.',
342
+ trustLevel: 'medium',
343
+ transport: 'stdio',
344
+ requiredAuth: ['ZENDESK_API_TOKEN', 'ZENDESK_SUBDOMAIN'],
345
+ serverName: 'zendesk',
346
+ tomlProjection: { command: 'npx', args: ['-y', 'zendesk-mcp'], env: { ZENDESK_API_TOKEN: '${ZENDESK_API_TOKEN}', ZENDESK_SUBDOMAIN: '${ZENDESK_SUBDOMAIN}' } },
347
+ enabledTools: ['list_tickets', 'get_ticket', 'search_tickets'],
348
+ },
349
+ {
350
+ key: 'infisical-secrets',
351
+ label: 'Infisical Secrets',
352
+ description: 'Secrets management with auto-rotation.',
353
+ useWhen: 'Repos using Infisical for secrets.',
354
+ adoption: 'Requires INFISICAL_TOKEN.',
355
+ trustLevel: 'low',
356
+ transport: 'stdio',
357
+ requiredAuth: ['INFISICAL_TOKEN'],
358
+ serverName: 'infisical',
359
+ tomlProjection: { command: 'npx', args: ['-y', '@infisical/mcp'], env: { INFISICAL_TOKEN: '${INFISICAL_TOKEN}' } },
360
+ enabledTools: ['get_secret', 'list_secrets'],
361
+ },
362
+ {
363
+ key: 'shopify-mcp',
364
+ label: 'Shopify',
365
+ description: 'Shopify API and deployment tooling.',
366
+ useWhen: 'Shopify stores and apps.',
367
+ adoption: 'Requires SHOPIFY_ACCESS_TOKEN.',
368
+ trustLevel: 'medium',
369
+ transport: 'stdio',
370
+ requiredAuth: ['SHOPIFY_ACCESS_TOKEN'],
371
+ serverName: 'shopify',
372
+ tomlProjection: { command: 'npx', args: ['-y', 'shopify-mcp'], env: { SHOPIFY_ACCESS_TOKEN: '${SHOPIFY_ACCESS_TOKEN}' } },
373
+ enabledTools: ['get_products', 'get_orders'],
374
+ },
375
+ {
376
+ key: 'huggingface-mcp',
377
+ label: 'Hugging Face',
378
+ description: 'Model search, dataset discovery, and Spaces.',
379
+ useWhen: 'AI/ML repos needing model registry access.',
380
+ adoption: 'Requires HF_TOKEN.',
381
+ trustLevel: 'medium',
382
+ transport: 'stdio',
383
+ requiredAuth: ['HF_TOKEN'],
384
+ serverName: 'huggingface',
385
+ tomlProjection: { command: 'npx', args: ['-y', 'huggingface-mcp-server'], env: { HF_TOKEN: '${HF_TOKEN}' } },
386
+ enabledTools: ['search_models', 'get_model_info', 'search_datasets'],
387
+ },
388
+ // ── 23 new packs ─────────────────────────────────────────────────────────
389
+ {
390
+ key: 'supabase-mcp', label: 'Supabase',
391
+ description: 'Database, auth, and storage for Supabase.',
392
+ useWhen: 'Repos using Supabase.',
393
+ adoption: 'Requires: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY.',
394
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['SUPABASE_URL', 'SUPABASE_SERVICE_ROLE_KEY'],
395
+ serverName: 'supabase',
396
+ tomlProjection: { command: 'npx', args: ['-y', '@supabase/mcp-server-supabase@latest'],
397
+ env: { SUPABASE_URL: '${SUPABASE_URL}', SUPABASE_SERVICE_ROLE_KEY: '${SUPABASE_SERVICE_ROLE_KEY}' } },
398
+ enabledTools: ['list_tables', 'query', 'insert', 'update'],
399
+ },
400
+ {
401
+ key: 'prisma-mcp', label: 'Prisma ORM',
402
+ description: 'Schema inspection and migrations via Prisma.',
403
+ useWhen: 'Repos with a Prisma schema.',
404
+ adoption: 'Requires: DATABASE_URL.',
405
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['DATABASE_URL'],
406
+ serverName: 'prisma',
407
+ tomlProjection: { command: 'npx', args: ['-y', 'prisma-mcp-server@latest'],
408
+ env: { DATABASE_URL: '${DATABASE_URL}' } },
409
+ enabledTools: ['introspect_schema', 'list_models', 'query_raw'],
410
+ },
411
+ {
412
+ key: 'vercel-mcp', label: 'Vercel',
413
+ description: 'Deployment management via Vercel.',
414
+ useWhen: 'Repos deployed on Vercel.',
415
+ adoption: 'Requires: VERCEL_TOKEN.',
416
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['VERCEL_TOKEN'],
417
+ serverName: 'vercel',
418
+ tomlProjection: { command: 'npx', args: ['-y', '@vercel/mcp-server@latest'],
419
+ env: { VERCEL_TOKEN: '${VERCEL_TOKEN}' } },
420
+ enabledTools: ['list_projects', 'get_deployment', 'list_deployments'],
421
+ },
422
+ {
423
+ key: 'cloudflare-mcp', label: 'Cloudflare',
424
+ description: 'Workers, KV, R2, and D1 management.',
425
+ useWhen: 'Repos using Cloudflare edge.',
426
+ adoption: 'Requires: CLOUDFLARE_API_TOKEN.',
427
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CLOUDFLARE_API_TOKEN'],
428
+ serverName: 'cloudflare',
429
+ tomlProjection: { command: 'npx', args: ['-y', '@cloudflare/mcp-server-cloudflare@latest'],
430
+ env: { CLOUDFLARE_API_TOKEN: '${CLOUDFLARE_API_TOKEN}' } },
431
+ enabledTools: ['list_workers', 'get_kv', 'list_r2_buckets'],
432
+ },
433
+ {
434
+ key: 'aws-mcp', label: 'AWS',
435
+ description: 'S3, Lambda, DynamoDB access.',
436
+ useWhen: 'Repos using AWS.',
437
+ adoption: 'Requires: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION.',
438
+ trustLevel: 'low', transport: 'stdio', requiredAuth: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_REGION'],
439
+ serverName: 'aws',
440
+ tomlProjection: { command: 'npx', args: ['-y', '@aws-samples/mcp-server-aws@latest'],
441
+ env: { AWS_ACCESS_KEY_ID: '${AWS_ACCESS_KEY_ID}', AWS_SECRET_ACCESS_KEY: '${AWS_SECRET_ACCESS_KEY}', AWS_REGION: '${AWS_REGION}' } },
442
+ enabledTools: ['list_buckets', 'list_functions', 'list_tables'],
443
+ },
444
+ {
445
+ key: 'redis-mcp', label: 'Redis',
446
+ description: 'Cache and session management.',
447
+ useWhen: 'Repos using Redis.',
448
+ adoption: 'Requires: REDIS_URL.',
449
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['REDIS_URL'],
450
+ serverName: 'redis',
451
+ tomlProjection: { command: 'npx', args: ['-y', 'redis-mcp-server@latest'],
452
+ env: { REDIS_URL: '${REDIS_URL}' } },
453
+ enabledTools: ['get', 'set', 'del', 'hget', 'hset'],
454
+ },
455
+ {
456
+ key: 'mongodb-mcp', label: 'MongoDB',
457
+ description: 'Document database access.',
458
+ useWhen: 'Repos using MongoDB.',
459
+ adoption: 'Requires: MONGODB_URI.',
460
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['MONGODB_URI'],
461
+ serverName: 'mongodb',
462
+ tomlProjection: { command: 'npx', args: ['-y', '@mongodb-js/mongodb-mcp-server@latest'],
463
+ env: { MONGODB_URI: '${MONGODB_URI}' } },
464
+ enabledTools: ['find', 'insertOne', 'updateOne', 'deleteOne'],
465
+ },
466
+ {
467
+ key: 'twilio-mcp', label: 'Twilio',
468
+ description: 'SMS, voice, and messaging.',
469
+ useWhen: 'Repos using Twilio.',
470
+ adoption: 'Requires: TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN.',
471
+ trustLevel: 'low', transport: 'stdio', requiredAuth: ['TWILIO_ACCOUNT_SID', 'TWILIO_AUTH_TOKEN'],
472
+ serverName: 'twilio',
473
+ tomlProjection: { command: 'npx', args: ['-y', 'twilio-mcp-server@latest'],
474
+ env: { TWILIO_ACCOUNT_SID: '${TWILIO_ACCOUNT_SID}', TWILIO_AUTH_TOKEN: '${TWILIO_AUTH_TOKEN}' } },
475
+ enabledTools: ['send_sms', 'list_messages', 'list_calls'],
476
+ },
477
+ {
478
+ key: 'sendgrid-mcp', label: 'SendGrid',
479
+ description: 'Transactional email delivery.',
480
+ useWhen: 'Repos using SendGrid.',
481
+ adoption: 'Requires: SENDGRID_API_KEY.',
482
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['SENDGRID_API_KEY'],
483
+ serverName: 'sendgrid',
484
+ tomlProjection: { command: 'npx', args: ['-y', 'sendgrid-mcp-server@latest'],
485
+ env: { SENDGRID_API_KEY: '${SENDGRID_API_KEY}' } },
486
+ enabledTools: ['send_email', 'list_templates', 'get_stats'],
487
+ },
488
+ {
489
+ key: 'algolia-mcp', label: 'Algolia Search',
490
+ description: 'Search indexing via Algolia.',
491
+ useWhen: 'Repos using Algolia.',
492
+ adoption: 'Requires: ALGOLIA_APP_ID, ALGOLIA_API_KEY.',
493
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['ALGOLIA_APP_ID', 'ALGOLIA_API_KEY'],
494
+ serverName: 'algolia',
495
+ tomlProjection: { command: 'npx', args: ['-y', 'algolia-mcp-server@latest'],
496
+ env: { ALGOLIA_APP_ID: '${ALGOLIA_APP_ID}', ALGOLIA_API_KEY: '${ALGOLIA_API_KEY}' } },
497
+ enabledTools: ['search', 'list_indices', 'get_index'],
498
+ },
499
+ {
500
+ key: 'planetscale-mcp', label: 'PlanetScale',
501
+ description: 'Serverless MySQL via PlanetScale.',
502
+ useWhen: 'Repos on PlanetScale.',
503
+ adoption: 'Requires: PLANETSCALE_TOKEN.',
504
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['PLANETSCALE_TOKEN'],
505
+ serverName: 'planetscale',
506
+ tomlProjection: { command: 'npx', args: ['-y', 'planetscale-mcp-server@latest'],
507
+ env: { PLANETSCALE_TOKEN: '${PLANETSCALE_TOKEN}' } },
508
+ enabledTools: ['list_databases', 'list_branches', 'execute_query'],
509
+ },
510
+ {
511
+ key: 'neon-mcp', label: 'Neon Serverless Postgres',
512
+ description: 'Serverless Postgres via Neon.',
513
+ useWhen: 'Repos using Neon.',
514
+ adoption: 'Requires: NEON_API_KEY.',
515
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['NEON_API_KEY'],
516
+ serverName: 'neon',
517
+ tomlProjection: { command: 'npx', args: ['-y', '@neondatabase/mcp-server-neon@latest'],
518
+ env: { NEON_API_KEY: '${NEON_API_KEY}' } },
519
+ enabledTools: ['list_projects', 'list_branches', 'execute_sql'],
520
+ },
521
+ {
522
+ key: 'turso-mcp', label: 'Turso Edge SQLite',
523
+ description: 'Edge SQLite via Turso.',
524
+ useWhen: 'Repos using Turso.',
525
+ adoption: 'Requires: TURSO_DATABASE_URL, TURSO_AUTH_TOKEN.',
526
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['TURSO_DATABASE_URL', 'TURSO_AUTH_TOKEN'],
527
+ serverName: 'turso',
528
+ tomlProjection: { command: 'npx', args: ['-y', 'turso-mcp-server@latest'],
529
+ env: { TURSO_DATABASE_URL: '${TURSO_DATABASE_URL}', TURSO_AUTH_TOKEN: '${TURSO_AUTH_TOKEN}' } },
530
+ enabledTools: ['execute_query', 'list_tables'],
531
+ },
532
+ {
533
+ key: 'upstash-mcp', label: 'Upstash Redis+Kafka',
534
+ description: 'Serverless Redis and Kafka.',
535
+ useWhen: 'Repos using Upstash.',
536
+ adoption: 'Requires: UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN.',
537
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN'],
538
+ serverName: 'upstash',
539
+ tomlProjection: { command: 'npx', args: ['-y', '@upstash/mcp-server@latest'],
540
+ env: { UPSTASH_REDIS_REST_URL: '${UPSTASH_REDIS_REST_URL}', UPSTASH_REDIS_REST_TOKEN: '${UPSTASH_REDIS_REST_TOKEN}' } },
541
+ enabledTools: ['redis_get', 'redis_set', 'redis_del'],
542
+ },
543
+ {
544
+ key: 'convex-mcp', label: 'Convex',
545
+ description: 'Reactive backend via Convex.',
546
+ useWhen: 'Repos using Convex.',
547
+ adoption: 'Requires: CONVEX_DEPLOYMENT.',
548
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CONVEX_DEPLOYMENT'],
549
+ serverName: 'convex',
550
+ tomlProjection: { command: 'npx', args: ['-y', '@convex-dev/mcp-server@latest'],
551
+ env: { CONVEX_DEPLOYMENT: '${CONVEX_DEPLOYMENT}' } },
552
+ enabledTools: ['run_query', 'run_mutation', 'list_functions'],
553
+ },
554
+ {
555
+ key: 'clerk-mcp', label: 'Clerk Authentication',
556
+ description: 'User auth via Clerk.',
557
+ useWhen: 'Repos using Clerk.',
558
+ adoption: 'Requires: CLERK_SECRET_KEY.',
559
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CLERK_SECRET_KEY'],
560
+ serverName: 'clerk',
561
+ tomlProjection: { command: 'npx', args: ['-y', '@clerk/mcp-server@latest'],
562
+ env: { CLERK_SECRET_KEY: '${CLERK_SECRET_KEY}' } },
563
+ enabledTools: ['list_users', 'get_user', 'create_user'],
564
+ },
565
+ {
566
+ key: 'resend-mcp', label: 'Resend Email',
567
+ description: 'Transactional email via Resend.',
568
+ useWhen: 'Repos using Resend.',
569
+ adoption: 'Requires: RESEND_API_KEY.',
570
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['RESEND_API_KEY'],
571
+ serverName: 'resend',
572
+ tomlProjection: { command: 'npx', args: ['-y', 'resend-mcp-server@latest'],
573
+ env: { RESEND_API_KEY: '${RESEND_API_KEY}' } },
574
+ enabledTools: ['send_email', 'list_domains', 'get_email'],
575
+ },
576
+ {
577
+ key: 'temporal-mcp', label: 'Temporal Workflow',
578
+ description: 'Workflow orchestration via Temporal.',
579
+ useWhen: 'Repos using Temporal.',
580
+ adoption: 'Requires: TEMPORAL_ADDRESS.',
581
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['TEMPORAL_ADDRESS'],
582
+ serverName: 'temporal',
583
+ tomlProjection: { command: 'npx', args: ['-y', 'temporal-mcp-server@latest'],
584
+ env: { TEMPORAL_ADDRESS: '${TEMPORAL_ADDRESS}' } },
585
+ enabledTools: ['list_workflows', 'get_workflow', 'signal_workflow'],
586
+ },
587
+ {
588
+ key: 'launchdarkly-mcp', label: 'LaunchDarkly',
589
+ description: 'Feature flags via LaunchDarkly.',
590
+ useWhen: 'Repos using LaunchDarkly.',
591
+ adoption: 'Requires: LAUNCHDARKLY_ACCESS_TOKEN.',
592
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['LAUNCHDARKLY_ACCESS_TOKEN'],
593
+ serverName: 'launchdarkly',
594
+ tomlProjection: { command: 'npx', args: ['-y', 'launchdarkly-mcp-server@latest'],
595
+ env: { LAUNCHDARKLY_ACCESS_TOKEN: '${LAUNCHDARKLY_ACCESS_TOKEN}' } },
596
+ enabledTools: ['list_flags', 'get_flag', 'toggle_flag'],
597
+ },
598
+ {
599
+ key: 'datadog-mcp', label: 'Datadog',
600
+ description: 'Monitoring and APM via Datadog.',
601
+ useWhen: 'Repos using Datadog.',
602
+ adoption: 'Requires: DATADOG_API_KEY, DATADOG_APP_KEY.',
603
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['DATADOG_API_KEY', 'DATADOG_APP_KEY'],
604
+ serverName: 'datadog',
605
+ tomlProjection: { command: 'npx', args: ['-y', '@datadog/mcp-server@latest'],
606
+ env: { DATADOG_API_KEY: '${DATADOG_API_KEY}', DATADOG_APP_KEY: '${DATADOG_APP_KEY}' } },
607
+ enabledTools: ['query_metrics', 'list_monitors', 'search_logs'],
608
+ },
609
+ {
610
+ key: 'grafana-mcp', label: 'Grafana',
611
+ description: 'Dashboards via Grafana.',
612
+ useWhen: 'Repos using Grafana.',
613
+ adoption: 'Requires: GRAFANA_URL, GRAFANA_API_KEY.',
614
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['GRAFANA_URL', 'GRAFANA_API_KEY'],
615
+ serverName: 'grafana',
616
+ tomlProjection: { command: 'npx', args: ['-y', 'grafana-mcp-server@latest'],
617
+ env: { GRAFANA_URL: '${GRAFANA_URL}', GRAFANA_API_KEY: '${GRAFANA_API_KEY}' } },
618
+ enabledTools: ['list_dashboards', 'get_panel', 'query_datasource'],
619
+ },
620
+ {
621
+ key: 'circleci-mcp', label: 'CircleCI',
622
+ description: 'CI/CD via CircleCI.',
623
+ useWhen: 'Repos using CircleCI.',
624
+ adoption: 'Requires: CIRCLECI_TOKEN.',
625
+ trustLevel: 'medium', transport: 'stdio', requiredAuth: ['CIRCLECI_TOKEN'],
626
+ serverName: 'circleci',
627
+ tomlProjection: { command: 'npx', args: ['-y', 'circleci-mcp-server@latest'],
628
+ env: { CIRCLECI_TOKEN: '${CIRCLECI_TOKEN}' } },
629
+ enabledTools: ['list_pipelines', 'get_pipeline', 'list_jobs'],
630
+ },
631
+ {
632
+ key: 'anthropic-mcp', label: 'Anthropic Claude API',
633
+ description: 'Claude API for AI-powered apps.',
634
+ useWhen: 'Repos building on Claude API.',
635
+ adoption: 'Requires: ANTHROPIC_API_KEY.',
636
+ trustLevel: 'high', transport: 'stdio', requiredAuth: ['ANTHROPIC_API_KEY'],
637
+ serverName: 'anthropic',
638
+ tomlProjection: { command: 'npx', args: ['-y', '@anthropic-ai/mcp-server@latest'],
639
+ env: { ANTHROPIC_API_KEY: '${ANTHROPIC_API_KEY}' } },
640
+ enabledTools: ['create_message', 'list_models'],
641
+ },
642
+ ];
643
+
644
+ // --- Helpers ---
645
+
646
+ function clone(value) {
647
+ return JSON.parse(JSON.stringify(value));
648
+ }
649
+
650
+ function hasDependency(deps, name) {
651
+ return Object.prototype.hasOwnProperty.call(deps || {}, name);
652
+ }
653
+
654
+ function hasFileContentMatch(ctx, filePath, pattern) {
655
+ if (!ctx) return false;
656
+ const content = ctx.fileContent(filePath);
657
+ return !!(content && pattern.test(content));
658
+ }
659
+
660
+ function getProjectDependencies(ctx) {
661
+ if (!ctx) return {};
662
+ if (typeof ctx.projectDependencies === 'function') {
663
+ return ctx.projectDependencies();
664
+ }
665
+ const pkg = ctx.jsonFile('package.json') || {};
666
+ return {
667
+ ...(pkg.dependencies || {}),
668
+ ...(pkg.devDependencies || {}),
669
+ };
670
+ }
671
+
672
+ function hasPostgresSignals(ctx, deps) {
673
+ if (
674
+ hasDependency(deps, 'pg') ||
675
+ hasDependency(deps, 'postgres') ||
676
+ hasDependency(deps, 'pg-promise') ||
677
+ hasDependency(deps, 'slonik') ||
678
+ hasDependency(deps, '@neondatabase/serverless') ||
679
+ hasDependency(deps, '@vercel/postgres')
680
+ ) {
681
+ return true;
682
+ }
683
+ return (
684
+ hasFileContentMatch(ctx, 'prisma/schema.prisma', /provider\s*=\s*["']postgresql["']/i) ||
685
+ hasFileContentMatch(ctx, 'docker-compose.yml', /\bpostgres\b/i) ||
686
+ hasFileContentMatch(ctx, 'docker-compose.yaml', /\bpostgres\b/i) ||
687
+ hasFileContentMatch(ctx, '.env', /postgres(?:ql)?:\/\//i) ||
688
+ hasFileContentMatch(ctx, '.env.example', /postgres(?:ql)?:\/\//i)
689
+ );
690
+ }
691
+
692
+ // --- Core Functions ---
693
+
694
+ function getCodexMcpPack(key) {
695
+ return CODEX_MCP_PACKS.find(pack => pack.key === key) || null;
696
+ }
697
+
698
+ function normalizeCodexMcpPackKeys(keys = []) {
699
+ return [...new Set((Array.isArray(keys) ? keys : [])
700
+ .map(key => `${key}`.trim())
701
+ .filter(Boolean))]
702
+ .filter(key => !!getCodexMcpPack(key));
703
+ }
704
+
705
+ /**
706
+ * Generate TOML string for a single MCP pack.
707
+ */
708
+ function packToToml(pack) {
709
+ const lines = [];
710
+ lines.push(`[mcp_servers.${pack.serverName}]`);
711
+ const proj = pack.tomlProjection;
712
+
713
+ if (proj.command) {
714
+ lines.push(`command = "${proj.command}"`);
715
+ }
716
+ if (proj.url) {
717
+ lines.push(`url = "${proj.url}"`);
718
+ }
719
+ if (proj.args && proj.args.length > 0) {
720
+ const argsStr = proj.args.map(a => `"${a}"`).join(', ');
721
+ lines.push(`args = [${argsStr}]`);
722
+ }
723
+ if (proj.env) {
724
+ const envPairs = Object.entries(proj.env)
725
+ .map(([k, v]) => `${k} = "${v}"`)
726
+ .join(', ');
727
+ lines.push(`env = { ${envPairs} }`);
728
+ }
729
+ if (pack.enabledTools && pack.enabledTools.length > 0) {
730
+ const toolsStr = pack.enabledTools.map(t => `"${t}"`).join(', ');
731
+ lines.push(`enabled_tools = [${toolsStr}]`);
732
+ }
733
+ lines.push('enabled = true');
734
+ lines.push('required = false');
735
+
736
+ return lines.join('\n');
737
+ }
738
+
739
+ /**
740
+ * Generate TOML for multiple packs.
741
+ */
742
+ function packsToToml(packKeys = []) {
743
+ return normalizeCodexMcpPackKeys(packKeys)
744
+ .map(key => {
745
+ const pack = getCodexMcpPack(key);
746
+ return pack ? packToToml(pack) : null;
747
+ })
748
+ .filter(Boolean)
749
+ .join('\n\n');
750
+ }
751
+
752
+ /**
753
+ * Detect which MCP packs to recommend for a Codex project.
754
+ */
755
+ function recommendCodexMcpPacks(stacks = [], domainPacks = [], options = {}) {
756
+ const recommended = new Set();
757
+ const stackKeys = new Set(stacks.map(s => s.key));
758
+ const ctx = options.ctx || null;
759
+ const deps = getProjectDependencies(ctx);
760
+ const domainKeys = new Set(domainPacks.map(p => p.key));
761
+
762
+ // Context7 docs for any project with detected stacks
763
+ if (stackKeys.size > 0) {
764
+ recommended.add('context7-docs');
765
+ }
766
+
767
+ // GitHub for collaborative / governed repos
768
+ if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo')) {
769
+ recommended.add('github-mcp');
770
+ }
771
+
772
+ // Playwright for frontend repos
773
+ if (
774
+ domainKeys.has('frontend-ui') ||
775
+ stackKeys.has('react') || stackKeys.has('nextjs') ||
776
+ stackKeys.has('vue') || stackKeys.has('angular') || stackKeys.has('svelte')
777
+ ) {
778
+ recommended.add('playwright-mcp');
779
+ }
780
+
781
+ // Postgres when explicit signals exist
782
+ if (
783
+ (domainKeys.has('backend-api') || domainKeys.has('infra-platform')) &&
784
+ hasPostgresSignals(ctx, deps)
785
+ ) {
786
+ recommended.add('postgres-mcp');
787
+ }
788
+
789
+ // Memory for complex / monorepo / long-lived projects
790
+ if (domainKeys.has('monorepo') || domainKeys.has('enterprise-governed')) {
791
+ recommended.add('memory-mcp');
792
+ }
793
+
794
+ // Sequential thinking for complex problem-solving
795
+ if (domainKeys.has('enterprise-governed') || domainKeys.has('monorepo') || domainKeys.has('infra-platform')) {
796
+ recommended.add('sequential-thinking');
797
+ }
798
+
799
+ // Filesystem for infra repos with reference docs
800
+ if (domainKeys.has('infra-platform')) {
801
+ recommended.add('filesystem-mcp');
802
+ }
803
+
804
+ // Fetch for repos with external API integrations
805
+ if (domainKeys.has('backend-api') && ctx && (
806
+ hasDependency(deps, 'axios') ||
807
+ hasDependency(deps, 'node-fetch') ||
808
+ hasDependency(deps, 'got') ||
809
+ hasDependency(deps, 'ky') ||
810
+ hasDependency(deps, 'undici')
811
+ )) {
812
+ recommended.add('fetch-mcp');
813
+ }
814
+
815
+ // Fallback: always recommend context7 if nothing else matched
816
+ if (recommended.size === 0) {
817
+ recommended.add('context7-docs');
818
+ }
819
+
820
+ return CODEX_MCP_PACKS
821
+ .filter(pack => recommended.has(pack.key))
822
+ .map(pack => clone(pack));
823
+ }
824
+
825
+ /**
826
+ * Get required env vars for a set of pack keys.
827
+ */
828
+ function getCodexMcpRequiredEnvVars(packKeys = []) {
829
+ const required = new Set();
830
+ for (const key of normalizeCodexMcpPackKeys(packKeys)) {
831
+ const pack = getCodexMcpPack(key);
832
+ if (!pack) continue;
833
+ for (const envVar of pack.requiredAuth) {
834
+ required.add(envVar);
835
+ }
836
+ }
837
+ return [...required].sort();
838
+ }
839
+
840
+ /**
841
+ * Trust preflight: check if packs are safe to install.
842
+ */
843
+ function getCodexMcpPreflight(packKeys = [], env = process.env) {
844
+ return normalizeCodexMcpPackKeys(packKeys)
845
+ .map(key => {
846
+ const pack = getCodexMcpPack(key);
847
+ if (!pack) return null;
848
+ const missingEnvVars = pack.requiredAuth.filter(envKey => {
849
+ const value = env && Object.prototype.hasOwnProperty.call(env, envKey) ? env[envKey] : '';
850
+ return !`${value || ''}`.trim();
851
+ });
852
+ return {
853
+ key,
854
+ label: pack.label,
855
+ trustLevel: pack.trustLevel,
856
+ requiredAuth: pack.requiredAuth,
857
+ missingEnvVars,
858
+ safe: missingEnvVars.length === 0,
859
+ warning: missingEnvVars.length > 0
860
+ ? `Missing env vars: ${missingEnvVars.join(', ')}. Pack will be included but may fail at runtime.`
861
+ : null,
862
+ };
863
+ })
864
+ .filter(Boolean);
865
+ }
866
+
867
+ /**
868
+ * Merge TOML: generate safe TOML additions for new MCP packs.
869
+ * Returns the TOML string to append (does not modify existing config).
870
+ */
871
+ function mergeCodexMcpToml(existingConfigContent = '', packKeys = []) {
872
+ const existingServers = new Set();
873
+
874
+ // Parse existing [mcp_servers.*] sections to avoid duplicates
875
+ const serverPattern = /\[mcp_servers\.([^\]]+)\]/g;
876
+ let match;
877
+ while ((match = serverPattern.exec(existingConfigContent)) !== null) {
878
+ existingServers.add(match[1]);
879
+ }
880
+
881
+ const newPacks = normalizeCodexMcpPackKeys(packKeys)
882
+ .map(key => getCodexMcpPack(key))
883
+ .filter(pack => pack && !existingServers.has(pack.serverName));
884
+
885
+ if (newPacks.length === 0) return '';
886
+
887
+ const lines = [
888
+ '',
889
+ '# <!-- nerviq:mcp-packs:start -->',
890
+ '# MCP packs added by nerviq',
891
+ ];
892
+
893
+ for (const pack of newPacks) {
894
+ lines.push('');
895
+ lines.push(packToToml(pack));
896
+ }
897
+
898
+ lines.push('');
899
+ lines.push('# <!-- nerviq:mcp-packs:end -->');
900
+
901
+ return lines.join('\n');
902
+ }
903
+
904
+ module.exports = {
905
+ CODEX_MCP_PACKS,
906
+ getCodexMcpPack,
907
+ normalizeCodexMcpPackKeys,
908
+ packToToml,
909
+ packsToToml,
910
+ recommendCodexMcpPacks,
911
+ getCodexMcpRequiredEnvVars,
912
+ getCodexMcpPreflight,
913
+ mergeCodexMcpToml,
914
+ };