feat: Add MCP (Model Context Protocol) sample implementation#2
Open
dihannahdi wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Open
feat: Add MCP (Model Context Protocol) sample implementation#2dihannahdi wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
dihannahdi wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This commit adds a new MCP binding sample for UCP, enabling AI agents to interact with UCP-compliant merchants through the Model Context Protocol. New files: - mcp/python/ucp_mcp_server.py: FastMCP server exposing UCP capabilities - Tools: list_products, create_checkout, add_to_checkout, complete_payment, etc. - Resources: catalog, checkout sessions, orders, discovery profile - Prompts: shopping assistant, order confirmation, product recommendations - Supports stdio, HTTP, and SSE transports - mcp/python/ucp_mcp_client.py: Example client demonstrating complete shopping flow - Connects via MCP protocol - Demonstrates happy path: browse -> checkout -> pay -> track - mcp/python/README.md: Comprehensive documentation - Architecture diagram - Quick start guide - Claude Desktop integration - Development guide - mcp/python/pyproject.toml: Project configuration with dependencies Updated: - README.md: Added MCP binding section with comparison table This sample enables conversational commerce experiences by allowing LLMs like Claude, GPT, and Gemini to perform shopping operations through the standardized MCP protocol.
49e69fe to
f1fef38
Compare
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
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