Skip to content

feat(mcp): MCP Elicitation support (#2486)#2521

Merged
bug-ops merged 2 commits intomainfrom
mcp-elicitation-support
Mar 31, 2026
Merged

feat(mcp): MCP Elicitation support (#2486)#2521
bug-ops merged 2 commits intomainfrom
mcp-elicitation-support

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 31, 2026

Summary

  • MCP servers can now request structured user input mid-task via elicitation/create protocol method
  • CLI channel: interactive prompt with server name attribution and typed field collection (string, integer, number, boolean, enum) with type coercion and validation
  • Non-interactive channels (TUI, Telegram, daemon, scheduler): auto-decline with warning log
  • Sandboxed trust-level servers unconditionally blocked from eliciting
  • Per-server elicitation_enabled override in [[mcp.servers]] takes precedence over global config
  • Phishing prevention: server name shown before every prompt; message sanitized (control chars stripped, 500-char cap via char-level truncation)

Configuration

[mcp]
elicitation_enabled = false        # default: off
elicitation_timeout_secs = 120     # default: 120 s

[[mcp.servers]]
name = "my-server"
elicitation_enabled = true         # per-server override

Known limitations

  • Elicitation arriving during MCP tool call execution always times out (agent loop blocked during tool await) — documented as phase-2 work
  • TUI and Telegram interactive UI deferred to phase 2 (currently auto-decline)
  • URL elicitation field variant deferred (auto-declined)

Test plan

  • Run cargo nextest run -p zeph-mcp --all-features — 390 tests pass
  • Run cargo nextest run --workspace --all-features --lib --bins — 6980/6980 pass
  • Live session: configure an MCP server that sends elicitation/create and verify CLI prompt appears with server name header
  • Verify non-CLI channels (TUI mode) auto-decline with log warning
  • Verify Sandboxed trust server cannot elicit even with elicitation_enabled = true

Closes #2486

@bug-ops bug-ops enabled auto-merge (squash) March 31, 2026 12:02
@github-actions github-actions bot added documentation Improvements or additions to documentation channels zeph-channels crate (Telegram) rust Rust code changes core zeph-core crate enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 31, 2026
@bug-ops bug-ops force-pushed the mcp-elicitation-support branch from 02a9d8b to a2b79b4 Compare March 31, 2026 12:23
bug-ops added 2 commits March 31, 2026 14:29
MCP servers can now request structured user input mid-task via the
Elicitation protocol. The agent routes ElicitationRequest events to
the active channel at turn boundaries via a non-blocking drain loop.

- CLI channel: interactive prompt with server name attribution and
  field-by-field input collection; supports string, boolean, integer,
  number, and enum field types with type coercion and validation
- Non-interactive channels (TUI, Telegram, daemon, scheduler):
  auto-decline with a logged warning
- Sandboxed trust level: elicitation is unconditionally blocked
- Per-server override: `elicitation_enabled` in [[mcp.servers]] takes
  precedence over the global `[mcp] elicitation_enabled` setting
- Timeout: configurable `elicitation_timeout_secs` (default 120s)
- Phishing prevention: server name always shown before any prompt;
  message sanitized (control chars stripped, 500-char cap via
  char-level truncation to avoid UTF-8 boundary panics)
- Input validation: invalid input declines gracefully with a message
  rather than storing a wrong-type value

Known limitation: elicitation arriving during MCP tool call execution
times out because the agent loop is blocked; tracked as phase-2 work.

9 new tests: sanitize_elicitation_message (control chars, cap,
multi-byte boundary), build_elicitation_fields (type mapping, required
flag), sandboxed trust blocks elicitation, elicitation_enabled gate.
6980/6980 tests pass.
- extract handler_cfg_for() helper to avoid too-many-lines in add_server
- add elicitation_enabled field to McpServerConfig Debug impl
- replace match-with-single-arm with if let in elicitation prompt
- use format string literals (clippy::uninlined_format_args)
@bug-ops bug-ops force-pushed the mcp-elicitation-support branch from a2b79b4 to dd49878 Compare March 31, 2026 12:29
@bug-ops bug-ops merged commit 70ea42e into main Mar 31, 2026
27 checks passed
@bug-ops bug-ops deleted the mcp-elicitation-support branch March 31, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels zeph-channels crate (Telegram) core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement(mcp): MCP Elicitation support — servers request structured user input mid-task

1 participant