You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Use HTTP transport for MCP to properly pass authInfo (#139)
* refactor: Use HTTP transport for MCP to properly pass authInfo
Replace InMemoryTransport with StreamableHTTPClientTransport to make
HTTP requests to /api/mcp endpoint with forwarded auth token. This
ensures MCP tool handlers receive proper authInfo through the
established withMcpAuth middleware flow.
- Add authToken to ChatRequestBody type
- Extract auth token from request headers in validateChatRequest
- Use HTTP transport to /api/mcp with Authorization header
- Update tests to include authToken in request bodies
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: Make authToken optional for internal flows
Internal flows like email processing don't have an auth token from
HTTP headers. Make authToken optional and skip MCP tools when not
present.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: Extract getBaseUrl to lib/networking
Move getBaseUrl utility to its own file following SRP.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: Extract getMcpTools to lib/mcp
Move MCP tools fetching logic to its own file following SRP.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: Add unit tests for getBaseUrl and getMcpTools
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: Use AI SDK built-in SSE transport for MCP
Replace StreamableHTTPClientTransport with AI SDK's built-in transport
config which provides a simpler API:
transport: {
type: "sse",
url: "...",
headers: { Authorization: "..." }
}
This should fix the "Streamable HTTP error" issue.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: Correct MCP endpoint URL to /mcp
The MCP route is at app/mcp/route.ts, not app/api/mcp/route.ts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: Use HTTP transport instead of SSE for MCP
The mcp-handler server only supports HTTP transport, not SSE.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments