Skip to main content
Declare downstream MCP servers once at the gateway and every agent that lists the server name gets the same pooled, shared client — not N connections per server.

Quick Start

1

One stdio server, two agents

One npx process serves both agents.
2

Mix stdio and HTTP servers

3

String shorthand for a local binary

Start the gateway with your config:

How It Works

Every agent that lists the server name walks the same path and lands on the same client.

Configuration

Each key under mcp_servers: is the server’s name (also its tool-name prefix), and the value is its spec.
An entry with neither command nor url, or one whose server fails to start, is logged and skipped — the gateway still boots. Check the gateway logs for mcp_servers.github needs a 'command' or 'url'; skipping or Failed to start MCP server 'github': ....

Referencing a server from an agent

List the server name in an agent’s tools: to attach the pooled client.
Names that are not in mcp_servers: fall through to the normal tool resolver, so built-in tools work alongside MCP servers.

Tool-name namespacing

Tools from a server named github are exposed as github_<tool>, so two servers that each offer a search tool never shadow each other.

Hot Reload

The pool keys each client by name and spec, so a reload only reconnects what changed.

Failure Modes

  • Bad spec (no command and no url) — logged, skipped, gateway continues.
  • Server fails to start — logged, skipped, gateway continues; the agent still registers without that server’s tools.
  • stdio server dies mid-session — the core praisonaiagents.MCP client restarts it on the next call.
  • Gateway stops — every pooled client is shut down.

Security

MCP tools from mcp_servers: run through the agent’s normal tool path, so existing tool policy and approval checks still apply.

Configuration Options

praisonaiagents.MCP

Underlying MCP client and its keyword options

Gateway YAML Configuration

Full gateway.yaml layout

Best Practices

Put every downstream server under mcp_servers: and reference it by name — never repeat the spec per agent.
The name becomes the tool prefix (github_create_issue), so short names keep tool names readable.
Use ${TOKEN} in env and headers instead of pasting credentials into the YAML.
A failing server does not stop the gateway — look for Failed to start MCP server warnings.

Gateway

Gateway setup and YAML configuration

MCP

Use MCP tools with agents

Gateway API Endpoints

The inverse — serve gateway agents as MCP tools

Runtime MCP

Attach and detach MCP servers at runtime