feat: Add MCP (Model Context Protocol) sample implementation #2
+1,778
−2
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
This PR adds a new MCP (Model Context Protocol) binding sample for UCP, enabling AI agents to interact with UCP-compliant merchants through the standardized Model Context Protocol.
Motivation
While the samples repo currently has REST and A2A bindings, there's no MCP sample. MCP is increasingly important for AI agent integration, allowing LLMs like Claude, GPT, and Gemini to perform commerce operations through a standardized protocol. This sample fills that gap.
Changes
New Files
mcp/python/ucp_mcp_server.pymcp/python/ucp_mcp_client.pymcp/python/README.mdmcp/python/pyproject.tomlUpdated Files
README.mdMCP Server Features
Tools (Actions with Side Effects)
list_products- Browse product catalogget_product- Get product detailscreate_checkout- Create checkout sessionadd_to_checkout/remove_from_checkout- Cart managementset_shipping_address- Configure deliverycomplete_payment- Process paymentget_order/cancel_checkout- Order managementResources (Read-Only Data)
ucp://catalog/products- Product catalogucp://checkout/{id}- Checkout stateucp://orders/{id}- Order detailsucp://discovery/profile- UCP discovery profilePrompts (Conversation Templates)
shopping_intro- Shopping assistant introductionorder_confirmation- Order confirmation messagerecommend_products- Product recommendationsArchitecture
Testing
The client demonstrates a complete shopping flow: browse → checkout → pay → track.
Claude Desktop Integration
Add to
claude_desktop_config.json:{ "mcpServers": { "ucp-shopping": { "command": "uv", "args": ["run", "ucp-mcp-server"], "cwd": "/path/to/samples/mcp/python" } } }Protocol Binding Comparison
Checklist