Skip to content

MCP initialize response uses snake_case (protocol_version/server_info) instead of camelCase — rejected by strict clients #52

Closed

Description

@savioruz

Summary

The Memayu MCP server (memayu mcp, v0.1.0-rc2) returns the MCP initialize result using snake_case field names (protocol_version, server_info) instead of the camelCase names required by the MCP specification (protocolVersion, serverInfo).

This causes strict MCP clients (e.g. Hermes Agent's native MCP client, which validates the response with pydantic v2) to reject the handshake:

2 validation errors for InitializeResult
protocolVersion
  Field required [type=missing, ...]
serverInfo
  Field required [type=missing, ...]

The connection itself succeeds and tools/list works correctly — only the initialize result shape is wrong, so the client aborts before discovering tools.

Root cause

In the MCP SDK (and the spec), InitializeResult is defined with camelCase JSON keys. Memayu's MCP handler serializes the response with Rust serde default field names (snake_case) without #[serde(rename_all = "camelCase")] on the result struct. The same issue likely affects other result structs that cross the MCP boundary (tool results are fine because they're wrapped in content arrays, but the capability/handshake structs need the rename).

Fix

Ensure all MCP-protocol-facing structs (especially InitializeResult and any struct that carries protocol_version/server_info/capabilities) serialize with camelCase. In Rust + the rmcp/mcp SDK, this is typically:

  • Add #[serde(rename_all = "camelCase")] to the result struct(s), OR
  • Use the SDK's provided response types (which already apply the correct rename) instead of a hand-rolled struct.

Verify against the MCP 2024-11-05 spec field names:

  • protocolVersion (not protocol_version)
  • serverInfo (not server_info)
  • capabilities (unchanged)

Acceptance criteria

  • memayu mcp initialize response uses protocolVersion + serverInfo (camelCase).
  • A strict MCP client (Hermes Agent native MCP, pydantic validation) successfully completes the handshake and discovers the 5 tools (add_memory, search_memory, list_memories, delete_memory, update_memory).
  • tools/list, tools/call continue to work (regression check).
  • Add a test that parses the initialize result against an MCP-spec-compliant schema (camelCase) so this doesn't regress.

Priority note

This blocks integrating Memayu as an MCP server into strict clients (Hermes Agent in particular). It is NOT a blocker for the direct HTTP API (which works fine) — only for MCP-based tool integration.

Activity

  1. added this to the v0.1.0 milestone on Aug 15, 2026
  2. added
    bugSomething isn't working
    apiHTTP API transport/handlers
    mcpMCP server tools
    priority-highHighest priority — must be done before next milestone
    on Aug 15, 2026
  3. savioruz commented on Aug 16, 2026

    @savioruz
    OwnerAuthor

    Implemented by PR #59 — serializes MCP InitializeResult (+ ServerInfo/ServerCapabilities/nested types) with camelCase keys per the MCP 2024-11-05 spec, so strict clients (Claude Code etc.) accept the initialize response. Includes a ser/serde + camelCase correctness test. CI green. Reviewed by g3333kbot: APPROVED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiHTTP API transport/handlersbugSomething isn't workingmcpMCP server toolspriority-highHighest priority — must be done before next milestone

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions