Skip to content

MCP protocol: handle 'server/discover' before 'initialize' #1449

Description

@JGSphaela

Summary

Executor's MCP endpoint currently rejects a server/discover request with:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Bad Request: Server not initialized"
  },
  "id": null
}

This occurs before the legacy initialize handshake and causes the
connection to close.

This is not specific to Antigravity CLI. Any MCP client using the current
discovery/protocol-negotiation flow may encounter the same failure.

Environment

  • Executor: v1.5.35
  • Antigravity CLI (agy): v1.1.5
  • OS: macOS
  • Transport: stdio via executor mcp

Agy is used here as the reproducing client; the issue concerns Executor's
MCP server behavior.

Reproduction

Configure Executor as a local MCP server:

{
  "mcpServers": {
    "executor": {
      "command": "executor",
      "args": ["mcp"]
    }
  }
}

Connect with a client that sends server/discover before initialize.

The first request is similar to:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "server/discover",
  "params": {
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientInfo": {
        "name": "antigravity-client",
        "version": "v1.0.0"
      },
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

Executor responds with:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Bad Request: Server not initialized"
  },
  "id": null
}

The client then reports a closed connection, for example:

connection closed: calling "initialize": client is closing: EOF

Expected behavior

Executor should support server/discover and return the negotiated protocol
versions, capabilities, and server information as described in the MCP
discovery specification:

https://modelcontextprotocol.io/specification/draft/server/discover

If discovery support is intentionally deferred, Executor should at minimum:

  1. Return JSON-RPC -32601 Method not found for the unsupported method.
  2. Keep the transport/session usable.
  3. Allow the client to fall back to the legacy initialize handshake.

Returning -32000 Server not initialized for an unsupported discovery method
misclassifies the request as a session-state error and prevents compatible
clients from falling back.

Impact

  • Modern MCP clients may fail to connect to Executor.
  • The failure occurs before Executor tools can be discovered.
  • The error message suggests an invalid initialization sequence, even though
    the client is performing protocol discovery.
  • This affects the interoperability boundary between modern and legacy MCP
    implementations, not only Agy.

Workaround

A local compatibility adapter that returns -32601 for server/discover and
then forwards the legacy MCP handshake allows the connection to succeed.
With this adapter, Executor tools load correctly and tool calls work from Agy.

Suggested tests

Please consider adding an integration test covering:

  • server/discover before initialize
  • Successful discovery response, or -32601 fallback behavior
  • Legacy initialize after discovery fallback
  • Successful tools/list and tools/call
  • No connection closure after an unsupported discovery request

Related issue

Antigravity CLI has a related report:

google-antigravity/antigravity-cli#615

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions