You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue: MCP Client disconnects immediately if Server returns a Prompt with an empty name {"name":""} #11816
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.
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 crashwhileread line;do# 1. Handshakeif [[ "$line"==*"initialize"* ]];thenecho'{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"prompts":{}},"serverInfo":{"name":"bug-repro","version":"1.0"}}}'fi# 2. OpenCode asks for promptsif [[ "$line"==*"prompts/list"* ]];then# 3. Server returns a prompt with an empty nameecho'{"jsonrpc":"2.0","id":2,"result":{"prompts":[{"name":"","description":"This crashes OpenCode"},{"name":"valid_prompt","description":"This should work"}]}}'fidone
Activity
github-actions commentedon Feb 2, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
github-actions commentedon Apr 4, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.