Skip to content

Docs for external MCP guardrails#618

Open
artberger wants to merge 6 commits into
mainfrom
adb-extmcp
Open

Docs for external MCP guardrails#618
artberger wants to merge 6 commits into
mainfrom
adb-extmcp

Conversation

@artberger

Copy link
Copy Markdown
Collaborator

Closes #609

Signed-off-by: Art Berger <art.berger@solo.io>
Signed-off-by: Art Berger <art.berger@solo.io>
@artberger artberger self-assigned this Jun 15, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploying agentproxy with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2a82be6
Status: ✅  Deploy successful!
Preview URL: https://e96bd986.agentproxy.pages.dev
Branch Preview URL: https://adb-extmcp.agentproxy.pages.dev

View logs

@artberger artberger marked this pull request as ready for review June 15, 2026 21:42
@@ -0,0 +1,88 @@
Use MCP guardrails (also called ExtMCP) to apply external authorization and external processing to Model Context Protocol (MCP) requests. An external gRPC policy server inspects, allows, mutates, or denies individual MCP method calls, such as `tools/call` and `tools/list`, using MCP request context instead of generic HTTP metadata.

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.

Suggested change
Use MCP guardrails (also called ExtMCP) to apply external authorization and external processing to Model Context Protocol (MCP) requests. An external gRPC policy server inspects, allows, mutates, or denies individual MCP method calls, such as `tools/call` and `tools/list`, using MCP request context instead of generic HTTP metadata.
Use MCP guardrails (also called ExtMCP) to apply external authorization and external processing to Model Context Protocol (MCP) requests. An external gRPC policy server inspects, allows, mutates, or denies individual MCP method calls, such as `tools/call` and `tools/list`, by using the MCP request context instead of generic HTTP metadata.


{{< reuse "agw-docs/snippets/agentgateway-capital.md" >}} already supports [external authorization]({{< link-hextra path="/security/extauth/basic" >}}) and [external processing (ExtProc)]({{< link-hextra path="/traffic-management/extproc" >}}) for HTTP traffic. Both call out to an external gRPC server so that you can centralize authorization and request or response mutation outside the proxy. However, these integrations operate on raw HTTP. To make a decision about an MCP tool call, the external server must reassemble the HTTP body, parse the JSON-RPC envelope, and handle MCP framing itself.

MCP guardrails solve this by calling out at the MCP method layer instead of the HTTP layer. The ExtMCP protocol is modeled on Envoy's ext_authz, but the external server receives a structured, MCP-native payload: the JSON-RPC method name, the target backend, the request or response parameters, and selected request headers. The server can then make a decision based on the actual tool, prompt, or resource being accessed, without re-implementing MCP semantics.

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.

Suggested change
MCP guardrails solve this by calling out at the MCP method layer instead of the HTTP layer. The ExtMCP protocol is modeled on Envoy's ext_authz, but the external server receives a structured, MCP-native payload: the JSON-RPC method name, the target backend, the request or response parameters, and selected request headers. The server can then make a decision based on the actual tool, prompt, or resource being accessed, without re-implementing MCP semantics.
MCP guardrails solve this challenge by calling out at the MCP method layer instead of the HTTP layer. The ExtMCP protocol is modeled on Envoy's `ext_authz` filter, but the external server receives a structured, MCP-native payload, including the JSON-RPC method name, the target backend, the request or response parameters, and selected request headers. The server can then make a decision based on the actual tool, prompt, or resource that is being accessed, without re-implementing MCP semantics.

* Rewrite request parameters or response results to redact sensitive data or inject context.
* Centralize MCP authorization logic in an external service that you already operate.

### Sequence diagram

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.

Suggested change
### Sequence diagram
### How it works

participant Client as MCP client
participant AGW as agentgateway
participant Ext as ExtMCP server
participant MCP as MCP target

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.

Suggested change
participant MCP as MCP target
participant MCP as MCP backend

AGW->>MCP: Forward (possibly mutated) request
MCP-->>AGW: Result
AGW->>Ext: CheckResponse (result)
Ext-->>AGW: Pass or Mutated result

@Nadine2016 Nadine2016 Jun 16, 2026

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.

Suggested change
Ext-->>AGW: Pass or Mutated result
Ext-->>AGW: Pass or return mutated response

Client->>AGW: tools/call (JSON-RPC)
AGW->>Ext: CheckRequest (method, tool, params, headers)
alt Allowed or mutated
Ext-->>AGW: Pass or Mutated params

@Nadine2016 Nadine2016 Jun 16, 2026

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.

Suggested change
Ext-->>AGW: Pass or Mutated params
Ext-->>AGW: Pass request or return mutated params

AGW->>Ext: CheckResponse (result)
Ext-->>AGW: Pass or Mutated result
AGW-->>Client: Result
else Denied

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.

wondering if there is another alternative route where the authorization error comes up after it checks the response


### Phases

The `methods` map controls when each method runs through a processor. Set a phase for each method that you want to send to the server.

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.

the sections before the steps start are heard to understand as it talks about settings that you don't know where they are coming from. I think it would be good to have a sample agw policy and tell people that this is where you set it. then you dive into individual settings

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.

also wondering if all of those concepts should live on a separate page. the page is pretty long

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.

might also be good to explain the methods block and that this refers to the API calls in the MCP spec

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.

looking at the policy, maybe you change the IA and start from the processor perspective. say that the processor defines the actions to take for a particular request/ response. and then you explain that each processor must be enforced by an ExtMCP server. that you can have multiple ExtMCP and each does a specific manipulation. and then for each processor, you say that you need to define the phase when this manipulation is supposed to happen, the method and the actual action.

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.

can we also add a link to the ExtMCP spec so that people know what to do to make their server compliant

appProtocol: agentgateway.dev/mcp
EOF
```

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.

maybe add verification steps?

methods:
tools/call: Request
tools/list: Response
EOF

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.

can we add a description for this block

methods:
            tools/call: Request
            tools/list: Response

it is a little hard to understand for me what this is actually doing

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added a table after the config

- backendRefs:
- name: ext-mcp
port: 4445
---

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.

it is a little hard to understand where this hostname is coming from and where this is used. also do you always create an httproute or only to apply the policy? because the policy does not seem to reference the httproute


### Step 6: Optional: Set a timeout for the policy server {#timeout}

The guardrails callout has no deadline by default. If the policy server is slow or cold, the request can hang instead of letting `failureMode` engage. To bound the call, set a request timeout on the policy server with a `backend.http.requestTimeout` policy.

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.

what happens if the timeout is happening. will the call just fail? (aka what does the MCP client see?)

artberger and others added 3 commits June 16, 2026 18:51
Signed-off-by: Art Berger <art.berger@solo.io>
Signed-off-by: Art Berger <art.berger@solo.io>
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.

Docs for ext MCP

2 participants