The seed script fetches from /prompts.json without the ?full_content=true
parameter. The API only returns contentPreview by default, so the content
field is undefined, causing PrismaClientValidationError for every prompt.
Changes:
- Add ?full_content=true to the fetch URL
- Make content optional in RemotePrompt interface
- Skip prompts without content instead of failing
Before: Created 0 prompts (1595 skipped) with validation errors
After: Created 1576 prompts (19 skipped - no content)
Addresses $6,478/month Vercel bill with 12 targeted fixes based on forensic
bill analysis and 7-expert review. See #1085 for full analysis.
MCP endpoint (src/pages/api/mcp.ts):
- Fix GetPromptRequestSchema P0 full table scan (findMany→findFirst)
- Remove all JSON pretty-printing (13 occurrences, ~30% payload reduction)
- Add Cache-Control headers to GET discovery endpoint
- Set tools.listChanged=false to prevent client polling
- Add 1MB body size limit to parseBody (DoS protection)
- Make elicitation opt-in via fill_variables param (saves 10s CPU/request)
- Fix timer leak in elicitation setTimeout
- Cap search content at 1,000 chars (contentPreview)
- Remove structuredFormat from search results
- Dynamic import for improve_prompt (reduces cold start)
- Optimize search_skills to return fileNames only
prompts.json:
- Add pagination (?page=&limit=) with backward compatibility
- Add ETag support for 304 Not-Modified responses
- Truncate content to 500-char preview by default
Infrastructure:
- Remove Sentry tunnelRoute (was proxying all browser events through edge)
- Add slug + composite database indexes for MCP query patterns
Closes#1085
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>