Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/mcpx/internal/mcpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (c *Client) finishLegacy(ctx context.Context, ir initResult) error {
return fmt.Errorf("initialized notification: %w", err)
}
// The standalone GET stream arrived with Streamable HTTP (2025-03-26).
if h, ok := c.t.(interface{ listen() }); ok && ir.ProtocolVersion >= "2025-03-26" {
if h, ok := c.t.(interface{ listen() }); ok && spec.AtOrAfter("2025-03-26")(ir.ProtocolVersion) {
h.listen()
}
return nil
Expand Down
5 changes: 3 additions & 2 deletions pkgs/mcpx/internal/mcpclient/modern.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/dezren39/mcpx/internal/defaults"
"github.com/dezren39/mcpx/internal/mcpheaders"
"github.com/dezren39/mcpx/internal/spec"
)

// The reserved _meta keys a 2026-07-28 request carries.
Expand Down Expand Up @@ -129,7 +130,7 @@ func (c *Client) elicitModeDeclared(mode string) bool {
case "", "form":
return true
case "url":
return h != nil && (c.Era == EraModern || c.Negotiated >= "2025-11-25")
return h != nil && (c.Era == EraModern || spec.AtOrAfter("2025-11-25")(c.Negotiated))
}
return false
}
Expand Down Expand Up @@ -268,7 +269,7 @@ func CallerVersionFrom(ctx context.Context) string {
// 2026-07-28 -- one that has a session a server can send requests on.
func CallerLegacy(ctx context.Context) bool {
v := CallerVersionFrom(ctx)
return v != "" && v < "2026-07-28"
return spec.Before("2026-07-28")(v)
}

// ErrNotRelayed is a handler declining a request it could not pass on, so
Expand Down
18 changes: 8 additions & 10 deletions pkgs/mcpx/internal/mcpserver/revisions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package mcpserver
import (
"encoding/json"
"strings"

"github.com/dezren39/mcpx/internal/spec"
)

// Oldest is the earliest revision mcpx serves.
Expand Down Expand Up @@ -31,17 +33,13 @@ const Oldest = "2024-11-05"
// only revision that could have sent it.
const Headerless = "2025-03-26"

// AtLeast compares revisions.
//
// Lexical comparison is correct because every revision is a date in
// ISO order, and that is not an accident of the naming -- the specification
// orders them this way on purpose. A test pins it so a future revision that
// breaks the assumption fails loudly rather than sorting wrong.
// AtLeast compares revisions, delegating to spec.AtOrAfter (#2211): the
// one predicate vocabulary lives in internal/spec, whose package comment
// prescribes asking the predicates rather than comparing date strings in
// place. Semantics are identical -- revisions are ISO dates, so lexical
// order is revision order, and the empty revision never satisfies a floor.
func AtLeast(version, floor string) bool {
if version == "" {
return false
}
return version >= floor
return spec.AtOrAfter(floor)(version)
}

// Feature is something a revision either defines or does not.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/mcpx/internal/mcpserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ const Latest = "2025-11-25"

// Modern reports whether a version uses per-request metadata rather than a
// handshake.
func Modern(version string) bool { return version >= "2026-07-28" }
func Modern(version string) bool { return spec.AtOrAfter("2026-07-28")(version) }

// withoutTask removes the task field, so the background run of a request does
// not ask to become a task again and recurse.
Expand Down
Loading