Streamable HTTP

Connect to an MCP server via streamable HTTP.

Want to use agentgateway in a Kubernetes environment with the Gateway API? Check out the kgateway docs.

Before you begin

Install the agentgateway binary.

Configure the agentgateway

  1. Spin up an MCP server that uses streamable HTTP.

    PORT=3005 npx -y @modelcontextprotocol/server-everything streamableHttp
  2. Create a configuration for your agentgateway to connect to your MCP server.

    cat <<EOF > config.yaml
    binds:
    - port: 3000
      listeners:
      - routes:
        - policies:
            cors:
              allowOrigins:
                - "*"
              allowHeaders:
                - "*"
          backends:
          - mcp:
              targets:
              - name: mcp
                mcp:
                  host: http://localhost:3005/mcp/
    EOF
  3. Run the agentgateway.

    agentgateway -f config.yaml

Verify access to tools

  1. Open the agentgateway UI to view your listener and backend configuration.

  2. Connect to the MCP test server with the agentgateway UI playground.

    1. From the navigation menu, click Playground.

    2. In the Testing card, review your Connection details and click Connect. The agentgateway UI connects to the target that you configured and retrieves the tools that are exposed on the target.

    3. Verify that you see a list of Available Tools.

  3. Verify access to a tool.

    1. From the Available Tools list, select the echo tool.

    2. In the message field, enter any string, such as This is my first agentgateway setup., and click Run Tool.

    3. Verify that you see your message echoed in the Response card.