John Howard 2371a5f37d
Docs: use URL for schemas (#954)
Makes it much more practical to use these
2026-02-12 14:52:28 -08:00
..
2026-02-12 14:52:28 -08:00
2025-07-18 14:40:33 -07:00

HTTP Example

This example shows using agentgateway as a standard HTTP proxy.

Running the example

cargo run -- -f examples/http/config.yaml

Let's look at the config to understand what's going on.

binds:
- port: 3000
  listeners:
  - routes:
    - backends:
      - mcp: ...

We have a few concepts to understand here:

  • binds represent each port our server listens on. In this case, we will listen on port 3000.
  • listeners can contain groups of resources. For our simple case here, we just have 1 listener.
  • routes can associate advanced routing functionality and traffic policies with traffic. In this case, we just match all traffic and do not apply any policies.
  • backends contains where the traffic is finally sent to. In this case, we have 1 backend of type mcp.

For the MCP backend, we can connect to MCP servers over HTTP or Stdio. Additionally, we can connect to multiple MCP servers, and expose them all as one aggregated server. In this example, we will connect to one server over Stdio.

name: default
targets:
- name: everything
  stdio:
    cmd: npx
    args: ["@modelcontextprotocol/server-everything"]

When clients connect to the gateway, the cmd will be executed to serve the traffic.

Now that we have the gateway running, we can use the mcpinspector to try it out.

npx @modelcontextprotocol/inspector

Once the inspector is running, it will present the port that it's running on, and then you can navigate to it in your browser.

Inspector

Agentgatway supports both SSE (served under /sse) and streamable HTTP (served under /mcp).

Once you're connected, you can navigate to the tools tab and see the available tools.

Tools

Let's try out one of the tools, like everything:echo.

Echo

That worked! The gateway was able to proxy the request to the everything tool and return the response.