Skip to main content

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.jsonc config file
  • A verified first query listing your connected Amazon sellers
  • A seven-day sales report generated directly in the terminal
  • A self-contained dashboard.html sales dashboard built by OpenCode using live DataDoe data, ready to open in any browser

Prerequisites

Step 1: Install OpenCode

Install OpenCode using the method that suits your platform:

bash
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 opencode

A 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:

bash
1opencode --version

Step 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 /models inside the TUI to open the model picker:

  1. Select a provider - OpenCode supports Anthropic, OpenAI, Google, Mistral, and more
  2. Choose an authentication method: API key
  3. Paste your key
  4. 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 Tab key. 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:

jsonc
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:

bash
1opencode mcp list

This 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 Ctrl+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_KEY

Step 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 sellers_and_vendors_list, exports_sources_get, exports_create, 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 all my available Amazon sellers

OpenCode calls sellers_and_vendors_list 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 a sales summary for the {example_seller} seller for the last 7 days

OpenCode will:

  1. Call sellers_and_vendors_list to confirm the account
  2. Create an export from the Profit by SKU & Date source for the last seven days and download the result
  3. Analyze 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:

bash
1mkdir sales-dashboard && cd sales-dashboard
2opencode

Prompt

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

  1. Calls sellers_and_vendors_list, then exports seven days of data from the Profit by SKU & Date source.
  2. Aggregates daily revenue and per-SKU totals.
  3. Scaffolds dashboard.html with Chart.js (loaded from CDN), KPI summary cards, a daily bar chart, and a top-5 product table.
  4. Writes the file to the current directory.

The generated file is a single self-contained HTML page. It uses Chart.js from a CDN, inline CSS, and the seven-day data embedded as JavaScript arrays. That is roughly 300 lines in total. Yours will differ based on your live data.

Verify the result

Open the generated file in your browser:

bash
1# macOS
2open dashboard.html
3
4# Windows
5start dashboard.html
6
7# Linux
8xdg-open dashboard.html

The 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.


DataDoe MCP resources

Check the following resources for more information: