Open
Conversation
Add Mac/Windows install scripts for OpenCode (as opposed to Claude Desktop).
Key differences from existing install scripts:
- Config target: ~/.config/opencode/opencode.json (not Claude Desktop)
- MCP format: OpenCode's {mcp: {name: {type, command}}} structure
- uv path skips pre-install; relies on uv run auto-resolution for dependency isolation
- Safe merge: preserves existing OpenCode settings (plugins, providers, other MCPs)
- Includes update_opencode_config.py for JSON config merging with backup
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Add setlocal EnableDelayedExpansion, use !VAR! inside parenthesized blocks - Escape parentheses in echo with ^( ^) to prevent cmd parse errors - Fix echo indentation that caused Chinese text to be parsed as commands - Add endlocal at script end
- Prefix Chinese-only echo lines with [i] tag so cmd sees ASCII first - Replace [!] warning icons with [*] to avoid delayed expansion conflicts - Fixes 3 lines that cmd.exe parsed Chinese chars as command names
Replace fragile .bat with native PowerShell (.ps1) to eliminate all cmd.exe encoding issues with Chinese text. The .bat file is now a minimal 6-line launcher that calls the .ps1 with -ExecutionPolicy Bypass. Benefits: - Native UTF-8 support (no chcp hacks) - Write-Host instead of echo (no parsing issues) - Proper try/catch error handling - No delayed expansion / variable escaping headaches
Windows PowerShell 5.1 reads .ps1 files as ANSI by default. Without BOM, Chinese characters corrupt the parser's brace matching, causing 'Missing closing }' errors across the entire file.
ErrorActionPreference=Stop causes PowerShell to treat uv stderr output (dependency install progress) as a terminating error. Switch to Continue for verification, use 2>&1 pipe filtering, and wrap in try/catch since verification is non-critical.
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.
This pull request introduces a cross-platform automated installation system for integrating the SBIR MCP Server into OpenCode, with dedicated scripts for Mac and Windows. The new installation flow ensures user settings are preserved, dependencies are managed via either
uvor Python virtual environments, and the OpenCode configuration is safely updated to include the SBIR MCP Server. The update also includes a robust Python utility for merging the MCP server configuration intoopencode.jsonwithout overwriting existing settings.Key changes:
1. Cross-platform Installation Scripts
install-opencode-mac.sh, a comprehensive Bash script for Mac users to automate environment checking, dependency installation (viauvor Python venv), safe OpenCode configuration merging, and installation verification. The script preserves user settings and provides clear instructions and error handling.install-opencode-windows.batandinstall-opencode-windows.ps1, providing a Windows batch launcher and a PowerShell script that mirrors the Mac installation logic, including environment checks, dependency setup, safe configuration merging, and user guidance. [1] [2]2. Safe OpenCode Configuration Update Utility
mcp-server/update_opencode_config.py, a Python script that safely merges the SBIR MCP Server configuration intoopencode.json, supporting bothuvand venv modes. The script ensures only the relevant MCP entry is updated/added, preserving all other user settings. It handles both JSON decode errors and file I/O gracefully.3. Robust Dependency Management and Verification
uvfor dependency management (for isolation and speed), falling back to Python venv ifuvis unavailable. They verify installation success by checking for the presence of required Python modules and confirm the MCP server entry in the OpenCode config. [1] [2]4. User Experience and Safety Enhancements
opencode.jsonbefore making changes, provide clear error messages and next-step instructions, and ensure that installation failures do not leave the user with a broken configuration. [1] [2]5. Documentation and Maintainability