diff --git a/src/api/routes/chatgpt-mcp.js b/src/api/routes/chatgpt-mcp.js index cf84051..29a3b1d 100644 --- a/src/api/routes/chatgpt-mcp.js +++ b/src/api/routes/chatgpt-mcp.js @@ -23,6 +23,28 @@ const mcpHandler = McpConnectAgent.serve("/chatgpt/mcp", { binding: "MCP_AGENT", }); +// Deprecation headers — this route is being retired in favor of the canonical +// mcp.chitty.cc aggregator. ChatGPT clients should re-register against +// https://mcp.chitty.cc/ (unified OAuth, same scopes, same tools, unified audit). +// Sunset window: 2026-08-15. +chatgptMcp.use("*", async (c, next) => { + await next(); + // The downstream MCP handler returns a streamed Response (SSE) whose headers + // are immutable; mutating c.res.headers in place can throw. Rebuild the + // Response so deprecation headers attach cleanly without buffering the body. + const res = new Response(c.res.body, c.res); + // RFC 9745: Deprecation is a structured-field Date (@), not a + // boolean. @1778976000 = 2026-05-17T00:00:00Z, the date this route entered + // deprecation. + res.headers.set("Deprecation", "@1778976000"); + res.headers.set("Sunset", "Sat, 15 Aug 2026 00:00:00 GMT"); + res.headers.set( + "Link", + '; rel="successor-version", ; rel="alternate"', + ); + c.res = res; +}); + /** * Authentication middleware. * Extracts bearer token or API key. Validation is deferred to the DO layer