Skip to content

Agent with remote mcp server deployed with kagent deploy fails #1048

@peterj

Description

@peterj

Create a project with kagent init, then add a remote MCP (e.g. kagent add-mcp) - i am using github mcp server as an example. Deploy everything to the cluster and try chatting with the agent -- it hangs and the agent pod has these logs:

ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
  File "/.kagent/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 162, in _handle_sse_event
    message = JSONRPCMessage.model_validate_json(sse.data)
  File "/.kagent/.venv/lib/python3.13/site-packages/pydantic/main.py", line 766, in model_validate_json
    return cls.__pydantic_validator__.validate_json(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        json_data, strict=strict, extra=extra, context=context, by_alias=by_alias, by_name=by_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
  Invalid JSON: EOF while parsing a value at line 1 column 0 [type=json_invalid, input_value='', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/json_invalid
INFO:     10.244.0.1:51990 - "GET /health HTTP/1.1" 200 OK
ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
  File "/.kagent/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 162, in _handle_sse_event
    message = JSONRPCMessage.model_validate_json(sse.data)
  File "/.kagent/.venv/lib/python3.13/site-packages/pydantic/main.py", line 766, in model_validate_json
    return cls.__pydantic_validator__.validate_json(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        json_data, strict=strict, extra=extra, context=context, by_alias=by_alias, by_name=by_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
  Invalid JSON: EOF while parsing a value at line 1 column 0 [type=json_invalid, input_value='', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/json_invalid
INFO:     10.244.0.1:58038 - "GET /health HTTP/1.1" 200 OK
ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
  File "/.kagent/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 162, in _handle_sse_event
    message = JSONRPCMessage.model_validate_json(sse.data)
  File "/.kagent/.venv/lib/python3.13/site-packages/pydantic/main.py", line 766, in model_validate_json
    return cls.__pydantic_validator__.validate_json(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        json_data, strict=strict, extra=extra, context=context, by_alias=by_alias, by_name=by_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
  Invalid JSON: EOF while parsing a value at line 1 column 0 [type=json_invalid, input_value='', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/json_invalid
INFO:     10.244.0.1:33466 - "GET /health HTTP/1.1" 200 OK
ERROR:mcp.client.streamable_http:Error parsing SSE message
Traceback (most recent call last):
  File "/.kagent/.venv/lib/python3.13/site-packages/mcp/client/streamable_http.py", line 162, in _handle_sse_event
    message = JSONRPCMessage.model_validate_json(sse.data)
  File "/.kagent/.venv/lib/python3.13/site-packages/pydantic/main.py", line 766, in model_validate_json
    return cls.__pydantic_validator__.validate_json(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        json_data, strict=strict, extra=extra, context=context, by_alias=by_alias, by_name=by_name
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
  Invalid JSON: EOF while parsing a value at line 1 column 0 [type=json_invalid, input_value='', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/json_invalid

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssue related to the CLI

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions