fix(ai): Accept header for docs-tools MCP endpoint#1334
Conversation
The internal docs-tools URL on mcp.stack-auth.com validates Accept and returns 406 unless the client advertises both application/json and text/event-stream. Add the combined Accept header to postDocsToolAction so AI documentation tools work in production. Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAn HTTP POST request to the docs-tools API endpoint now includes an Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryAdds the Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant AI as AI Tool (docs.ts)
participant MCP as mcp.stack-auth.com<br/>/api/internal/docs-tools
Note over AI,MCP: Before fix
AI->>MCP: "POST /api/internal/docs-tools<br/>Content-Type: application/json"
MCP-->>AI: "406 Not Acceptable<br/>(missing Accept header)"
Note over AI,MCP: After fix
AI->>MCP: "POST /api/internal/docs-tools<br/>Content-Type: application/json<br/>Accept: application/json, text/event-stream"
MCP-->>AI: 200 OK (JSON response)
AI->>AI: res.json() → DocsToolHttpResult
Reviews (1): Last reviewed commit: "fix(ai): send Accept header for docs-too..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Fixes production 406 responses from the docs-tools MCP endpoint by aligning the backend HTTP client’s Accept header with the MCP server’s content-negotiation requirements.
Changes:
- Add
Accept: application/json, text/event-streamto thepostDocsToolActionfetch request so requests pass MCP Accept validation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Production requests to
https://mcp.stack-auth.com/api/internal/docs-toolswere returning 406 withNot Acceptable: Client must accept both application/json and text/event-streambecausepostDocsToolActiononly setContent-Type.Change
Set
Accept: application/json, text/event-streamon the fetch to match the MCP-style JSON-RPC handler.Testing
mcp.stack-auth.com: without this header → 406; with it → request passes Accept validation (no longer 406).Made with Cursor
Summary by CodeRabbit