Skip to content

feat(app-server): support mcp elicitations in v2 api#13425

Merged
owenlin0 merged 1 commit intomainfrom
owen/mcp_elicitations_v2
Mar 5, 2026
Merged

feat(app-server): support mcp elicitations in v2 api#13425
owenlin0 merged 1 commit intomainfrom
owen/mcp_elicitations_v2

Conversation

@owenlin0
Copy link
Collaborator

@owenlin0 owenlin0 commented Mar 4, 2026

This adds a first-class server request for MCP server elicitations: mcpServer/elicitation/request.

Until now, MCP elicitation requests only showed up as a raw codex/event/elicitation_request event from core. That made it hard for v2 clients to handle elicitations using the same request/response flow as other server-driven interactions (like shell and apply_patch tools).

This also updates the underlying MCP elicitation request handling in core to pass through the full MCP request (including URL and form data) so we can expose it properly in app-server.

Why not item/mcpToolCall/elicitationRequest?

This is because MCP elicitations are related to MCP servers first, and only optionally to a specific MCP tool call.

In the MCP protocol, elicitation is a server-to-client capability: the server sends elicitation/create, and the client replies with an elicitation result. RMCP models it that way as well.

In practice an elicitation is often triggered by an MCP tool call, but not always.

What changed

  • add mcpServer/elicitation/request to the v2 app-server API
  • translate core codex/event/elicitation_request events into the new v2 server request
  • map client responses back into Op::ResolveElicitation so the MCP server can continue
  • update app-server docs and generated protocol schema
  • add an end-to-end app-server test that covers the full round trip through a real RMCP elicitation flow
    • The new test exercises a realistic case where an MCP tool call triggers an elicitation, the app-server emits mcpServer/elicitation/request, the client accepts it, and the tool call resumes and completes successfully.

app-server API flow

  • Client starts a thread with thread/start.
  • Client starts a turn with turn/start.
  • App-server sends item/started for the mcpToolCall.
  • While that tool call is in progress, app-server sends mcpServer/elicitation/request.
  • Client responds to that request with { action: "accept" | "decline" | "cancel" }.
  • App-server sends serverRequest/resolved.
  • App-server sends item/completed for the mcpToolCall.
  • App-server sends turn/completed.
  • If the turn is interrupted while the elicitation is pending, app-server still sends serverRequest/resolved before the turn finishes.

@owenlin0 owenlin0 marked this pull request as ready for review March 4, 2026 04:08
@owenlin0
Copy link
Collaborator Author

owenlin0 commented Mar 4, 2026

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c23ca48846

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@owenlin0
Copy link
Collaborator Author

owenlin0 commented Mar 4, 2026

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// server-to-client request, not a turn- or tool-call-scoped primitive.
pub turn_id: Option<String>,
pub server_name: String,
pub message: String,
Copy link
Collaborator

@mzeng-openai mzeng-openai Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the standard MCP elicit request payload here? I think that's the rich metadata that the group was talking about. It already comes with rmcp: rmcp::Model::CreateElicitationRequestParams

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to define a copy of it in v2.rs to be able to export it properly to typescript and json schema, but it's the same shape

#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct McpServerElicitationRequestResponse {
pub action: McpServerElicitationAction,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can we use the standard MCP elicit response?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above - had to define a copy of it in v2.rs to be able to export it properly to typescript and json schema, but it's the same shape

@owenlin0 owenlin0 force-pushed the owen/mcp_elicitations_v2 branch from 7bd8712 to 97ee4dd Compare March 5, 2026 05:05
@owenlin0
Copy link
Collaborator Author

owenlin0 commented Mar 5, 2026

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@owenlin0 owenlin0 merged commit 926b2f1 into main Mar 5, 2026
29 of 31 checks passed
@owenlin0 owenlin0 deleted the owen/mcp_elicitations_v2 branch March 5, 2026 15:20
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants