Skip to main content

Using OpenCode with Marrow MCP

OpenCode 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, Marrow MCP acts as the data layer for OpenCode. Your agent calls Marrow 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, or the built-in OpenCode Zen tier enabled
  • Marrow 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 Marrow data
OpenCode TUI with Marrow sales dashboard output OpenCode TUI with Marrow sales dashboard output

Prerequisites

  • A Marrow account with your Amazon connections set up and synced
  • A Marrow MCP key. If you have not created one yet, follow the Marrow MCP Overview guide first, then return here. You can also create a key directly in Marrow MCP Integrations
  • An API key for your chosen LLM provider, or the built-in OpenCode Zen tier
  • A modern terminal emulator
  • Node.js 18 or later installed

Step 1: Install OpenCode

Install OpenCode using the method that suits your platform:
Verify the installation:
OpenCode TUI launch screen

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 Run /connect inside the TUI, select opencode, and sign in at opencode.ai/auth. Zen provides a curated set of models maintained by the OpenCode team. Option B - your own API key Run /model inside the TUI to open the model picker:
  1. Select a provider such as Anthropic, OpenAI, Google, or Mistral
  2. Choose an authentication method
  3. Paste your key
  4. Select a model
OpenCode /model provider list OpenCode model selection

Step 3: Connect Marrow MCP

Important: OpenCode does not currently support adding remote authenticated MCP servers with a CLI command. You must configure Marrow MCP by editing the config file manually.
Open ~/.config/opencode/opencode.jsonc in your preferred text editor and add the following block:
Replace YOUR_MARROW_MCP_KEY with your key from Marrow MCP Integrations. Save the file. Before restarting OpenCode, verify that the config is picked up correctly:
You should see marrow-mcp with a connected or enabled state. opencode mcp list output showing marrow-mcp connected If marrow-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. Restart OpenCode after saving the file.

Step 4: Verify the MCP connection

Restart OpenCode and open a new session, then ask:
OpenCode should respond with a list of Marrow MCP tools, such as list_sellers, query_table, and others. OpenCode TUI - Marrow tools list

Step 5: First conversation and seven-day sales report

Start with a simple query:
OpenCode calls list_sellers through Marrow MCP and returns the names of your connected accounts. OpenCode TUI - list sellers result Now produce a business report, replacing {example_seller} with your seller name:
OpenCode will call Marrow tools, query the Profit by SKU & Date table, and return a structured markdown report with per-SKU breakdowns, daily rows, and executive KPIs. OpenCode TUI - 7-day sales report result

Step 6: Build a sales dashboard HTML page

This step shows OpenCode’s coding-agent capability: it fetches live Amazon data from Marrow and writes a complete, self-contained HTML dashboard into your project folder. Create a new project directory and open OpenCode inside it:
Paste the following prompt, replacing {example_seller} with your seller name:
OpenCode should call Marrow tools, aggregate the data, scaffold dashboard.html, and write the file to the current directory.

Marrow MCP resources