Skip to content

McpClient cannot be created using netstandard with SseClientTransport #583

Closed
@lucapivato

Description

@lucapivato

McpClientFactory.CreateAsync(clientTransport) throws an exception with netstandard using the SseClientTransport:

'The format of value 'application/json; charset=utf-8' is invalid

That's because the encoding is already specified:

        using var content = new StringContent(
            JsonSerializer.Serialize(message, McpJsonUtilities.JsonContext.Default.JsonRpcMessage),
            Encoding.UTF8,
            "application/json; charset=utf-8"
        );

must be:

        using var content = new StringContent(
            JsonSerializer.Serialize(message, McpJsonUtilities.JsonContext.Default.JsonRpcMessage),
            Encoding.UTF8,
            "application/json"
        );

See PR #582

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions