Skip to main content

stdio Transport

Connect agentgateway to local process-based MCP servers

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://agentgateway.dev/examples/mcp-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
mcp:
port: 3000
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:

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

Example: Filesystem MCP server

Expose local filesystem access via MCP:

mcp:
port: 3000
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