Skip to content

[Feature] Port /mcp command to oclite #114

@randomm

Description

@randomm

Summary

Port the /mcp command from opencode CLI to oclite, allowing users to manage MCP servers via interactive select dialog.

Requirements

Core Functionality

  • List all configured MCP servers with status icons:
    • ✓ connected
    • ○ disabled
    • ✗ failed (show error)
    • ⚠ needs authentication
  • Toggle servers on/off with space key
  • Restart servers with 'r' key
  • OAuth authentication flow for servers that need it

UI Pattern

Use existing select.ts component with extended key bindings:

  • ↑/↓ - Navigate
  • Space - Toggle selected server on/off
  • r - Restart selected server
  • Enter - Initiate OAuth if needed, otherwise close
  • Escape - Close

Implementation Notes

Files to modify:

  • packages/opencode/src/cli/lite/commands.ts - Add handleMcp() function
  • packages/opencode/src/cli/lite/index.ts - Register /mcp command
  • packages/opencode/src/cli/lite/select.ts - May need to extend for space/r key bindings

MCP operations available:

  • MCP.status() - Get all server statuses
  • MCP.connect(name) - Enable/connect server
  • MCP.disconnect(name) - Disable server
  • Restart = disconnect + connect

Reference:

  • Full CLI implementation: packages/opencode/src/cli/cmd/mcp.ts
  • MCP module: packages/opencode/src/mcp/index.ts

Acceptance Criteria

  • /mcp command shows list of MCP servers with status
  • Space key toggles server on/off
  • 'r' key restarts selected server
  • Status updates after toggle/restart
  • Works with existing select.ts component pattern
  • Reusable pattern for future /models enhancements

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions