Skip to content

Commit cda1213

Browse files
committed
docs: add docs for dynamic header forwarding
1 parent a2dff47 commit cda1213

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docs/source/best-practices.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,9 @@ To maintain clear trust boundaries, MCP servers must only accept tokens explicit
4747
Forwarding client tokens downstream is not allowed.
4848

4949
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.
50+
51+
## Avoid forwarding credentials with header forwarding
52+
53+
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.
54+
55+
**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.

docs/source/config-file.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ All fields are optional.
2020
| `cors` | `Cors` | | CORS configuration |
2121
| `custom_scalars` | `FilePath` | | Path to a [custom scalar map](/apollo-mcp-server/custom-scalars) |
2222
| `endpoint` | `URL` | `http://localhost:4000/` | The target GraphQL endpoint |
23+
| `forward_headers`| `List<string>` | `[]` | Headers to forward from MCP clients to GraphQL API |
2324
| `graphos` | `GraphOS` | | Apollo-specific credential overrides |
2425
| `headers` | `Map<string, string>` | `{}` | List of hard-coded headers to include in all GraphQL requests |
2526
| `health_check` | `HealthCheck` | | Health check configuration |
@@ -43,6 +44,19 @@ These fields are under the top-level `graphos` key and define your GraphOS graph
4344
| `apollo_registry_url` | `URL` | | The URL to use for Apollo's registry |
4445
| `apollo_uplink_endpoints` | `URL` | | List of uplink URL overrides. You can also provide this with the `APOLLO_UPLINK_ENDPOINTS` environment variable |
4546

47+
### Forward Headers
48+
49+
The `forward_headers` option allows you to forward specific headers from incoming MCP client requests to your GraphQL API.
50+
51+
This is useful for:
52+
- Multi-tenant applications (forwarding tenant IDs)
53+
- A/B testing (forwarding experiment IDs)
54+
- Geo information (forwarding country Codes)
55+
- Client identification (forwarding AI client names)
56+
- Internal instrumentation (forwarding correlation IDs)
57+
58+
Supports exact header names only. Hop-by-hop headers (like `connection`, `transfer-encoding`) are automatically blocked for security.
59+
4660
### CORS
4761

4862
These fields are under the top-level `cors` key and configure Cross-Origin Resource Sharing (CORS) for browser-based MCP clients.

0 commit comments

Comments
 (0)