Repository navigation
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:
hasMcpin context-engineering-gaps.md L37 (same expression in panel-rpc.ts L293)computeContextGapsin interpreter.ts L655-L659- used features in analyzer-insights.ts L629 (and L613 lists MCP Tools as not available for OpenCode)
- MCP server count in panel-request-service.ts L1295
#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
- OpenCode names an MCP tool
sanitize(server) + "_" + sanitize(tool), for examplegithub_search_repositories(catalog.ts L117-L119 in v1.19.6), and saves that name aspart.tool(processor.ts L241). The v2 branch builds the same shape (mcp.ts L23-L25). applyOpenCodePartpushes the rawpart.toolintotoolsUsed(parser-opencode.ts L254-L256).- Every MCP check above looks for
mcp_and finds nothing. - 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
- Add an MCP server to
opencode.json:{ "mcp": { "github": { "type": "local", "command": ["github-mcp-server", "stdio"] } } } - Run an OpenCode session that calls it a few times (the tool part ends up as
{ "type": "tool", "tool": "github_search_repositories", ... }). - 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, nomcp_match, andcontext-engineering-gapsreporting "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"]

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