Skip to content

feat: HTTP Header Standardization for method and name#907

Open
guglielmo-san wants to merge 11 commits intomainfrom
guglielmoc/SEP-2243_http_standardization
Open

feat: HTTP Header Standardization for method and name#907
guglielmo-san wants to merge 11 commits intomainfrom
guglielmoc/SEP-2243_http_standardization

Conversation

@guglielmo-san
Copy link
Copy Markdown
Contributor

Description

Implements SEP-2243 (https://modelcontextprotocol.io/seps/2243-http-standardization) (HTTP Header Standardization) for Mcp-Method and Mcp-Name standard headers (x-mcp-param custom headers will be covvered in separate PR).

Fixes #905

Comment thread mcp/streamable.go
Comment thread mcp/streamable_test.go
Comment thread mcp/mcp_http_headers.go Outdated
Comment thread mcp/mcp_http_headers_test.go Outdated
Comment thread mcp/mcp_http_headers_test.go Outdated
Comment thread mcp/mcp_http_headers.go Outdated
Comment thread mcp/mcp_http_headers.go Outdated
Comment thread mcp/streamable_headers.go
Comment thread mcp/streamable.go
Comment thread mcp/mcp_http_headers.go Outdated
Comment thread mcp/streamable_test.go Outdated
req.Header.Set(methodHeader, "wrong-method")
}
resp, err := http.DefaultTransport.RoundTrip(req)
if err == nil && req.Header.Get(methodHeader) == "wrong-method" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why do we need to capture anything? Doesn't the error from CallTool contain all necessary details?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was that chackResponse in streamableClientConn was only extracting the http.StatusCode from the error returned by the server and nothing else. I improved it to extract the jsonrpc error body and include it in the client Error

Comment thread mcp/streamable.go
Comment thread mcp/streamable_headers.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-2243 HTTP Standardization

2 participants