Skip to content
agentgateway has joined the Agentic AI Foundation — Learn more

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

Stdio

Verified : Code examples on this page have been automatically tested and verified.
Page as Markdown

Run a local MCP server as a subprocess and expose it through agentgateway over stdio.

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

Before you begin

Install the agentgateway binary.

Configure the agentgateway

You can add the MCP server in the UI or in a configuration file.

  1. Create a configuration with an empty mcp section, and start agentgateway. You add the MCP server in the UI.

    cat <<'EOF' > config.yaml
    # yaml-language-server: $schema=https://agentgateway.dev/schema/config
    mcp:
      port: 3000
      targets: []
    EOF
    agentgateway -f config.yaml
  2. Open http://localhost:15000/ui/mcp/servers (MCP > Servers), and click Add server.

  3. Enter everything for the Server name, and select the Command Line transport.

  4. Enter npx for the Command and @modelcontextprotocol/server-everything for the Arguments.

    Add MCP server drawer for the everything target with the npx command and the @modelcontextprotocol/server-everything argument
    Add MCP server drawer for the everything target with the npx command and the @modelcontextprotocol/server-everything argument
  5. Click Save server.

The UI writes the same everything target as the example configuration, plus an empty env map and clear_env: false. The UI splits Arguments on spaces. For an argument that contains a space, use the Raw icon (<>) in the drawer header.

The example configuration also sets a CORS policy for the UI playground. In the UI, you add that policy with Apply CORS when you verify the setup in the next section.

Whether the UI can save depends on your storage mode. For more information, see Save changes from the UI.

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 under MCP, click Tool Playground.

    2. If you see a Browser access is not allowed notice, click Apply CORS so the playground can call the MCP listener from the UI.

    3. Click Initialize to open an MCP session. The agentgateway UI connects to the target that you configured and lists the tools that are exposed on the target.

  3. Verify access to a tool.

    1. From the Tool list, select the echo tool.

    2. In the Message field, enter any string, such as This is my first agentgateway setup., and click Call tool.

    3. Verify that the Result card shows an HTTP 200 response with your message echoed back.

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