Using OpenCode with DataDoe MCP
OpenCode (opens in a new tab) is an open-source AI coding agent built for the terminal. It supports a TUI, CLI, and desktop app, and works with major LLM providers such as Anthropic, OpenAI, and Google. Unlike browser-based assistants, OpenCode runs in your terminal alongside your code, making it a natural fit for scaffolding projects, writing scripts, and building tools that use live data.
In this setup, DataDoe MCP acts as the data layer for OpenCode. Your agent calls DataDoe tools to read live Amazon Seller, Vendor, and Ads data on demand, without manual exports or custom SP-API pipelines.
What you will build
By the end of this tutorial, you will have:
- OpenCode installed and running on your machine
- An LLM provider configured (Anthropic, OpenAI, or OpenCode Zen)
- DataDoe MCP connected via the
~/.config/opencode/opencode.jsoncconfig file - A verified first query listing your connected Amazon sellers
- A seven-day sales report generated directly in the terminal
- A self-contained
dashboard.htmlsales dashboard built by OpenCode using live DataDoe data, ready to open in any browser
Prerequisites
- A DataDoe account with your Amazon connections set up and synced
- A DataDoe MCP key — if you have not created one yet, follow the DataDoe MCP Overview guide first, then return here. You can also create a key directly in DataDoe MCP Integrations (opens in a new tab)
- An API key for your chosen LLM provider (Anthropic or OpenAI), or use the built-in OpenCode Zen tier (no external key required)
- A modern terminal emulator, such as WezTerm (opens in a new tab), Ghostty (opens in a new tab), Alacritty (opens in a new tab), or Kitty (opens in a new tab)
- Node.js (opens in a new tab) 18 or later installed (verify with
node --version)
Step 1: Install OpenCode
Install OpenCode using the method that suits your platform:
1# One-liner (recommended)
2curl -fsSL https://opencode.ai/install | bash
3
4# Node.js (npm, bun, pnpm, or yarn)
5npm i -g opencode-ai@latest
6
7# macOS and Linux (Homebrew — always up to date)
8brew install anomalyco/tap/opencode
9
10# Windows
11scoop install opencode
12choco install opencodeA desktop app is also available if you prefer a graphical interface. Download it from opencode.ai/download (opens in a new tab) for macOS, Windows, or Linux.
Verify the installation:
1opencode --versionStep 2: Configure an LLM provider and choose a model
Navigate to any directory and run opencode to open the TUI. You have two options for connecting an LLM:
Option A — OpenCode Zen (no external API key required)
Run /connect inside the TUI, select opencode, and sign in at opencode.ai/auth (opens in a new tab). Zen provides a curated set of models maintained by the OpenCode team, so you do not need an Anthropic or OpenAI account.
Option B — your own API key
Run /model inside the TUI to open the model picker:
- Select a provider — OpenCode supports Anthropic, OpenAI, Google, Mistral, and more
- Choose an authentication method: API key
- Paste your key
- Select a model, for example
claude-sonnet-4-6
Build vs. plan mode. OpenCode has two built-in agent modes: build (default, full file access) and plan (read-only, for analysis and exploration). Switch between them with the
Tabkey. For this tutorial, stay in build mode.
Step 3: Connect DataDoe MCP
Important: OpenCode does not currently support adding remote authenticated MCP servers with a CLI command. You must configure DataDoe MCP by editing the config file manually in a text editor such as VS Code, nano, or vim.
Open ~/.config/opencode/opencode.jsonc in your preferred text editor and add the following block:
1{
2 "$schema": "https://opencode.ai/config.json",
3 "mcp": {
4 "datadoe-mcp": {
5 "type": "remote",
6 "url": "https://mcp.datadoe.com/mcp/v1",
7 "enabled": true,
8 "headers": {
9 "datadoe-mcp-key": "YOUR_DATADOE_MCP_KEY"
10 }
11 }
12 }
13}Replace YOUR_DATADOE_MCP_KEY with your key from DataDoe MCP Integrations (opens in a new tab).
Save the file. Before restarting OpenCode, you can verify that the config is picked up correctly by running the following command in your terminal:
1opencode mcp listThis lists all configured MCP servers and their status. You should see datadoe-mcp with a connected or enabled state.
If datadoe-mcp does not appear, check that the config file is saved at ~/.config/opencode/opencode.jsonc and that it contains valid JSON with no trailing commas and correct indentation.
Now restart OpenCode (press cmd + c to quit, then run opencode again) to load the MCP server into the active session.
Quick setup reference
If you are already familiar with OpenCode MCP configuration, here is everything you need:
Config: ~/.config/opencode/opencode.jsonc → mcp.datadoe-mcp
URL: https://mcp.datadoe.com/mcp/v1
Header: datadoe-mcp-key: YOUR_DATADOE_MCP_KEYStep 4: Verify the MCP connection
Restart OpenCode and open a new session, then ask:
What DataDoe tools do you have access to?OpenCode should respond with a list of DataDoe MCP tools, such as list_sellers, query_table, and others. If no tools appear, check that the config file contains valid JSON with correct indentation and that the MCP key is correct.
Step 5: First conversation and seven-day sales report
List your connected sellers
Start with a simple query to confirm that DataDoe data flows through the connection:
List my all available sellers on AmazonOpenCode calls list_sellers through DataDoe MCP and returns the names of your connected accounts. Note the seller name, as you will use it in the next query.
Generate a seven-day sales report
Now use OpenCode to produce a business report. Paste the prompt below, replacing {example_seller} with your seller name:
Prepare me a sales summary for {example_seller} seller for last 7 daysOpenCode will:
- Call
list_sellersto confirm the account - Query the
Profit by SKU & Datetable for the last seven days - Analyse the data and return a structured markdown report with per-SKU breakdowns, daily rows, and executive KPIs (total sales, units sold, profit, ACoS, TACoS, ROI)
Step 6: Build a sales dashboard HTML page
This step shows OpenCode's full coding agent capability: it fetches live Amazon data from DataDoe and writes a complete, self-contained HTML dashboard into your project folder. No server or build step is required.
Setup
Create a new project directory and open OpenCode inside it:
1mkdir sales-dashboard && cd sales-dashboard
2opencodePrompt
Paste the following prompt, replacing {example_seller} with your seller name:
Using DataDoe MCP, fetch the 7-day sales data for my {example_seller} seller and create
a self-contained HTML file called dashboard.html with a sales dashboard. Include:
- KPI cards at the top: total revenue, total units sold, total profit, average ACoS
- A daily revenue chart (bar chart) using Chart.js from CDN
- A table of top 5 products by profit with columns: SKU, ASIN, total revenue, units sold, profit, ROI
Use clean modern inline CSS, no external stylesheets. All data must come from DataDoe tools.What OpenCode does
- Calls
list_sellersandquery_tableonProfit by SKU & Dateto fetch the seven-day data - Aggregates daily revenue and per-SKU totals
- Scaffolds
dashboard.htmlwith Chart.js (loaded from CDN), KPI summary cards, a daily bar chart, and a top-5 product table - Writes the file to the current directory
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <title>Delto UK - 7-Day Sales Dashboard</title>
7 <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
8 <style>
9 * {
10 margin: 0;
11 padding: 0;
12 box-sizing: border-box;
13 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
14 }
15 body {
16 background: #f0f2f5;
17 padding: 30px;
18 color: #1a1a2e;
19 }
20 .dashboard {
21 max-width: 1200px;
22 margin: 0 auto;
23 }
24 h1 {
25 font-size: 26px;
26 margin-bottom: 6px;
27 }
28 .subtitle {
29 color: #666;
30 font-size: 14px;
31 margin-bottom: 24px;
32 }
33 .kpi-grid {
34 display: grid;
35 grid-template-columns: repeat(4, 1fr);
36 gap: 16px;
37 margin-bottom: 24px;
38 }
39 .kpi-card {
40 background: #fff;
41 border-radius: 12px;
42 padding: 20px;
43 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
44 }
45 .kpi-label {
46 font-size: 12px;
47 text-transform: uppercase;
48 letter-spacing: 0.5px;
49 color: #888;
50 margin-bottom: 6px;
51 }
52 .kpi-value {
53 font-size: 28px;
54 font-weight: 700;
55 }
56 .kpi-value.green {
57 color: #16a34a;
58 }
59 .kpi-value.blue {
60 color: #2563eb;
61 }
62 .kpi-value.purple {
63 color: #7c3aed;
64 }
65 .kpi-value.orange {
66 color: #ea580c;
67 }
68 .chart-section {
69 background: #fff;
70 border-radius: 12px;
71 padding: 24px;
72 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
73 margin-bottom: 24px;
74 }
75 .chart-section h2 {
76 font-size: 16px;
77 margin-bottom: 16px;
78 }
79 .chart-wrap {
80 position: relative;
81 height: 320px;
82 }
83 .table-section {
84 background: #fff;
85 border-radius: 12px;
86 padding: 24px;
87 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
88 }
89 .table-section h2 {
90 font-size: 16px;
91 margin-bottom: 16px;
92 }
93 table {
94 width: 100%;
95 border-collapse: collapse;
96 }
97 th {
98 text-align: left;
99 padding: 10px 12px;
100 font-size: 12px;
101 text-transform: uppercase;
102 letter-spacing: 0.4px;
103 color: #888;
104 border-bottom: 2px solid #e5e7eb;
105 }
106 td {
107 padding: 10px 12px;
108 font-size: 14px;
109 border-bottom: 1px solid #f0f0f0;
110 }
111 tr:last-child td {
112 border-bottom: none;
113 }
114 tr:hover td {
115 background: #f9fafb;
116 }
117 .text-right {
118 text-align: right;
119 }
120 .text-green {
121 color: #16a34a;
122 }
123 </style>
124 </head>
125 <body>
126 <div class="dashboard">
127 <h1>Delto UK — 7-Day Sales Dashboard</h1>
128 <p class="subtitle">10 Jun – 17 Jun 2026 · Data via DataDoe</p>
129
130 <div id="kpis" class="kpi-grid"></div>
131
132 <div class="chart-section">
133 <h2>Daily Revenue (GBP)</h2>
134 <div class="chart-wrap"><canvas id="revenueChart"></canvas></div>
135 </div>
136
137 <div class="table-section">
138 <h2>Top 5 Products by Profit</h2>
139 <table>
140 <thead>
141 <tr>
142 <th>SKU</th>
143 <th>ASIN</th>
144 <th class="text-right">Total Revenue</th>
145 <th class="text-right">Units Sold</th>
146 <th class="text-right">Profit</th>
147 <th class="text-right">ROI</th>
148 </tr>
149 </thead>
150 <tbody id="topProducts"></tbody>
151 </table>
152 </div>
153 </div>
154
155 <script>
156 const dailyData = [
157 { date: '2026-06-10', sales: 9206.11, units: 1281, profit: 5612.52, acos: 21.21 },
158 { date: '2026-06-11', sales: 8956.88, units: 1217, profit: 5451.63, acos: 23.17 },
159 { date: '2026-06-12', sales: 8512.72, units: 1124, profit: 5053.9, acos: 23.34 },
160 { date: '2026-06-13', sales: 8432.64, units: 1114, profit: 5037.35, acos: 22.25 },
161 { date: '2026-06-14', sales: 8272.24, units: 1102, profit: 5062.28, acos: 22.86 },
162 { date: '2026-06-15', sales: 3951.41, units: 543, profit: 1914.89, acos: 23.27 },
163 { date: '2026-06-16', sales: 0, units: 0, profit: -739.6, acos: 24.9 },
164 { date: '2026-06-17', sales: 0, units: 0, profit: -21.13, acos: 50.79 }
165 ];
166
167 const topProducts = [
168 {
169 sku: '286_5214_UK_bkqnk_ctf_FBA',
170 asin: 'B0UIBG392T',
171 sales: 3586.4,
172 units: 359,
173 profit: 2000.68,
174 roi: 63.29
175 },
176 {
177 sku: '43_1_3017_m_ball_FBA',
178 asin: 'B033B4S05B',
179 sales: 1182.21,
180 units: 91,
181 profit: 675.07,
182 roi: 93.52
183 },
184 {
185 sku: 'SET_9_TQVRWGQB_ctf_FBA',
186 asin: 'B0B2JO7LH3',
187 sales: 909.16,
188 units: 140,
189 profit: 462.53,
190 roi: 59.43
191 },
192 {
193 sku: '30_9749_aluminum_block_FBA_SnL',
194 asin: 'B0HX5GGN1M',
195 sales: 608.16,
196 units: 122,
197 profit: 442.03,
198 roi: 209.66
199 },
200 {
201 sku: '249_7421_UK_shpmo_ctf_FBA',
202 asin: 'B0CGQVMC6U',
203 sales: 515.73,
204 units: 61,
205 profit: 374.29,
206 roi: 182.29
207 }
208 ];
209
210 const totalRevenue = dailyData.reduce((s, d) => s + d.sales, 0);
211 const totalUnits = dailyData.reduce((s, d) => s + d.units, 0);
212 const totalProfit = dailyData.reduce((s, d) => s + d.profit, 0);
213 const avgAcos = dailyData.reduce((s, d) => s + d.acos, 0) / dailyData.length;
214
215 const fmt = (n, d = 2) => '£' + n.toFixed(d).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
216 const fmtUnits = n => n.toLocaleString();
217
218 document.getElementById('kpis').innerHTML = `
219 <div class="kpi-card"><div class="kpi-label">Total Revenue</div><div class="kpi-value blue">${fmt(totalRevenue, 2)}</div></div>
220 <div class="kpi-card"><div class="kpi-label">Total Units Sold</div><div class="kpi-value purple">${fmtUnits(totalUnits)}</div></div>
221 <div class="kpi-card"><div class="kpi-label">Total Profit</div><div class="kpi-value green">${fmt(totalProfit, 2)}</div></div>
222 <div class="kpi-card"><div class="kpi-label">Average ACoS</div><div class="kpi-value orange">${avgAcos.toFixed(2)}%</div></div>
223`;
224
225 const labels = dailyData.map(d => {
226 const p = d.date.split('-');
227 return p[2] + '/' + p[1];
228 });
229 const values = dailyData.map(d => d.sales);
230
231 new Chart(document.getElementById('revenueChart'), {
232 type: 'bar',
233 data: {
234 labels,
235 datasets: [
236 {
237 label: 'Revenue (GBP)',
238 data: values,
239 backgroundColor: values.map(v =>
240 v > 0 ? 'rgba(37,99,235,.75)' : 'rgba(200,200,200,.4)'
241 ),
242 borderColor: values.map(v => (v > 0 ? '#2563eb' : '#ccc')),
243 borderWidth: 1,
244 borderRadius: 4
245 }
246 ]
247 },
248 options: {
249 responsive: true,
250 maintainAspectRatio: false,
251 plugins: {
252 legend: { display: false }
253 },
254 scales: {
255 y: {
256 beginAtZero: true,
257 ticks: { callback: v => '£' + v.toLocaleString() },
258 grid: { color: 'rgba(0,0,0,.06)' }
259 },
260 x: {
261 grid: { display: false }
262 }
263 }
264 }
265 });
266
267 document.getElementById('topProducts').innerHTML = topProducts
268 .map(
269 p => `
270 <tr>
271 <td style="font-family:monospace;font-size:13px">${p.sku}</td>
272 <td style="font-family:monospace;font-size:13px">${p.asin}</td>
273 <td class="text-right">${fmt(p.sales, 2)}</td>
274 <td class="text-right">${fmtUnits(p.units)}</td>
275 <td class="text-right text-green">${fmt(p.profit, 2)}</td>
276 <td class="text-right">${p.roi.toFixed(1)}%</td>
277 </tr>
278`
279 )
280 .join('');
281 </script>
282 </body>
283</html>Verify the result
Open the generated file in your browser:
1# macOS
2open dashboard.html
3
4# Windows
5start dashboard.html
6
7# Linux
8xdg-open dashboard.htmlThe page is fully self-contained, so no web server or additional dependencies are required.
Note: The dashboard is generated from live data at the time of running. Re-run the same prompt at any time to refresh the data.
Related resources
- OpenCode documentation (opens in a new tab)
- OpenCode MCP server configuration (opens in a new tab)
- OpenCode GitHub repository (opens in a new tab)
- DataDoe MCP Overview
- DataDoe MCP Integrations (opens in a new tab)
DataDoe MCP resources
Check the following resources for more information:
- MCP server URL:
https://mcp.datadoe.com/mcp/v1 - Interactive Data Scheme
- Data Scheme JSON: https://api.datadoe.com/api/v1/spec/data-scheme
- Need help? Use the contact form

