Skip to content

Commit 58abd5b

Browse files
authored
Merge pull request #469 from apollographql/DXM-323
docs: headers and header forwarding
2 parents 0c6e064 + 26191dc commit 58abd5b

File tree

2 files changed

+44
-26
lines changed

2 files changed

+44
-26
lines changed

docs/source/best-practices.mdx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,4 @@ In particular, we strongly recommend contract variants when using:
2626

2727
If you register a persisted query with a specific client name instead of `null`, you must configure the MCP Server to send the necessary header indicating the client name to the router.
2828

29-
Use the `headers` option when running the MCP Server to pass the header to the router. The default name of the header expected by the router is `apollographql-client-name`. To use a different header name, configure `telemetry.apollo.client_name_header` in router YAML configuration.
30-
31-
## Avoid token passthrough for authentication
32-
33-
Token passthrough forwards `Authorization` headers from MCP clients through MCP Servers to downstream APIs. Although it might seem useful in some multi-tenant setups, the Apollo MCP Server intentionally does not support this pattern and we strongly discourage its use.
34-
35-
According to [MCP security best practices](https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices#token-passthrough) and the [MCP authorization specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#access-token-privilege-restriction), this pattern introduces serious security risks:
36-
37-
- **Audience confusion**: If the MCP Server accepts tokens not intended for it, it can violate OAuth’s trust boundaries.
38-
- **Confused deputy problem**: If an unvalidated token is passed downstream, a downstream API may incorrectly trust it as though it were validated by the MCP Server.
39-
40-
To maintain clear trust boundaries, MCP servers must only accept tokens explicitly issued for themselves and must act as independent OAuth clients when calling upstream services.
41-
Forwarding client tokens downstream is not allowed.
42-
43-
Apollo MCP Server supports OAuth 2.1 authentication that follows best practices and aligns with the MCP authorization model. See our [authorization guide](/apollo-mcp-server/auth) for implementation details.
44-
45-
## Avoid forwarding credentials with header forwarding
46-
47-
The [forward_headers](/apollo-mcp-server/config-file#forward-headers) setting is designed for forwarding **non-sensitive metadata** like A/B testing, feature flagging, geo information from CDNs, or internal instrumentation.
48-
49-
**We strongly recommend against using header forwarding for passing through credentials** such as API keys or access tokens. Forwarding credentials can introduce confused deputy vulnerabilities where your GraphQL API may incorrectly trust headers as though they were validated by the MCP Server.
29+
Use [the `headers` option](/apollo-mcp-server/config-file#headers) when running the MCP Server to pass the header to the router. The default name of the header expected by the router is `apollographql-client-name`. To use a different header name, configure `telemetry.apollo.client_name_header` in router YAML configuration.

docs/source/config-file.mdx

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,56 @@ These fields are under the top-level `graphos` key and define your GraphOS graph
4444
| `apollo_registry_url` | `URL` | | The URL to use for Apollo's registry |
4545
| `apollo_uplink_endpoints` | `URL` | | List of uplink URL overrides. You can also provide this with the `APOLLO_UPLINK_ENDPOINTS` environment variable |
4646

47-
### Forward Headers
47+
### Static headers
4848

49-
The `forward_headers` option allows you to forward specific headers from incoming MCP client requests to your GraphQL API.
49+
The `headers` option enables you to specify a list of static, hard-coded headers and values. These are included in all GraphQL requests.
50+
51+
```yaml title="mcp.yaml"
52+
headers: { "apollographql-client-name": "my-mcp-server" }
53+
```
54+
55+
To forward dynamic header values from the client, use the [`forward_headers` option](#forwarding-headers) instead.
56+
57+
### Forwarding headers
58+
59+
The `forward_headers` option allows you to forward specific headers from incoming MCP client requests to your GraphQL API.
5060

5161
This is useful for:
5262
- Multi-tenant applications (forwarding tenant IDs)
5363
- A/B testing (forwarding experiment IDs)
54-
- Geo information (forwarding country Codes)
55-
- Client identification (forwarding AI client names)
64+
- Geo information (forwarding country codes)
65+
- Client identification (forwarding client names)
5666
- Internal instrumentation (forwarding correlation IDs)
5767

58-
Supports exact header names only. Hop-by-hop headers (like `connection`, `transfer-encoding`) are automatically blocked for security.
68+
Header names should match exactly but are case-insensitive.
69+
70+
Header values are forwarded as-is, according to what the MCP client provides.
71+
72+
Hop-by-hop headers (like `connection`, `transfer-encoding`) are automatically blocked for security.
73+
74+
```yaml title="mcp.yaml"
75+
forward_headers:
76+
- x-tenant-id
77+
- x-experiment-id
78+
- x-geo-country
79+
```
80+
81+
<Caution>
82+
83+
Don't use header forwarding to pass through sensitive credentials such as API keys or access tokens.
84+
85+
<br/><br/>
86+
87+
According to [MCP security best practices](https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices#token-passthrough) and the [MCP authorization specification](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#access-token-privilege-restriction), token passthrough introduces serious security risks:
88+
89+
- **Audience confusion**: If the MCP Server accepts tokens not intended for it, it can violate OAuth's trust boundaries.
90+
- **Confused deputy problem**: If an unvalidated token is passed downstream, a downstream API may incorrectly trust it as though it were validated by the MCP Server.
91+
92+
<br/>
93+
94+
Apollo MCP Server supports OAuth 2.1 authentication that follows best practices and aligns with the MCP authorization model. See our [authorization guide](/apollo-mcp-server/auth) for implementation details and how to use the [auth configuration](#auth).
95+
96+
</Caution>
5997

6098
### CORS
6199

0 commit comments

Comments
 (0)