[PR #4763] [MERGED] fix(mcp): missing Content-Type header for mcp DCR #31169

Closed
opened 2026-04-17 22:05:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4763
Author: @Berndwl
Created: 9/19/2025
Status: Merged
Merged: 9/19/2025
Merged by: @himself65

Base: canaryHead: canary


📝 Commits (2)

  • d2f457f fix(mcp): Add missing Content-Type header to JSON response
  • 6a0d865 fix(mcp): Validate Content-Type header in mcp test

📊 Changes

2 files changed (+4 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/plugins/mcp/index.ts (+1 -0)
📝 packages/better-auth/src/plugins/mcp/mcp.test.ts (+3 -0)

📄 Description

Problem
The mcp plugin supports dynamically creating clients. The endpoint "/mcp/register" returns a json response, without the "application/json" content type in the response header, resulting in some providers (for example OpenAI) not accepting the response.

Solution
Added "Content-Type": "application/json" to the response headers for the "/mcp/register" success result (including a test).


Summary by cubic

Set the Content-Type header to application/json on successful /mcp/register responses so providers like OpenAI accept the JSON payload. Added a test to verify the header.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4763 **Author:** [@Berndwl](https://github.com/Berndwl) **Created:** 9/19/2025 **Status:** ✅ Merged **Merged:** 9/19/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (2) - [`d2f457f`](https://github.com/better-auth/better-auth/commit/d2f457f3f5f3ac2808fc669489b5e01016b25fee) fix(mcp): Add missing Content-Type header to JSON response - [`6a0d865`](https://github.com/better-auth/better-auth/commit/6a0d865fb4f918d157a01c204f92611c21b3b049) fix(mcp): Validate Content-Type header in mcp test ### 📊 Changes **2 files changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/mcp/index.ts` (+1 -0) 📝 `packages/better-auth/src/plugins/mcp/mcp.test.ts` (+3 -0) </details> ### 📄 Description **Problem** The mcp plugin supports dynamically creating clients. The endpoint "/mcp/register" returns a json response, without the "application/json" content type in the response header, resulting in some providers (for example OpenAI) not accepting the response. **Solution** Added "Content-Type": "application/json" to the response headers for the "/mcp/register" success result (including a test). <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Set the Content-Type header to application/json on successful /mcp/register responses so providers like OpenAI accept the JSON payload. Added a test to verify the header. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:05:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#31169