# Shopline MCP

> Shopline MCP Server lets your AI agent run as a full-time store operations manager. It handles everything from auditing product inventory and checking low stock counts to pulling customer profiles and compiling order fulfillment lists using direct API calls, all through natural conversation.

## Overview
- **Category:** ecommerce
- **Price:** Free
- **Tags:** multi-currency, storefront-backend, order-fulfillment, product-audit, customer-profiles, global-commerce

## Description

The **Shopline MCP** gives your AI agent full administrative access to your store's backend data. It lets your agent act like a dedicated operations manager that never logs into the vendor panel—it just talks directly to your Admin API, giving you immediate read access to critical business functions through simple conversations.

*   **Audit Product Catalog:** You can list every single product in the catalog using `list_products`. If you need specifics on one item, use `get_product_details` to pull all the listing details and variant info for a specific SKU. To see how your products are grouped, run `list_collections`, which lists every active product grouping. You can also check out general store information and metadata by calling `get_shop_info`, which returns things like currency settings or overall store status.
*   **Track Customer Activity:** Your agent pulls customer records using `list_customers`. This gives you a list of all registered accounts and basic profile info, letting you analyze demographics and account status at a glance. 
*   **View Order History & Details:** To audit live sales pipelines, the system lists multiple recent orders with `list_orders`, giving summaries across a date range or specific limit for transaction dates, totals, and item counts. If you need every piece of data associated with one sale, you pinpoint a single order ID and run `get_order_details` to retrieve all transactional information.

When your agent has access to these tools, it handles complex queries immediately. For instance, if you ask it to look at the last ten orders and then check stock levels for products in the 'Dog Collar' collection, it runs those specific API calls—`list_orders`, `get_product_details`, and `list_collections`—and spits out one single answer. You don't have to jump through menus or build complex reports; your agent just talks to the data source directly.

## Tools

### get_order_details
Retrieves all transactional data for one specified order ID.

### get_product_details
Fetches the full listing details and variant information for a single product SKU.

### get_shop_info
Retrieves high-level metadata, such as currency settings or overall store status.

### list_collections
Lists every product grouping (collection) currently active in the storefront.

### list_customers
Returns a list of all registered customer accounts and basic profile information.

### list_orders
Lists multiple recent orders, providing summaries of transactions across a date range or limit.

### list_products
Returns an index of every product in the shopline catalog.

## Prompt Examples

**Prompt:** 
```
Fetch the 10 most recent orders and summarize the total value and items purchased.
```

**Response:** 
```
Aggregating the `list_orders` query. I have parsed the latest 10 transactional blocks. The sum of the finalized captures amounts to $145.90. Items dispersed primarily included variable SKUs targeting "Deluxe Dog Collar" variants predominantly acquired across 4 unique client interactions safely tracked.
```

**Prompt:** 
```
Examine product ID '20410' and tell me if any variants are out of stock.
```

**Response:** 
```
Running the precise interrogation matrix using `get_product_details` for product '20410'... Found 3 associated variant IDs. SKU 'SL-VAB-M' (Medium sized) reports 0 quantity explicitly across the aggregated node. Both Small and Large variants possess strong buffer reserves remaining actively published.
```

## Capabilities

### Audit Product Catalog
The agent lists all available products using `list_products` or checks specific item details via `get_product_details`.

### Track Customer Activity
You query the store for customer records using `list_customers` to analyze demographics and account status.

### View Order History
The system lists all recent orders with `list_orders`, allowing you to review transaction dates, totals, and item counts.

### Get Specific Order Data
You pinpoint a single order ID and run `get_order_details` to retrieve every piece of data associated with that specific transaction.

### Manage Collections
The agent lists all product groupings available using `list_collections`, helping you understand how your products are categorized.

### Get Store Context
You fetch general store information and metadata by calling `get_shop_info`.

## Use Cases

### Investigating a high-value return.
A customer service rep needs to know what was bought, when it arrived, and how much they spent. The agent runs `get_order_details` using the order ID, which immediately gives the full item list, total cost, and purchase date—all without leaving the chat window.

### Checking for seasonal stock issues.
Merchandising needs to know if the new fall line is ready. They ask the agent to run `list_products` then filter by keywords, followed by `get_product_details` on the top 5 candidates to confirm inventory levels.

### Auditing a sales day's revenue.
A manager needs a quick snapshot of last week's activity. They ask the agent to run `list_orders`, specifying the date range, and the agent returns an aggregated list summarizing total value across dozens of transactions.

### Finding out who bought similar items.
The marketing team wants to find VIPs. They ask the agent to run `list_customers` and then use that output as a filter parameter when calling `get_product_details` for top-selling products.

## Benefits

- Audit entire order pipelines instantly. Instead of running separate reports, use `list_orders` to get a summary list and then drill into individual purchases with `get_order_details`. You see the total value and item breakdown in one pass.
- Manage inventory without logging in. Use `list_products` to see everything listed, and then call `get_product_details` on any SKU you're concerned about to verify exact stock counts or variant availability.
- Analyze customer behavior easily. Run `list_customers` to get a roster of buyers. You can combine this with product data to identify your top-spending client segments quickly.
- Verify store settings in seconds. The `get_shop_info` tool pulls core metadata, letting you confirm things like the current operating currency or tax status without navigating deep into the admin console.
- Map out product structure efficiently. You can use `list_collections` to map your entire site hierarchy and then cross-reference that with `list_products` to ensure no orphaned items exist.

## How It Works

The bottom line is: you give the agent a question, and it figures out which of the seven available tools it needs to use to answer it for you.

1. Anchor the Shopline MCP interface directly into your agent's framework.
2. Securely place your `SHOPLINE_ACCESS_TOKEN` matrix within the workspace to lock down access boundaries.
3. Prompt your agent with a natural language query (e.g., "What were the total sales from last Tuesday?") and let it run the required tools.

## Frequently Asked Questions

**How do I check product stock using get_product_details?**
The `get_product_details` tool returns the current inventory count and details for all associated variants of a specific SKU. This is your primary source for real-time stock checks.

**Can list_orders show me more than just the total amount?**
Yes, `list_orders` provides an aggregated summary of transactions across the date range you specify. You can then use `get_order_details` to get item-level breakdowns for individual orders.

**Does list_customers give me enough data to analyze demographics?**
`list_customers` provides basic profile information and status flags. While it doesn't run complex demographic reports, it gives you the raw data set needed to start that analysis.

**How do I list all products in my store using list_products?**
Simply call `list_products`. This tool returns an index of every product SKU currently registered with Shopline, giving you a full catalog overview.

**When I use `get_order_details`, what specific information does it pull for a single transaction?**
It retrieves detailed line items, payment status, and shipping addresses for one order ID. You get the full breakdown of products purchased, including SKUs and quantities, plus when the order was placed.

**What is the best way to use `list_collections` to find product groupings?**
The tool lists all active collection names and their associated IDs. This lets you see what groups of products exist in your store, acting as a directory for curated inventory.

**If I run `list_orders`, how do I handle rate limits or API errors?**
The agent will typically throw an error if the limit is hit. You just need to implement simple backoff logic in your client code; retrying after a short delay usually fixes it.

**When setting up the MCP, how do I securely manage my Shopline access tokens?**
The system expects you to anchor the `SHOPLINE_ACCESS_TOKEN` as an environment variable. Always keep this token locked down in your workspace; it's necessary for any tool function.

**Can the AI forcefully transition or edit an order status directly?**
Currently, the integration specifically implements reading mechanisms (`list_orders`, `get_order_details`) as a query matrix tailored explicitly around monitoring and auditing. It does not actively expose a write mutation structurally to alter or destroy existing operational orders.

**Why do I need a Custom Admin API integration token and not a public one?**
Because the `Admin API` is the unadulterated backend context designed primarily for secure backend logic rather than client storefront interfaces. This token permits your integration to run system-level monitoring, extraction over raw orders, and sensitive customer profiles natively.

**Is this tool accessing the Shopline GraphQL portal or REST architecture limitlessly?**
By structural intent, we implement targeted endpoints using Shopline's scalable endpoints to parse specifically filtered responses like single pagination segments to avoid massive latency. You interact efficiently bypassing raw structural limits naturally via these curated `list_x` and `get_x` procedures.