feat(bazaar): add MCP resource type support to Go SDK#1967
Open
avidreder wants to merge 3 commits intox402-foundation:mainfrom
Open
feat(bazaar): add MCP resource type support to Go SDK#1967avidreder wants to merge 3 commits intox402-foundation:mainfrom
avidreder wants to merge 3 commits intox402-foundation:mainfrom
Conversation
Add MCP tool discovery extensions to the bazaar package, achieving parity with the TypeScript and Python SDKs. Servers can now declare MCP tool discovery extensions alongside HTTP resources, and facilitators can detect and extract them from payment payloads. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…e tests - Fix transport schema enum to include both valid values (streamable-http, sse) instead of only the provided value, matching TypeScript SDK behavior - Fix doc.go examples to use bazaar.BAZAAR.Key() instead of bazaar.BAZAAR - Inline createMcpDiscoveryExtension into DeclareMcpDiscoveryExtension - Add negative validation tests for wrong type and empty toolName - Add edge case tests for whitespace-only toolName and invalid transport Co-Authored-By: Claude <noreply@anthropic.com>
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
McpInput,McpTransport,McpDiscoveryInfo,DeclareMcpDiscoveryConfig) to the shared types package and re-export from bazaarDeclareMcpDiscoveryExtension()for servers to declare MCP tool resources with tool name, input schema, transport, description, and exampleDiscoveryInfo.UnmarshalJSONto discriminatetype: "mcp"from HTTP inputs, enabling correct JSON round-tripsEnrichDeclaration()so MCP extensions pass through without HTTP method narrowing or dynamic route extractionDiscoveredResourcewithToolNamefield and update bothExtractDiscoveredResourceFromPaymentPayloadandExtractDiscoveredResourceFromPaymentRequiredto handle MCP extractionTest plan
TestDeclareMcpDiscoveryExtension— full config, minimal config, missing toolName/inputSchema errors, transport variantsTestValidateDiscoveryExtension_MCP— schema validation passes for MCP extensionsTestDiscoveryInfoUnmarshalJSON_MCP— JSON round-trip correctly producesMcpInputTestExtractDiscoveredResourceFromPaymentPayload_MCP— v2 MCP extension in PaymentPayload extractsToolNameTestExtractDiscoveredResourceFromPaymentRequired_MCP— v2 MCP in PaymentRequiredTestBazaarResourceServerExtension_MCP— EnrichDeclaration passes MCP through unchanged (including with dynamic route context)TestExtractDiscoveryInfoFromExtension_MCP— direct extraction from MCP extensiongo test ./...passes🤖 Generated with Claude Code