> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hologrow.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Using OpenCode with Marrow MCP

# Using OpenCode with Marrow MCP

[OpenCode](https://opencode.ai) 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

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/overview-1.png" alt="OpenCode TUI with Marrow sales dashboard output" />

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/overview-2.png" alt="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](/hologrow-marrow-mcp/overview) guide first, then return here. You can also create a key directly in [Marrow MCP Integrations](https://app.marrow.com/integrations/mcp)
* An API key for your chosen LLM provider, or the built-in OpenCode Zen tier
* A modern terminal emulator
* [Node.js](https://nodejs.org) 18 or later installed

## Step 1: Install OpenCode

Install OpenCode using the method that suits your platform:

```bash theme={null}
# One-liner, recommended
curl -fsSL https://opencode.ai/install | bash

# Node.js
npm i -g opencode-ai@latest

# macOS and Linux
brew install anomalyco/tap/opencode
```

Verify the installation:

```bash theme={null}
opencode --version
```

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-1-install.png" alt="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](https://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

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-2-provider-select.png" alt="OpenCode /model provider list" />

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-2-model-select.png" alt="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:

```jsonc theme={null}
{
    "$schema": "https://opencode.ai/config.json",
    "mcp": {
        "marrow-mcp": {
            "type": "remote",
            "url": "https://mcp.marrow.com/mcp/v1",
            "enabled": true,
            "headers": {
                "marrow-mcp-key": "YOUR_MARROW_MCP_KEY"
            }
        }
    }
}
```

Replace `YOUR_MARROW_MCP_KEY` with your key from [Marrow MCP Integrations](https://app.marrow.com/integrations/mcp).

Save the file. Before restarting OpenCode, verify that the config is picked up correctly:

```bash theme={null}
opencode mcp list
```

You should see `marrow-mcp` with a `connected` or `enabled` state.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-3-mcp-list.png" alt="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:

```text theme={null}
What Marrow tools do you have access to?
```

OpenCode should respond with a list of Marrow MCP tools, such as `list_sellers`, `query_table`, and others.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-4-tools-list.png" alt="OpenCode TUI - Marrow tools list" />

## Step 5: First conversation and seven-day sales report

Start with a simple query:

```text theme={null}
List my all available sellers on Amazon
```

OpenCode calls `list_sellers` through Marrow MCP and returns the names of your connected accounts.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-5-list-sellers.png" alt="OpenCode TUI - list sellers result" />

Now produce a business report, replacing `{example_seller}` with your seller name:

```text theme={null}
Prepare me a sales summary for {example_seller} seller for last 7 days
```

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.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/hologrowinc/hub-files/mcp/opencode/step-6-sales-report.png" alt="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:

```bash theme={null}
mkdir sales-dashboard && cd sales-dashboard
opencode
```

Paste the following prompt, replacing `{example_seller}` with your seller name:

```text theme={null}
Using Marrow 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, a daily revenue chart using Chart.js from CDN, and a table of top 5 products by profit. Use clean modern inline CSS. All data must come from Marrow tools.
```

OpenCode should call Marrow tools, aggregate the data, scaffold `dashboard.html`, and write the file to the current directory.

## Related resources

* [OpenCode documentation](https://opencode.ai/docs/en)
* [OpenCode MCP server configuration](https://opencode.ai/docs/en/mcp-servers/)
* [OpenCode GitHub repository](https://github.com/anomalyco/opencode)
* [Marrow MCP Overview](/hologrow-marrow-mcp/overview)
* [Marrow MCP Integrations](https://app.marrow.com/integrations/mcp)

## Marrow MCP resources

* MCP server URL: `https://mcp.marrow.com/mcp/v1`
* [Interactive Data Scheme](/hub/data-scheme)
* Data Scheme JSON: [https://api.marrow.com/api/v1/spec/data-scheme](https://api.marrow.com/api/v1/spec/data-scheme)
