Skip to content

Commit 31688a3

Browse files
committed
fix(server): let Claude approve Yes/No MCP confirmation forms
mongodb-mcp-server (and the hosted Atlas connector) confirms writes with a required "confirmation" enum ["Yes","No"]. No option matched the allow-once pattern, so the Claude adapter declined before any approval card appeared and the tool failed with "User did not confirm". When the user clicks Approve, the Claude path now also picks a one-time affirmative choice (Yes/Confirm/Proceed/Continue/OK). Schema defaults stay stripped and persistence choices are still never picked; the Codex path is unchanged since the option is opt-in.
1 parent 119bf4c commit 31688a3

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3855,6 +3855,7 @@ export function claudeMcpElicitationAcceptance(
38553855
const response = toMcpElicitationResponse(
38563856
{ mode: "form", requestedSchema: withoutSchemaDefaults(request.requestedSchema) },
38573857
"accept",
3858+
{ acceptConfirmationChoices: true },
38583859
);
38593860
// The helper leaves content out when the schema is not a form it can read.
38603861
const filled = response.content;

‎apps/server/src/provider/CodexMcpElicitation.ts‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,16 @@ export function describeMcpElicitation(
177177
};
178178
}
179179

180+
const ONE_TIME_APPROVAL_CHOICE =
181+
/^(?:once|accept|approve|allow)(?:[_\s-]*(?:once(?:[_\s-]*only)?|this[_\s-]*time))?$/i;
182+
// Confirmation forms (e.g. mongodb-mcp-server's required "Yes"/"No" enum) ask
183+
// for consent with a plain affirmative instead of an allow-once choice.
184+
const ONE_TIME_CONFIRMATION_CHOICE = /^(?:yes|confirm|proceed|continue|ok(?:ay)?)$/i;
185+
180186
export function toMcpElicitationResponse(
181187
payload: McpElicitationResponseInput,
182188
decision: ProviderApprovalDecision,
189+
responseOptions?: { readonly acceptConfirmationChoices?: boolean },
183190
): EffectCodexSchema.McpServerElicitationRequestResponse {
184191
if (decision === "decline" || decision === "cancel") {
185192
return { action: decision };
@@ -203,9 +210,10 @@ export function toMcpElicitationResponse(
203210
const chosenOption = options.find((option) =>
204211
persist
205212
? mcpElicitationPersistenceDecision(option.value) === decision
206-
: /^(?:once|accept|approve|allow)(?:[_\s-]*(?:once(?:[_\s-]*only)?|this[_\s-]*time))?$/i.test(
207-
option.value.trim(),
208-
) && mcpElicitationPersistenceDecision(option.value) === null,
213+
: (ONE_TIME_APPROVAL_CHOICE.test(option.value.trim()) ||
214+
(responseOptions?.acceptConfirmationChoices === true &&
215+
ONE_TIME_CONFIRMATION_CHOICE.test(option.value.trim()))) &&
216+
mcpElicitationPersistenceDecision(option.value) === null,
209217
);
210218
if (chosenOption) {
211219
content[key] = chosenOption.value;

0 commit comments

Comments
 (0)