Package io.modelcontextprotocol.server
Interface McpTransportContext
- All Known Implementing Classes:
DefaultMcpTransportContext
public interface McpTransportContext
Context associated with the transport layer. It allows to add transport-level metadata
for use further down the line. Specifically, it can be beneficial to extract HTTP
request metadata for use in MCP feature implementations.
- Author:
- Dariusz Jędrzejczyk
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final McpTransportContextAn empty, unmodifiable context.static final StringKey for use in Reactor Context to transport the context to user land. -
Method Summary
-
Field Details
-
KEY
Key for use in Reactor Context to transport the context to user land.- See Also:
-
EMPTY
An empty, unmodifiable context.
-
-
Method Details
-
get
Extract a value from the context.- Parameters:
key- the key under the data is expected- Returns:
- the associated value or
nullif missing.
-
put
Inserts a value for a given key.- Parameters:
key- a String representing the keyvalue- the value to store
-
copy
McpTransportContext copy()Copies the contents of the context to allow further modifications without affecting the initial object.- Returns:
- a new instance with the underlying storage copied.
-