shopify-mcp
Enables management of Shopify store via GraphQL, including products, orders, inventory, and discounts with security features like preview mode and write protection.
README
shopify-mcp-cloud-run
Production-ready Shopify Admin MCP server for Google Cloud Run. It exposes an authenticated MCP endpoint at /mcp and safe Shopify Admin GraphQL tools for products, orders, inventory, discounts, and service health.
Security model
- Every
/mcprequest must includeAuthorization: Bearer <MCP_API_KEY>or a valid OAuth access token issued by this server. - OAuth 2.1 authorization-code + PKCE endpoints are included for ChatGPT Apps developer mode.
Originis validated when present. SetMCP_ALLOWED_ORIGINSto a comma-separated list for browser clients.- Shopify credentials are read only from environment variables and are never logged.
- Write tools never write by default. They return a JSON preview unless
confirm=true. - Confirmed writes still require
ALLOW_WRITE_TOOLS=true. - Destructive actions such as deleting customers/products, refunding orders, or canceling orders are intentionally not implemented.
Shopify custom app setup
- In Shopify Admin, go to Settings > Apps and sales channels > Develop apps.
- Create a custom app for this MCP server.
- Configure Admin API scopes:
read_productswrite_productsread_ordersread_inventorywrite_inventoryread_discountswrite_discountsread_locations
- Install the app and copy the Admin API access token.
- Store the token in Google Secret Manager or your local
.envfile.
Environment variables
Copy .env.example to .env for local development:
cp .env.example .env
Required values:
SHOPIFY_SHOP_DOMAIN=your-store.myshopify.com
SHOPIFY_ADMIN_ACCESS_TOKEN=replace-with-shopify-admin-api-token
SHOPIFY_API_VERSION=2026-04
MCP_API_KEY=some-secret-key
ALLOW_WRITE_TOOLS=false
Optional values:
PUBLIC_BASE_URL=https://your-cloud-run-service-url
OAUTH_AUTHORIZATION_PASSWORD=owner-login-password-for-chatgpt-linking
OAUTH_TOKEN_SECRET=random-oauth-signing-secret
MCP_ALLOWED_ORIGINS=https://your-client.example.com
SHOPIFY_REQUEST_TIMEOUT_MS=20000
SHOPIFY_MAX_RETRIES=2
Keep ALLOW_WRITE_TOOLS=false unless you intentionally want this MCP server to edit Shopify data.
PUBLIC_BASE_URL is recommended in Cloud Run so OAuth discovery metadata uses the exact public service URL. OAUTH_AUTHORIZATION_PASSWORD is the password you enter in the browser when ChatGPT links the app. OAUTH_TOKEN_SECRET signs short-lived OAuth access tokens.
Run locally
npm install
npm run dev
The service listens on 0.0.0.0 using process.env.PORT, defaulting to 8080.
Test health:
curl http://localhost:8080/health
Test MCP initialization:
curl http://localhost:8080/mcp \
-H "Authorization: Bearer $MCP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0.0"}}}'
List tools:
curl http://localhost:8080/mcp \
-H "Authorization: Bearer $MCP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
Preview vs confirm
All write tools support preview mode. For example, this returns the proposed change without writing to Shopify:
{
"productId": "gid://shopify/Product/123",
"seoTitle": "New SEO title",
"seoDescription": "New SEO description",
"confirm": false
}
To write, both conditions are required:
- Set
ALLOW_WRITE_TOOLS=truein the service environment. - Pass
"confirm": trueto the tool call.
If either condition is missing, the server does not write.
For update_inventory_quantity, a confirmed write first reads the current available quantity at the given location and sends it as Shopify's compare value with an idempotency key. If inventory changed between preview and confirm, Shopify returns a user error instead of silently overwriting the new value.
Cloud Run deployment
Enable required Google APIs:
gcloud services enable run.googleapis.com secretmanager.googleapis.com cloudbuild.googleapis.com
Create Secret Manager secrets:
printf "replace-with-shopify-admin-api-token" | gcloud secrets create shopify-admin-token --data-file=-
printf "some-secret-key" | gcloud secrets create mcp-api-key --data-file=-
printf "owner-login-password" | gcloud secrets create oauth-authorization-password --data-file=-
openssl rand -base64 32 | gcloud secrets create oauth-token-secret --data-file=-
Deploy to Cloud Run:
gcloud run deploy shopify-mcp-cloud-run \
--source . \
--region me-west1 \
--allow-unauthenticated \
--set-env-vars SHOPIFY_SHOP_DOMAIN=your-store.myshopify.com,SHOPIFY_API_VERSION=2026-04,ALLOW_WRITE_TOOLS=false,MCP_ALLOWED_ORIGINS=https://chatgpt.com \
--set-secrets SHOPIFY_ADMIN_ACCESS_TOKEN=shopify-admin-token:latest,MCP_API_KEY=mcp-api-key:latest,OAUTH_AUTHORIZATION_PASSWORD=oauth-authorization-password:latest,OAUTH_TOKEN_SECRET=oauth-token-secret:latest
Cloud Run is marked --allow-unauthenticated so MCP clients can reach the service, but the /mcp endpoint still requires the bearer token.
After the first deploy, get the public service URL:
SERVICE_URL=$(gcloud run services describe shopify-mcp-cloud-run \
--region me-west1 \
--format='value(status.url)')
Then set it as PUBLIC_BASE_URL so OAuth metadata is stable:
gcloud run services update shopify-mcp-cloud-run \
--region me-west1 \
--update-env-vars PUBLIC_BASE_URL="$SERVICE_URL"
Connect to ChatGPT
- In ChatGPT web, open Settings > Apps > Advanced settings.
- Enable Developer mode.
- Click Create app.
- Use the MCP server URL:
https://your-cloud-run-service-url/mcp. - Choose OAuth authentication if prompted.
- When the authorization page opens, enter
OAUTH_AUTHORIZATION_PASSWORD.
The server exposes OAuth discovery at:
/.well-known/oauth-protected-resource/.well-known/oauth-authorization-server/oauth/register/oauth/authorize/oauth/token
MCP tools
search_products and get_orders paginate through all matching Shopify pages. Use query to narrow results.
health_checkshopify_admin_graphqlsearch_productsget_productupdate_product_seoupdate_product_descriptionupdate_product_tagsupdate_product_statuscreate_productadd_product_mediaupdate_product_mediadelete_product_mediareorder_product_mediareplace_product_mediaappend_variant_mediadetach_variant_mediaupdate_product_metafieldsget_ordersget_inventory_by_skuupdate_inventory_quantitycreate_discount_code
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。