Repository navigation
docs(mcp-generator): server instructions and egress policy - #7969
Conversation
- Add "Set the server instructions" and "Restrict outbound requests" sections to the Configure page, plus a cross-link from the custom-tool fetch section to the egress allow-list. - List instructions, appendInstructions, and egress in the sdk-config reference.
|
🌿 Preview your docs: https://fern-preview-tdclarin854-mcp-docs-instructions-egress.docs.buildwithfern.com/learn Here are the markdown pages you've updated: |
- Server instructions: spec-generated block, append-vs-replace, per-conversation token cost. - Egress: open(default)/allowlist/empty-allowlist lockdown, host-exact matching, every-hop redirects, always-on SSRF + credential-origin-lock.
There was a problem hiding this comment.
Style review against AGENTS.md and Vale. Structure, verb headings, /learn/... links, ParamField entries, and prose-over-callouts all match the rest of the docs. One Vale error (line 246) needs fixing, and a few paragraphs could be tighter (inline suggestions).
Questions
- Redirects: the existing
context.fetchsection says it doesn't follow redirects, but this section says the allowlist check "runs on every hop" of a redirect. Which requests does that apply to, the globalfetchin a custom tool's handler? Please also state outright whetheregresscovers the globalfetchand not onlycontext.fetch. - Instructions on every turn: "The MCP client sends the instructions to the model on every turn of every conversation" sounds like it depends on the client. Can you confirm it's true for the main clients, or soften the wording?
- Source: the CLI changelog lists
egress(5.228.0) but notinstructionsorappendInstructions. Which@postman/sdk-configversion added them? Readers may need a minimum version. - Changelog: should this get an entry in
fern/products/mcp-generator/changelog/?
Nit: the prose spells "allow-list" with a hyphen and the config value is allowlist. Using one spelling (ideally the key's) would be clearer.
|
|
||
| ## Set the server instructions | ||
|
|
||
| On `initialize`, the server returns a block of **instructions** that tells an agent how to work with it. Fern generates this block from your spec, with no configuration: the server's name and description, the authentication scheme and the header to send, the `openapi://` resource and schema URIs an agent reads to browse docs and fetch full input schemas, and a note that arguments must match each tool's input schema. `appendInstructions` adds your own guidance after that block, and `instructions` replaces it. |
There was a problem hiding this comment.
Vale FernStyles.Hedges flags "a note that":
| On `initialize`, the server returns a block of **instructions** that tells an agent how to work with it. Fern generates this block from your spec, with no configuration: the server's name and description, the authentication scheme and the header to send, the `openapi://` resource and schema URIs an agent reads to browse docs and fetch full input schemas, and a note that arguments must match each tool's input schema. `appendInstructions` adds your own guidance after that block, and `instructions` replaces it. | |
| On `initialize`, the server returns a block of **instructions** that tells an agent how to work with it. Fern generates this block from your spec, with no configuration: the server's name and description, the authentication scheme and the header to send, the `openapi://` resource and schema URIs an agent reads to browse docs and fetch full input schemas, and the rule that arguments must match each tool's input schema. `appendInstructions` adds your own guidance after that block, and `instructions` replaces it. |
There was a problem hiding this comment.
Accepted in 0c0e4b6 (applied the "the rule that" rewording).
| Prefer place_order over cancelling and re-creating an order. | ||
| ``` | ||
|
|
||
| Prefer `appendInstructions`. It keeps the generated wiring, the `openapi://` URIs and `_meta` keys an agent needs to browse docs and fetch schemas, and adds your domain guidance on top. `instructions` replaces that wiring, so a bare replacement can break an agent's doc and schema browsing unless you restate what you still need. Setting both replaces the block first, then appends. With neither set, the server returns the generated instructions unchanged. |
There was a problem hiding this comment.
This repeats the openapi:// URIs from the first paragraph, introduces _meta keys without explaining them, and calls the generated text "wiring". A tighter version:
| Prefer `appendInstructions`. It keeps the generated wiring, the `openapi://` URIs and `_meta` keys an agent needs to browse docs and fetch schemas, and adds your domain guidance on top. `instructions` replaces that wiring, so a bare replacement can break an agent's doc and schema browsing unless you restate what you still need. Setting both replaces the block first, then appends. With neither set, the server returns the generated instructions unchanged. | |
| Prefer `appendInstructions`, which keeps the generated block. `instructions` replaces it, so restate the `openapi://` URIs if agents still need to browse docs and fetch schemas. Setting both replaces the block first, then appends. With neither set, the server returns the generated block unchanged. |
There was a problem hiding this comment.
Accepted in 0c0e4b6.
|
|
||
| Prefer `appendInstructions`. It keeps the generated wiring, the `openapi://` URIs and `_meta` keys an agent needs to browse docs and fetch schemas, and adds your domain guidance on top. `instructions` replaces that wiring, so a bare replacement can break an agent's doc and schema browsing unless you restate what you still need. Setting both replaces the block first, then appends. With neither set, the server returns the generated instructions unchanged. | ||
|
|
||
| Keep this text short. The MCP client sends the instructions to the model on every turn of every conversation, so they cost context tokens on each call. The generated block is budgeted to stay compact; your `appendInstructions` and `instructions` text is sent verbatim with no size cap, so long instructions add token cost to every request for as long as they're set. |
There was a problem hiding this comment.
This states the token cost twice. "The generated block is budgeted to stay compact" describes how the feature is built rather than what the reader does. A tighter version (see question 2 in the review summary about "every turn"):
| Keep this text short. The MCP client sends the instructions to the model on every turn of every conversation, so they cost context tokens on each call. The generated block is budgeted to stay compact; your `appendInstructions` and `instructions` text is sent verbatim with no size cap, so long instructions add token cost to every request for as long as they're set. | |
| Keep this text short. The MCP client sends the instructions to the model on every turn, and your text goes out verbatim with no size cap. |
There was a problem hiding this comment.
Accepted in 0c0e4b6.
|
|
||
| ## Restrict outbound requests | ||
|
|
||
| A generated tool only ever calls your API, but a custom tool's handler can `fetch` any public host. `egress` restricts where the server sends outbound requests, including the calls custom tools make through `context.fetch`. |
There was a problem hiding this comment.
Drop "only ever":
| A generated tool only ever calls your API, but a custom tool's handler can `fetch` any public host. `egress` restricts where the server sends outbound requests, including the calls custom tools make through `context.fetch`. | |
| A generated tool calls only your API, but a custom tool's handler can `fetch` any public host. `egress` restricts where the server sends outbound requests, including the calls custom tools make through `context.fetch`. |
There was a problem hiding this comment.
Accepted in 0c0e4b6, and extended slightly to answer question 1: egress covers every outbound request, so I stated it covers both context.fetch and the global fetch a handler can call, not only context.fetch.
|
|
||
| `policy` is either `open` or `allowlist`: | ||
|
|
||
| - **`open`** places no allow-list on destinations. It's the default, and leaving out the `egress` block entirely is the same as `open`, so existing servers keep reaching any public host until you opt in. |
There was a problem hiding this comment.
Three clauses chained together. A shorter version:
| - **`open`** places no allow-list on destinations. It's the default, and leaving out the `egress` block entirely is the same as `open`, so existing servers keep reaching any public host until you opt in. | |
| - **`open`** (the default, and the same as leaving out `egress`) places no limit on destinations. |
There was a problem hiding this comment.
Accepted in 0c0e4b6.
| `policy` is either `open` or `allowlist`: | ||
|
|
||
| - **`open`** places no allow-list on destinations. It's the default, and leaving out the `egress` block entirely is the same as `open`, so existing servers keep reaching any public host until you opt in. | ||
| - **`allowlist`** refuses every outbound host except your API's origin, your OAuth issuer, and the hosts in `allowedUpstreams`. Declaring any `allowedUpstreams` turns on `allowlist` on its own, so write `policy: allowlist` by itself only to lock a server down to its API with no extra hosts (an empty allow-list). |
There was a problem hiding this comment.
Splitting this makes the empty-allowlist case easier to follow:
| - **`allowlist`** refuses every outbound host except your API's origin, your OAuth issuer, and the hosts in `allowedUpstreams`. Declaring any `allowedUpstreams` turns on `allowlist` on its own, so write `policy: allowlist` by itself only to lock a server down to its API with no extra hosts (an empty allow-list). | |
| - **`allowlist`** refuses every outbound host except your API's origin, your OAuth issuer, and the hosts in `allowedUpstreams`. Listing any `allowedUpstreams` turns on `allowlist` without setting `policy`. Set `policy: allowlist` alone to limit the server to its API. |
There was a problem hiding this comment.
Accepted in 0c0e4b6.
| - **`open`** places no allow-list on destinations. It's the default, and leaving out the `egress` block entirely is the same as `open`, so existing servers keep reaching any public host until you opt in. | ||
| - **`allowlist`** refuses every outbound host except your API's origin, your OAuth issuer, and the hosts in `allowedUpstreams`. Declaring any `allowedUpstreams` turns on `allowlist` on its own, so write `policy: allowlist` by itself only to lock a server down to its API with no extra hosts (an empty allow-list). | ||
|
|
||
| `allowedUpstreams` entries are bare hostnames, with no scheme, path, port, or wildcard, matched exactly: `api.stripe.com` does not cover `sub.api.stripe.com`. Under `allowlist` the check runs on every hop, so a redirect to a host that isn't allowed is refused too. |
There was a problem hiding this comment.
Vale Microsoft.Contractions error:
| `allowedUpstreams` entries are bare hostnames, with no scheme, path, port, or wildcard, matched exactly: `api.stripe.com` does not cover `sub.api.stripe.com`. Under `allowlist` the check runs on every hop, so a redirect to a host that isn't allowed is refused too. | |
| `allowedUpstreams` entries are bare hostnames, with no scheme, path, port, or wildcard, matched exactly: `api.stripe.com` doesn't cover `sub.api.stripe.com`. Under `allowlist` the check runs on every hop, so a redirect to a host that isn't allowed is refused too. |
There was a problem hiding this comment.
Accepted in 0c0e4b6, plus a short redirect clarifier (the global fetch follows redirects so each hop is checked; context.fetch returns a 3xx as-is) to line up with the context.fetch section.
nerminamiller-postman
left a comment
There was a problem hiding this comment.
ok to merge after review
|
Thanks for the review. Pushed
Nit (allow-list/allowlist): switched the prose to |
What changed
Documents two MCP server configuration options that shipped but were missing from the docs: the server
instructionsreturned oninitialize, and theegressoutbound allow-list.fern/products/mcp-generator/configure.mdxinitialize,appendInstructions(append) vsinstructions(replace), and the per-conversation token cost of verbatim author text.egress.policy(opendefault vsallowlist), the empty-allowlist lockdown, host-exact matching, every-hop redirect enforcement, and the always-on SSRF + credential-origin-lock layer underneath.context.fetchsection to the new egress section.fern/products/sdks/reference/sdk-config-reference.mdxinstructions,appendInstructions, andegressto the MCP targetgenerationreference.Field names and behavior verified against the
@postman/sdk-configschema and the shipped feature.Test plan
fern checkpasses (0 errors, no new warnings).#set-the-server-instructionsand#restrict-outbound-requestsanchors resolve.