---
title: "406 Not Acceptable on Your Discovery Files: When an Agent's Accept Header Gets Refused"
slug: 406-not-acceptable-agent-discovery-files
published: 2026-11-28T13:12:52.11096+00:00
updated: 2026-11-28T13:13:14.614149+00:00
author: "M Asif Rahman"
author_url: https://ar.bd
category: "AI Readiness"
tags: check:P2, check:P1, check:C1, 406, Accept header, content negotiation, MCP, agent discovery, well-known
description: "Why a 406 on an MCP card, API catalog or missing file breaks AI agents, what RFC 9110 allows, and how to fix it on nginx and app routes. Tested 28 Nov 2026."
url: https://aiscan.site/blog/406-not-acceptable-agent-discovery-files
---

A 406 Not Acceptable on a discovery file means the server read the agent's `Accept` header, decided it could not match it, and refused to send anything. For a JSON or text file that an agent asks for by its own media type, the right answer is almost always to serve the file and label it correctly, or to send a plain 404 when the file is missing. We sent 200 requests to our own five sites on 28 November 2026 and found exactly one source of 406s: aiscan.site's fallback for paths that do not exist.

This guide shows what the 406 does to an agent, how to find the rule that sends it, and how to fix it on nginx, in an app route and at a static host. It takes about 15 minutes once you know where the rule lives.

## Quick summary

| If you see | What it means | Fix | Time |
|---|---|---|---|
| 406 on a file that exists | A strict negotiation rule refuses the agent's `Accept` value | Ignore `Accept` for that file and send its default type | 10 min |
| 406 on a file that does not exist | A catch-all handler answers "HTML only" before it answers "not found" | Return 404 for unknown paths, whatever the `Accept` | 15 min |
| 200 but `application/json` on a card | The file works but is labelled with a generic type | Send `application/mcp-server-card+json` | 5 min |
| 200 `application/octet-stream` on `/.well-known/api-catalog` | The host does not know the extension-less file | Map it to `application/linkset+json` | 5 min |

The check IDs this touches are P2 (MCP server card), P1 (API catalog) and C1 (content negotiation), all listed under [capabilities checks](https://aiscan.site/docs/checks/capabilities).

## Why a discovery file should not refuse an Accept header

Agents now ask for discovery files by name. The MCP Server Card extension's discovery document, fetched from the extension repository on 28 November 2026, says in its own words that "A client requesting a Server Card SHOULD send `Accept: application/mcp-server-card+json`". According to [RFC 9727 §6.2](https://www.rfc-editor.org/rfc/rfc9727.html#section-6.2), verified on 28 November 2026, a `/.well-known/api-catalog` location "MUST support the Linkset format of application/linkset+json". So a well-behaved client sends a specific type, not `*/*`.

HTTP gives the server two choices when it cannot match. According to [RFC 9110 §12.4.1](https://www.rfc-editor.org/rfc/rfc9110.html#section-12.4.1), the origin server "can either honor the header field by sending a 406 (Not Acceptable) response or disregard the header field by treating the response as if it is not subject to content negotiation". [Section 15.5.7](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.7) adds that a 406 means the server "is unwilling to supply a default representation".

Think of it as a shop assistant who has the item in stock but refuses to hand it over because you asked for it by its brand name. For a file that exists in one format only, the 406 helps nobody. The agent gets an error body instead of the JSON it could have parsed, and nothing in the extension tells it to retry with `*/*`.

A 406 on a missing file is worse. According to RFC 9110, a 404 means the server "did not find a current representation for the target resource". A 406 tells the agent something exists in another format, so a crawler may keep the URL, retry it, or report "not acceptable" where the real answer was "not here".

## What our own five sites answer (28 November 2026)

We fetched five discovery paths on aiscan.site, xspeedcache.com, storeseo.com, bettershield.ai and thinkrank.ai with eight `Accept` values each: none, `*/*`, `application/json`, `application/mcp-server-card+json`, `application/linkset+json`, `application/ai-catalog+json`, `text/markdown` and `text/plain`. That is 200 requests with curl and a browser user agent, 28 November 2026 around 13:15 UTC.

| File | Sites with the file | Refused any Accept value | Content-Type sent |
|---|---|---|---|
| `/.well-known/api-catalog` | 5 of 5 | 0 | `application/linkset+json` on 4, `application/octet-stream` on 1 |
| `/.well-known/mcp/server-card.json` | 3 of 5 | 0 | `application/json` on all 3 |
| `/.well-known/ai-catalog.json` | 1 of 5 | 0 | `application/json` |
| `/llms.txt` | 5 of 5 | 0 | `text/plain` |
| `/robots.txt` | 5 of 5 | 0 | `text/plain` |

All 19 files that exist ignored `Accept` and sent their default, which is what RFC 9110 allows. None of the three cards used the card media type, so a client that checks `Content-Type` against what it asked for will see a mismatch.

The 406s came from paths that do not exist. On aiscan.site, `/mcp/server-card` (the location the extension reserves for a card), `/.well-known/agent-card.json` and any made-up path answered as follows:

| Accept sent | aiscan.site (missing path) | The other four sites (missing path) |
|---|---|---|
| none or `*/*` | 404 `text/html` | 404 `text/html` |
| `text/html` | 404 `text/html` | 404 `text/html` |
| `application/json` | **406** `{"error":"Only HTML requests are supported here"}` | 404 |
| `application/mcp-server-card+json` | **406** | 404 |
| `text/markdown` or `text/plain` | **406** | 404 |

A browser never sees this, because it sends `text/html`. An MCP client following the extension does. We filed it with the site team.

## Find the rule that sends the 406

1. Reproduce it with one header: `curl -s -o /dev/null -w '%{http_code}\n' -H 'Accept: application/json' https://yoursite.com/does-not-exist`. A 406 here and a 404 without the header confirms an `Accept` rule.
2. Read the response's `Server` header and body. On aiscan.site it was `server: nginx` with a JSON error, so the rule sits in front of the app.
3. Search your config for the message or for `$http_accept`: `grep -rn 'http_accept\|406' /etc/nginx/`. In an app, search route handlers for `406` or `req.accepts(`.

## Fix it

**nginx.** Keep any HTML-only rule away from discovery paths and from the 404 fallback, and serve the files with explicit types. A `.json` file takes its type from nginx's `types` map, so `default_type` alone does nothing for it. According to the [nginx core module docs](https://nginx.org/en/docs/http/ngx_http_core_module.html#types), fetched from nginx.org on 28 November 2026, an empty `types { }` block followed by `default_type` makes one location emit one type for every request.

```nginx
location = /.well-known/api-catalog {
    types { }
    default_type application/linkset+json;
}
location = /.well-known/mcp/server-card.json {
    types { }
    default_type application/mcp-server-card+json;
}
location / {
    try_files $uri $uri/ =404;
}
```

If you have a check such as `if ($http_accept !~ "text/html") { return 406; }`, move it inside the one location that needs it, never above the file lookup.

**An app route (Express, Next.js, Hono, a Supabase or Lovable edge function).** Check for the file before you look at `Accept`. If the path is unknown, return 404. If it is known, send the one representation you have with its real `Content-Type`, and add `Vary: Accept` only if you really serve more than one.

**A static host.** The other four sites sent no 406 at all, for files that exist or files that do not. Static hosts usually guess the type from the file extension instead. The risk there is the label, as in the `application/octet-stream` row above, so set the header in your host's own headers configuration and confirm it with the curl loop below.

A localhost lab with two Python handlers, one strict and one lenient, showed the difference on the same card. With the card `Accept`, Node's `fetch()` got 200 from both for the real card, and 406 against 404 for a missing one. `curl` and `fetch()` both send `*/*` by default, so a quick manual test without the header hides the bug.

## Verify the fix

Run the scan first: `npx aiscan-cli yoursite.com`. Check P2 should read the card, and P1 should find the API catalog. Then check by hand:

```bash
for a in 'application/mcp-server-card+json' 'application/json' 'text/markdown'; do
  curl -s -o /dev/null -w "%{http_code} %{content_type}\n" -H "Accept: $a" \
    https://yoursite.com/.well-known/mcp/server-card.json
done
```

Expected output is three lines of `200 application/mcp-server-card+json`. Repeat against a made-up path; every line should read `404`.

## Who can skip this

If your site has no discovery files and no catch-all handler, there is nothing to fix. If your only problem is a `text/markdown` request on a page, read [how to serve text/markdown to AI agents](https://aiscan.site/blog/markdown-for-ai-agents), because there negotiation is the feature. For the card itself, start with [publishing an MCP server card](https://aiscan.site/blog/publish-mcp-server-card); for status codes on robots.txt, see [robots.txt status and content type](https://aiscan.site/blog/robots-txt-status-content-type). Cross-origin errors on the same files are in [CORS for agent discovery files](https://aiscan.site/blog/cors-agent-discovery-files).

## Next step

Scan your site at [AIScan](https://aiscan.site/), look at P2 and P1, then pick the next fix from the [guides](https://aiscan.site/guides).

