Skip to content

docs(mcp-generator): server instructions and egress policy - #7969

Merged
tdclarin854 merged 3 commits into
mainfrom
tdclarin854/mcp-docs-instructions-egress
Nov 25, 2026
Merged

tdclarin854 merged 3 commits into
mainfrom
tdclarin854/mcp-docs-instructions-egress

Conversation

@tdclarin854

@tdclarin854 tdclarin854 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Documents two MCP server configuration options that shipped but were missing from the docs: the server instructions returned on initialize, and the egress outbound allow-list.

fern/products/mcp-generator/configure.mdx

  • New Set the server instructions section: the spec-generated instructions block returned on initialize, appendInstructions (append) vs instructions (replace), and the per-conversation token cost of verbatim author text.
  • New Restrict outbound requests section: egress.policy (open default vs allowlist), the empty-allowlist lockdown, host-exact matching, every-hop redirect enforcement, and the always-on SSRF + credential-origin-lock layer underneath.
  • Cross-link from the custom-tool context.fetch section to the new egress section.

fern/products/sdks/reference/sdk-config-reference.mdx

  • Adds instructions, appendInstructions, and egress to the MCP target generation reference.

Field names and behavior verified against the @postman/sdk-config schema and the shipped feature.

Test plan

  • fern check passes (0 errors, no new warnings).
  • Vercel preview renders both new sections; the #set-the-server-instructions and #restrict-outbound-requests anchors resolve.

- 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.
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

- 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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Redirects: the existing context.fetch section 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 global fetch in a custom tool's handler? Please also state outright whether egress covers the global fetch and not only context.fetch.
  2. 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?
  3. Source: the CLI changelog lists egress (5.228.0) but not instructions or appendInstructions. Which @postman/sdk-config version added them? Readers may need a minimum version.
  4. 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.

Written by Devin


## 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vale FernStyles.Hedges flags "a note that":

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeats the openapi:// URIs from the first paragraph, introduces _meta keys without explaining them, and calls the generated text "wiring". A tighter version:

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"):

Suggested change
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop "only ever":

Suggested change
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`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three clauses chained together. A shorter version:

Suggested change
- **`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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitting this makes the empty-allowlist case easier to follow:

Suggested change
- **`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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vale Microsoft.Contractions error:

Suggested change
`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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 nerminamiller-postman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok to merge after review

@tdclarin854

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed 0c0e4b6 accepting all the inline style suggestions (and the Vale fixes on lines 202 and 246). Answers to the questions:

  1. Redirects / global fetch vs context.fetch. egress is enforced at the platform outbound worker that every outbound request is forced through, so it covers both context.fetch and the global fetch a custom-tool handler can call — not only context.fetch. The "every hop" check applies to requests that follow redirects: the global fetch follows them (each hop is checked), while context.fetch returns a 3xx as-is and doesn't follow. I've stated both outright now (the egress intro and the redirect sentence).

  2. Instructions on every turn. Softened to "on every turn". This is inherent to MCP, not client-specific: the server returns instructions on initialize and the client includes them in the model's context on each turn. Fern doesn't control the cadence, so I dropped the "of every conversation" absolutism.

  3. Source / minimum version. instructions/appendInstructions shipped in @postman/sdk-config 0.25.0 (fern CLI 5.225.0); egress in 0.26.0 (fern CLI 5.228.0). I added version floors to both sections, matching the existing "Merged tools require Fern CLI 5.222.0 or later" line.

  4. Changelog. Both features already have fern CLI changelog entries (5.225.0, 5.228.0), and the MCP GA entry covers the GA surface. Since this PR is docs catch-up for already-shipped features, I didn't add a new mcp-generator/changelog/ entry — happy to add one if you'd prefer.

Nit (allow-list/allowlist): switched the prose to allowlist throughout to match the config key.

@tdclarin854
tdclarin854 merged commit 321ee0e into main Nov 25, 2026
4 checks passed
@tdclarin854
tdclarin854 deleted the tdclarin854/mcp-docs-instructions-egress branch November 25, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants