Fix OpenCode MCP server integration - Enable safe-outputs and GitHub tools#2167
Merged
Fix OpenCode MCP server integration - Enable safe-outputs and GitHub tools#2167
Conversation
- Install jq for JSON transformation in OpenCode setup - Add "Configure OpenCode MCP servers" step to transform Copilot-style MCP config to OpenCode format - Transform local (stdio) servers: merge command and args into single array - Transform remote (http) servers: convert to OpenCode remote format - Preserve environment variables from MCP server configs - Update documentation to explain MCP server integration - Tested transformation with sample configs - working correctly - All tests pass (make test-unit, make lint, make fmt) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All implementation complete: - MCP config transformation working for both local and HTTP servers - jq installation added to workflow - Documentation updated with MCP integration details - All tests passing (make agent-finish) - Workflow compiles successfully - Transformation tested with multiple MCP server types Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix OpenCode MCP server integration and enable safe-outputs tools
Fix OpenCode MCP server integration - Enable safe-outputs and GitHub tools
Oct 22, 2025
pelikhan
approved these changes
Oct 22, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The smoke-opencode workflow was experiencing a 100% failure rate because OpenCode agents couldn't access configured MCP tools (safe-outputs, github, etc.). The root cause was a configuration format mismatch:
/tmp/gh-aw/mcp-config/mcp-servers.json~/.config/opencode/opencode.jsonin its own formatEvidence from audit logs showed:
The agent was instructed to "use the create-issue tool from the safe-outputs MCP" but had no access to it.
Solution
This PR adds automatic MCP configuration transformation for OpenCode workflows by modifying
.github/workflows/shared/opencode.md:$GH_AW_MCP_CONFIG~/.config/opencode/opencode.jsonFormat Transformation
Local (stdio) MCP servers:
Remote (HTTP) MCP servers:
Benefits
Testing
make test-unitmake lintmake agent-finishgh aw compile smoke-opencodeSecurity
${{ secrets.* }}) preserved during transformationFixes #2143
Original prompt
This section details on the original issue you should resolve
<issue_title>[q] Fix OpenCode MCP server integration - Enable safe-outputs tools</issue_title>
<issue_description># Q Workflow Optimization Report
Issues Found (from live data)
smoke-opencode Workflow
Log Analysis: Analyzed 4 consecutive failed runs of the smoke-opencode workflow
Run IDs Analyzed: 18722224746, 18715612738, 18725510532, 18706992084
Pattern: 100% failure rate - all runs completed successfully but failed to create expected outputs
Issues Identified:
opencode.jsonfile created despite MCP servers being configured in workflowcreate_issuetool from safe-outputs MCPEvidence from logs (Run githubnext/gh-aw#18722224746):
The agent was instructed in the prompt: "To create an issue, use the create-issue tool from the safe-outputs MCP" but had no access to this tool.
Root Cause Analysis
Technical Problem
OpenCode requires MCP servers to be configured in
~/.config/opencode/opencode.json:{ "$schema": "(redacted)", "mcp": { "server-name": { "type": "local", "command": ["npx", "mcp-server"], "enabled": true } } }Current Implementation (Broken):
Comparison with GenAIScript (Working):
--mcp-configCLI parameterChanges Made
.github/workflows/shared/opencode.md1. Added jq Installation (Step renamed to "Install OpenCode and jq"):
Required for JSON transformation between Copilot and OpenCode MCP config formats.
2. Added MCP Configuration Step (New step before "Run OpenCode"):
Key Features:
3. Updated Documentation (HTML comment section):
Expected Improvements
Immediate Benefits
create_issuetool will be available to OpenCode agentFixes #2164
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.