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

# Set Up Wherobots in OpenCode

> Configure the Wherobots MCP Server, Agent Skills, and CLI in OpenCode for AI-assisted geospatial development from your terminal.

<Badge color="purple">Public Preview</Badge>

**OpenCode** is a terminal-based agentic coding tool. It does not support VS Code extensions. Install the MCP Server, Agent Skills, and CLI separately.

## Component Overview

Wherobots' Agentic Tools consist of the following components that work together to provide our agentic experience:

<AccordionGroup>
  <Accordion title="MCP Server" icon="message-bot">
    Connects your AI assistant to Wherobots Cloud for catalog exploration, Spatial SQL generation, and query execution.
  </Accordion>

  <Accordion title="Agent Skills" icon="brain">
    Gives your AI assistant domain-specific Wherobots knowledge for more accurate commands and fewer errors.
  </Accordion>

  <Accordion title="Wherobots CLI" icon="terminal">
    Wraps the full Wherobots API into a single binary for job submission, log streaming, and automation.
  </Accordion>
</AccordionGroup>

## Why use Wherobots' agentic tools?

Wherobots' agentic tools connect your AI assistant to Wherobots Cloud and your local development environment so you can interact with your spatial data, catalogs, and jobs in a more intuitive way.

<AccordionGroup>
  <Accordion title="Explore your spatial catalog conversationally" icon="book-open">
    The MCP Server connects your AI assistant to Wherobots Cloud so you can browse catalogs, databases, and table schemas (including Overture Maps and your own datasets) by asking questions in plain language instead of navigating the console.
  </Accordion>

  <Accordion title="Generate Spatial SQL without memorizing functions" icon="code">
    Describe a geospatial task (e.g. "find buildings within 500m of this point") and the MCP Server returns optimized Spatial SQL using WherobotsDB's ST functions, spatial joins, and indexing patterns.
  </Accordion>

  <Accordion title="Submit and monitor Wherobots jobs from your editor" icon="rocket">
    Use the CLI or the extension to submit Spark job runs, stream logs in real time, check resource metrics, and cancel jobs without leaving your editor or terminal.
  </Accordion>

  <Accordion title="Get Wherobots-aware AI assistance" icon="brain">
    Agent Skills teach your AI assistant Wherobots-specific APIs, query patterns, and workflow sequences so it produces correct `wherobots` CLI commands, valid MCP tool calls, and accurate notebook code on the first try.
  </Accordion>
</AccordionGroup>

## Before you start

* [OpenCode](https://opencode.ai/) installed with a [modern terminal emulator](https://opencode.ai/docs/#prerequisites).
* A **Wherobots Account** within a Professional or Enterprise Organization. See [Create a Wherobots Account](/get-started/wherobots-cloud/create-account).
* A Wherobots [API key](/get-started/wherobots-cloud/api-keys).

## Install and configure

<Steps>
  <Step title="Configure the MCP Server">
    In your terminal, run `opencode mcp add` and configure the following settings:

    * **MCP server name:** `wherobots-mcp-server` (or any name you prefer)
    * **MCP server type:** `Remote`
    * **MCP server URL:** `https://api.cloud.wherobots.com/mcp/`
    * **OAuth authentication:** `No`

    Set the **WHEROBOTS\_API\_KEY** environment variable:

    ```bash theme={"system"}
    export WHEROBOTS_API_KEY='<your-api-key>'
    ```

    To persist this across sessions, add the export to your shell profile (e.g., `~/.zshrc` or `~/.bashrc`).

    Restart OpenCode after adding the server.

    <Note>
      OpenCode requires using a [modern terminal emulator](https://opencode.ai/docs/#prerequisites) for the most optimal experience.
    </Note>

    <Info>
      For more information on downloading, installing, and using OpenCode, see [Install](https://opencode.ai/docs/#install) and [Usage](https://opencode.ai/docs/#usage) sections in the OpenCode documentation.
    </Info>
  </Step>

  <Step title="Install Agent Skills">
    [Agent Skills](/develop/agent-skills) give your AI assistant structured context about Wherobots workflows, APIs, and best practices.

    ```bash theme={"system"}
    npx skills add -g wherobots/agent-skills
    ```
  </Step>

  <Step title="Install the CLI (optional)">
    The [Wherobots CLI](/develop/cli) wraps the full Wherobots API into a single binary for job submission, log streaming, and automation.

    ```bash theme={"system"}
    gh repo clone wherobots/wbc-cli && cd wbc-cli && ./scripts/install-release.sh
    ```

    Set your API key (if not already set above):

    ```bash theme={"system"}
    export WHEROBOTS_API_KEY='<your-api-key>'
    ```

    Verify the connection:

    ```bash theme={"system"}
    wherobots api --tree
    ```
  </Step>
</Steps>

## Verify everything works

Ask a test question in OpenCode:

> Show me the catalogs in my Organization

If configured correctly, OpenCode will call the Wherobots MCP server (showing a tool such as `list_catalogs`) and return the catalogs available in your Organization.

If you installed the CLI, verify the connection:

```bash theme={"system"}
wherobots api --tree
```

You should see a tree of available CLI commands.

## Next steps

<CardGroup cols={2}>
  <Card title="MCP Server Best Practices" icon="message-bot" href="/develop/mcp/mcp-server-usage">
    Common tasks, example prompts, and cost considerations for the MCP Server.
  </Card>

  <Card title="MCP Server Demo Videos" icon="video" href="/develop/mcp/mcp-server-automating-geospatial-workflows">
    Watch the MCP Server automate catalog discovery, spatial queries, and notebook generation.
  </Card>

  <Card title="Agent Skills" icon="brain" href="/develop/agent-skills">
    Learn more about available skills and installation options.
  </Card>

  <Card title="Agentic Terminal Usage" icon="terminal" href="/develop/cli-agentic-usage">
    Use the CLI with OpenCode for natural language job management.
  </Card>

  <Card title="CLI Reference" icon="terminal" href="/develop/cli">
    Submit jobs, stream logs, and access the full Wherobots API.
  </Card>

  <Card title="MCP Server vs CLI" icon="scale-balanced" href="/develop/mcp-vs-cli">
    Understand when to use the MCP Server vs. the CLI.
  </Card>
</CardGroup>
