Skip to content

Sentry MCP server fails to initialize: cannot unmarshal JSON Schema array union type into string #14

Closed

Description

@ejaramillompg

Summary

mcpx v1.5.0 fails to initialize the @sentry/mcp-server with the following error:

error: server "sentry": initialize: mcp: initialization failed: mcp: transport closed

Running with verbose output reveals the root cause:

json: cannot unmarshal array into Go struct field PropertySchema.tools.inputSchema.properties.type of type string

Root Cause

The Sentry MCP server uses JSON Schema draft-07 union types where type is an array of strings for optional/nullable fields:

{
  "type": ["string", "null"],
  "description": "..."
}

mcpx's Go JSON unmarshaler maps inputSchema.properties.*.type to type string, which cannot hold an array value. The spec allows both "type": "string" and "type": ["string", "null"].

Expected behavior

mcpx should handle type as either a string or []string (union) per the JSON Schema spec. Unknown or unsupported types could fall back to "any" / untyped rather than hard-failing initialization.

Reproduction

  1. Add to ~/.mcpx/config.yml:
    sentry:
      command: npx
      args: ["-y", "@sentry/mcp-server"]
      transport: stdio
  2. Authenticate: npx -y @sentry/mcp-server auth login
  3. Run: mcpx list sentry -v

Result: initialization error as above.

Environment

  • mcpx version: 1.5.0 (brew, codestz/tap)
  • @sentry/mcp-server version: latest (npx -y)
  • OS: macOS 25.3.0 (Darwin)

Workaround

Use the Sentry REST API directly with the OAuth token cached at ~/.sentry/mcp.json by the MCP server's device code flow.

Activity

  1. Codestz commented on May 3, 2026

    @Codestz
    Owner

    Fixed in v1.6.0 (released today, just merged via #15).

    The schema normalizer in internal/mcp/schema.go now handles JSON Schema union types correctly: type: ["string", "null"] is parsed as Type: "string", Nullable: true, matching the JSON Schema draft-07 spec. The same pass also handles oneOf, anyOf, allOf, and $ref, with unknown keywords preserved in an Ext map for round-trip integrity.

    Validated end-to-end against the live @sentry/mcp-server after sentry-mcp auth login:

    $ mcpx list sentry -v
    sentry (22 tools)
    
      whoami
        Identify the authenticated user in Sentry.
      ...
    

    All 22 Sentry tools list cleanly — no transport-closed, no unmarshal errors.

    Auto-closed by the PR merge. Thanks for the precise reproducer with the verbose log — it made the diagnosis straightforward and the fix is now covered by unit tests (TestSentryUnionType, TestSentryFullToolSchema in internal/mcp/schema_test.go) so this can't regress silently.

    Upgrade: brew upgrade mcpx once the v1.6.0 release artifacts publish (Homebrew tap auto-updates from the goreleaser workflow), or go install github.com/codestz/mcpx/cmd/mcpx@v1.6.0.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions