# What Actually Breaks When You Ship an MCP Connector

> Seven failures from taking a Magento MCP connector live behind OAuth 2.1. Each one looked healthy and had a silent fault. Updated for MCP 2026-07-28.

Source: https://angeo.dev/mcp-oauth-what-actually-breaks/
Updated: 2026-10-09

Written 20 August 2026 - Updated 9 October 2026 for MCP 2026-07-28 - Field notes from taking a Magento 2 MCP connector live

Building an MCP server is the easy part. Shipping one behind OAuth 2.1, to a real assistant, against a real store, is where it stops being easy. Almost none of what goes wrong looks like an error.

**Which MCP version this covers.** These failures were found on a connector that spoke the session-based protocol (2025-06-18 and earlier, now called *legacy*). MCP **2026-07-28** removed the `initialize` handshake and the `Mcp-Session-Id` header. What that changes here:

- **Failures 1 and 4 to 7** apply unchanged.

- **Failure 2** (lost session header) only hits legacy clients. Its modern twin is a proxy that drops or rewrites `Mcp-Method`, `Mcp-Name` or `MCP-Protocol-Version`. Each failure section says what to check in both eras.

- **Failure 3** still applies to streamed responses and to notifications. `notifications/initialized` itself is gone in 2026-07-28.

- The `instructions` string (failure 6) now comes from `server/discover`, not only from `initialize`.

Most clients still accept legacy servers, so a dual-era server meets both sets of problems. Details: [MCP 2026-07-28 without sessions](https://angeo.dev/mcp-2026-07-28-magento/).

**Seven failures, one pattern.** Each produced a connector that looked healthy: clean logs, valid tokens, tests passing. Each had a silent fault that the client could see and the server could not.

- Metadata that names the wrong resource URI -> the client gives up before authorization, and the audit log stays empty

- A proxy that drops protocol headers -> an endless handshake and "this connector has no tools"

- Streaming and notification responses masked as errors -> the connection dies before the tool list

- A database timeout shorter than the upstream call -> random failures under no special load

- A framework that does not wire an optional dependency -> half the feature silently missing

- A server that calls itself read-only while it offers checkout -> the model declines to transact

- Tool selection losing to a built-in capability -> the ceiling nobody documents

**Contents**

1. Where each failure sits

2. Metadata that names the wrong resource

3. Dropped protocol headers

4. Response shapes that are not errors

5. A database timeout shorter than the upstream call

6. The dependency the framework did not wire

7. A server that talks itself out of the sale

8. The ceiling: tool selection

9. What made all of this findable

10. Pre-launch checklist

11. FAQ

## Where each failure sits

All seven happen at a different point in the same request path. The symptoms often look the same, but the place is different. So read them in order: it is the fastest way to find which one you have.

Failures 6 and 7 happen before a single tool call; 1 to 3 during connection; 4 and 5 on any request.

## 1. Metadata that names the wrong resource

**Symptom.** The client says "you started connecting but didn't finish." There is no entry in the server's audit log and no error in the web server log. The OAuth endpoints all answer correctly when you test them by hand.

RFC 9728 protected-resource metadata has a `resource` field. It must name the resource the client actually asked about. Our connector answered at two URIs, a root path and a per-tenant path, and both metadata documents named the canonical one.

A strict client fetches the metadata for the URI it was given, sees a different URI come back, and stops. It stops during *discovery*. That is before authorization, and before any request reaches your code. That is why the log is empty: nothing you wrote ever ran.

```
# The check that would have caught it.
# RFC 9728: the metadata for a resource with a path lives under the well-known
# path, with the resource path appended.
curl -s https://mcp.example.com/.well-known/oauth-protected-resource/t/acme/mcp \
  | jq -r '.resource'
# must equal exactly:  https://mcp.example.com/t/acme/mcp
```

The same kind of failure hits the `issuer` in RFC 8414 authorization-server metadata. It must match the URL used for discovery byte for byte, trailing slash included. It is the most common reason a strict MCP client walks away before it shows a consent screen. MCP 2026-07-28 also requires RFC 9207: the authorization response carries an `iss` parameter, and the client checks it against the same issuer. One wrong slash breaks both.

**Rule of thumb.** Every identifier a client can compare, compare yourself, in a deploy check. Discovery failures are invisible from the server side by design.

## 2. Dropped protocol headers

**Symptom (legacy protocol).** The audit log shows `initialize` -> `notifications/initialized` -> `initialize` -> `notifications/initialized`, all HTTP 200, forever. `tools/list` never appears. The client says the connector has no tools.

Legacy Streamable HTTP is session-based. The server issues `Mcp-Session-Id` in the response to `initialize`, and the client must send it back on every later request. Our proxy forwarded request bodies and response bodies correctly. But it dropped every response header except `Content-Type`.

So the session id never reached the client. Every call looked like a new, uninitialised session to the upstream, which refused it, so the client started the handshake again. The repeating pair in the log is the signature: **a doubled `initialize` with no `tools/list` between them means session state is being lost**.

Two fixes, and you need both:

- Forward `Mcp-Session-Id` in *both* directions: client to upstream, and upstream response back to the client.

- Add it to `Access-Control-Expose-Headers`. Without that, a browser-based client receives the header and is then not allowed to read it. It fails the same way and is even harder to see.

**In MCP 2026-07-28** there is no session to lose, but the same proxy mistake still hurts. Every request now carries its protocol version (`MCP-Protocol-Version`), and Streamable HTTP POSTs must carry `Mcp-Method` and, for a tool call, `Mcp-Name`. A server should reject a request whose headers disagree with its body (`HeaderMismatchError`, code `-32020`). A proxy that drops or rewrites these headers produces exactly that error, on every call.

A proxy that forwards *everything* is a different mistake: it leaks `Set-Cookie`, `Server` and whatever else the upstream sends. Use an allow-list of the headers that carry the protocol.

## 3. Response shapes that are not errors

**Symptom.** Occasional 502s from the proxy with no upstream failure. The connection dies somewhere before the first tool call.

We added a check that an upstream response body really looked like JSON before we labelled it `application/json`. Sensible on its own, and it broke two correct cases:

| Response | When | What our check did |

| `text/event-stream` | Server chooses to stream | Rejected: the body does not start with `{` |

| Empty body, HTTP 202 | A JSON-RPC notification, which expects no answer | Rejected: the body is empty |

The second one is the killer. In the legacy protocol, `notifications/initialized` is part of every handshake. Masking its correct, empty 202 response as a 502 breaks the connection before `tools/list` is ever tried. The client then reports an empty connector, not an error. MCP 2026-07-28 removed that notification, but other notifications still exist and still expect a 202 with an empty body.

A proxy in front of MCP has to be transparent about response shape. Pass the upstream's `Content-Type` through, allow an empty body on 202 and 204, and only mask what is really broken.

## 4. A database timeout shorter than the upstream call

**Symptom.** `SQLSTATE[HY000]: General error: 2006 MySQL server has gone away`, on an interactive CLI command, every time, with a healthy database.

Shared hosting had `wait_timeout` at **20 seconds**. Usual values are hundreds or thousands of seconds. Our CLI opened its database connection when the script started, then waited for an operator to type a password. By the time the write ran, the connection had been closed for a while.

Three lessons that apply beyond this case:

- **Connect lazily.** Never hold a connection open across a prompt, a network call, or anything else that waits on something outside your process.

- **Compare the timeout with your upstream timeout.** The database connection sits idle for the whole proxied call. If your upstream timeout is 25 seconds and `wait_timeout` is 20, any query after the call is a coin flip.

- **Do not retry writes blindly.** Running `SELECT 1` again costs nothing. Running `used_calls = used_calls + 1` again after an unclear failure can charge a merchant twice. Probe with something safe to repeat, reconnect, then write once.

**A trap we walked into.** Our deploy check read `wait_timeout` with `SHOW VARIABLES`, from a CLI session that had just raised its own session value. It reported a comfortable 600 seconds while production ran on 20. Read `@@GLOBAL.wait_timeout`, not the session value.

## 5. The dependency the framework did not wire

**Symptom.** A new feature ships, tests pass, no errors, and none of it takes effect. The store name is missing from output that should contain it.

We added a config object as an *optional* constructor argument. That kept the protocol layer testable without the framework, and kept the existing wiring working. But Magento does not auto-wire optional constructor arguments: a nullable parameter with a default gets that default unless you name it in `di.xml`.

So the parameter was `null` in production. Every null-safe call returned nothing, and the whole feature fell back to its old behaviour without a single warning.

```
<type name="Vendor\Module\Model\Server">
    <arguments>
        <argument name="config" xsi:type="object">Vendor\Module\Model\Config</argument>
    </arguments>
</type>
```

This is the worst kind of bug to ship: nothing fails, so nothing tells you. We only caught it because an operator dumped the raw protocol output and saw a store name that should not have been there.

If you take one habit from this article, take this one: **dump the protocol and read it with your own eyes**. Not the client's rendering of it. The bytes.

## 6. A server that talks itself out of the sale

**Symptom.** Everything works. The assistant still sends shoppers to general web results instead of the store's own checkout.

An MCP server has an `instructions` string. It is the first thing a client reads about your server, before any tool name or description. In MCP 2026-07-28 it is part of the `server/discover` result; in legacy versions it is in the `initialize` response. Ours was written when the server was read-only, and it said so:

*"Read-only commerce tools for this Magento 2 store: product search, product details, category tree, and store information."*

By then the checkout module was installed. Four of the ten tools wrote, and one of them placed real orders. In its own first sentence, the server was saying it could not transact. That gave away the one thing a web search cannot do.

Two lessons:

- **Generate that text, do not hard-code it.** Ours is now built from the store name and the tools actually installed. Adding or removing the checkout module keeps it true.

- **Name the store in it.** An assistant matching "check Acme" against "this Magento 2 store" has nothing to work with. The store's real name is the anchor.

**Watch the default store name.** If the store view is still called "Default Store View", the assistant gets a name no shopper will ever type. We ended up rejecting all of Magento's default names, such as "Main Website" and "Main Website Store", and falling back to a neutral phrase. A meaningless name is worse than none.

## 7. The ceiling: tool selection

This is the most valuable finding, because nobody states it plainly, and it shapes what an MCP connector is actually for.

An assistant decides whether to use your tools *before* it calls anything. It decides from the instructions, the tool names and the tool descriptions. We improved all three: the store name in the instructions, the store name added to every description, generated human-readable titles, correct annotations, and MCP conversation starters. Then we measured, in fresh conversations, with the connector on.

| Prompt | Result |

| "What do you sell here?" | Connector |

| "What's the return policy?" | Connector |

| "What's in my cart?" | Connector |

| "Find me a grey backpack *in the Acme store*" | Connector |

| "Find me a grey backpack" *(cold, no store named)* | Built-in product search |

The last row did not change, whatever we did to the server. And on reflection it should not: a request that names no shop is a question about the market. One store winning it would be the wrong result for the person asking.

That is a positioning point, not a bug report:

- **A store connector wins everything about that store:** catalogue, cart, shipping to a specific address, policies, checkout. No general search has your cart, so nothing competes there.

- **It loses cold shopping requests that name no store**, and no amount of description tuning changes that.

- **The realistic way in is context, not phrasing.** A shopper who arrives from a merchant's own "connect" button is already in that store's context and does not write cold generic queries.

This is also the clearest argument for treating agent *discoverability* and agent *transactability* as two separate problems. Being readable to a model (structured data, `llms.txt`, clean product attributes) is what gets you considered at all. An MCP connector is what lets the assistant act once you have been. Neither replaces the other.

## What made all of this findable

Six of the seven were found from one thing: an audit log that recorded *refusals*, not only successes.

The first version logged a line after each successful upstream call. That version could not have found any of this. Every failure above lives between "the request arrived" and "the request succeeded": expired tokens, audience mismatches, quota refusals, unknown tenants, cross-tenant replay attempts. All invisible.

The rewritten logger writes exactly one line per final decision, allow or deny, with a reason code and a correlation id. It never touches request or response payloads. Checkout bodies carry shoppers' personal data, so staying blind to content is both a privacy choice and a way to limit damage.

```
{"ts":"...","request_id":"6fb0...","decision":"deny","tenant":"acme",
 "reason":"cross_tenant_replay","error":"invalid_token"}
```

That reason field turns "the connector is broken" into a fifteen-second diagnosis. If you build one thing before going live, build this.

## Pre-launch checklist

Each item below would have caught one of the seven. None needs a connected client, and all can run from a deploy script.

1. **Every metadata document names the URI it was reached at.**
Fetch each protected-resource document and compare its `resource` field to the resource URI. Compare the `issuer` in the authorization-server document to your configured issuer, byte for byte, trailing slash included. Check that the authorization response carries a matching `iss` (RFC 9207).

2. **An unauthenticated request returns 401 with a usable challenge.**
`WWW-Authenticate` must be present and must carry `resource_metadata`. Check it on GET as well as POST: some clients probe with GET and read the challenge to find the authorization server.

3. **`server/discover` answers.**
Every MCP 2026-07-28 server must implement it. Check that it returns your supported versions, `capabilities.tools` and current instructions. If you also serve legacy clients, check that `initialize` still works.

4. **Protocol headers survive the proxy.**
Modern: `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` reach the upstream unchanged, and a mismatch returns `-32020`, not a 502. Legacy: `Mcp-Session-Id` reaches the client on `initialize`, reaches the upstream on every later call, and is listed in `Access-Control-Expose-Headers`.

5. **Correct response shapes are not masked as errors.**
An empty body with HTTP 202 is a correct answer to a notification. `text/event-stream` is a correct content type. Neither should become a 502.

6. **The database timeout is longer than the upstream timeout.**
Read `@@GLOBAL.wait_timeout`, not the session value. A CLI check that raised its own session limit will report a comfortable number while production runs on the real one.

7. **Optional dependencies are wired explicitly.**
Frameworks that do not auto-wire optional constructor arguments give you the default and no warning. Dump the protocol output and confirm the feature is really in the bytes.

8. **The instructions string describes the tools that are installed.**
Generate it, do not hard-code it, and name the store in it. A server that calls itself read-only while it offers checkout is arguing against its own use.

9. **Denials are logged with a reason and a correlation id.**
Expired tokens, audience mismatches, quota refusals and cross-tenant replay attempts. No request or response payloads: checkout bodies carry shoppers' personal data.

10. **Secrets are not served.**
Request `.env`, key files, the audit log and the lockfile over HTTPS from outside. A 200 on any of them is an incident, not a warning.

11. **Walk the whole flow with a real client.**
MCP Inspector shows each HTTP step. Consent screens and protocol headers are exactly the parts no unit test covers.

## FAQ

### Why does my MCP connector say "no tools available" when tools/list works?

Three common causes, most likely first. The server does not declare `capabilities.tools` (in `server/discover`, or in the legacy `initialize` response), so the client decides there are none and never asks. Or protocol headers are lost in a proxy, so the connection never gets as far as the tool list. Or a proxy masks a correct response shape, such as an empty HTTP 202 for a notification, as an error.

### Why does the client give up before showing a consent screen?

Almost always a discovery mismatch. The `resource` field in RFC 9728 metadata must equal the URI the client used, and the `issuer` in RFC 8414 metadata must equal the discovery URL byte for byte, trailing slash included. A mismatch stops the flow before any request reaches your application, which is why nothing appears in your logs.

### What causes an endless initialize loop in an MCP connection?

Lost session state, in the legacy, session-based protocol. The server issues `Mcp-Session-Id` on `initialize` and expects it on every later request. If a proxy drops that header in either direction, or leaves it out of `Access-Control-Expose-Headers` for browser clients, each call looks like a new session and the client starts again. MCP 2026-07-28 has no sessions, so a modern client does not loop this way.

### Can an MCP server make an AI assistant use it instead of web search?

Not for a cold request that names no store. The assistant decides before calling anything, and a general shopping question competes with its own product search. What a server can control (accurate instructions, the store's name in the text, clear descriptions, correct annotations) reliably wins questions about that store: catalogue, cart, shipping, policies, checkout.

### Should an MCP proxy forward the client's access token upstream?

No. The MCP specification forbids token pass-through. The proxy checks the client's token and stops there, then calls the upstream with a separate credential of its own. Forwarding the token makes the proxy a confused deputy: the upstream cannot tell whose authority it is acting on.

### What should an MCP audit log record?

Every final decision, allow and deny, with a machine-readable reason and a correlation id. Denials matter more than successes: expired tokens, audience mismatches, quota refusals and cross-tenant replay attempts are exactly what an isolation boundary exists to catch. Do not log request or response payloads at all, because checkout bodies carry shoppers' personal data.

**Related**

- [MCP 2026-07-28 without sessions](https://angeo.dev/mcp-2026-07-28-magento/)  -  what changed, and a migration checklist

- [MCP modules for Magento 2](https://angeo.dev/docs/mcp/)  -  configuration reference, agent presentation, the tool SPI

- [MCP Checkout for Magento 2](https://angeo.dev/docs/mcp-checkout/)  -  connecting an assistant, example prompts, the safety model

- [How to connect Magento 2 to ChatGPT and Claude](https://angeo.dev/connect-magento-to-chatgpt-claude/)  -  the three ways, step by step

- [MCP and agentic commerce glossary](https://angeo.dev/docs/mcp-glossary/)  -  every term used here, defined once

- [MCP for Magento](https://angeo.dev/magento-mcp-server/)  -  what a live connection does, with a real order on video

- [AI crawlers for Magento 2](https://angeo.dev/docs/ai-crawlers/)  -  the discovery half of the same problem

Written 20 August 2026 against MCP 2025-06-18. Updated 9 October 2026: version notes for MCP 2026-07-28 (no sessions, `server/discover`, required `Mcp-Method` and `Mcp-Name` headers, RFC 9207), a corrected metadata check in failure 1, and the tool count in failure 6. Disclosure: we build the open-source angeo MCP modules and operate the proxy described here.
