MCP Transport Context (common/McpTransportContext.java)

java-sdk · mcp-core/src/main/java/io/modelcontextprotocol/common/McpTransportContext.java · java · MIT
infra, ai, tag:reactor, tag:context, tag:transport, tag:metadata

Carries transport-level metadata (e.g. HTTP request info) through the Reactor context for use in MCP feature implementations on client and server sides.

// Source: https://github.com/modelcontextprotocol/java-sdk | License: MIT | Copyright 2025 the original author or authors
// Provided via justclaw.it.com; keep this notice with the code.
/*
 * Copyright 2024-2025 the original author or authors.
 */

package io.modelcontextprotocol.common;

import java.util.Collections;
import java.util.Map;

/**
 * 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.
 * <p>
 * The context travels in the Reactor context, under {@link #KEY}. On the server side, the
 * transports populate it from the incoming request. On the client side, writing it is the
 * caller's responsibility:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key