Extending the MCP Server
You can add three capability types to the MCP server: tools, prompts, and resources. There are three ways to implement them: as an app (webhook-based, works in Shopware Cloud), a plugin (in-process PHP, full DAL access), or a Symfony bundle (in-process, always active, no install lifecycle).
This page is a quick reference. For step-by-step guides, see:
Working examples:
- shopwareLabs/SwagMcpAdminUsers: plugin with tools, prompts, and resources for admin user management
- shopwareLabs/McpHelloWorld: minimal app with tools, prompts, and resources
Tools
Tools let the AI agent call your code to take action or fetch data.
Prompts
Prompts give the AI context and instructions before tool calls start. Return an array of {role, content} message objects.
Resources
Resources expose read-only reference data via a URI without consuming the tool's call budget. Return {uri, mimeType, text}.
Summary
| App | Plugin | Bundle | |
|---|---|---|---|
| Tool | <mcp-tool> in mcp.xml + webhook handler | #[McpTool] class + shopware.mcp.tool tag | Same as plugin |
| Prompt | <mcp-prompt> in mcp.xml + webhook returns message array | #[McpPrompt] class + shopware.mcp.prompt tag | Same as plugin |
| Resource | <mcp-resource> in mcp.xml + webhook returns {uri, mimeType, text} | #[McpResource] class + shopware.mcp.resource tag | Same as plugin |
| Context access | Via source.shopId in webhook body | McpContextProvider::getContext() | Same as plugin |
| DAL access | No (remote process) | Full | Full |
| Lifecycle | App install/update | Plugin install/activate | Always active |