Skip to main content
Reference

Relay configuration reference

The relay configuration file controls how keep-mcp-relay listens for MCP connections, routes tool calls to upstream servers, and logs audit events. Pass the file path with --config.

Top-level fields

FieldTypeRequiredDefaultDescription
listenstringYesAddress and port to listen on (e.g., ":8090", "127.0.0.1:8090").
rules_dirstringYesPath to the directory containing Keep rule files.
profiles_dirstringNo""Path to the directory containing profile YAML files.
packs_dirstringNo""Path to the directory containing starter pack files.
routeslistYesOne or more route definitions. Must not be empty.
logobjectNoSee belowLog format and output configuration.

routes

Each route maps a scope to an upstream MCP server. The relay connects to each upstream at startup and discovers available tools.

FieldTypeRequiredDefaultDescription
scopestringYesScope name matching a scope declared in your rule files.
upstreamstringConditionalURL of a remote MCP server (SSE transport). Mutually exclusive with command.
commandstringConditionalCommand to launch a local MCP server (stdio transport). Mutually exclusive with upstream.
argslistNo[]Arguments passed to command. Ignored when upstream is set.
authobjectNonullAuthentication for the upstream connection.

Exactly one of upstream or command must be set per route.

auth

FieldTypeRequiredDefaultDescription
typestringYesAuthentication type (e.g., "bearer").
token_envstringNo""Name of the environment variable that holds the token value.
headerstringNo""Custom header name for the token. Defaults to Authorization for bearer auth.

log

FieldTypeRequiredDefaultDescription
formatstringNo"json"Log format.
outputstringNo"stdout"Output destination. A file path writes audit logs to that file.

Complete example

listen: ":8090"
rules_dir: "./rules"
profiles_dir: "./profiles"
packs_dir: "./packs"

routes:
  - scope: linear-tools
    upstream: "https://mcp.linear.app/mcp"
    auth:
      type: bearer
      token_env: "LINEAR_API_KEY"

  - scope: slack-tools
    upstream: "https://slack-mcp.example.com"

  - scope: sqlite-tools
    command: "uvx"
    args: ["mcp-server-sqlite", "--db-path", "./data.db"]

log:
  format: json
  output: stdout

This configuration starts the relay on port 8090 with three upstream routes. The linear-tools route authenticates with a bearer token read from the LINEAR_API_KEY environment variable. The sqlite-tools route launches a local MCP server via uvx using stdio transport.