The Subtotal AI Toolkit: MCP Server and Integration Packages


Introducing the Subtotal AI Toolkit
We are thrilled to announce the release of the Subtotal AI Toolkit, a collection of open-source packages designed to seamlessly integrate your favorite AI agent frameworks with the Subtotal API. This toolkit provides a simple and powerful way for AI applications to leverage end consumer purchase data to deliver personalized and context-aware experiences.
What is Subtotal?
The Subtotal platform makes it easy for developers to integrate itemized, full-basket purchase data into their applications.
Consumers use Merchant Link to connect their retailer accounts from merchants like Walmart, Target or Sephora to apps and services they trust. Developers can then use the Subtotal API to access and analyze itemized retail purchases for any connected account.
What’s inside the Subtotal AI Toolkit?
-
TypeScript AI Integration Package (Python coming soon!)
- A developer-friendly library that enables AI agents to fetch, analyze, and draw insights from users' itemized retail purchases, with seamless integration into frameworks like LangChain, OpenAI and Vercel AI SDK.
-
Model Context Protocol (MCP) Server
- A MCP server implementation that allows AI applications to query and utilize purchase history as part of their reasoning and decision-making processes. This solution is perfect for applications that need to access purchase data in a secure and compliant manner and for developers that need to scale MCP servers to support their AI agents.
Unlock the power of itemized purchases in AI agents
Subtotal embraces the changing landscape of AI agent frameworks and applications. The ability to access structured, full-basket purchase data opens up endless possibilities for AI-driven automation, insights, and recommendations.
Seamless Integration: Example with Vercel’s AI SDK
Integrating the Subtotal AI Toolkit into your AI applications is straightforward. Here’s a TypeScript example demonstrating how to pull a user's purchase history and provide a product recommendation:
import {SubtotalAIToolkit, Tools} from '@subtotal-inc/ai-toolkit/ai-sdk';
import {openai} from '@ai-sdk/openai';
import {generateText} from 'ai';
const subtotalAIToolkit = new SubtotalAIToolkit({
secretKey: "YOUR_SECRET_KEY",
configuration: {
tools: [Tools.getPurchases, Tools.getPurchaseDetails]
},
});
const model = openai('gpt-4o');
(async () => {
const result = await generateText({
model: model,
tools: {...subtotalAIToolkit.getTools()},
maxSteps: 3,
prompt: 'Get the purchase details for the last purchase for ' +
'connection ID "01JNHY5M3Q5207QEF9YYV909MG" and give a ' +
'product recommendation based on the contents of that purchase'
});
console.log(JSON.stringify(result, null, 2));
})();
With just a few lines of code, your AI application can harness the power of purchase history to deliver intelligent and context-aware recommendations. Sign up for our dashboard and generate an API key to get started today. For additional examples and documentation, check out our GitHub repository.
Get started today
The Subtotal AI Toolkit is now available on GitHub! Get access to the Subtotal API and start building your next project in minutes by signing up on our dashboard. Whether you're building an AI assistant, a financial planning app, or an intelligent shopping companion, our toolkit makes it easy to bring real-world purchase history into your AI experiences. We greatly appreciate your feedback and we are excited to build a community together. Feel free to submit an issue or pull request, or reach out to us at support@subtotal.com.
👉 Create your API key: Subtotal Dashboard
👉 Check out the repository and start building: Subtotal AI Toolkit
We can’t wait to see what you create! (And don't worry! Python support is coming soon -- probably tomorrow)
Join the Subtotal community by following us on X and LinkedIn.
Copy Link