opencode-mcp
Verified Safeby nosolosoft
Overview
An MCP (Model Context Protocol) server that provides seamless integration with OpenCode, the open-source AI coding agent for the terminal.
Installation
python -m src.services.fast_mcp.opencode_serverEnvironment Variables
- OPENCODE_COMMAND
- OPENCODE_DEFAULT_MODEL
- OPENCODE_DEFAULT_AGENT
- OPENCODE_DEFAULT_TIMEOUT
- OPENCODE_MAX_TIMEOUT
- OPENCODE_SERVER_LOG_LEVEL
Security Notes
The server wraps the OpenCode CLI, executing commands via `subprocess.create_subprocess_exec` with user-provided arguments. Key security risks, as identified in the `PLAN.md` and confirmed by code analysis, include: 1) Lack of validation for `allowed_operations` in `settings.py` (it's defined but not enforced). 2) Missing validation for `files` paths, extensions (`allowed_file_extensions`), and sizes (`max_file_size`) when provided to `opencode_run`. 3) Prompts and tool arguments are logged directly (e.g., in `server.py` `call_tool` and `execution.py`), posing a risk of sensitive information leakage. 4) The `execute_generic` tool and others pass user-controlled strings (e.g., `prompt`) directly to the underlying `opencode` CLI, which could potentially be exploited if the CLI itself has injection vulnerabilities, although `subprocess.create_subprocess_exec` is generally safer than `shell=True`. These unaddressed points significantly lower the score for an AI agent wrapper.
Similar Servers
zeromcp
A minimal, pure Python Model Context Protocol (MCP) server for exposing tools, resources, and prompts via HTTP/SSE and Stdio transports.
codex-mcp-go
Wraps the OpenAI Codex CLI as an MCP tool, enabling AI clients like KiloCode, Roo Code, and Claude Code to utilize Codex for high-precision coding tasks, debugging, and code reviews within an agentic workflow.
mcp-server-python-template
This server acts as a template for building Model Context Protocol (MCP) servers in Python, specifically demonstrating how to expose weather-related tools (get_alerts, get_forecast) by integrating with an external API (National Weather Service) to provide context and actions for AI models.
tenets
The Tenets MCP server provides intelligent, token-optimized code context and automatically injects guiding principles for AI coding assistants (like Claude Code, Cursor, Windsurf) to help them understand codebases better and maintain consistency.