Connect Loop Subscriptions to ChatGPT: Manage Orders & Schedules
Learn how to connect Loop Subscriptions to ChatGPT using a managed MCP server. Execute subscription workflows, swap variants, and track recurring orders.
If you want to connect Loop Subscriptions to ChatGPT so your AI agents can manage recurring orders, update billing schedules, and swap product variants in real time, you need a Model Context Protocol (MCP) server. This infrastructure layer acts as the bridge between your large language model's tool-calling capabilities and Loop's REST APIs. You can either spend weeks writing, hosting, and maintaining a custom MCP server, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL in seconds.
If your team uses Claude, check out our guide on connecting Loop Subscriptions to Claude or explore our broader architectural overview on connecting Loop Subscriptions to AI Agents.
Giving a Large Language Model (LLM) read and write access to a subscription management platform is an engineering challenge. You have to handle complex nested line items, map Shopify IDs to Loop internal IDs, and enforce strict state transition rules for contract lifecycles. Every time an API endpoint updates, your custom server code must be patched and redeployed.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Loop Subscriptions, connect it natively to ChatGPT, and execute complex e-commerce workflows using natural language.
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds. :::
The Engineering Reality of the Loop Subscriptions API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Loop Subscriptions requires handling several domain-specific API quirks. If you decide to build a custom MCP server, you own the entire API lifecycle.
Here are the specific integration challenges that break standard CRUD assumptions when working with Loop Subscriptions:
Composite ID Mapping (Loop vs Shopify)
Because Loop Subscriptions sits on top of Shopify, nearly every substantive payload requires a deep understanding of which ID namespace you are operating in. An LLM might know a customer by their shopify_customer_id, but the Loop API often requires a Loop internal customer_id or subscription_id to make updates. When swapping a variant in a subscription line item, the LLM must pass the variantShopifyId rather than a Loop ID. If your MCP server does not expose these schema requirements clearly in its tool definitions, ChatGPT will hallucinate IDs and throw HTTP 400 errors.
Strict Epoch Math and Frequency Constraints
When an AI agent reschedules a subscription, it cannot simply pass a natural language date like "next Tuesday." The Loop API demands newBillingDateEpoch, which requires the MCP client to calculate exact Unix timestamps. Furthermore, Loop enforces strict business logic: the next billing date must be at least 24 hours in the future. Updating a billing anchor (anchorType) requires exact case-sensitive matches to the current billing frequency (e.g., WEEKDAY, MONTHDAY, or YEARDAY). Your integration layer must expose these exact constraints to the LLM via JSON Schema.
Granular Lifecycle State Transitions
A subscription in Loop cannot arbitrarily change states. You cannot "resume" a canceled subscription - you must call a dedicated reactivate endpoint. You cannot edit shipping methods if "Auto update shipping price" is enabled in the Loop dashboard. Operations like swapping a line item (loop_subscriptions_subscription_lines_swap) versus skipping a line item for one cycle (loop_subscriptions_subscription_lines_delete_once) require entirely different endpoints and payload structures.
Rate Limit Handling and Backoff
Like all high-volume APIs, Loop Subscriptions enforces strict rate limits. It is critical to understand that Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Loop API returns an HTTP 429 Too Many Requests, Truto passes that error directly back to the caller. However, Truto does normalize upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller (your MCP client or AI agent framework) is fully responsible for intercepting these 429s, reading the standardized headers, and implementing its own retry or backoff logic.
Generating a Loop Subscriptions MCP Server
Truto dynamically generates MCP servers based on the Loop Subscriptions OpenAPI specification and your specific tenant connection. The resulting server URL contains a cryptographic token that securely maps to the integrated account, meaning you do not need to manage raw OAuth tokens in your LLM application.
You can create this MCP server using either the Truto dashboard or programmatically via the API.
Method 1: Via the Truto UI
For ad-hoc tasks, internal operations, or prompt engineering, you can generate an MCP URL directly from the browser:
- Navigate to the Integrated Accounts section in your Truto dashboard.
- Select your connected Loop Subscriptions account.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration (e.g., filtering to only allow
readandwritemethods for specific tags likesubscriptionsandorders). - Copy the generated MCP server URL. Treat this URL like a secret - it carries authentication for this specific connection.
Method 2: Via the Truto API
For production workflows where you are provisioning AI agents dynamically for your end-users, you should generate the MCP server programmatically.
Make a POST request to /integrated-account/:id/mcp with your desired configuration:
curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
-H "Authorization: Bearer $TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Loop Subscriptions Agent Support",
"config": {
"methods": ["read", "write", "custom"],
"tags": ["subscriptions", "orders", "customers"]
},
"expires_at": "2026-12-31T23:59:59Z"
}'The API returns a payload containing the secure URL:
{
"id": "mcp_8a9b0c1d",
"name": "Loop Subscriptions Agent Support",
"url": "https://api.truto.one/mcp/a1b2c3d4e5f6g7h8...",
"expires_at": "2026-12-31T23:59:59Z"
}Connecting the MCP Server to ChatGPT
Once you have your Truto MCP URL, you can plug it into any MCP-compliant client. Here are the two primary ways to connect it to ChatGPT.
Method 1: Via the ChatGPT UI (Custom Connectors)
If you are using ChatGPT Pro, Plus, Business, Enterprise, or Education, you can add the server directly via the interface:
- Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
- Ensure Developer mode is enabled (MCP support requires this).
- Under MCP servers / Custom connectors, click to add a new server.
- Name: Enter a descriptive label (e.g., "Loop Subscriptions").
- Server URL: Paste the
https://api.truto.one/mcp/...URL generated in the previous step. - Save the configuration. ChatGPT will instantly perform a handshake, call
tools/list, and populate its context with the available Loop Subscriptions operations.
Method 2: Via Manual Configuration File
If you are running a local instance of an MCP client, a headless agent, or testing via an MCP inspector, you can configure the connection using the standard JSON configuration array and the @modelcontextprotocol/server-sse transport package.
Because Truto exposes MCP over HTTP using Server-Sent Events (SSE) for continuous communication, your config file will look like this:
{
"mcpServers": {
"loop_subscriptions": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"--url",
"https://api.truto.one/mcp/a1b2c3d4e5f6g7h8..."
]
}
}
}Once connected, your agent will immediately parse the auto-generated JSON schemas for every available endpoint.
Hero Tools for Loop Subscriptions
Truto dynamically translates Loop Subscriptions API endpoints into tightly scoped JSON-RPC tools. Here are the highest-leverage tools available for your AI agents when managing subscriptions.
get_single_loop_subscriptions_subscription_by_id
Fetches a comprehensive payload for a single subscription, including billing status, delivery policies, line items, and historical order status. This is the primary diagnostic tool an agent uses before making any lifecycle changes.
"Fetch the current status, line items, and next billing date for subscription ID 8912345."
loop_subscriptions_subscriptions_reschedule
Allows an AI agent to delay or prepone a subscription's upcoming order by modifying its billing date. The LLM must calculate the new Unix timestamp (epoch) for a date at least 24 hours in the future.
"The customer asked to push their next delivery for subscription 8912345 to December 15th. Calculate the epoch timestamp for that date and reschedule the billing."
loop_subscriptions_subscription_lines_swap
Executes a product swap within an active subscription contract. The agent must specify the specific line_id being removed, and provide the new variantShopifyId to be added, along with quantity and pricing type.
"Swap line item 45678 in subscription 8912345 with the new Shopify variant ID 999888777. Keep the quantity at 2."
loop_subscriptions_subscriptions_change_plan
Updates the actual selling plan frequency (e.g., moving from "Deliver every 30 days" to "Deliver every 60 days"). This requires passing the new sellingPlanShopifyId that maps to the desired interval.
"The customer wants to change their subscription 8912345 from monthly to quarterly. Update the selling plan using Shopify plan ID 555444333."
loop_subscriptions_subscription_orders_list_order_schedule
Retrieves the complete schedule of upcoming orders for a specific contract. This is crucial for answering customer inquiries about "when will my next three shipments arrive?" without having to parse complex recurring logic manually.
"List all scheduled upcoming orders for subscription 8912345 so I can tell the customer what to expect over the next three months."
list_all_loop_subscriptions_subscription_activity_logs
Fetches the raw audit trail for a subscription. This tool is invaluable for debugging disputes, tracking down when a customer paused their account, or verifying if an automated system altered a discount code.
"Pull the activity logs for subscription 8912345 for the last 30 days to see exactly when their payment method failed."
To view the complete inventory of available proxy endpoints, schemas, and required parameters, visit the Loop Subscriptions integration page.
Workflows in Action
By chaining these tools together, ChatGPT can execute complex, multi-step customer support operations that would normally require a human agent to navigate three different UI screens in the Loop dashboard.
Scenario 1: The Subscription Swap & Delay
A customer emails support asking to change their coffee subscription from "Dark Roast" to "Light Roast" and push their next shipment out by two weeks because they are traveling.
"Look up subscription 8912345. Swap the current 'Dark Roast' line item with the 'Light Roast' variant (Shopify ID: 1122334455). Then, calculate the date exactly 14 days from the current next billing date, convert it to an epoch timestamp, and reschedule the subscription."
Execution Steps:
get_single_loop_subscriptions_subscription_by_id: ChatGPT fetches the subscription, extracting the currentnextBillingDateEpochand the internalline_idfor the "Dark Roast" item.loop_subscriptions_subscription_lines_swap: ChatGPT issues the swap command, passing the oldline_idand the newvariantShopifyId.loop_subscriptions_subscriptions_reschedule: ChatGPT calculates the new epoch timestamp (+14 days) and executes the reschedule command.
sequenceDiagram
participant User as Customer Support
participant ChatGPT as ChatGPT
participant MCP as Truto MCP Server
participant LoopAPI as Loop API
User->>ChatGPT: "Swap variant to 1122334455 and delay billing by 14 days for sub 8912345"
ChatGPT->>MCP: Call get_single_loop_subscriptions_subscription_by_id
MCP->>LoopAPI: GET /subscriptions/8912345
LoopAPI-->>MCP: Returns line_ids and nextBillingDateEpoch
MCP-->>ChatGPT: JSON Response
ChatGPT->>MCP: Call loop_subscriptions_subscription_lines_swap
MCP->>LoopAPI: POST /subscriptions/8912345/lines/swap
LoopAPI-->>MCP: 200 OK
MCP-->>ChatGPT: Success
ChatGPT->>MCP: Call loop_subscriptions_subscriptions_reschedule
MCP->>LoopAPI: POST /subscriptions/8912345/reschedule<br>{"newBillingDateEpoch": 1735689600}
LoopAPI-->>MCP: 200 OK
MCP-->>ChatGPT: Success
ChatGPT-->>User: "Successfully swapped the variant and delayed the next order."```
### Scenario 2: The Dispute Audit Trail
A customer complains they were charged for a subscription they "canceled" last month. The support agent asks ChatGPT to investigate the timeline.
> "Find customer ID 554433. List their subscriptions. Check the activity logs for any active subscriptions to see if a cancellation request was made or reversed in the last 45 days."
**Execution Steps:**
1. **`loop_subscriptions_customers_list_subscriptions`**: ChatGPT retrieves the list of subscriptions tied to the customer ID, identifying one active subscription that caused the charge.
2. **`list_all_loop_subscriptions_subscription_activity_logs`**: ChatGPT fetches the audit trail for that specific subscription ID.
3. **Analysis:** ChatGPT reads the JSON response, noting that the customer paused the subscription (rather than canceling it) and the system automatically resumed it based on a 30-day pause limit. ChatGPT summarizes this timeline for the human agent.
## Security and Access Control
Giving an LLM unconstrained access to a billing and subscription system is highly dangerous. Truto provides several mechanisms to lock down your MCP servers:
* **Method Filtering:** Use `config.methods: ["read"]` to create a read-only server. This ensures the AI agent can audit logs and view schedules but cannot accidentally cancel a subscription or swap product lines.
* **Tag Filtering:** Restrict tools functionally by passing `config.tags: ["orders", "customers"]`. Tools outside these specific resource tags are stripped from the JSON-RPC response.
* **Require API Token Auth:** By setting `config.require_api_token_auth: true`, the MCP URL alone is no longer enough to execute tools. The client must also pass a valid Truto API token in the `Authorization` header, binding tool execution to authenticated sessions.
* **Time-to-Live (TTL):** Pass `expires_at` during server creation to automatically tear down the infrastructure. This is ideal for provisioning temporary AI agent environments that self-destruct after a specific support shift or batch processing job.
Connecting Loop Subscriptions to ChatGPT using a managed MCP server removes the friction of OAuth management, complex pagination logic, and continuous schema maintenance. By scoping tools dynamically based on documentation, you ensure your AI agents have accurate, up-to-date access to Shopify e-commerce data without writing fragile integration code.FAQ
- Can I filter which Loop Subscriptions tools ChatGPT can access?
- Yes. When generating the MCP server in Truto, you can pass method filters (e.g., restricting to only 'read' operations) and tag filters to control exactly which endpoints the LLM can see.
- How are Loop Subscriptions rate limits handled via the MCP server?
- Truto does not retry or throttle requests when encountering rate limits. It returns the HTTP 429 error directly to ChatGPT along with standardized rate limit headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset), leaving retry logic up to the caller.
- Does Truto handle the mapping between Shopify IDs and Loop IDs?
- Truto exposes the raw Loop API requirements through auto-generated JSON schemas. The LLM must correctly parse these schemas to understand when to use a Shopify ID versus a Loop internal ID, as defined by the tool descriptions.