Skip to content

fix(mcp): missing isDeployed in contract breaking settings, parameter overrides lack of clarity#5164

Merged
icecrasher321 merged 9 commits into
stagingfrom
fix/mcp-servers
Jun 22, 2026
Merged

fix(mcp): missing isDeployed in contract breaking settings, parameter overrides lack of clarity#5164
icecrasher321 merged 9 commits into
stagingfrom
fix/mcp-servers

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Fix the Deploy → MCP flow so Start‑block input descriptions are no longer dropped: the Start block is now the default source for MCP tool parameter descriptions, with durable per‑tool overrides stored in a new workflow_mcp_tool.parameter_description_overrides column (parameterSchema becomes a materialized base‑plus‑overrides cache that the redeploy sync re‑applies, so overrides survive redeploys), and the tool description now falls back to the workflow description when unset.

Also enables the previously‑always‑greyed "Add Workflows" button (the deployed‑workflows query now receives isDeployed), makes that header chip a primary + Add Workflows, and deep‑links "Manage" to the specific server's config. Additive/expand‑only migration with no serve‑side changes for existing tools, so already‑deployed MCP servers keep working unchanged.

Type of Change

  • Bug fix
  • Other: UX Improvement

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jun 22, 2026 4:18am

Request Review

@cursor

cursor Bot commented Jun 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches MCP orchestration, serve tools/list, and deploy persistence with a DB migration; behavior changes how descriptions are stored and merged on redeploy, though legacy full-schema payloads remain supported.

Overview
MCP tool configuration now treats the deployed Start block as the source of truth for parameter descriptions, with sparse per-tool overrides stored in a new parameter_description_overrides column; parameterSchema is rebuilt from the deployed base plus overrides on create/update and on workflow redeploy sync. The deploy MCP tab loads deployed workflow state (not the live editor), prefills parameters from Start-block descriptions, saves overrides instead of a full schema, and migrates legacy descriptions from stored schema when the column is empty.

Tool descriptions can be left empty to mean “use workflow description”; tools/list and clients resolve via getMeaningfulWorkflowDescription when the stored tool description is blank. Create/update APIs, orchestration, copilot deploy_mcp, and Settings still accept legacy full parameterSchema by diffing it into overrides.

Settings / deploy UX: workflow list queries now include isDeployed so “Add Workflows” works; the add control is a primary header chip; opening MCP settings respects ?mcpServerId=; Deploy → Manage deep-links to the active server. Docs updated for defaults and override behavior.

Additive DB migration (parameter_description_overrides default {}).

Reviewed by Cursor Bugbot for commit 1732587. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two independent bugs in the Deploy → MCP flow: the "Add Workflows" button was always greyed out because isDeployed was missing from the workflow list response, and Start-block input descriptions were dropped when a tool was created or edited. The fix introduces a new parameter_description_overrides column in workflow_mcp_tool, moves to a sparse-override model (base schema from deployed Start block + per-tool overrides), and makes tool descriptions fall back to the workflow description at serve time via a JOIN instead of being stored redundantly.

  • isDeployed fix: queries.ts now includes the column in listColumns, and the client-side filter in fetchDeployedWorkflows can correctly exclude non-deployed workflows, enabling the "Add Workflows" button.
  • Override model: workflow-tool-schema.ts gains four new utilities (applyDescriptionOverrides, pruneOverridesToSchema, extractDescriptionOverrides, getMeaningfulWorkflowDescription) used consistently across the serve layer, sync, lifecycle, deploy modal, and copilot tool; the additive migration adds the parameter_description_overrides column with a safe NOT NULL DEFAULT '{}' so existing tools continue to work unchanged.
  • UX: The deploy modal pre-fills parameter descriptions from the Start block, the "Manage" button deep-links to the specific server, and the "Add Workflows" chip is promoted to variant='primary' in the header.

Confidence Score: 5/5

Safe to merge — all data paths are correct, the migration is additive with a safe default, and existing deployed MCP tools are unaffected.

The isDeployed fix, the sparse-override model, the migration, and the serve-layer changes are all well-implemented and backward-compatible. The two findings in mcp.tsx are change-detection edge cases that produce a redundant API call or a missed dirty state within a single browser session, with no data corruption. Correctness at the DB and serve layer is solid.

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/mcp/mcp.tsx — the savedValues/dirty-detection logic has two minor edge cases worth a follow-up.

Important Files Changed

Filename Overview
apps/sim/lib/mcp/workflow-tool-schema.ts Adds applyDescriptionOverrides, pruneOverridesToSchema, extractDescriptionOverrides, and getMeaningfulWorkflowDescription — all well-scoped utilities with correct edge-case handling.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/mcp/mcp.tsx Refactored to sparse override model; savedValues.toolDescription stores raw UI value instead of normalized save value, causing a false dirty state in edge cases, and savedOverrides recomputed against current startBlockDescriptions can miss a needed override after an in-session Start-block edit.
apps/sim/lib/mcp/orchestration/workflow-mcp-lifecycle.ts prepareWorkflowMcpTool now always uses a fresh base schema + sparse overrides; performUpdateWorkflowMcpTool correctly fetches workflowId and regenerates base before applying overrides. Extra DB query outside the transaction is pre-existing pattern.
apps/sim/lib/mcp/workflow-mcp-sync.ts Sync now re-applies per-tool overrides on each redeploy, replacing the two bulk UPDATE statements with one per tool; correctness is sound; latency trade-off for high-fanout workflows was noted in a prior review.
packages/db/migrations/0247_workflow_mcp_tool_param_desc_overrides.sql Additive migration that adds parameter_description_overrides json column with NOT NULL + empty-object default; non-breaking for existing rows.
apps/sim/lib/workflows/queries.ts Adds isDeployed to listColumns and WorkflowListRow, fixing the root cause of the always-greyed Add Workflows button.
apps/sim/app/api/mcp/serve/[serverId]/route.ts handleToolsList now JOINs workflow for name/description and falls back through getMeaningfulWorkflowDescription at serve time instead of relying on a stored description string.
apps/sim/lib/copilot/tools/handlers/deployment/deploy.ts Copilot deploy handler now sends parameterDescriptionOverrides instead of a full parameterSchema; description computation updated to use getMeaningfulWorkflowDescription.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant UI as Deploy Modal (mcp.tsx)
    participant API as POST /tools
    participant Orch as workflow-mcp-lifecycle
    participant Sync as workflow-mcp-sync
    participant DB as Database
    participant Serve as GET /serve/[serverId]

    UI->>UI: load startBlockDescriptions from inputFormat
    UI->>UI: show param descriptions (Start-block defaults)
    UI->>UI: user edits → computeDescriptionOverrides() → sparse overrides
    UI->>API: "{ toolName, toolDescription, parameterDescriptionOverrides }"
    API->>Orch: performCreateWorkflowMcpTool()
    Orch->>DB: generateParameterSchemaForWorkflow() — base schema
    Orch->>Orch: pruneOverridesToSchema() + applyDescriptionOverrides()
    Orch->>DB: INSERT tool (parameterSchema, parameterDescriptionOverrides)

    Note over Sync,DB: On redeploy (syncMcpToolsForWorkflow)
    Sync->>DB: fetch tools with parameterDescriptionOverrides
    Sync->>Sync: pruneOverridesToSchema() — drops stale fields
    Sync->>Sync: applyDescriptionOverrides(newBaseSchema, prunedOverrides)
    Sync->>DB: UPDATE parameterSchema + parameterDescriptionOverrides

    Note over Serve,DB: At serve time (tools/list)
    Serve->>DB: SELECT tool JOIN workflow
    Serve->>Serve: "toolDescription?.trim() || getMeaningfulWorkflowDescription() || fallback"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant UI as Deploy Modal (mcp.tsx)
    participant API as POST /tools
    participant Orch as workflow-mcp-lifecycle
    participant Sync as workflow-mcp-sync
    participant DB as Database
    participant Serve as GET /serve/[serverId]

    UI->>UI: load startBlockDescriptions from inputFormat
    UI->>UI: show param descriptions (Start-block defaults)
    UI->>UI: user edits → computeDescriptionOverrides() → sparse overrides
    UI->>API: "{ toolName, toolDescription, parameterDescriptionOverrides }"
    API->>Orch: performCreateWorkflowMcpTool()
    Orch->>DB: generateParameterSchemaForWorkflow() — base schema
    Orch->>Orch: pruneOverridesToSchema() + applyDescriptionOverrides()
    Orch->>DB: INSERT tool (parameterSchema, parameterDescriptionOverrides)

    Note over Sync,DB: On redeploy (syncMcpToolsForWorkflow)
    Sync->>DB: fetch tools with parameterDescriptionOverrides
    Sync->>Sync: pruneOverridesToSchema() — drops stale fields
    Sync->>Sync: applyDescriptionOverrides(newBaseSchema, prunedOverrides)
    Sync->>DB: UPDATE parameterSchema + parameterDescriptionOverrides

    Note over Serve,DB: At serve time (tools/list)
    Serve->>DB: SELECT tool JOIN workflow
    Serve->>Serve: "toolDescription?.trim() || getMeaningfulWorkflowDescription() || fallback"
Loading

Reviews (3): Last reviewed commit: "address ux concern" | Re-trigger Greptile

Comment thread packages/db/migrations/0247_workflow_mcp_tool_param_desc_overrides.sql Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1732587. Configure here.

@icecrasher321 icecrasher321 merged commit 951ad42 into staging Jun 22, 2026
15 checks passed
@icecrasher321 icecrasher321 deleted the fix/mcp-servers branch June 22, 2026 04:23
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.

1 participant