Using Locally with OpenCode

Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

Using Locally with OpenCode

Locally's built-in MCP server lets OpenCode interact with the resources running in Locally. This guide covers installing, configuring and uninstalling it. You can also install the Locally Agent Skills, which teach OpenCode how to work with Locally.

Install

Locally can register the MCP server with OpenCode for you:

$ locally mcp install opencode

This adds Locally to OpenCode's global configuration file (~/.config/opencode/opencode.json), so it's available in every project. OpenCode will then need to be restarted to pick up the new MCP server.

Use the --force flag to overwrite an existing entry, which is useful in scripts or when updating an existing entry:

$ locally mcp install opencode --force

To check the registration status across all supported clients on your machine:

$ locally mcp list

Manual Configuration

If you'd rather configure the MCP server yourself, add Locally to the mcp section of OpenCode's configuration file - either the global one at ~/.config/opencode/opencode.json, or an opencode.json in your project:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "locally": {
      "type": "local",
      "command": ["/path/to/locally", "mcp"],
      "enabled": true
    }
  }
}

Replace /path/to/locally with the absolute path to the locally binary, which you can find by running which locally. OpenCode will need to be restarted to pick up the new MCP server.

Uninstall

To remove the Locally MCP server from OpenCode:

$ locally mcp uninstall opencode

If no Locally entry is present, the command will fail. Use the --force flag to make removal idempotent, which is useful in scripts:

$ locally mcp uninstall opencode --force

Next steps

The MCP Server page lists the tools OpenCode can use, from deploying templates to managing Key Vault Secrets. If you run more than one agent, Subscriptions, Tenants & Credentials shows how to give each one its own Subscription.

Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

A local cloud for you and your agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.