Skip to main content

Commerce MCP Server

5.1 Tool Design for an E-Commerce MCP Server

A complete e-commerce MCP Server typically includes the following tools:

5.2 Tool Design Principles

Single Responsibility

Each tool should do one thing. Do not combine search and ordering in the same tool. The AI model will automatically compose multiple tools based on context.

Clear Descriptions

A tool’s description directly affects when the AI model chooses to use it. Be explicit about:
  • What the tool does
  • When it should be used
  • What type of data it returns

Sensible Parameter Design

  • Keep required parameters minimal (lower the barrier to use)
  • Provide defaults for optional parameters
  • Write specific parameter descriptions

Leverage structuredContent

For return data that needs programmatic processing (such as price calculations, inventory comparisons), provide both content (for LLM reading) and structuredContent (for programmatic processing):

Use isError to Distinguish Business Errors

For business issues encountered during tool execution (e.g., product not found, insufficient inventory), use isError: true instead of throwing an exception:

5.3 Complete E-Commerce MCP Server Example

5.4 Commerce Resource Design

Beyond tools, an e-commerce Server can also expose static context as Resources, enabling AI agents to understand your business:
When an AI agent answers questions like “Do you accept returns?”, it automatically reads the relevant resource as context.

5.5 Permissions and Security

Commerce Servers require special attention to access control: For remote deployment, use OAuth 2.1 authentication to ensure correct user identity and permissions. For tools that require authentication, you can request user login via Elicitation, or rely on the Host application’s existing OAuth integration.

5.6 Commerce MCP Server and Its Relationship to Other Protocols

In a complete Agentic Commerce system, MCP serves as the “connection layer” between AI applications and your commerce systems, while UCP/ACP/OTR handle the specific commerce protocol logic.
Next Chapter: Resources and Prompts — Deep dive into Resources and Prompts