Blog
Joey Caffrey
CEO
Ask AI About Your Deductions: Connecting Marginwiz to Claude and ChatGPT
Connect Marginwiz to Claude or ChatGPT using MCP and ask questions about your deduction data in plain English. Setup takes under 5 minutes.
What if you could open Claude and ask "how much have we won back from UNFI this year?" and get an instant answer pulled directly from your Marginwiz data?
With Marginwiz's new MCP integration, you can. MCP (Model Context Protocol) is an open standard that lets AI assistants like Claude and ChatGPT securely connect to your business tools. Instead of logging into dashboards, exporting CSVs, and building pivot tables, you just ask questions in plain English.
This guide walks you through connecting Marginwiz to your AI assistant in under 5 minutes.
What you can ask
Once connected, your AI assistant has access to your full deduction history. Here are some questions you can ask right away:
- "How much have we won back in the last 12 months?"
- "Which retailers have the highest deduction rates?"
- "Show me a monthly breakdown of sales vs. deductions for this year"
- "What categories are driving the most deductions from UNFI?"
- "What's our dispute success rate by retailer?"
- "List all open deductions over $5,000"
- "Search for invoice number INV-2024-1234"
- "Which reason codes are most likely to be disputable?"
Claude can format the results as tables, summaries, or even generate charts when using the analysis tool.
Prerequisites
Before you start, you'll need:
- A Marginwiz account with deduction data already imported
- Your Marginwiz API key (generated from Settings in the Marginwiz app — see Step 1)
- Claude Desktop (plus Node.js, used by the connection bridge) or Claude Code (CLI). Claude.ai browser and ChatGPT connections aren't supported yet — see below.
Step 1: Get your API key
- Log into Marginwiz at app.marginwiz.com
- Go to Settings > API Keys
- Click Generate API Key and give it a name (e.g. "Claude MCP")
- Copy the key — you'll need it in the next step. It's only shown once, so store it somewhere safe.
Step 2: Connect your AI assistant
Choose the setup that matches the tool you use:
Option A: Claude Desktop
Claude Desktop runs MCP servers as local processes, so the connection goes through the mcp-remote bridge (this is why Node.js is required).
Open your Claude Desktop configuration file:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%\Claude\claude_desktop_config.json
Add the Marginwiz MCP server to the mcpServers section:
{
"mcpServers": {
"marginwiz": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.marginwiz.com/sse",
"--header",
"Authorization: Bearer your-api-key-here"
]
}
}
}
Replace your-api-key-here with the API key you copied in Step 1.
Save the file and restart Claude Desktop.
Option B: Claude Code (CLI)
If you use Claude Code in the terminal, add the MCP server to your settings:
claude mcp add --transport sse marginwiz https://mcp.marginwiz.com/sse \
--header "Authorization: Bearer your-api-key-here"
Replace your-api-key-here with your API key.
What about Claude.ai (browser) and ChatGPT?
Claude.ai and ChatGPT custom connectors authenticate with OAuth, which the Marginwiz MCP server doesn't support yet. For now, connect through Claude Desktop or Claude Code — browser-based Claude.ai and ChatGPT support is on our roadmap.
Step 3: Verify the connection
Start a new conversation and try:
"Can you pull a summary of my deductions from the last 90 days?"
If everything is configured correctly, your AI assistant will call the Marginwiz tools and return your deduction data. You should see your total sales, deduction amounts, dispute counts, and win amounts.
In Claude Desktop, you can also use the Onboarding prompt (available in the prompt selector) which will automatically verify your connection and show you what's available.
Available tools
Behind the scenes, your AI assistant has access to these Marginwiz tools:
- Deduction Summary — Total sales, deductions, disputes, repayments, and winnable estimates
- Analytics Metrics — Operational stats: documents processed, tasks completed, disputes filed
- Deductions by Retailer — Invoice and deduction totals per retailer/distributor
- Monthly Breakdown — Time series of sales and deductions by month and distributor
- Deductions by Category — Totals grouped by deduction category/reason code
- Disputes by Source — Dispute win amounts and counts per retailer
- List Deductions — Browse individual deductions with status, kind, and date filters
- Search Deductions — Find specific deductions by invoice number, PO, or check number
- Reason Code Breakdown — Deductions by reason code with dispute likelihood rating
Every tool supports date range and retailer/distributor filtering, so you can drill down into any time period or trading partner.
The server also includes a set of onboarding tools — account status, sync status, setup links, pricing, a disputable-deduction scan, and dispute-service activation — that power the Onboarding prompt in Claude Desktop.
Example conversation
Here's what a typical session looks like:
You: How did we do on deduction recovery last quarter?
Claude: Based on your Q1 2026 data:
- Total deductions: $842,300 across 1,247 deductions
- Disputes filed: 89
- Disputes won: 61 (69% win rate)
- Total recovered: $127,450
- Your estimated winnable range is $42,115 - $63,172 in additional recovery opportunity.
You: Break that down by retailer
Claude: Here's your Q1 recovery by retailer:
- UNFI — $68,200 won (34 disputes, 72% win rate)
- KeHE — $31,100 won (15 disputes, 65% win rate)
- Walmart — $18,900 won (8 disputes, 62% win rate)
- Target — $9,250 won (4 disputes, 80% win rate)
You: What categories are driving the UNFI deductions?
Claude: (fetches category breakdown filtered to UNFI)
Tips for getting the most out of it
- Be specific with dates. "Last 6 months" works, but "January through March 2026" is more precise.
- Name the retailer. Your AI assistant can filter by any of your trading partners: UNFI, KeHE, Walmart, Target, Kroger, Amazon, Costco, and more.
- Ask follow-up questions. The AI remembers context within a conversation. Start broad ("how are we doing?") and drill down.
- Request charts. Ask to "chart this" or "make a bar chart" to generate visualizations from your data.
- Export data. Ask to format results as a CSV or markdown table you can paste into a report.
Security and privacy
- Your data stays in your Marginwiz account. The AI reads it on-demand through the MCP connection — nothing is stored between conversations.
- API keys can be revoked at any time from Settings > API Keys in the Marginwiz app.
- The analytics tools are read-only — the AI cannot modify your deductions or change any data. The one exception is an optional onboarding tool that, only after you explicitly confirm, notifies our team to activate dispute filing for your account.
- All communication is encrypted over TLS.
Need help?
If you run into issues connecting:
- Double-check your API key is correct and hasn't been revoked
- Make sure you've restarted Claude Desktop after editing the config file
- Check that the JSON in your config file is valid (no trailing commas, matching brackets)
- Reach out to support@marginwiz.com and we'll help you get set up
Marginwiz helps CPG brands automate deduction management, from import to dispute to recovery. Learn more