Tools and state

mcp

Extracts MCP JSON-RPC method, tool, resource, prompt, version, and session metadata into filter-visible request fields.

Praxis AI v0.13.0 (alpha) 4 min read
On this page

Extracts MCP protocol metadata from JSON-RPC request bodies and promotes method, tool/resource/prompt name, JSON-RPC kind, protocol version, and session presence to request headers/filter results; stores session ID in durable metadata.

MCP static catalog filter that aggregates tool catalogs from multiple backend MCP servers and handles tools/list, tools/call, and current-profile broker methods (initialize, ping, and notifications/initialized).

Configuration Notes

Recognized methods include initialize, tools/call, tools/list, resources/read, resources/list, prompts/get, prompts/list, and ping.

Methods requiring a name selector (tools/call, resources/read, prompts/get) return a JSON-RPC error if the selector is missing and on_invalid is reject.

Writes mcp.* and json_rpc.* entries to the filter result set for branch chain conditions.

In the stateless profile, tools/call routes to the configured backend cluster by exposed tool name, stripping the public prefix from params.name and repairing the forwarded Mcp-Name header before forwarding.

In the current profile, tools/call returns -32601 unless backend_sessions is configured. With it, the broker lazily runs the backend initialize / notifications/initialized handshake once per (Mcp-Session-Id, server) pair through a generated outbound chain that dials the server’s top-level cluster, then forwards the call to that cluster with the backend Mcp-Session-Id. A backend 404 drops the mapping so the next call reinitializes. Server clusters must be declared in top-level clusters: so the handshake chain can reference them.

With backend_sessions, initialize issues signed gateway session ids, and a request carrying a well-formed id the broker did not issue, or one a DELETE ended, gets HTTP 404 on every method; the client sends a new initialize without the header. A malformed header (empty, too long, or with characters outside visible ASCII) gets 400. A DELETE that would end a session still holding backend sessions created with other credentials answers 409 and leaves it usable. Ownership follows the forwarded credential, so a caller whose token was refreshed or re-minted gets 409 on its own session until the older backend sessions expire.

Supports two protocol profiles: current (session-based, default) and stateless (MCP 2026-07-28, configurable). Version and cache fields are derived from the selected profile when omitted.

Configuration

FieldTypeRequiredDescription
header_validationobjectnoHeader validation settings.
header_validation.mismatchreject | ignorenoBehavior when header value conflicts with body-derived value.
header_validation.missingignore | synthesize | rejectnoBehavior when expected MCP headers are absent.
headersobjectnoHeader names for MCP metadata promotion. Must not be hop-by-hop, framing, Host, credential, API-key, or other internal x-praxis-* names. Dedicated x-praxis-mcp-* defaults remain allowed.
headers.kindstringnoHeader name for the JSON-RPC kind (e.g. x-praxis-mcp-kind).
headers.methodstringnoHeader name for the MCP method (e.g. x-praxis-mcp-method).
headers.namestringnoHeader name for the tool/resource/prompt name (e.g. x-praxis-mcp-name).
headers.protocol_versionstringnoHeader name for the MCP protocol version (e.g. x-praxis-mcp-protocol-version).
headers.session_presentstringnoHeader name for MCP session presence (e.g. x-praxis-mcp-session-present).
max_body_bytesintegernoMaximum body size in bytes for StreamBuffer.
on_invalidcontinue | reject | errornoInvalid input handling behavior.
backend_sessionsobjectnoCurrent-profile backend session management. Requires protocol_profile: current.
backend_sessions.forward_headersstring[]noRequest headers copied from the client request onto the handshake.
backend_sessions.idle_timeout_msintegernoIdle lifetime of one backend session mapping, in milliseconds.
backend_sessions.handshake_timeout_msintegernoBudget for one whole handshake, in milliseconds: waiting for a concurrent handshake, initialize, and notifications/initialized share it, and a parent deadline can shorten it.
backend_sessions.max_sessionsintegernoMaximum retained backend session mappings.
backend_sessions.max_response_bytesintegernoResponse body ceiling for each handshake exchange, in bytes.
backend_sessions.outbound_filtersFilterEntry[]noExtra filters run on each handshake subrequest before the broker’s generated load_balancer (for example credential injection).
cache_scopepublic | privatenoCache scope for stateless responses. Requires protocol_profile: stateless.
cache_ttl_msintegernoCache TTL in milliseconds for stateless responses. Requires protocol_profile: stateless.
default_versionstringnoFallback MCP protocol version. When omitted, derived from the profile.
invalid_tool_policyreject_server | filter_outnoBehavior when a tool has an invalid schema.
pathstringnoPublic MCP path handled by Praxis.
protocol_profilecurrent | statelessnoProtocol profile governing session semantics and header requirements for this broker instance.
serversobject[]noBackend server definitions.
servers[].namestringyesUnique server name.
servers[].clusterstringyesBackend cluster name.
servers[].pathstringnoBackend MCP path.
servers[].tool_prefixstringnoTool prefix for this server.
servers[].toolsobject[]noStatically defined tools.
servers[].tools[].namestringyesTool name on the backend.
servers[].tools[].descriptionstringnoOptional description.
servers[].tools[].inputSchemaanynoOptional input schema. schema is accepted as a local shorthand.
servers[].tools[].annotationsanynoOptional tool annotations.
supported_versionsstring[]noProtocol versions accepted during negotiation. When omitted, derived from the profile.

Examples

Example 1

filter: mcp

Example 2

filter: mcp
max_body_bytes: 65536
on_invalid: reject
header_validation:
  mismatch: reject
  missing: ignore
headers:
  method: x-praxis-mcp-method
  name: x-praxis-mcp-name
  kind: x-praxis-mcp-kind
  protocol_version: x-praxis-mcp-protocol-version
  session_present: x-praxis-mcp-session-present

Example 3

filter: mcp
path: /mcp
max_body_bytes: 65536
servers:
  - name: weather
    cluster: weather-mcp
    path: /mcp
    tool_prefix: weather_
    tools:
      - name: get_weather
        description: Get current weather
  - name: calendar
    cluster: calendar-mcp
    path: /mcp
    tool_prefix: cal_
    tools:
      - name: create_event
        description: Create a calendar event