stdio Transport

The stdio transport connects agentgateway to MCP servers that run as local processes, communicating via standard input/output.

Overview

stdio transport is ideal when:

  • MCP servers run as local command-line tools
  • You want to manage MCP server lifecycle with agentgateway
  • The server is distributed as an npm package or binary

Quick start

# Download the stdio MCP configuration
curl -L https://raw.githubusercontent.com/agentgateway/agentgateway/refs/heads/main/examples/basic/config.yaml -o config.yaml

# Run agentgateway
agentgateway -f config.yaml

Configuration

Configure an stdio MCP backend in your config.yaml:

# yaml-language-server: $schema=https://agentgateway.dev/schema/config
binds:
- port: 3000
  listeners:
  - routes:
    - policies:
        cors:
          allowOrigins:
            - "*"
          allowHeaders:
            - "*"
          exposeHeaders:
            - "Mcp-Session-Id"
      backends:
      - mcp:
          targets:
          - name: my-mcp-server
            stdio:
              cmd: npx
              args:
                - "-y"
                - "@modelcontextprotocol/server-everything"

Example: MCP test server

The MCP test server (@modelcontextprotocol/server-everything) is useful for testing:

backends:
- mcp:
    targets:
    - name: test-server
      stdio:
        cmd: npx
        args:
          - "-y"
          - "@modelcontextprotocol/server-everything"

Example: Filesystem MCP server

Expose local filesystem access via MCP:

backends:
- mcp:
    targets:
    - name: filesystem
      stdio:
        cmd: npx
        args:
          - "-y"
          - "@modelcontextprotocol/server-filesystem"
          - "/path/to/allowed/directory"

Why use agentgateway?

Direct stdioWith agentgateway
One client per serverMultiple clients share servers
No authenticationOAuth2, API keys, or custom auth
No access controlTool-level authorization
Client manages processGateway manages lifecycle
No metricsFull observability with OpenTelemetry

Verify access

  1. Open the agentgateway UI to view your configuration
  2. Go to Playground to test tools
  3. Click Connect to retrieve available tools
  4. Select a tool and click Run Tool to test

Learn more

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/.