Skip to content

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

Page as Markdown

Stdio

Expose MCP servers through the agentgateway.

An MCP backend allows exposing MCP servers through the agentgateway using STDIOSTDIO (Standard Input/Output)A connection method for MCP servers that communicates through standard input and output streams. STDIO is commonly used for local MCP server processes..

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

Before you begin

Install the agentgateway binary.

Configure the agentgateway

  1. Download an MCP configuration for your agentgateway.

    curl -L https://agentgateway.dev/examples/basic/config.yaml -o config.yaml
  2. Review the configuration file.

    cat config.yaml
    binds:
    - port: 3000
      listeners:
      - routes:
        - policies:
            cors:
              allowOrigins:
              - "*"
              allowHeaders:
              - mcp-protocol-version
              - content-type
              - cache-control
              exposeHeaders:
              - "Mcp-Session-Id"
          backends:
          - mcp:
              targets:
              - name: everything
                stdio:
                  cmd: npx
                  args: ["@modelcontextprotocol/server-everything"]
    Review the following table to understand this configuration.
    FieldDescription
    mcpThe top-level MCP configuration block that defines how agentgateway connects to MCP servers.
    portThe port on which agentgateway listens for incoming MCP requests, such as 3000. If not specified, a default port is used.
    targetsA list of MCP targets to connect to. Each target defines an MCP server that agentgateway proxies requests to. At least one target is required.
    nameA unique name for the MCP target, such as server-everything. This name identifies the target in logs and the UI.
    stdioConfiguration for connecting to an MCP server via standard input/output. Use this for local MCP servers that run as a command. Contains cmd (the command to run) and args (arguments for the command). In this example, npx runs the @modelcontextprotocol/server-everything package.
    mcpConfiguration for connecting to a remote MCP server via streamable HTTP. Use this for remote MCP servers. Contains host (the URL of the MCP server endpoint).
  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.

Was this page helpful?
Agentgateway assistant

Ask me anything about agentgateway configuration, features, or usage.

Note: AI-generated content might contain errors; please verify and test all returned information.

Tip: one topic per conversation gives the best results. Use the + button in the chat header to start a new conversation.

Switching topics? Starting a new conversation improves accuracy.
↑↓ navigate select esc dismiss

What could be improved?

Your feedback helps us improve assistant answers and identify docs gaps we should fix.

Need more help? Join us on Discord: https://discord.gg/y9efgEmppm

Want to use your own agent? Add the Solo MCP server to query our docs directly. Get started here: https://search.solo.io/.