fix: remove mark3labs/mcp-go dependency entirely#164
Merged
Conversation
Replace the mcp-go type aliases in mcpcompat/mcp/alias.go with standalone definitions that preserve the same JSON wire format. The mcp-go dependency is now completely eliminated from the module graph. The alias.go file (single chokepoint that re-exported ~100 types from mcp-go) is replaced by 10 standalone files defining every type, constant, and helper with identical JSON tags and marshaling logic. The wire-format golden tests in mcp_test.go guard the conversion and pass unchanged. Key changes: - Delete alias.go; create consts.go, content.go, tools.go, jsonrpc.go, resources.go, prompts.go, elicitation.go, logging.go, initialize.go, helpers.go with standalone definitions - Simplify ResourceTemplate.URITemplate from *URITemplate (wrapping yosida95/uritemplate/v3) to a plain string — nobody accesses the field - Add ElicitationParams.Validate() method used by mcpcompat/server - Fix stray direct mcp-go import in registry/converters/converters_test.go to use the shim - Update doc.go to reflect standalone definitions rather than aliases - go mod tidy removes mark3labs/mcp-go, yosida95/uritemplate, spf13/cast Closes #160 (the Renovate PR bumping mcp-go is now moot)
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
Removes the
mark3labs/mcp-godependency from the module graph entirely.The
mcpcompat/mcp/alias.gofile was the single chokepoint that re-exported ~100 types from mcp-go via type aliases. This PR replaces it with standalone definitions that preserve the same JSON wire format (identical struct tags, identical custom marshaling). The wire-format golden tests inmcp_test.goguard the conversion and pass unchanged.Changes
alias.go— the single file that importedmark3labs/mcp-go/mcpmcpcompat/mcp/:consts.go—MCPMethodtype, method name constants, content type constantsjsonrpc.go—Meta,RequestId, JSON-RPC types, error codes,PingRequest,EmptyResultcontent.go—Contentinterface,TextContent,ImageContent, etc.,UnmarshalContent,As*helperstools.go—Tool(+ customMarshalJSON),ToolInputSchema,CallToolRequest(with all accessors),CallToolResult, buildersresources.go—Resource,ResourceTemplate,ResourceContentsinterface, pagination typesprompts.go—Prompt,PromptMessage,Roleelicitation.go— elicitation types +Validate()methodlogging.go—LoggingLevel,SetLevelRequestinitialize.go—Implementation,ClientCapabilities,ServerCapabilities,InitializeRequest/Resulthelpers.go— sentinel errors,NewTextContent,NewJSONRPCErrorDetails, etc.ResourceTemplate.URITemplatefrom*URITemplate(wrappingyosida95/uritemplate/v3) to plainstring— nobody in the codebase accesses this fieldregistry/converters/converters_test.goto use the shimdoc.goto reflect standalone definitions rather than aliasesgo mod tidyremovesmark3labs/mcp-go,yosida95/uritemplate,spf13/castVerification
go test ./...— all 23 packages passgolangci-lint run ./...— 0 issuesmcpcompat/mcp/mcp_test.gopass unchangedgrep 'mark3labs/mcp-go' go.mod go.sum— no matchesmark3labs/mcp-go(only historical context in doc comments)Closes #160 (the Renovate PR bumping mcp-go is now moot)