MCP Gateway · OpenCode
Connect Cube to OpenCode
Questions about real usage come up mid-task: is this bug common, which option do customers pick, how often does this path run? OpenCode can put them to Cube from the same session and get analytics data or generated SQL back. Cube is listed in the mcp block of your config as a remote server pointing at the gateway, and every call is checked by Speakeasy's plugin first.
- Category
- Data & analytics
- Authentication
- None
- OpenCode
- Terminal
Behind the MCP Gateway
Run Cube MCP behind the MCP Gateway
One URL for every agent, sign-in through your IdP, RBAC down to the tool, and every Cube call inspected and logged.
Set up
Add Cube to OpenCode in 4 steps
- 01
Add Cube from the catalog
An admin finds Cube in the MCP Catalog (MCP Gateway > MCP > Catalog) and clicks Add. Speakeasy registers the vendor's server as a remote MCP server and proxies sessions to it. Nothing is copied or re-hosted.
Where MCP-scoped policies are enabled, the install offers a recommended risk policy for the new server that detects secrets and PII and inspects tool requests and responses.
- 02
Choose who can use Cube
Give teams the
mcp:connectscope on the Cube server through team access or a role. OpenCode connects to the Cube server's own URL, and the server's authorization decides who can connect and which tools they can call. - 03
Connect OpenCode
Add the server to OpenCode's own mcp config block as a remote server.
Copy the server's URL from its hosted install page in Speakeasy.
Add it to the
mcpblock of your OpenCode config withtypeset toremote.Restart OpenCode and sign in when prompted.
{ "mcp": { "<server slug>": { "type": "remote", "url": "<URL from the hosted install page>" } } } - 04
Sign in and use Cube from OpenCode
The first time OpenCode connects, it opens a browser so the person can sign in to Speakeasy through your identity provider.
From then on, Cube's tools appear in OpenCode, limited to what the person's access allows, and every call lands in the gateway's tool logs.
OpenCode doesn't receive MCP servers from plugins. The observability package is installed separately, from a ZIP or with speakeasy-hooks install --provider=opencode, and the device agent can maintain it.
Use cases
What OpenCode users do with Cube
See whether a bug hits real users
OpenCode explores Cube data to check whether the bug you're fixing shows up in real usage, before you decide how urgent the fix is.
Turn a question into SQL
Describe the numbers you need and OpenCode has Cube generate the SQL, which you can run yourself or keep in the repo's scripts folder.
Add usage context to release notes
Before writing release notes, OpenCode surfaces insights from Cube about how the features you changed are used, so the notes lead with what matters.
Control
What Speakeasy can see and stop in OpenCode
The gateway covers every client the same way. The rest depends on what OpenCode exposes to Speakeasy.
Tool logs
Gateway
Every Cube call is logged with the person and the client that made it.
Access by role
Gateway
People reach only the Cube tools their team or role allows.
Request and response blocking
Gateway
A risk policy scoped to Cube can reject a tool request before it reaches the server, or withhold a result from OpenCode. MCP-scoped policies are enabled per organization.
Prompt and tool-call blocking
OpenCode
The OpenCode plugin sends each prompt and tool call to Speakeasy, which allows or denies it before it runs.
Usage telemetry
OpenCode
Token and cost totals flow through the plugin, reported per turn.
Device agent
OpenCode
The device agent installs and maintains the observability package.
- OpenCode has no OpenTelemetry exporter, so session data comes through the plugin.
- Tool output is blocked at the gateway rather than in OpenCode's hooks.
Questions
Frequently asked questions
Can Cube results be blocked in OpenCode?
Where does OpenCode report usage for Cube sessions?
How do OpenCode users get Cube?
Are Cube calls from OpenCode logged?
Connect more