GitHub

MiddlewareOptions

API reference for MiddlewareOptions.

The request a middleware wraps.

target is the tool name, the resource URI or the prompt name; for completion/complete the prompt name or the URI template; for skills/get the URI of the skill's SKILL.md. payload holds the request's parameters. On a list request, which runs middleware only around a visibility, once per registration, target is that registration's name, URI or URI template and payload is None.

headers are the HTTP request's, empty on stdio and in process; session_id is its mcp-session-id header.

Attributes

AttributeTypeDescription
methodMiddlewareMethod
targetstr
payloadobject
request_contextRequestContext
headersMapping[str, str]
session_idstr | None

Functions

__init__

__init__(*, method, target, payload, request_context, headers, session_id) -> None
ParameterTypeDescription
methodMiddlewareMethod
targetstr
payloadobject
request_contextRequestContext
headersMapping[str, str]
session_idstr | None