refactor(registry/types): swap mcp-go import for mcpcompat shim#154
Merged
Conversation
Stop registry/types from importing github.com/mark3labs/mcp-go/mcp directly. Switch both publisher_provided_types.go and registry_types.go to import the mcpcompat/mcp shim (aliased as `mcp`), whose Tool type is a type alias for mcpgo.Tool — identical type, wire-compatible, source-compatible. Zero call-site changes. This was the last non-shim import of mcp-go in the module; the only remaining reference is the intentional chokepoint in mcpcompat/mcp/alias.go. Unblocks stacklok/toolhive#5729 from carrying mcp-go as a transitive indirect dep.
f64c326 to
97f3c4b
Compare
rdimitrov
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop
registry/typesfrom importinggithub.com/mark3labs/mcp-go/mcpdirectly. Switch both files that reference it to import themcpcompat/mcpshim (aliased asmcp), whoseTooltype is a type alias formcpgo.Tool— identical type, wire-compatible, source-compatible. This was the last non-shim import of mcp-go in the module.Unblocks stacklok/toolhive#5729 from carrying mcp-go as a transitive indirect dep.
What changed
Two import-path swaps, zero call-site logic changes:
registry/types/publisher_provided_types.go—"github.com/mark3labs/mcp-go/mcp"→mcp "github.com/stacklok/toolhive-core/mcpcompat/mcp"(sole usage:ToolDefinitions []mcp.Tool).registry/types/registry_types.go— same swap (usages:ToolDefinitions []mcp.Tool, theGetToolDefinitions() []mcp.Toolinterface method, and itsBaseServerMetadataimplementation).Because
mcpcompat/mcp.Toolis a type alias formcpgo.Tool, all struct tags, JSON marshaling, and theswaggerignore:"true"tag remain identical. Thegcilinter regrouped the imports so the shim now sits with the otherstacklok/toolhive-coreimports rather than the third-party block.What did NOT change
mcpcompat/mcp/alias.gois untouched — it remains the single intentional chokepoint that references mcp-go (per its owndoc.go).go.mod/go.sumunchanged —go mod tidymade no change. mcp-go stays as a direct dep because themcpcompat/mcpshim still references it. That's expected and acceptable per the task: the goal is to remove the non-shim import, not the shim itself.registry/typesimported mcp-go directly, so none needed swapping.Verification
go build ./...— cleango vet ./...— cleango test ./registry/types/... ./mcpcompat/...— passes (the wire-format golden tests in mcpcompat pin the JSON shape; unaffected since the type is unchanged)task(lint + test) — green, 0 lint issuesgrep -rln "github.com/mark3labs/mcp-go" --include="*.go" . | grep -v "_test.go" | grep -v "mcpcompat/"returns nothing.