Class McpMessageFilters
- Namespace
- ModelContextProtocol.Server
- Assembly
- ModelContextProtocol.Core.dll
Provides grouped message filter collections.
public sealed class McpMessageFilters
- Inheritance
-
McpMessageFilters
- Inherited Members
Properties
IncomingFilters
Gets or sets the filters for all incoming JSON-RPC messages.
public IList<McpMessageFilter> IncomingFilters { get; set; }
Property Value
Remarks
These filters intercept all incoming JSON-RPC messages before they are processed by the server, including requests, notifications, responses, and errors. The filters can perform logging, authentication, rate limiting, or other cross-cutting concerns that apply to all message types.
Message filters are applied before request-specific filters. If a message filter does not call the next handler in the pipeline, the default handlers will not be executed.
OutgoingFilters
Gets or sets the filters for all outgoing JSON-RPC messages.
public IList<McpMessageFilter> OutgoingFilters { get; set; }
Property Value
Remarks
These filters intercept all outgoing JSON-RPC messages before they are sent to the client, including responses, notifications, and errors. The filters can perform logging, redaction, auditing, or other cross-cutting concerns that apply to all message types.
If a message filter does not call the next handler in the pipeline, the message will not be sent. Filters may also call the next handler multiple times with different messages to emit additional server-to-client messages.