Skip to content

Commit e843f73

Browse files
authored
chore(server/mcp): update to accept other json content type request (googleapis#1049)
Toolbox MCP endpoint to accept request of multiple content type according to the json schema (https://www.jsonrpc.org/historical/json-rpc-over-http.html#http-header) Toolbox endpoints only accept `Content-Type: application/json`. Update to accept `Content-Type: application/json-rpc` and `Content-Type:application/jsonrequest` as well. Fixes googleapis#1004
1 parent 6eaf36a commit e843f73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/server/mcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func (s *stdioSession) write(ctx context.Context, response any) error {
214214
func mcpRouter(s *Server) (chi.Router, error) {
215215
r := chi.NewRouter()
216216

217-
r.Use(middleware.AllowContentType("application/json"))
217+
r.Use(middleware.AllowContentType("application/json", "application/json-rpc", "application/jsonrequest"))
218218
r.Use(middleware.StripSlashes)
219219
r.Use(render.SetContentType(render.ContentTypeJSON))
220220

0 commit comments

Comments
 (0)