Examples
Mcp Session Broker
Static-catalog MCP broker for stateful backends
Category: Setup-dependent integration
Task: Static-catalog MCP broker for stateful backends
Prerequisites: The external service, credentials, or certificates referenced by this configuration.
Run it: Use ghcr.io/praxis-proxy/ai:0.13.0 and follow the container quickstart to mount and start the configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
# MCP Session Broker (current profile)
#
# Static-catalog MCP broker for stateful backends. Clients
# initialize with Praxis and receive a gateway
# Mcp-Session-Id. On the first tools/call for each backend
# server, the broker runs the backend initialize and
# notifications/initialized handshake, then forwards the call
# to the server's cluster with the backend Mcp-Session-Id.
# Later calls reuse that session. A backend 404 drops the
# mapping, and the next call initializes a fresh backend
# session. DELETE on the gateway session terminates its
# backend sessions. The broker accepts only gateway session
# ids it issued and that were not deleted. A well-formed id it
# did not issue, or one that was deleted, gets 404 on every
# method: the client must send a new initialize without the
# old Mcp-Session-Id header. A malformed header gets 400.
# A DELETE that would end a session other credentials still
# use answers 409 and leaves it usable. Ownership follows the
# forwarded credential, so a client whose token was refreshed
# gets 409 until its older backend sessions expire.
#
# The handshake runs as a filtered subrequest through a
# generated outbound chain whose load_balancer references
# each server cluster by name, so declare the clusters in
# top-level `clusters:`. The main chain's load_balancer
# references the same declarations.
#
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains: [main]
clusters:
- name: weather-mcp
endpoints:
- "127.0.0.1:3001"
- name: calendar-mcp
endpoints:
- "127.0.0.1:3002"
filter_chains:
- name: main
filters:
- filter: mcp
path: /mcp
max_body_bytes: 65536
backend_sessions:
max_sessions: 4096
idle_timeout_ms: 600000
handshake_timeout_ms: 5000
max_response_bytes: 1048576
forward_headers: [authorization]
servers:
- name: weather
cluster: weather-mcp
path: /mcp
tool_prefix: "weather_"
tools:
- name: get_weather
description: Get current weather
inputSchema:
type: object
properties:
city:
type: string
- name: calendar
cluster: calendar-mcp
path: /mcp
tool_prefix: "cal_"
tools:
- name: create_event
description: Create a calendar event
- filter: load_balancer
clusters:
- name: weather-mcp
- name: calendar-mcp
insecure_options:
allow_private_endpoints: true # example proxies to local backends