Files
Greg Richardson b539cc0529 feat(docs): return page suggestions in markdown 404 pages (#45439)
Markdown guides (`/docs/guides/**/*.md`) that 404 currently return a
text/plain `Not found` response. Since agents often hallucinate URL
paths, this PR proactively provides page suggestions so that agents can
find the page they are looking forward without further guessing. It uses
the docs Content API to fetch related pages, similar to the [HTML 404
page](https://supabase.com/docs/404):

```
# 404 - Page Not Found

The page `/docs/guides/mcp.md` does not exist.

## You might be looking for...

- [Model context protocol (MCP)](https://supabase.com/docs/guides/getting-started/mcp.md)
- [Building an MCP Server with mcp-lite](https://supabase.com/docs/guides/functions/examples/mcp-server-mcp-lite.md)
- [Model Context Protocol (MCP) Authentication](https://supabase.com/docs/guides/auth/oauth-server/mcp-authentication.md)
- [Deploy MCP servers](https://supabase.com/docs/guides/getting-started/byo-mcp.md)
- [Enabling MCP Server Access](https://supabase.com/docs/guides/self-hosting/enable-mcp.md)

See also: [Changelog](https://supabase.com/changelog.md)
```

## How to test
1. Use curl to fetch a non-existent page with an `.md` extension:

   ```shell
curl -i
https://docs-git-docs-markdown-404-suggestions-supabase.vercel.app/docs/guides/mcp.md
   ```

Confirm that relevant pages are suggested (ballpark - our search algo
needs some improvement). Also confirm that the response has content type
`text/markdown`.

2. Use curl to fetch a non-existent page using the `Accept:
text/markdown` header


   ```shell
   curl -i -H 'Accept: text/markdown' \

https://docs-git-docs-markdown-404-suggestions-supabase.vercel.app/docs/guides/mcp
   ```

    And confirm the same result as 1.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* 404 pages for missing guides now return a formatted Markdown response
with proper content-type and no-cache headers, and include up to five
related documentation suggestions to help users find relevant content.

* **Chores**
* Build environment now preserves an additional hosting URL variable to
improve build/task consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-05 08:40:44 +02:00
..