Create a custom tools server

Custom tools add business-specific functionality to Shopper MCP Server when your needs go beyond the default tools. You build them in your own MCP server on Adobe App Builder, deploy it to Adobe I/O Runtime, and then register it so Shopper MCP Server lists your tools alongside its own.

This page guides you through generating the server from the Adobe App Builder template, configuring authentication, and deploying it with the example tools. To add your own tools, see Define custom tools.

Custom tools support is in early access for Adobe Commerce on cloud infrastructure and on-premises and Adobe Commerce as a Cloud Service. Support for Adobe Commerce Optimizer is planned.

What the template provides template

The template is available in the Adobe App Builder template catalog as @adobe/generator-app-commerce-merchandising-mcp-custom-tools. It provides:

  • An Adobe App Builder application with one Runtime action, mcp-tool, that uses stateless Streamable HTTP for MCP. It returns JSON responses and does not use sessions.
  • Adobe Identity Management Services (IMS) token validation on every request.
  • A defineTool() helper to declare tools with a Zod input schema and a handler, plus two example tools.
  • Unit tests, lint configuration, and an end-to-end smoke test for the deployed endpoint.

Prerequisites prerequisites

  • Your organization is connected to Shopper MCP Server and has early access to custom tools. Custom tools extend an existing connection. They do not provide access to the Shopper MCP Server. See Early access.
  • Catalog data is available through Catalog Service or the Shopper MCP Catalog enablement module.
  • Node.js 22 or later is installed.
  • You have the Adobe I/O CLI (aio), an Adobe Developer Console project with Adobe App Builder access, and a Runtime workspace (Stage or Production).
  • Optional: an MCP-capable client for testing, such as cURL, MCP Inspector, Cursor, or Claude Desktop.

For general information, see the Adobe App Builder overview and getting started guide.

Create the project create-project

  1. Sign in and create a project folder:

    code language-bash
    aio login
    mkdir my-commerce-tools
    cd my-commerce-tools
    
  2. Initialize the application from the template:

    code language-bash
    aio app init --template @adobe/generator-app-commerce-merchandising-mcp-custom-tools
    
  3. Answer the generator prompts.

    The project name (--project-name, default commerce-merchandising-mcp) must contain 1–64 lowercase letters, digits, or hyphens, and must start with a letter or digit.

  4. Install dependencies; create your local environment file, and link the project to your Runtime workspace:

    code language-bash
    npm install
    cp .env.example .env
    aio app use
    

Generate a standalone project standalone

To generate a project without aio app init, install the package and Yeoman, and then run the generator:

npm install -g yo @adobe/generator-app-commerce-merchandising-mcp-custom-tools
yo @adobe/app-commerce-merchandising-mcp-custom-tools --skip-prompt \
  --project-name my-commerce-tools --ims-env prod

The --skip-prompt option uses the values that you supply instead of prompting.

Add the template to an existing project existing-project

You can also add the template to an existing Adobe App Builder project. The template adds the mcp-toolruntime action, which handles MCP requests and serves as the server endpoint. It merges the required dependencies into the project and preserves your existing actions and configuration. If an action named mcp-tool already exists, the generator stops rather than replacing it. The generator also supports the Adobe App Builder action-folder, config-path, and full-key-to-manifest options.

Review the generated files generated-files

actions/mcp-tool/      MCP HTTP action, tool definitions, server
actions/middleware/    CORS, IMS authentication, middleware chain
actions/utils.js       Shared action utilities
test/                  Action and middleware unit tests
e2e/                   Deployed-endpoint smoke tests
app.config.yaml        Runtime web action configuration (nodejs:22, raw-http)
.env.example           Environment variable names and IMS defaults; no credentials
README.md              Deployment, client configuration, and custom-tool guide

The actions/mcp-tool/ directory contains:

File
Responsibility
index.js
HTTP routing, I/O Runtime to Web Request/Response conversion, and the middleware chain
server.js
createMcpServer(), which registers tools
tools.js
Tool definitions (defineTool()) and registerTools()

How the server handles requests server-behavior

The server uses the official MCP TypeScript SDK (McpServer with WebStandardStreamableHTTPServerTransport). It is stateless: each request creates a new server and transport, responses are always JSON, and the server does not use SSE streams or sessions. The action is deployed with raw-http: true, so the request body reaches the transport unchanged.

Method
Behavior
Authentication
POST
Handles an MCP JSON-RPC message or batch through the SDK.
IMS token required
GET
Returns a health check, such as { "status": "healthy", ... }. A request with Accept: text/event-stream returns 405.
None
OPTIONS
Handles a CORS preflight request and returns 204.
None
DELETE
Returns 200. There is no session to end.
IMS token required

Because the server is stateless, do not rely on in-memory state between calls.

Configure authentication authentication

Every MCP POST request must include an Authorization header with an IMS access token. Only the GET health check and OPTIONS preflight request are public.

Set the IMS environment in .env:

IMS_ENV=prod

The server caches token validation results for up to 5 minutes. It may still accept a revoked token while its validation result is cached. The server always rejects expired tokens.

Test locally test

Run the unit tests and linter:

npm test
npm run lint

npm test runs the action and middleware unit tests and writes coverage for actions/ to coverage/ in text summary and LCOV formats. npm run lint runs ESLint.

Optionally, run the action locally:

aio app dev

With aio app dev, actions run locally on localhost:9080 by default. With aio app run, actions are deployed and served from Adobe I/O Runtime while the UI runs locally. For details, see aio app dev vs. aio app run and debugging in Visual Studio Code.

Deploy deploy

Build and deploy the application:

aio app build
aio app deploy

aio app deploy deploys all actions to Adobe I/O Runtime and any static files to the CDN. The output lists the web action URL, which is your MCP endpoint:

https://<namespace>.adobeioruntime.net/api/v1/web/<runtime-package>/mcp-tool

Save this URL. You need it to register your server.

To remove the deployment later, run aio app undeploy.

Next step next-step

Define custom tools

References references

recommendation-more-help
commerce-help-shopper-mcp