Skip to content
Latest (currently 2026.10.2) has the newest features, bug fixes, and CVE patches of Solo Enterprise for agentgateway.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Composable MCP

Enterprise
Verified : Automated tests passed for: End-to-end run: Every step ran in a fresh test environment and the results were checked.
Page as Markdown

Define custom MCP tools as multi-step pipelines that chain HTTP and MCP calls together with CEL expressions.

Each step in that pipeline is an HTTP request or a tool call on another MCP server, and subsequent steps can reference earlier outputs. A final CEL expression assembles the composite response that downstream MCP clients receive.

About composable MCP

In many agentic workflows, a single user action requires data from multiple sources. For example, an agent might need to fetch a user profile from one REST API and a list of that user’s recent repositories from another. Without composable MCP, you would need to build a custom MCP server to combine those results.

A composable MCP target removes the need for a custom server by letting you declare a pipeline of steps directly on an EnterpriseAgentgatewayBackend. Each step is either an HTTP call (to any REST API) or an MCP call (to another MCP server). Steps run sequentially, and each step’s JSON response is captured in output.<step_name> so that later steps and the final output expression can reference it. The composite tool appears to downstream MCP clients as a single tool in tools/list.

The key components of a composable MCP target are:

  • inputSchema: A JSON schema that defines the tool’s input parameters. The gateway validates every incoming tool call against this schema before running any steps.
  • steps: An ordered list of HTTP and MCP calls. Each step has a unique name, and its response is stored in output.<step_name>.
  • output: A CEL expression evaluated after all steps complete. The result becomes the tool’s return value.

There are two ways to create a composable MCP server:

  • Composable MCP wizard (Solo UI): Turn an existing OpenAPI service into a composable MCP server without writing YAML by hand. The wizard imports an OpenAPI document, lets you choose which operations to expose, and generates the backend and route resources for you. Each selected operation becomes a composable target with a single HTTP step. For more information, see Create an MCP server (UI).
  • Manually with YAML: Define the composable target directly on an EnterpriseAgentgatewayBackend resource for full control over multi-step pipelines that chain HTTP and MCP calls with CEL expressions. For more information, see the steps in Create an MCP server (YAML).

Create an MCP server (UI)

The Composable MCP wizard in the Solo UI turns an existing OpenAPI service into a composable MCP server in four steps: Import, Compose, Deploy, and Expose. You import an OpenAPI document and select the operations to expose. Then, the wizard generates the resources for you: an EnterpriseAgentgatewayBackend MCP server, its upstream backend, and an HTTPRoute with a permissive CORS policy. Each operation that you select becomes a composable target with a single HTTP step, so the wizard gives you the same composable MCP capability as the manual steps through a guided workflow. When you finish, the wizard opens the deployed server in the agentgateway playground so that you can test it right away.

Before you begin

  1. Install the agentgateway control plane.
  2. Set up the Solo UI and open it in your browser.

Step 1: Import an OpenAPI spec

  1. In the Solo UI, click Composable MCP in the navigation menu.

  2. On the Import step, choose how to provide your OpenAPI document:

    • URL Fetch: Enter a URL to an OpenAPI document. The UI fetches the document from your browser, so the URL must be reachable from your browser and allow cross-origin requests.
    • File Upload: Upload a .yaml, .yml, or .json file up to 5 MiB.
    • YAML Editor: Paste the document directly into an editor.
  3. This example uses a minimal Swagger Petstore spec that exposes two operations. Run the following command to create a petstore.json file, select File Upload, and upload the file. Because the servers entry uses an absolute https URL, the wizard can infer the upstream host, port, and TLS settings in the Deploy step.

    cat > petstore.json <<'EOF'
    {
      "openapi": "3.0.4",
      "info": {
        "title": "Swagger Petstore",
        "description": "A sample API for a pet store.",
        "version": "1.0.0"
      },
      "servers": [
        { "url": "https://petstore3.swagger.io/api/v3" }
      ],
      "paths": {
        "/store/inventory": {
          "get": {
            "operationId": "getInventory",
            "summary": "Returns pet inventories by status",
            "description": "Returns a map of status codes to quantities.",
            "responses": { "200": { "description": "successful operation" } }
          }
        },
        "/pet/{petId}": {
          "get": {
            "operationId": "getPetById",
            "summary": "Find pet by ID",
            "description": "Returns a single pet.",
            "parameters": [
              {
                "name": "petId",
                "in": "path",
                "description": "ID of pet to return",
                "required": true,
                "schema": { "type": "integer", "format": "int64" }
              }
            ],
            "responses": { "200": { "description": "successful operation" } }
          }
        }
      }
    }
    EOF
  4. Verify that the wizard validates the document and reports the number of operations that it found, such as OpenAPI file is valid · 2 operations found. Then, click Continue.

Step 2: Compose the MCP server

On the Compose step, select which API paths and parameters to expose through your MCP server. Every operation is selected by default. To expose only a subset, click Select none and select the operations that you want, or use the filter to find specific paths. When you select a path, its parameters are shown in the Path Parameters panel. Leave both operations selected for this example, and click Continue.

Step 3: Deploy the MCP server

On the Deploy step, the wizard infers the upstream connection details from the spec’s server URL and generates the resources to create the MCP server.

  1. Review the resource configuration. You can edit any of the following fields:

    FieldDescription
    MCP Server NameThe name of the EnterpriseAgentgatewayBackend MCP server that exposes the composed tools. Defaults to the imported document’s name, such as petstore.
    Upstream NameThe name of the EnterpriseAgentgatewayBackend that represents the upstream API, such as petstore-upstream.
    MCP & Upstream NamespaceThe namespace to create both backends in. Defaults to agentgateway-system.
    Upstream hostThe upstream hostname. Inferred from the spec’s server URL. For this example, the wizard fills in petstore3.swagger.io.
    Upstream portThe upstream port. Inferred from the server URL scheme. Because the server uses https, the wizard fills in 443.

    Because the spec’s server uses an absolute https URL, the wizard also adds a tls: {} policy to the upstream backend so that the gateway originates a TLS connection to the API. If your spec uses a relative server URL or the wizard cannot infer these values, enter the upstream host and port manually.

  2. Review the generated YAML in the code block. The wizard creates two EnterpriseAgentgatewayBackend resources: an upstream backend with the inferred static host, port, and TLS settings, and an MCP backend whose entMcp.targets list contains one composable custom target per operation that you selected. Each target has a single HTTP step that calls the upstream backend.

  3. Click the Copy or Download button to get a YAML file that you can apply to your cluster. The wizard does not apply the resources for you.

    kubectl apply -f - <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayBackend
    metadata:
      name: petstore-upstream
      namespace: agentgateway-system
    spec:
      policies:
        tls: {}
      static:
        host: petstore3.swagger.io
        port: 443
    ---
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayBackend
    metadata:
      name: petstore
      namespace: agentgateway-system
    spec:
      entMcp:
        targets:
          - name: get-inventory
            custom:
              description: "Returns pet inventories by status. Returns a map of status codes to quantities."
              inputSchema:
                type: object
              steps:
                - name: request
                  http:
                    backendRef:
                      group: enterpriseagentgateway.solo.io
                      kind: EnterpriseAgentgatewayBackend
                      name: petstore-upstream
                    method: GET
                    path: '"/api/v3/store/inventory"'
              output: output.request
          - name: get-pet-by-id
            custom:
              description: "Find pet by ID. Returns a single pet."
              inputSchema:
                type: object
                properties:
                  petId:
                    type: integer
                    description: "ID of pet to return"
                required:
                - petId
              steps:
                - name: request
                  http:
                    backendRef:
                      group: enterpriseagentgateway.solo.io
                      kind: EnterpriseAgentgatewayBackend
                      name: petstore-upstream
                    method: GET
                    path: '"/api/v3/pet/" + string(input.petId)'
              output: output.request
    EOF
  4. After the resources are created, the wizard detects them and enables the Continue button. Click Continue.

Step 4: Expose the MCP server

On the Expose step, the wizard generates an HTTPRoute and a permissive CORS policy so that the MCP server can be reached through the gateway and tested in the playground.

  1. Review the route configuration. You can edit any of the following fields:

    FieldDescription
    NameThe name of the HTTPRoute, such as petstore-route.
    NamespaceThe namespace to create the route in. Defaults to agentgateway-system.
    Path override (optional)The path prefix that the route matches, such as /petstore-mcp.
    GatewayThe gateway to attach the route to, such as agentgateway-proxy.
  2. Review the generated YAML. The wizard creates an HTTPRoute that routes the path prefix to the MCP backend, and an AgentgatewayPolicy that applies a permissive CORS policy to the route so that the playground can call it from your browser.

  3. Click the Copy or Download button to get a YAML file that you can apply to your cluster. The wizard does not apply the resources for you.

    kubectl apply -f - <<EOF
    apiVersion: gateway.networking.k8s.io/v1
    kind: HTTPRoute
    metadata:
      name: petstore-route
      namespace: agentgateway-system
    spec:
      parentRefs:
        - name: agentgateway-proxy
      rules:
        - matches:
            - path:
                type: PathPrefix
                value: /petstore-mcp
          backendRefs:
            - group: enterpriseagentgateway.solo.io
              kind: EnterpriseAgentgatewayBackend
              name: petstore
    ---
    apiVersion: agentgateway.dev/v1alpha1
    kind: AgentgatewayPolicy
    metadata:
      name: petstore-route-cors
      namespace: agentgateway-system
    spec:
      targetRefs:
        - group: gateway.networking.k8s.io
          kind: HTTPRoute
          name: petstore-route
      traffic:
        cors:
          allowOrigins:
            - "*"
          allowMethods:
            - "*"
          allowHeaders:
            - "*"
    EOF
  4. After the resources are created, the wizard detects them and enables the Continue button. Click Continue.

Step 5: Test the MCP server in the playground

After you apply the route, the wizard opens the Playground tab with the new route selected. From here, you can connect to the MCP server and call its tools.

  1. In the Connection Settings card, provide a route bearer token if your route requires authentication. For this example, no token is required. Click Connect.

  2. After you connect, the playground lists the tools that the MCP server exposes. Each composable target appears as a tool named <target>_<tool>, such as get-inventory_get-inventory and get-pet-by-id_get-pet-by-id.

  3. Select a tool, provide any required input parameters, and run it. For example, select the get-inventory_get-inventory tool, which takes no parameters, and click Run Tool. Verify that the response contains the pet inventory from the upstream API. The following image shows a sample response; the exact inventory values that you see depend on the live upstream API.

Clean up the wizard resources

You can remove the resources that you created in this guide.
kubectl delete HTTPRoute petstore-route -n agentgateway-system
kubectl delete AgentgatewayPolicy petstore-route-cors -n agentgateway-system
kubectl delete EnterpriseAgentgatewayBackend petstore petstore-upstream -n agentgateway-system

Create an MCP server (YAML)

Create an MCP server with YAML by defining the composable target directly on an EnterpriseAgentgatewayBackend resource. This example defines a github-summary tool that fetches a GitHub user’s profile and their public repositories in two HTTP steps, then synthesizes a greeting from both results.

Before you begin

Install the agentgateway control plane.

Step 1: Create a backend for the upstream HTTP API

Create an EnterpriseAgentgatewayBackend resource that represents the target that you want to access. In this example, you use the GitHub API server. Because, the server only accepts HTTPS connections, create an EnterpriseAgentgatewayPolicy resource that originates TLS connections to the GitHub API server backend.

kubectl apply -f- <<EOF
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayBackend
metadata:
  name: github-api
  namespace: default
spec:
  static:
    host: api.github.com
    port: 443
---
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayPolicy
metadata:
  name: github-api-tls
  namespace: default
spec:
  targetRefs:
    - group: enterpriseagentgateway.solo.io
      kind: EnterpriseAgentgatewayBackend
      name: github-api
  backend:
    tls: {}
EOF

Step 2: Create the composable MCP target

Create an EnterpriseAgentgatewayBackend resource that defines the composed tool that you want to expose to users. This example defines a github-summary tool that fetches a GitHub user’s profile and their public repositories in two HTTP steps, then synthesizes a greeting from both results.

kubectl apply -f- <<EOF
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayBackend
metadata:
  name: composable-mcp
  namespace: default
spec:
  entMcp:
    targets:
    - name: github-summary
      custom:
        description: "Fetch a GitHub user's public profile and list a few of their repositories."
        inputSchema:
          type: object
          additionalProperties: false
          required: [name]
          properties:
            name:
              type: string
              description: "GitHub username"
        steps:
        - name: user
          http:
            backendRef:
              group: enterpriseagentgateway.solo.io
              kind: EnterpriseAgentgatewayBackend
              name: github-api
            method: GET
            path: '"/users/" + input.name'
            headers:
              - name: User-Agent
                value: '"agentgateway-composable-mcp"'
              - name: Accept
                value: '"application/vnd.github+json"'
        - name: repos
          http:
            backendRef:
              group: enterpriseagentgateway.solo.io
              kind: EnterpriseAgentgatewayBackend
              name: github-api
            method: GET
            path: '"/users/" + input.name + "/repos?per_page=5"'
            headers:
              - name: User-Agent
                value: '"agentgateway-composable-mcp"'
              - name: Accept
                value: '"application/vnd.github+json"'
        output: |
          "Hello " + output.user.login
          + "! You have " + string(output.user.public_repos) + " public repos."
          + " A few of them: " + output.repos.map(r, r.name).join(", ") + "."
EOF
Review the following table to understand this configuration.
SettingDescription
entMcp.targets[].customDeclares a composable MCP target. The target is exposed as a single MCP tool to downstream clients.
custom.descriptionTool description advertised to downstream MCP clients in tools/list.
custom.inputSchemaRequired. JSON Schema for the tool’s input parameters. Every incoming tool call is validated against this schema before any step runs. This example requires the GitHub username to be sent in a name input parameter.
custom.stepsOrdered list of HTTP and MCP steps. You can define 1–64 steps per target. Each step’s JSON response is stored under output.<step_name>.
custom.steps[].httpAn HTTP step. Required: backendRef. Optional: method (defaults to GET), path (CEL), body (CEL), headers (each value is CEL).
custom.steps[].mcpAn MCP step. Required: backendRef, tool. Optional: arguments (CEL expression that evaluates to a JSON object).
custom.outputCEL expression evaluated after all steps complete. The result becomes the tool’s return value that the MCP client sees. The expression refers to earlier step responses with output.<step_name>.<field>, where <step_name> matches the name of an entry in custom.steps and <field> is a key from that step’s JSON response. For example, output.user.login reads the login field from the response of the step named user. To learn more about CEL expressions in composable MCP, see the CEL expressions section.

Step 3: Route to the composable target

Create an HTTPRoute that routes incoming MCP traffic to the composable EnterpriseAgentgatewayBackend.

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: composable-mcp
  namespace: default
spec:
  parentRefs:
    - name: agentgateway-proxy
      namespace: agentgateway-system
  rules:
    - matches:
      - path:
          type: PathPrefix
          value: /mcp
      backendRefs:
      - name: composable-mcp
        group: enterpriseagentgateway.solo.io
        kind: EnterpriseAgentgatewayBackend
EOF

Step 4: Verify the composable tool

Send MCP requests through the gateway to verify that the composable tool works.

  1. Get the agentgateway address.

    export INGRESS_GW_ADDRESS=$(kubectl get gateway agentgateway-proxy -n agentgateway-system -o=jsonpath="{.status.addresses[0].value}")
    echo $INGRESS_GW_ADDRESS
    kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80
    export INGRESS_GW_ADDRESS=localhost:8080
  2. Initialize an MCP session.

    curl -sD - "http://${INGRESS_GW_ADDRESS}/mcp" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -d '{
        "jsonrpc": "2.0",
        "id": 1,
        "method": "initialize",
        "params": {
          "protocolVersion": "2025-03-26",
          "capabilities": {},
          "clientInfo": {"name": "test", "version": "1.0"}
        }
      }'

    Example output: In the response headers, note the mcp-session-id value.

    HTTP/1.1 200 OK
    content-type: text/event-stream
    cache-control: no-cache
    mcp-session-id: eyJ0Ij...
    transfer-encoding: chunked
    date: Thu, 14 May 2026 20:38:05 GMT
    
    data: {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{"tools":{}},"serverInfo":{"name":"rmcp","version":"1.5.0"}}}
  3. Save the session ID as an environment variable.

    export SESSION_ID=eyJ0Ij...
  4. List the available tools.

    curl -s "http://${INGRESS_GW_ADDRESS}/mcp" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -H "Mcp-Session-Id: $SESSION_ID" \
      -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}'

    Example output: Verify that github-summary appears in the tools list with the input schema you defined.

    data: {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"github-summary","description":"Fetch a GitHub user's public profile and list a few of their repositories.","inputSchema":{"additionalProperties":false,"properties":{"name":{"description":"GitHub username","type":"string"}},"required":["name"],"type":"object"}}]}}
  5. Call the composable tool. Make sure to enter all required input parameters in the params block. In this example, you provide the GitHub username in the name field as defined in your composable tool that you created earlier. Verify that the response contains a greeting message that combines the fields from both steps that you defined in the composable tool.

    curl -s "http://${INGRESS_GW_ADDRESS}/mcp" \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -H "Mcp-Session-Id: $SESSION_ID" \
      -d '{
        "jsonrpc": "2.0",
        "id": 3,
        "method": "tools/call",
        "params": {
          "name": "github-summary",
          "arguments": {"name": "octocat"}
        }
      }'

    Example output:

    data: {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"Hello octocat! You have 8 public repos. A few of them: boysenberry-repo-1, git-consortium, hello-worId, Hello-World, linguist."}],"isError":false}}

Step reference

Review the following reference information for the steps in your composable MCP target on the EnterpriseAgentgatewayBackend resource.

HTTP steps

An HTTP step makes a REST API call. Responses must be JSON. Non-2xx responses fail the step. The step’s JSON response is bound to output.<step_name> for later steps and the final output expression.

An HTTP step picks an upstream with a backendRef. The referenced object can be a Kubernetes Service, an upstream AgentgatewayBackend, or an EnterpriseAgentgatewayBackend resource with a static or aws spec. Inline policies on the referenced backend, such as TLS, retries, or auth apply to the request.

Reference a Kubernetes Service in the same namespace. The port field is required.

- name: internal-lookup
  http:
    backendRef:
      group: ""
      kind: Service
      name: users-svc
      port: 8080
    method: POST
    path: '"/lookup"'
    body: '{"id": input.user_id}'

Reference an upstream AgentgatewayBackend resource. The port is resolved from the backend resource; do not set a port here.

- name: internal-api
  http:
    backendRef:
      group: agentgateway.dev
      kind: AgentgatewayBackend
      name: internal-api
    method: GET
    path: '"/items/" + input.id'

Reference an EnterpriseAgentgatewayBackend resource with a static or aws spec. The port is resolved from the backend; do not set a port here.

- name: github
  http:
    backendRef:
      group: enterpriseagentgateway.solo.io
      kind: EnterpriseAgentgatewayBackend
      name: github-api
    method: GET
    path: '"/users/" + input.name'
FieldDescription
backendRef.groupRequired. "" for Service, agentgateway.dev for AgentgatewayBackend, or enterpriseagentgateway.solo.io for EnterpriseAgentgatewayBackend.
backendRef.kindRequired. Must match the group: Service, AgentgatewayBackend, or EnterpriseAgentgatewayBackend.
backendRef.nameRequired. Name of the referenced resource in the same namespace.
backendRef.portRequired when kind is Service. Must not be set otherwise.
methodHTTP method. One of GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. Defaults to GET.
pathCEL expression for the request path. Defaults to "/".
bodyCEL expression for the request body.
headersList of headers, up to 32 entries. Each header has a name (string) and a value that is a CEL expression.

MCP steps

An MCP step calls a tool on another MCP server and uses its response as the step output. The upstream is picked with a backendRef that points at an MCP-typed AgentgatewayBackend or EnterpriseAgentgatewayBackend resource. To reach an MCP server that is fronted by a Kubernetes Service, create an MCP backend that points at the Service first, then reference that backend in the MCP step.

An MCP backend resource can expose multiple MCP server targets (each entry under mcp.targets[] or entMcp.targets[]). The fields on the MCP step let you drill down to a single tool call as follows:

  • backendRef.name: The name of the MCP backend resource.
  • backendRef.target: The name of a target inside the referenced backend. Optional. If omitted, the gateway treats the whole backend as a single streamable-HTTP MCP server.
  • tool: The name of the MCP tool to call on the selected target.

The MCP step’s response is either the upstream tools/call result’s structuredContent (if present), or the first text content parsed as JSON. If neither of them are returned, the response is set to null.

Reference a specific target on an MCP-typed backend with target. Dispatch happens in-process without a network hop.

- name: time
  mcp:
    backendRef:
      group: enterpriseagentgateway.solo.io
      kind: EnterpriseAgentgatewayBackend
      name: upstream-mcp
      target: time
    tool: get_current_time
    arguments: '{"timezone": has(input.timezone) ? input.timezone : "UTC"}'

Reference an MCP backend without selecting a target. The gateway treats the entire backend as a single streamable-HTTP MCP server.

- name: search
  mcp:
    backendRef:
      group: agentgateway.dev
      kind: AgentgatewayBackend
      name: search-mcp-backend
    tool: search
    arguments: '{"q": input.query}'
FieldDescription
backendRef.groupRequired. agentgateway.dev for AgentgatewayBackend, or enterpriseagentgateway.solo.io for EnterpriseAgentgatewayBackend.
backendRef.kindRequired. Must match the group: AgentgatewayBackend or EnterpriseAgentgatewayBackend. The referenced backend must be MCP-typed.
backendRef.nameRequired. Name of the referenced backend in the same namespace.
backendRef.targetOptional. Name of a specific target on the referenced MCP backend. If omitted, the backend is treated as a single streamable-HTTP MCP server.
toolRequired. The name of the MCP tool to call on the upstream server.
argumentsCEL expression that evaluates to a JSON object. Passed as the arguments field when calling the upstream MCP tool.

CEL expressions

CEL expressions are used in HTTP path, body, and header value fields; MCP arguments; and the target-level output.

Available variables

Composable MCP steps use a separate CEL context from policy CEL expressions. The following variables are available:

VariableTypeDescription
inputobjectThe tool call arguments from the downstream client, validated against the inputSchema.
outputobjectAn object keyed by step name. For example, output.user.login reads the login field from the user step’s JSON response. Only steps that have already run are available.
requestobjectThe incoming downstream HTTP request (headers, method, path).
jwtobjectClaims from the validated JWT token, if a JWT policy is attached to the downstream route.
apiKeyobjectThe API key principal, if an API key policy is attached to the downstream route.

Output behavior

Each step’s upstream response must be JSON, which is how step results become available to later steps and the final output expression. The final output expression itself, however, can evaluate to any CEL value (a string, object, list, number, or boolean). The shape of that final value controls what the downstream MCP client receives:

  • String result: If the output expression evaluates to a string (for example, "Hello " + output.user.login), the gateway returns it to the MCP client as a single text content item.
  • Any other value: If the output expression evaluates to an object, list, number, or boolean (for example, { "user": output.user.login, "repos": output.user.public_repos }), the gateway serializes the value to JSON and returns the JSON as a text content item. The same value is also attached as structuredContent for MCP clients that support the structured content extension.

Example expressions

The following examples walk through the output expression patterns that you commonly use to construct the tool response.

Example 1: Simple string concatenation

This expression returns a string that concatenates a greeting with the login field from the response of a step named user. The MCP client receives a single text content item.

output: '"Hello " + output.user.login'

Example 2: Combining multiple step outputs

This is the expression used in the github-summary example earlier in this guide. To understand how the expression maps to the upstream response, consider the JSON that the GitHub API returns for the two HTTP steps when called with name: octocat.

The user step calls GET https://api.github.com/users/octocat, which returns a JSON object similar to the following (most fields omitted for clarity):

{
  "login": "octocat",
  "name": "The Octocat",
  "public_repos": 8,
  ...
}

The repos step calls GET https://api.github.com/users/octocat/repos?per_page=5, which returns a JSON array of repository objects:

[
  { "name": "Hello-World", ... },
  { "name": "Spoon-Knife", ... },
  { "name": "octocat.github.io", ... },
  { "name": "git-consortium", ... },
  { "name": "hello-worId", ... }
]

The output expression then references each step’s response and transforms the data into the final greeting.

output: |
  "Hello " + output.user.login
  + "! You have " + string(output.user.public_repos) + " public repos."
  + " A few of them: " + output.repos.map(r, r.name).join(", ") + "."

In this expression:

  • output.user.login reads the login field from the user step’s JSON response ("octocat").
  • string(output.user.public_repos) reads public_repos (8) and converts the integer to a string so it can be concatenated.
  • output.repos.map(r, r.name) iterates over the array returned by the repos step and maps each repository object r to its name field, producing the list ["Hello-World", "Spoon-Knife", "octocat.github.io", "git-consortium", "hello-worId"].
  • .join(", ") joins the list into a single comma-separated string.

The MCP client receives the resulting text:

Hello octocat! You have 8 public repos. A few of them: Hello-World, Spoon-Knife, octocat.github.io, git-consortium, hello-worId.

Example 3: Returning structured data

Instead of a string, the expression can evaluate to an object. The gateway serializes the object to JSON and also attaches it as structuredContent for MCP clients that support that extension.

output: |
  {
    "user": output.user.login,
    "repos": output.user.public_repos,
    "top_repos": output.repos.map(r, r.name)
  }

Sessions

MCP steps participate in the downstream session lifecycle. When the downstream client sends initialize, the gateway fans the handshake out to every MCP step in the pipeline so that upstream sessions are established before the tool is called.

Clients that skip the initialize step see the upstream’s own session error on the first tools/call.

Cleanup

You can remove the resources that you created in this guide.
kubectl delete HTTPRoute composable-mcp -n default
kubectl delete EnterpriseAgentgatewayBackend composable-mcp -n default
kubectl delete EnterpriseAgentgatewayBackend github-api -n default
kubectl delete EnterpriseAgentgatewayPolicy github-api-tls -n default