Skip to content

[FEATURE]: Full MCP client capabilities #28567

@Arcadi4

Description

@Arcadi4

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

OpenCode's MCP client features are way behind the latest MCP standard. The gaps below were touched across many issues and PRs (see list below). I myself also encountered many difficulties due to the incomplete capability while developing MCP extensions for OpenCode. A one-time implementation is probably the cleanest fix to all of them and leaves no technical debt. This should also bring architectural advantages by flattening skills and tasks into the MCP layer.

I know this proposal for a project of this size might be a bit unrealistic. Rewriting the MCP client would definitely break loads of plugins and dependencies, and the migration wouldn't be easy. Even so, the count of issues on this is large enough that I think the discussion is at least worth having.

Behavioral gaps

Missing entirely:

  • sampling/createMessage and the sampling capability1
  • elicitation/create (form + URL modes), notifications/elicitation/complete, URLElicitationRequiredError -32042, and the elicitation capability2
  • roots/list, notifications/roots/list_changed, and the roots capability3
  • resources/subscribe / resources/unsubscribe / notifications/resources/updated / notifications/resources/list_changed4
  • resources/templates/list5
  • completion/complete6
  • ⚠️ logging/setLevel and notifications/message7 — inbound notifications/message is now handled; outbound logging/setLevel is still missing
  • ping8
  • ❌ The entire experimental tasks/* system from 2025-11-259
  • ❌ No capabilities object passed to new Client(...) — opencode advertises nothing at initialize10

Partial or incorrect:

  • ⚠️ Progress: resetTimeoutOnProgress: true is passed to callTool and works at the SDK level for timeout resets, but onprogress is never wired through, so no progress token is sent and progress events are not surfaced to the user11
  • ❌ Cancellation: notifications/cancelled is never sent when a user aborts a tool call12
  • Pagination: tools/list, resources/list, prompts/list are called without cursors; large lists silently truncateresolved: generic paginate() with cursor support, cycle detection, and 1000-page max is implemented13
  • Tool results: structuredContent is ignoredresolved: now JSON-stringified to text content14
  • outputSchema is tolerated during tools/list fallback by stripping it rather than validated or consumed15
  • resource_link content type is droppedresolved: handled as 'resource' content type in session/tools.ts16
  • audio content type is dropped17
  • isError flag in tool results is not checked
  • ❌ Tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint)18 and icons[]19 are not consumed
  • tools/list_changed is the only notification handled; resources/list_changed and prompts/list_changed are missing20
  • ❌ The server's InitializeResult.instructions does not appear to be captured from MCP initialization or threaded into the LLM context, so the server's own usage hints are lost21

Authorization:

  • Token refresh: refreshToken is stored but never executed — tokens silently expireresolved: SDK v1.29.0 executes token refresh via refreshAuthorization()22
  • RFC 8707 resource indicators: not sentresolved: implemented by SDK23
  • RFC 9728 protected resource metadata: no explicit WWW-Authenticate resource_metadata parsingresolved: implemented by SDK24
  • OpenID Connect Discovery 1.0: not implementedresolved: SDK falls back from RFC 8414 to OIDC Discovery25
  • ⚠️ Client ID Metadata Documents: SDK supports it, but OpenCode's McpOAuthProvider does not supply clientMetadataUrl26
  • Step-up authorization (insufficient_scope re-auth): not implementedresolved: SDK handles with loop protection27
  • ❌ OAuth callback server (port 19876) is not stopped after auth completes
  • ❌ OAuth callback page has unescaped error query parameter (XSS / CWE-79)
  • headers config is not sent during mcp auth / mcp debugresolved

Networking:

  • Streamable HTTP Accept header doesn't always list both application/json and text/event-streamresolved: SDK sends correct Accept header28
  • ⚠️ MCP-Protocol-Version header: SDK dynamically negotiates correctly during normal operation, but opencode mcp debug still hardcodes protocolVersion: "2024-11-05" (three revisions behind)29
  • Mcp-Session-Id is not handled; session loss permanently breaks the connectionresolved: SDK stores and sends session ID30
  • Last-Event-ID resumption is not implementedresolved: SDK implements resumption31
  • No transport-level auto-reconnect on socket errorsresolved: SDK auto-reconnects with exponential backoff28
  • ⚠️ Local stdio servers still have incomplete lifecycle cleanup coverage on disconnect / replace / rollback32
  • ❌ Origin header validation, SSRF protection, and session-hijacking mitigations from the spec's Security Best Practices are not implemented33

Related issues and PRs

Sampling:

Elicitation / roots / initialize instructions:

Resources and resource content:

Prompts:

Progress and cancellation:

Tool result schemas, structured content, and content types:

OAuth / auth:

Transport / Streamable HTTP / SSE:

Connection lifecycle / reconnect / stdio:

Custom / dynamic headers:

Tool invocation and tool management:

Server notifications, _meta, logging, and schema compatibility:

TLS / mTLS / certificate validation:

Stdio / platform transport compatibility:

Footnotes

  1. https://modelcontextprotocol.io/specification/2025-11-25/client/sampling

  2. https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation

  3. https://modelcontextprotocol.io/specification/2025-11-25/client/roots

  4. https://modelcontextprotocol.io/specification/2025-11-25/server/resources#subscriptions

  5. https://modelcontextprotocol.io/specification/2025-11-25/server/resources#resource-templates

  6. https://modelcontextprotocol.io/specification/2025-11-25/server/utilities/completion

  7. https://modelcontextprotocol.io/specification/2025-11-25/server/utilities/logging

  8. https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/ping

  9. https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks

  10. https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#capability-negotiation

  11. https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/progress

  12. https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/cancellation

  13. https://modelcontextprotocol.io/specification/2025-11-25/server/utilities/pagination

  14. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#structured-content

  15. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#output-schema

  16. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-result

  17. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool

  18. https://modelcontextprotocol.io/specification/2025-11-25/basic#icons

  19. https://modelcontextprotocol.io/specification/2025-11-25/server/tools#list-changed-notification

  20. https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#initialization

  21. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization

  22. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#resource-parameter-implementation

  23. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#authorization-server-discovery

  24. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#authorization-server-metadata-discovery

  25. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#client-id-metadata-documents

  26. https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#scope-challenge-handling

  27. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http 2

  28. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header

  29. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#session-management

  30. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#resumability-and-redelivery

  31. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#stdio

  32. https://modelcontextprotocol.io/specification/2025-11-25/basic/security_best_practices

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions