-
Notifications
You must be signed in to change notification settings - Fork 248
feat: Add MCP elicitation for apply_migration tool #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Implemented user confirmation dialog for apply_migration using MCP elicitation protocol - Added graceful fallback for clients that don't support elicitation - Tests pass with fallback behavior in test environment - Maintains backwards compatibility with all MCP clients
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds user confirmation prompts for database migrations using MCP's elicitation feature. When applying migrations, users will now be presented with the SQL to review and must explicitly confirm before the migration executes.
Key Changes:
- Adds elicitation/create request to prompt users for confirmation before applying migrations
- Passes server instance to database tools to enable elicitation requests
- Maintains backwards compatibility by proceeding without confirmation if elicitation is not supported
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/mcp-server-supabase/src/tools/database-operation-tools.ts | Implements elicitation request for user confirmation with SQL review before migration execution |
| packages/mcp-server-supabase/src/server.ts | Passes server instance to getDatabaseTools to enable elicitation functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // If elicitation fails (client doesn't support it), proceed without confirmation | ||
| // This maintains backwards compatibility | ||
| console.warn( | ||
| 'Elicitation not supported by client, proceeding with migration without confirmation' | ||
| ); |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The catch block silently proceeds with the migration after any elicitation error, which could include network failures or other issues unrelated to client support. Consider checking the specific error type to distinguish between 'unsupported' vs other failures, and potentially fail fast for unexpected errors rather than always proceeding.
| // If elicitation fails (client doesn't support it), proceed without confirmation | |
| // This maintains backwards compatibility | |
| console.warn( | |
| 'Elicitation not supported by client, proceeding with migration without confirmation' | |
| ); | |
| // Only proceed if the error is due to unsupported elicitation; otherwise, fail fast | |
| const errorMessage = | |
| typeof error === 'string' | |
| ? error | |
| : error instanceof Error | |
| ? error.message | |
| : ''; | |
| if ( | |
| errorMessage && | |
| ( | |
| errorMessage.includes('elicitation not supported') || | |
| errorMessage.includes('Elicitation not supported') || | |
| errorMessage.includes('not implemented') || | |
| errorMessage.includes('unsupported') | |
| ) | |
| ) { | |
| console.warn( | |
| 'Elicitation not supported by client, proceeding with migration without confirmation' | |
| ); | |
| } else { | |
| // Unexpected error, fail fast | |
| throw error; | |
| } |
| }, | ||
| }, | ||
| }, | ||
| // @ts-ignore - elicitation types might not be available |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @ts-ignore suppresses all type checking for the next line. Consider using @ts-expect-error instead, which will fail if the error no longer exists, helping track when types become available.
| // @ts-ignore - elicitation types might not be available | |
| // @ts-expect-error - elicitation types might not be available |
|
@mattrossman I've implemented elicitation on |
| // Try to request user confirmation via elicitation | ||
| if (server) { | ||
| try { | ||
| const result = (await server.request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we can use the elicitInput helper here
Summary
Implements MCP elicitation for the
apply_migrationtool to request user confirmation before applying database migrations.Implementation
Uses a try-catch pattern to gracefully fallback when clients don't support elicitation:
Client Support
Currently supported: VS Code Copilot, Cursor, Postman, VT Code, fast-agent, mcp-use, MCPJam
Not yet supported: Claude Desktop, Claude.ai, GitHub Copilot coding agent
Related
AI-142: Explore MCP Elicitations