Description
Description
The OpenCode MCP client appears to have strict validation on the prompts/list capability. If an MCP server returns a prompt object containing an empty string for the name ({"name": ""}), OpenCode throws an error and immediately closes the socket/connection with MCP error -32000.
This prevents the use of servers that may have minor schema bugs (like the official reportportal/mcp-server:1.0.0) but are otherwise functional.
Observed Behavior
The connection status shows "Connected" briefly, then logs an error and disconnects. The tools never populate.
Log Output:
ERROR service=mcp clientName=reportportal promptName= error=MCP error -32000: Connection closed failed to get prompt from MCP server
Expected Behavior
OpenCode should:
Detect the invalid name property.
Log a warning (e.g., Skipping invalid prompt: name is empty).
Continue processing the rest of the valid prompts/tools in the list.
Keep the connection alive.
Context / Environment
OS: macOS
Problematic Server: reportportal/mcp-server:1.0.0 (Docker)
Attempted Workaround
We attempted to strip the invalid JSON stream using a middleware/proxy wrapper (e.g. perl substitution) to remove the empty prompt entry. However, this proved unstable.
We were ultimately forced to downgrade the OpenCode CLI to a previous version to bypass this strict validation crash, suggesting this may be a regression in the latest CLI release.
Plugins
No response
OpenCode version
most recent version
Steps to reproduce
Reproduction Steps
- Create a dummy MCP server script (
bad-server.sh) that mimics the ReportPortal v1.0.0 behavior:
#!/bin/bash
# Simple mock to reproduce the crash
while read line; do
# 1. Handshake
if [[ "$line" == *"initialize"* ]]; then
echo '{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"prompts":{}},"serverInfo":{"name":"bug-repro","version":"1.0"}}}'
fi
# 2. OpenCode asks for prompts
if [[ "$line" == *"prompts/list"* ]]; then
# 3. Server returns a prompt with an empty name
echo '{"jsonrpc":"2.0","id":2,"result":{"prompts":[{"name":"","description":"This crashes OpenCode"},{"name":"valid_prompt","description":"This should work"}]}}'
fi
done
-
Register this server in opencode.jsonc.
-
Run opencode mcp list.
Screenshot and/or share link
No response
Operating System
macOS 26.2
Terminal
No response
Description
Description
The OpenCode MCP client appears to have strict validation on the
prompts/listcapability. If an MCP server returns a prompt object containing an empty string for the name ({"name": ""}), OpenCode throws an error and immediately closes the socket/connection withMCP error -32000.This prevents the use of servers that may have minor schema bugs (like the official
reportportal/mcp-server:1.0.0) but are otherwise functional.Observed Behavior
The connection status shows "Connected" briefly, then logs an error and disconnects. The tools never populate.
Log Output:
ERROR service=mcp clientName=reportportal promptName= error=MCP error -32000: Connection closed failed to get prompt from MCP serverExpected Behavior
OpenCode should:
Detect the invalid name property.
Log a warning (e.g., Skipping invalid prompt: name is empty).
Continue processing the rest of the valid prompts/tools in the list.
Keep the connection alive.
Context / Environment
OS: macOS
Problematic Server: reportportal/mcp-server:1.0.0 (Docker)
Attempted Workaround
We attempted to strip the invalid JSON stream using a middleware/proxy wrapper (e.g. perl substitution) to remove the empty prompt entry. However, this proved unstable.
We were ultimately forced to downgrade the OpenCode CLI to a previous version to bypass this strict validation crash, suggesting this may be a regression in the latest CLI release.
Plugins
No response
OpenCode version
most recent version
Steps to reproduce
Reproduction Steps
bad-server.sh) that mimics the ReportPortal v1.0.0 behavior:Register this server in opencode.jsonc.
Run opencode mcp list.
Screenshot and/or share link
No response
Operating System
macOS 26.2
Terminal
No response