-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(workflow-as-mcp): wrapping workflows in the same workspace as MCP tools to particular MCP servers #2415
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR implements a comprehensive MCP (Model Context Protocol) server system that wraps deployed workflows as callable tools. The implementation adds infrastructure for users to create workspace-scoped MCP servers, register deployed workflows as tools, and expose them via standard MCP protocol endpoints for external clients. Key Changes:
Architecture: Security: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as MCP Client
participant ServeAPI as /api/mcp/serve/[serverId]
participant ExecAPI as /api/workflows/[id]/execute
participant DB as Database
participant Workflow as Workflow Engine
Note over Client,Workflow: MCP Tool Execution Flow
Client->>ServeAPI: POST tools/call {name, arguments}
ServeAPI->>ServeAPI: checkHybridAuth()
ServeAPI->>DB: Query workflow_mcp_tool by serverId + toolName
DB-->>ServeAPI: Return tool with workflowId
ServeAPI->>DB: Check workflow.isDeployed
DB-->>ServeAPI: Return deployment status
alt Workflow not deployed
ServeAPI-->>Client: Error: Workflow not deployed
else Workflow deployed
ServeAPI->>ExecAPI: POST /api/workflows/{workflowId}/execute<br/>{input: arguments, triggerType: 'mcp'}
ExecAPI->>Workflow: Execute workflow with input
Workflow-->>ExecAPI: Return execution result
ExecAPI-->>ServeAPI: Return {success, output}
ServeAPI-->>Client: JSONRPCResponse with result
end
Note over Client,Workflow: Tool Registration & Sync Flow
participant UI as Deploy UI
participant ToolAPI as /api/mcp/workflow-servers/[id]/tools
participant DeployAPI as /api/workflows/[id]/deploy
participant Sync as workflow-mcp-sync
UI->>ToolAPI: POST {workflowId, toolName, description}
ToolAPI->>DB: Verify workflow.isDeployed = true
ToolAPI->>DB: Verify hasValidStartBlock()
ToolAPI->>DB: Insert workflow_mcp_tool
DB-->>ToolAPI: Return created tool
ToolAPI-->>UI: Success
Note over DeployAPI,Sync: On workflow deploy/undeploy
DeployAPI->>Sync: syncMcpToolsForWorkflow()
Sync->>DB: Load workflow blocks
Sync->>Sync: Extract inputFormat from start block
Sync->>Sync: Generate parameter schema
Sync->>DB: Update workflow_mcp_tool.parameterSchema
DB-->>Sync: Schema updated
Sync-->>DeployAPI: Sync complete
|
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.
29 files reviewed, 4 comments
apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts
Outdated
Show resolved
Hide resolved
apps/sim/app/api/mcp/workflow-servers/[id]/connection-info/route.ts
Outdated
Show resolved
Hide resolved
2f2ec02 to
2259bfc
Compare
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
…o feat/workflow-as-mcp
Summary
We wrap the existing API calls as MCP tool endpoints and use them to trigger workflows from MCP servers.
Type of Change
Testing
Tested manually with @Sg312
Checklist