Skip to content

fix(tui): enable paste in MCP server configuration modal#276

Merged
echobt merged 1 commit intomasterfrom
fix/mcp-modal-paste
Jan 27, 2026
Merged

fix(tui): enable paste in MCP server configuration modal#276
echobt merged 1 commit intomasterfrom
fix/mcp-modal-paste

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 27, 2026

Problem

When adding an MCP server (HTTP or stdio) or setting API keys in the TUI, users could not paste text into the input fields (name, URL, API key, etc.). The paste operation simply didn't work.

Root Cause

The paste event (EngineEvent::Paste) was only routed to:

  1. Form modals (ActiveModal::Form)
  2. The main input widget

However, the MCP manager modal uses the unified modal stack system (ModalStack) with the Modal trait, which did not have a handle_paste method.

Solution

  1. Added handle_paste method to the Modal trait with a default no-op implementation
  2. Added handle_paste method to ModalStack to delegate to the top modal
  3. Implemented handle_paste in McpManagerModal for all text input modes:
    • AddStdioServer: name, command, args fields
    • AddHttpServer: name, url fields
    • SetAuth: api_key field
    • SelectFromRegistry: search_query field
  4. Updated the event loop to check modal_stack for paste events first

Testing

  • cargo check -p cortex-tui passes
  • cargo fmt --check passes

Previously, when adding an MCP server (HTTP or stdio) or setting API keys,
users could not paste text into the input fields. This was because the
paste event (EngineEvent::Paste) was only routed to Form modals and the
main input widget, not to the unified modal stack that includes the MCP
manager modal.

Changes:
- Add handle_paste method to the Modal trait with default no-op impl
- Add handle_paste method to ModalStack to delegate to top modal
- Implement handle_paste in McpManagerModal for all text input modes:
  - AddStdioServer (name, command, args fields)
  - AddHttpServer (name, url fields)
  - SetAuth (api_key field)
  - SelectFromRegistry (search_query field)
- Update event loop to check modal_stack for paste events first
@echobt echobt merged commit a296b9d into master Jan 27, 2026
2 of 3 checks passed
@echobt echobt deleted the fix/mcp-modal-paste branch January 27, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants