Bence Kosztolnik created YARN-11986:
---------------------------------------

             Summary: Implement MCP 2025-06-18 protocol compliance in 
hadoop-common
                 Key: YARN-11986
                 URL: https://issues.apache.org/jira/browse/YARN-11986
             Project: Hadoop YARN
          Issue Type: Sub-task
          Components: yarn
    Affects Versions: 3.6.0
            Reporter: Bence Kosztolnik
            Assignee: Bence Kosztolnik


h3. Overview

Complete MCP 2025-06-18 spec compliance in {{org.apache.hadoop.mcp}} 
({{{}hadoop-common{}}}).
YARN-11977 delivers the minimal HTTP/JSON-RPC framework and JSON-RPC envelope 
validation. This task adds the remaining *protocol-level* requirements: session 
lifecycle, duplicate request ID handling, Streamable HTTP transport checks, and 
tool security controls.
h3. Spec references
 * 
[Lifecycle|https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle]
 * [Requests (duplicate 
IDs)|https://modelcontextprotocol.io/specification/2025-06-18/basic#requests]
 * [Streamable HTTP 
transport|https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#sending-messages-to-the-server]
 * [Tool security 
considerations|https://modelcontextprotocol.io/specification/2025-06-18/server/tools#security-considerations]

h2.  
h2. Scope
h3. 1. MCP session lifecycle management
 * Create server-side session state on {{initialize}}
 * Return {{Mcp-Session-Id}} on {{initialize}} responses (spec header name)
 * Require a valid, initialized session for operational methods 
({{{}tools/list{}}}, {{{}tools/call{}}}, etc.)
 * Enforce lifecycle ordering:
 ** {{initialize}} → {{notifications/initialized}} → operation phase
 * Reject or block requests that skip lifecycle (e.g. {{tools/*}} before init)
 * Implement session idle TTL and expired-session handling (HTTP 404 per 
transport spec)
 * Handle {{ping}} per lifecycle/transport rules (allowed without full session 
where spec requires)

h3. 2. Duplicate request ID rejection per session
 * Track used JSON-RPC request {{id}} values per {{Mcp-Session-Id}} session
 * Reject reuse of the same request ID within a session with an appropriate 
JSON-RPC error
 * Clear or scope ID tracking correctly on session expiry

h3. 3. Streamable HTTP transport validation

Validate incoming HTTP requests per [Streamable 
HTTP|https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#sending-messages-to-the-server]:
 * {{Origin}} header validation (where required by spec)
 * {{Mcp-Session-Id}} required on post-init requests (except {{initialize}} / 
{{ping}} exemptions)
 * {{MCP-Protocol-Version}} header handling
 * Correct HTTP status codes for notifications (202), unknown/expired session 
(404), unsupported methods (405), etc.

h3. 4. Tool output sanitization and rate limiting

Per [tool security 
considerations|https://modelcontextprotocol.io/specification/2025-06-18/server/tools#security-considerations]:
 * Rate-limit {{tools/call}} invocations (per session or per connection — 
document choice)
 * Sanitize tool outputs before returning to clients (size limits, unsafe 
content handling as appropriate)
 * Validate {{tools/call}} arguments against each tool's {{inputSchema}} before 
invocation
----



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to