- Namespace
- ModelContextProtocol.Server
- Assembly
- ModelContextProtocol.Core.dll
Provides a context container that provides access to the server and resources for processing a JSON-RPC message.
public class MessageContext
- Inheritance
-
MessageContext
- Derived
- Inherited Members
Constructors
MessageContext(McpServer, JsonRpcMessage)
Initializes a new instance of the MessageContext class with the specified server and JSON-RPC message.
public MessageContext(McpServer server, JsonRpcMessage jsonRpcMessage)
Parameters
serverMcpServerThe server with which this instance is associated.
jsonRpcMessageJsonRpcMessageThe JSON-RPC message associated with this context.
Properties
Items
Gets or sets a key/value collection that can be used to share data within the scope of this message.
public IDictionary<string, object?> Items { get; set; }
Property Value
JsonRpcMessage
Gets the JSON-RPC message associated with this context.
public JsonRpcMessage JsonRpcMessage { get; set; }
Property Value
Server
Gets or sets the server with which this instance is associated.
public McpServer Server { get; set; }
Property Value
Services
Gets or sets the services associated with this message.
public IServiceProvider? Services { get; set; }
Property Value
User
Gets or sets the user associated with this message.
public ClaimsPrincipal? User { get; set; }