Skip to content

OpenCode MCP tool calls are never counted as MCP, so OpenCode users always get "No MCP tool integration" #398

Backlog

Description

Description

Hi team, hope you're doing well! OpenCode MCP tool calls never get counted as MCP, so an OpenCode only user is always told they don't use MCP.

For context on what this code does: AEC decides whether someone uses MCP by looking for tool names that start with mcp_. That one check feeds the "No MCP tool integration" gap in context engineering, the MCP Tools row in the migration features, and the MCP server breakdown:

#374 handled exactly this for Copilot CLI and App by renaming calls that carry mcpServerName to mcp_<server>_<tool> (parser-vscode-cli.ts L441-L446), which was really nice to see. The OpenCode parser doesn't have an equivalent yet.

Steps to Reproduce

  1. OpenCode names an MCP tool sanitize(server) + "_" + sanitize(tool), for example github_search_repositories (catalog.ts L117-L119 in v1.19.6), and saves that name as part.tool (processor.ts L241). The v2 branch builds the same shape (mcp.ts L23-L25).
  2. applyOpenCodePart pushes the raw part.tool into toolsUsed (parser-opencode.ts L254-L256).
  3. Every MCP check above looks for mcp_ and finds nothing.
  4. Result: the session reports "No MCP tool integration", MCP Tools never shows as used, and the MCP server breakdown is empty, even though the user called an MCP server on every turn.

Expected Behavior

OpenCode MCP calls get counted as MCP, the same way Copilot CLI calls are since #374, so the gap goes away and the server breakdown shows github.

Minimal repro

  1. Add an MCP server to opencode.json:
    {
      "mcp": {
        "github": { "type": "local", "command": ["github-mcp-server", "stdio"] }
      }
    }
  2. Run an OpenCode session that calls it a few times (the tool part ends up as { "type": "tool", "tool": "github_search_repositories", ... }).
  3. Open AEC. I haven't run this on a real OpenCode install yet. In a local AEC clone, I fed the OpenCode parser a 40 turn session in that shape, and it ended with the raw name in toolsUsed, no mcp_ match, and context-engineering-gaps reporting "4 of 4 context engineering signals missing", MCP included.
flowchart LR
  A["OpenCode part.tool<br/>github_search_repositories"] --> B["applyOpenCodePart<br/>pushes raw name"]
  B --> C["toolsUsed"]
  C --> D{"startsWith mcp_ ?"}
  D -- "no" --> E["No MCP tool integration<br/>empty server breakdown"]
  F["Copilot CLI since #374<br/>mcp_server_tool"] --> D
  D -- "yes" --> G["MCP counted"]
Loading

applyOpenCodePart with its caller and callees
applyOpenCodePart with its one caller and six callees, none of which renames MCP tools, Functions view in Architect

Question on the fix

The tricky bit is that OpenCode stores no MCP marker on the part, and the name alone is ambiguous: built in tools like apply_patch and custom tools named <file>_<export> have the same a_b shape. So a plain "has an underscore" rule would miscount.

The default I'd reach for is reading the mcp server names from the global and project opencode.json(c), sanitizing them the way OpenCode does, matching the longest <server>_ prefix, and renaming to mcp_<server>_<tool> like #374. The catch is that a server removed from the config since the session ran would be missed.

Would you be happy with that config based prefix matching, or is there another signal you'd prefer (or know of) for spotting OpenCode MCP calls? I'm glad to put up a PR for whichever way you like, and any tips are very welcome.

Extension Version

0.1.0 (main at 76e28ca)

VS Code Version

n/a, found by reading the source on main

Operating System

macOS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions