zuplo 6.70.56 → 6.70.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/articles/limits.mdx +1 -1
- package/docs/articles/mcp-quickstart-local.mdx +99 -0
- package/docs/articles/mcp-quickstart.mdx +2 -2
- package/docs/articles/step-1-setup-basic-gateway-local.mdx +60 -84
- package/docs/articles/step-2-add-rate-limiting-local.mdx +46 -77
- package/docs/articles/step-2-add-rate-limiting.mdx +0 -5
- package/docs/articles/step-3-add-api-key-auth-local.mdx +80 -130
- package/docs/articles/step-3-add-api-key-auth.mdx +0 -5
- package/docs/articles/step-4-deploying-to-the-edge-local.mdx +106 -0
- package/docs/articles/step-5-dynamic-rate-limiting-local.mdx +180 -0
- package/docs/articles/support.mdx +8 -8
- package/docs/dev-portal/zudoku/components/callout.mdx +126 -8
- package/docs/dev-portal/zudoku/components/head.mdx +2 -12
- package/docs/dev-portal/zudoku/customization/colors-theme.mdx +19 -0
- package/docs/dev-portal/zudoku/markdown/admonitions.md +79 -0
- package/docs/mcp-gateway/code-config/overview.mdx +13 -28
- package/docs/mcp-gateway/how-to/connect-upstream-api-key.mdx +146 -0
- package/docs/mcp-gateway/how-to/curate-tools-local.mdx +288 -0
- package/docs/mcp-gateway/how-to/curate-tools.mdx +103 -257
- package/docs/mcp-gateway/quickstart-local.mdx +291 -0
- package/docs/mcp-gateway/quickstart.mdx +208 -189
- package/docs/policies/monetization-inbound/schema.json +11 -1
- package/package.json +4 -4
|
@@ -5,8 +5,12 @@ sidebar_icon: circle-alert
|
|
|
5
5
|
|
|
6
6
|
import { Callout } from "zudoku/ui/Callout";
|
|
7
7
|
import { ReactComponentDoc } from "zudoku/ui/ReactComponentDoc";
|
|
8
|
+
import { FileHeartIcon } from "zudoku/icons";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
A callout component to draw attention to important information.
|
|
11
|
+
|
|
12
|
+
Writing Markdown? Use the [admonitions](../markdown/admonitions) shorthand (`:::tip`) instead of the
|
|
13
|
+
component directly.
|
|
10
14
|
|
|
11
15
|
## Import
|
|
12
16
|
|
|
@@ -16,13 +20,6 @@ import { Callout } from "zudoku/ui/Callout";
|
|
|
16
20
|
|
|
17
21
|
<ReactComponentDoc component={Callout} />
|
|
18
22
|
|
|
19
|
-
:::tip{title="Hot tip"}
|
|
20
|
-
|
|
21
|
-
There's a shortcut to use callout components in Markdown files:
|
|
22
|
-
[Admonitions](../markdown/admonitions).
|
|
23
|
-
|
|
24
|
-
:::
|
|
25
|
-
|
|
26
23
|
## Note
|
|
27
24
|
|
|
28
25
|
<Callout type="note" title="Hey, listen!">
|
|
@@ -83,6 +80,78 @@ There's a shortcut to use callout components in Markdown files:
|
|
|
83
80
|
</Callout>
|
|
84
81
|
```
|
|
85
82
|
|
|
83
|
+
## Sparkles
|
|
84
|
+
|
|
85
|
+
<Callout type="sparkles" title="What's new">
|
|
86
|
+
Highlight new features or AI-powered functionality.
|
|
87
|
+
</Callout>
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
<Callout type="sparkles" title="What's new">
|
|
91
|
+
Highlight new features or AI-powered functionality.
|
|
92
|
+
</Callout>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Rocket
|
|
96
|
+
|
|
97
|
+
<Callout type="rocket" title="Getting started">
|
|
98
|
+
Spin up your first project in minutes.
|
|
99
|
+
</Callout>
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Callout type="rocket" title="Getting started">
|
|
103
|
+
Spin up your first project in minutes.
|
|
104
|
+
</Callout>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Settings
|
|
108
|
+
|
|
109
|
+
<Callout type="settings" title="Configuration">
|
|
110
|
+
Tweak these options to match your workflow.
|
|
111
|
+
</Callout>
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<Callout type="settings" title="Configuration">
|
|
115
|
+
Tweak these options to match your workflow.
|
|
116
|
+
</Callout>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Zap
|
|
120
|
+
|
|
121
|
+
<Callout type="zap" title="Performance">
|
|
122
|
+
Use this pattern when latency matters.
|
|
123
|
+
</Callout>
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<Callout type="zap" title="Performance">
|
|
127
|
+
Use this pattern when latency matters.
|
|
128
|
+
</Callout>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Lock
|
|
132
|
+
|
|
133
|
+
<Callout type="lock" title="Authentication required">
|
|
134
|
+
This endpoint needs a valid API key.
|
|
135
|
+
</Callout>
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<Callout type="lock" title="Authentication required">
|
|
139
|
+
This endpoint needs a valid API key.
|
|
140
|
+
</Callout>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Megaphone
|
|
144
|
+
|
|
145
|
+
<Callout type="megaphone" title="Announcement">
|
|
146
|
+
We've just shipped a breaking change to the v2 API.
|
|
147
|
+
</Callout>
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Callout type="megaphone" title="Announcement">
|
|
151
|
+
We've just shipped a breaking change to the v2 API.
|
|
152
|
+
</Callout>
|
|
153
|
+
```
|
|
154
|
+
|
|
86
155
|
## Variations
|
|
87
156
|
|
|
88
157
|
Callouts can be customized by omitting the title or icon:
|
|
@@ -97,6 +166,12 @@ Callouts can be customized by omitting the title or icon:
|
|
|
97
166
|
Or have neither title nor icon
|
|
98
167
|
</Callout>
|
|
99
168
|
|
|
169
|
+
Or pass any React node as the `icon` to override the default for the chosen `type`:
|
|
170
|
+
|
|
171
|
+
<Callout type="tip" icon={<FileHeartIcon />} title="Made with love">
|
|
172
|
+
The icon inherits the type's accent color.
|
|
173
|
+
</Callout>
|
|
174
|
+
|
|
100
175
|
```tsx
|
|
101
176
|
<Callout type="note">
|
|
102
177
|
Without a title
|
|
@@ -109,4 +184,47 @@ Callouts can be customized by omitting the title or icon:
|
|
|
109
184
|
<Callout type="note" icon={false}>
|
|
110
185
|
Or have neither title nor icon
|
|
111
186
|
</Callout>
|
|
187
|
+
|
|
188
|
+
<Callout type="tip" icon={<FileHeartIcon />} title="Made with love">
|
|
189
|
+
The icon inherits the type's accent color.
|
|
190
|
+
</Callout>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Customize colors
|
|
194
|
+
|
|
195
|
+
Each callout type is driven by a single CSS variable that determines the icon, border tint, and
|
|
196
|
+
background tint via `color-mix`. Override any of them in your theme's `customCss` to recolor a type
|
|
197
|
+
globally:
|
|
198
|
+
|
|
199
|
+
```ts title="zudoku.config.ts"
|
|
200
|
+
export default {
|
|
201
|
+
theme: {
|
|
202
|
+
customCss: `
|
|
203
|
+
:root {
|
|
204
|
+
--callout-tip: oklch(0.65 0.18 160);
|
|
205
|
+
--callout-sparkles: oklch(0.6 0.22 320);
|
|
206
|
+
}
|
|
207
|
+
.dark {
|
|
208
|
+
--callout-tip: oklch(0.78 0.18 160);
|
|
209
|
+
--callout-sparkles: oklch(0.75 0.2 320);
|
|
210
|
+
}
|
|
211
|
+
`,
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
All available variables:
|
|
217
|
+
|
|
218
|
+
```css
|
|
219
|
+
--callout-note
|
|
220
|
+
--callout-tip
|
|
221
|
+
--callout-info
|
|
222
|
+
--callout-caution
|
|
223
|
+
--callout-danger
|
|
224
|
+
--callout-sparkles
|
|
225
|
+
--callout-rocket
|
|
226
|
+
--callout-settings
|
|
227
|
+
--callout-zap
|
|
228
|
+
--callout-lock
|
|
229
|
+
--callout-megaphone
|
|
112
230
|
```
|
|
@@ -3,9 +3,8 @@ title: Head
|
|
|
3
3
|
sidebar_icon: circle-fading-plus
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
The Head component
|
|
7
|
-
|
|
8
|
-
[`react-helmet-async`](https://github.com/staylor/react-helmet-async) under the hood.
|
|
6
|
+
The Head component allows you to manage document head elements like title, meta tags, and links from
|
|
7
|
+
anywhere in your component tree. It uses [Unhead](https://unhead.unjs.io/) under the hood.
|
|
9
8
|
|
|
10
9
|
## Import
|
|
11
10
|
|
|
@@ -175,15 +174,6 @@ The Layout component automatically provides:
|
|
|
175
174
|
- Description meta tags from page meta
|
|
176
175
|
- Favicon links from meta configuration
|
|
177
176
|
|
|
178
|
-
## Notes
|
|
179
|
-
|
|
180
|
-
:::tip
|
|
181
|
-
|
|
182
|
-
The Head component is an alias for the Helmet component from React Helmet Async. You can use either
|
|
183
|
-
`<Head>` or `<Helmet>` - they're identical.
|
|
184
|
-
|
|
185
|
-
:::
|
|
186
|
-
|
|
187
177
|
:::info
|
|
188
178
|
|
|
189
179
|
Head tags are merged across components, so you can set some meta tags globally and override specific
|
|
@@ -214,6 +214,25 @@ const config = {
|
|
|
214
214
|
};
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
+
### Enabling Code Ligatures
|
|
218
|
+
|
|
219
|
+
Dev Portal disables ligatures in code blocks by default to avoid unwanted glyph joining in fonts like
|
|
220
|
+
Geist Mono (e.g. `---`, `###`, `|--|`). If you're using a coding font designed around ligatures
|
|
221
|
+
(Fira Code, JetBrains Mono, etc.), re-enable them via `customCss`:
|
|
222
|
+
|
|
223
|
+
```ts title=zudoku.config.ts
|
|
224
|
+
const config = {
|
|
225
|
+
theme: {
|
|
226
|
+
customCss: `
|
|
227
|
+
code, pre, kbd, samp, .shiki, .shiki span {
|
|
228
|
+
font-variant-ligatures: normal;
|
|
229
|
+
font-feature-settings: normal;
|
|
230
|
+
}
|
|
231
|
+
`,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
217
236
|
## Default Theme
|
|
218
237
|
|
|
219
238
|
Dev Portal comes with a built-in default theme based on
|
|
@@ -80,6 +80,85 @@ Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
|
|
|
80
80
|
|
|
81
81
|
:::
|
|
82
82
|
|
|
83
|
+
## Additional types
|
|
84
|
+
|
|
85
|
+
Beyond the standard severity types, the following themed variants are available with their own color
|
|
86
|
+
and icon:
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
:::sparkles
|
|
90
|
+
|
|
91
|
+
For new features or AI-powered functionality.
|
|
92
|
+
|
|
93
|
+
:::
|
|
94
|
+
|
|
95
|
+
:::rocket
|
|
96
|
+
|
|
97
|
+
For getting-started or launch-related content.
|
|
98
|
+
|
|
99
|
+
:::
|
|
100
|
+
|
|
101
|
+
:::settings
|
|
102
|
+
|
|
103
|
+
For configuration sections.
|
|
104
|
+
|
|
105
|
+
:::
|
|
106
|
+
|
|
107
|
+
:::zap
|
|
108
|
+
|
|
109
|
+
For performance tips.
|
|
110
|
+
|
|
111
|
+
:::
|
|
112
|
+
|
|
113
|
+
:::lock
|
|
114
|
+
|
|
115
|
+
For authentication and security notes.
|
|
116
|
+
|
|
117
|
+
:::
|
|
118
|
+
|
|
119
|
+
:::megaphone
|
|
120
|
+
|
|
121
|
+
For announcements.
|
|
122
|
+
|
|
123
|
+
:::
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
:::sparkles
|
|
127
|
+
|
|
128
|
+
For new features or AI-powered functionality.
|
|
129
|
+
|
|
130
|
+
:::
|
|
131
|
+
|
|
132
|
+
:::rocket
|
|
133
|
+
|
|
134
|
+
For getting-started or launch-related content.
|
|
135
|
+
|
|
136
|
+
:::
|
|
137
|
+
|
|
138
|
+
:::settings
|
|
139
|
+
|
|
140
|
+
For configuration sections.
|
|
141
|
+
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
:::zap
|
|
145
|
+
|
|
146
|
+
For performance tips.
|
|
147
|
+
|
|
148
|
+
:::
|
|
149
|
+
|
|
150
|
+
:::lock
|
|
151
|
+
|
|
152
|
+
For authentication and security notes.
|
|
153
|
+
|
|
154
|
+
:::
|
|
155
|
+
|
|
156
|
+
:::megaphone
|
|
157
|
+
|
|
158
|
+
For announcements.
|
|
159
|
+
|
|
160
|
+
:::
|
|
161
|
+
|
|
83
162
|
## With title
|
|
84
163
|
|
|
85
164
|
You can also add a title to the admonition by adding it after the type:
|
|
@@ -2,37 +2,22 @@
|
|
|
2
2
|
title: "Set up an MCP Gateway"
|
|
3
3
|
sidebar_label: "Set up the gateway"
|
|
4
4
|
description:
|
|
5
|
-
Wire up the Zuplo MCP Gateway in routes.oas.json and policies.json —
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Wire up the Zuplo MCP Gateway in routes.oas.json and policies.json — register
|
|
6
|
+
the runtime plugin, configure one OAuth policy and one token-exchange policy
|
|
7
|
+
per upstream, and add an MCP route.
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
To turn any Zuplo project into an MCP Gateway, configure
|
|
11
|
-
control: the
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
To turn any Zuplo project into an MCP Gateway, configure four things in source
|
|
11
|
+
control: the runtime plugin in `modules/zuplo.runtime.ts`, one MCP OAuth policy
|
|
12
|
+
in `config/policies.json`, one `mcp-token-exchange-inbound` policy per
|
|
13
|
+
OAuth-protected upstream, and one route per upstream in
|
|
14
|
+
`config/routes.oas.json`. This guide walks through each piece for a
|
|
15
|
+
single-upstream gateway.
|
|
16
16
|
|
|
17
17
|
For the conceptual model — what each piece does and why the pieces are split the
|
|
18
18
|
way they are — see [How the MCP Gateway works](../how-it-works.mdx).
|
|
19
19
|
|
|
20
|
-
## 1.
|
|
21
|
-
|
|
22
|
-
MCP Gateway features require `compatibilityDate >= 2026-03-01` in `zuplo.jsonc`:
|
|
23
|
-
|
|
24
|
-
```jsonc title="zuplo.jsonc"
|
|
25
|
-
{
|
|
26
|
-
"version": 1,
|
|
27
|
-
"compatibilityDate": "2026-03-01",
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
New Zuplo projects default to a recent compatibility date, so this only applies
|
|
32
|
-
to existing projects being upgraded to use the MCP Gateway. See
|
|
33
|
-
[Compatibility dates](./compatibility-dates.mdx) for details.
|
|
34
|
-
|
|
35
|
-
## 2. Register the MCP Gateway plugin
|
|
20
|
+
## 1. Register the MCP Gateway plugin
|
|
36
21
|
|
|
37
22
|
Add a `modules/zuplo.runtime.ts` file that registers `McpGatewayPlugin`:
|
|
38
23
|
|
|
@@ -50,7 +35,7 @@ and upstream connect callbacks the gateway needs. It's a no-op when no
|
|
|
50
35
|
MCP-related policy is present, so adding it to projects that don't yet use the
|
|
51
36
|
gateway has zero runtime cost.
|
|
52
37
|
|
|
53
|
-
##
|
|
38
|
+
## 2. Define one OAuth policy
|
|
54
39
|
|
|
55
40
|
The OAuth policy authenticates inbound MCP requests against your identity
|
|
56
41
|
provider. Pick the first-class wrapper for your IdP — the
|
|
@@ -89,7 +74,7 @@ identity provider.
|
|
|
89
74
|
|
|
90
75
|
:::
|
|
91
76
|
|
|
92
|
-
##
|
|
77
|
+
## 3. Define one token-exchange policy per upstream
|
|
93
78
|
|
|
94
79
|
Each OAuth-protected upstream gets its own `mcp-token-exchange-inbound` policy:
|
|
95
80
|
|
|
@@ -118,7 +103,7 @@ user-to-upstream connections, so pick it once and keep it.
|
|
|
118
103
|
For per-mode reference and worked examples per provider, see
|
|
119
104
|
[Connect a gateway to an upstream OAuth provider](../how-to/connect-upstream-oauth.mdx).
|
|
120
105
|
|
|
121
|
-
##
|
|
106
|
+
## 4. Define one route per upstream
|
|
122
107
|
|
|
123
108
|
Each upstream gets a route in `routes.oas.json`. The handler points at the
|
|
124
109
|
upstream URL; the inbound policy chain attaches the OAuth policy followed by the
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Connect a gateway to an API-key upstream MCP server"
|
|
3
|
+
sidebar_label: "Connect an API-key upstream"
|
|
4
|
+
description:
|
|
5
|
+
Front an MCP server that authenticates with a static API key over a Bearer
|
|
6
|
+
token. Configure a custom upstream in the wizard, strip the inbound auth
|
|
7
|
+
token, and inject the upstream key with the Add or Set Request Headers policy.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Not every upstream MCP server uses OAuth. Many authenticate with a static API
|
|
11
|
+
key. The Zuplo MCP Gateway fronts these the same way it fronts OAuth upstreams:
|
|
12
|
+
clients still authenticate to the gateway with whatever inbound auth you choose
|
|
13
|
+
(including OAuth), and the gateway swaps in the upstream API key before
|
|
14
|
+
forwarding.
|
|
15
|
+
|
|
16
|
+
This example sends the key as a `Bearer` token in the `Authorization` header,
|
|
17
|
+
which is the most common shape. Any other API key scheme works the same way: the
|
|
18
|
+
upstream might expect the key in a custom header (such as `X-API-Key`), a
|
|
19
|
+
different prefix, or no prefix at all. You set whatever header name and value
|
|
20
|
+
the upstream requires in the same policy.
|
|
21
|
+
|
|
22
|
+
The flow has two parts:
|
|
23
|
+
|
|
24
|
+
1. Run the **MCP Gateway Virtual Server** wizard, choosing a **Custom** upstream
|
|
25
|
+
and **None** for outbound auth.
|
|
26
|
+
2. Add an **Add or Set Request Headers** policy to the end of the policy stack
|
|
27
|
+
that sets the `Authorization` header to the upstream's API key, read from an
|
|
28
|
+
environment variable.
|
|
29
|
+
|
|
30
|
+
This means you can put OAuth (or any inbound auth) in front of an API-key-only
|
|
31
|
+
MCP server and add it to any client you like.
|
|
32
|
+
|
|
33
|
+
## Run the wizard with a custom upstream
|
|
34
|
+
|
|
35
|
+
Follow the [Portal quickstart](../quickstart.mdx) to start an **MCP Gateway
|
|
36
|
+
Virtual Server**, with these choices:
|
|
37
|
+
|
|
38
|
+
1. **Upstream**: select the **Custom** tab instead of a library server. Set a
|
|
39
|
+
**Name**, the **MCP Server URL** (the upstream provides this), and the
|
|
40
|
+
**Path** you want to expose on your gateway.
|
|
41
|
+
2. **Inbound Auth**: pick whatever your clients should authenticate with. OAuth
|
|
42
|
+
through an identity provider works exactly as it does for OAuth upstreams.
|
|
43
|
+
3. **Tools**: choose **Passthrough** or **Curate** as usual.
|
|
44
|
+
4. **Outbound Auth**: choose **None**, then set the inbound `Authorization`
|
|
45
|
+
header handling to **Remove auth token**. The upstream doesn't use OAuth, so
|
|
46
|
+
the gateway shouldn't run a token exchange, and the inbound client's token
|
|
47
|
+
must be stripped before forwarding so it doesn't leak to the upstream.
|
|
48
|
+
|
|
49
|
+
<ModalScreenshot size="md">
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
</ModalScreenshot>
|
|
54
|
+
|
|
55
|
+
Click **Finish**. The wizard scaffolds the route, the inbound auth policy, a
|
|
56
|
+
capability filter (if you curated), and a `remove-authorization-header` policy
|
|
57
|
+
that strips the inbound token.
|
|
58
|
+
|
|
59
|
+
## Set the upstream API key
|
|
60
|
+
|
|
61
|
+
The upstream still expects its API key. Add it as an environment variable so the
|
|
62
|
+
secret stays out of source control.
|
|
63
|
+
|
|
64
|
+
Open your project's **Settings** from the navigation bar, click **Environment
|
|
65
|
+
Variables** under Project Settings, and add a variable for the upstream key, for
|
|
66
|
+
example `CONTEXT7_API_TOKEN`. Check the **Secret** box so the value is hidden in
|
|
67
|
+
the encrypted secret store, then click **Save**.
|
|
68
|
+
|
|
69
|
+
:::note
|
|
70
|
+
|
|
71
|
+
A new deployment is needed for environment variable changes to take effect.
|
|
72
|
+
|
|
73
|
+
:::
|
|
74
|
+
|
|
75
|
+
## Inject the key with a set-headers policy
|
|
76
|
+
|
|
77
|
+
Now add the upstream credential. The **Add or Set Request Headers** policy
|
|
78
|
+
([`set-headers-inbound`](../../policies/set-headers-inbound.mdx)) sets the
|
|
79
|
+
`Authorization` header on the request before it leaves the gateway.
|
|
80
|
+
|
|
81
|
+
Open the route's policy stack and click **Add Policy** at the **end** of the
|
|
82
|
+
inbound stack, after the `remove-authorization-header` policy the wizard added.
|
|
83
|
+
Order matters: the inbound token is removed first, then your upstream key is
|
|
84
|
+
set.
|
|
85
|
+
|
|
86
|
+
<ModalScreenshot size="md">
|
|
87
|
+
|
|
88
|
+

|
|
89
|
+
|
|
90
|
+
</ModalScreenshot>
|
|
91
|
+
|
|
92
|
+
Configure the policy to set the `Authorization` header to the upstream API key,
|
|
93
|
+
referencing the environment variable with `$env(...)`:
|
|
94
|
+
|
|
95
|
+
```json title="set-headers-inbound policy"
|
|
96
|
+
{
|
|
97
|
+
"export": "SetHeadersInboundPolicy",
|
|
98
|
+
"module": "$import(@zuplo/runtime)",
|
|
99
|
+
"options": {
|
|
100
|
+
"headers": [
|
|
101
|
+
{
|
|
102
|
+
"name": "Authorization",
|
|
103
|
+
"value": "Bearer $env(CONTEXT7_API_TOKEN)"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Replace `CONTEXT7_API_TOKEN` with your own environment variable name. This
|
|
111
|
+
example uses a `Bearer` token in the `Authorization` header, but the policy sets
|
|
112
|
+
any header you need. If the upstream expects the key in a different header (such
|
|
113
|
+
as `X-API-Key`), without the `Bearer` prefix, or as a raw value, change `name`
|
|
114
|
+
and `value` to match. For a key that lives in a custom (non-`Authorization`)
|
|
115
|
+
header, the dedicated
|
|
116
|
+
[`set-upstream-api-key-inbound`](../../policies/set-upstream-api-key-inbound.mdx)
|
|
117
|
+
policy is an alternative.
|
|
118
|
+
|
|
119
|
+
**Save** the project and deploy.
|
|
120
|
+
|
|
121
|
+
## How the request flows
|
|
122
|
+
|
|
123
|
+
For each MCP request, the gateway now:
|
|
124
|
+
|
|
125
|
+
1. Authenticates the client with your chosen inbound auth.
|
|
126
|
+
2. Filters capabilities (if you curated tools).
|
|
127
|
+
3. Removes the inbound `Authorization` header so the client's token never
|
|
128
|
+
reaches the upstream.
|
|
129
|
+
4. Sets the upstream API key header from your environment variable. In this
|
|
130
|
+
example, `Authorization: Bearer <upstream-key>`.
|
|
131
|
+
5. Forwards the request to the upstream MCP server.
|
|
132
|
+
|
|
133
|
+
The result: clients authenticate to the gateway however you like, and the
|
|
134
|
+
gateway presents the upstream's API key on their behalf.
|
|
135
|
+
|
|
136
|
+
## Related
|
|
137
|
+
|
|
138
|
+
- [MCP Gateway quickstart](../quickstart.mdx): the full wizard walkthrough.
|
|
139
|
+
- [Connect an upstream OAuth provider](./connect-upstream-oauth.mdx): the OAuth
|
|
140
|
+
equivalent of this guide.
|
|
141
|
+
- [`set-headers-inbound` policy](../../policies/set-headers-inbound.mdx): the
|
|
142
|
+
Add or Set Request Headers policy reference.
|
|
143
|
+
- [`set-upstream-api-key-inbound` policy](../../policies/set-upstream-api-key-inbound.mdx):
|
|
144
|
+
a dedicated policy for API keys in a custom (non-`Authorization`) header.
|
|
145
|
+
- [`McpProxyHandler` reference](../code-config/mcp-proxy-handler.mdx): the route
|
|
146
|
+
handler that forwards to the upstream.
|