Package io.modelcontextprotocol.server
Class DefaultMcpTransportContext
java.lang.Object
io.modelcontextprotocol.server.DefaultMcpTransportContext
- All Implemented Interfaces:
McpTransportContext
Default implementation for
McpTransportContext which uses a Thread-safe map.
Objects of this kind are mutable.- Author:
- Dariusz Jędrzejczyk
-
Field Summary
Fields inherited from interface io.modelcontextprotocol.server.McpTransportContext
EMPTY, KEY -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultMcpTransportContext
public DefaultMcpTransportContext()Create an empty instance.
-
-
Method Details
-
get
Description copied from interface:McpTransportContextExtract a value from the context.- Specified by:
getin interfaceMcpTransportContext- Parameters:
key- the key under the data is expected- Returns:
- the associated value or
nullif missing.
-
put
Description copied from interface:McpTransportContextInserts a value for a given key.- Specified by:
putin interfaceMcpTransportContext- Parameters:
key- a String representing the keyvalue- the value to store
-
copy
Allows copying the contents.- Specified by:
copyin interfaceMcpTransportContext- Returns:
- new instance with the copy of the underlying map
-