diff --git a/dsl-reference.md b/dsl-reference.md
index c5f463f5..98567879 100644
--- a/dsl-reference.md
+++ b/dsl-reference.md
@@ -15,6 +15,7 @@
+ [HTTP](#http-call)
+ [OpenAPI](#openapi-call)
+ [A2A](#a2a-call)
+ + [MCP](#mcp-call)
- [Do](#do)
- [Emit](#emit)
- [For](#for)
@@ -322,6 +323,7 @@ Serverless Workflow defines several default functions that **MUST** be supported
- [HTTP](#http-call)
- [OpenAPI](#openapi-call)
- [A2A](#a2a-call)
+- [MCP](#mcp-call)
##### AsyncAPI Call
@@ -527,6 +529,68 @@ do:
text: Generate the Q1 sales report.
```
+##### MCP Call
+
+The [MCP Call](#mcp-call) enables workflows to interact with MCP servers that are used by AI agents (https://modelcontextprotocol.io/).
+
+###### Properties
+
+| Name | Type | Required | Description|
+|:--|:---:|:---:|:---|
+| method | `string` | `yes` | The MCP JSON-RPC method to send.
*Supported values are: `initialize`, `notifications/initialized`, `prompts/list`, `prompts/get`, `notifications/prompts/list_changed`, `resources/list`, `resources/read`, `resources/templates/list`, `notifications/resources/list_changed`, `tools/list`, `tools/call`, `notifications/tools/list_changed`, `logging/setLevel`, and `notifications/message`* |
+| server | `string`\|[`endpoint`](#endpoint) | `yes` | An URI, an object (for HTTP) or a filename (for STDIO) that describes the MCP server to call.
|
+| parameters | `map`
`string` | `no` | The parameters for the MCP RPC method. For the `initialize` method, runtimes must set the `protocolVersion` parameter to the used version. Runtimes must implement the MCP specification version of 2025-06-18.
*Can be an object or a runtime expression.* |
+
+> [!NOTE]
+> On success the output is the JSON-RPC result. On failure runtimes must raise an error with type [https://serverlessworkflow.io/spec/1.0.0/errors/runtime](https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#standard-error-types).
+>
+> This call supports MCP over both HTTP and STDIO (communication over standard in and standard out) transport mechanisms.
+
+###### Examples
+
+This example shows an initialization phase as the first interaction between MCP client and server. The client sends its supported version, capabilities, and implementation information in the initialize request. The server MUST respond with its own capabilities and information including the supported version.
+
+```yaml
+document:
+ dsl: '1.0.1'
+ namespace: test
+ name: mcp-example
+ version: '0.1.0'
+do:
+ - GenerateReport:
+ call: mcp
+ with:
+ method: initialize
+ server:
+ endpoint: https://example.com/mcp
+ parameters:
+ protocolVersion: '2025-06-18'
+ capabilities:
+ roots:
+ listChanged: true
+```
+
+The following example showcases a prompts/list request by the client to retrieve available prompts from the MCP server.
+
+```yaml
+document:
+ dsl: '1.0.1'
+ namespace: test
+ name: mcp-example
+ version: '0.1.0'
+do:
+ - GenerateReport:
+ call: mcp
+ with:
+ method: prompts/get
+ server:
+ endpoint: https://example.com/mcp
+ parameters:
+ name: "code_review"
+ arguments:
+ code: "def hello():\n print('world')"
+```
+
#### Do
Serves as a fundamental building block within workflows, enabling the sequential execution of multiple subtasks. By defining a series of subtasks to perform in sequence, the Do task facilitates the efficient execution of complex operations, ensuring that each subtask is completed before the next one begins.
@@ -2706,4 +2770,4 @@ References a workflow definition.
name: greet
namespace: samples
version: '0.1.0-rc2'
-```
\ No newline at end of file
+```
diff --git a/examples/call-mcp-1.yaml b/examples/call-mcp-1.yaml
new file mode 100644
index 00000000..67b65d1f
--- /dev/null
+++ b/examples/call-mcp-1.yaml
@@ -0,0 +1,17 @@
+document:
+ dsl: '1.0.1'
+ namespace: test
+ name: mcp-example
+ version: '0.1.0'
+do:
+ - GenerateReport:
+ call: mcp
+ with:
+ method: initialize
+ server:
+ endpoint: https://example.com/mcp
+ parameters:
+ protocolVersion: '2025-06-18'
+ capabilities:
+ roots:
+ listChanged: true
\ No newline at end of file
diff --git a/examples/call-mcp-2.yaml b/examples/call-mcp-2.yaml
new file mode 100644
index 00000000..4cddc899
--- /dev/null
+++ b/examples/call-mcp-2.yaml
@@ -0,0 +1,16 @@
+document:
+ dsl: '1.0.1'
+ namespace: test
+ name: mcp-example
+ version: '0.1.0'
+do:
+ - GenerateReport:
+ call: mcp
+ with:
+ method: prompts/get
+ server:
+ endpoint: https://example.com/mcp
+ parameters:
+ name: "code_review"
+ arguments:
+ code: "def hello():\n print('world')"
\ No newline at end of file
diff --git a/schema/workflow.yaml b/schema/workflow.yaml
index 1d3933bb..a82a34c1 100644
--- a/schema/workflow.yaml
+++ b/schema/workflow.yaml
@@ -473,6 +473,41 @@ $defs:
description: The parameters object to send with the A2A method.
required: [ method ]
unevaluatedProperties: false
+ - title: CallMCP
+ description: Defines the MCP call to perform.
+ type: object
+ unevaluatedProperties: false
+ required: [ call, with ]
+ allOf:
+ - $ref: '#/$defs/taskBase'
+ - properties:
+ call:
+ type: string
+ const: mcp
+ with:
+ type: object
+ title: MCPArguments
+ description: The MCP call arguments.
+ properties:
+ server:
+ title: MCPServer
+ description: The MCP server endpoint (HTTP or STDIO) to send the request to.
+ $ref: '#/$defs/endpoint'
+ method:
+ type: string
+ title: WithMCPMethod
+ description: The MCP method to send.
+ enum: [ 'initialize', 'notifications/initialized', 'prompts/list', 'prompts/get', 'notifications/prompts/list_changed', 'resources/list', 'resources/read', 'resources/templates/list', 'notifications/resources/list_changed', 'tools/list', 'tools/call', 'notifications/tools/list_changed', 'logging/setLevel', 'notifications/message' ]
+ parameters:
+ oneOf:
+ - type: object
+ minProperties: 1
+ additionalProperties: true
+ - type: string
+ title: WithMCPParameters
+ description: The parameters object to send with the MCP method.
+ required: [ method, server ]
+ unevaluatedProperties: false
- title: CallFunction
description: Defines the function call to perform.
type: object
@@ -484,7 +519,7 @@ $defs:
call:
type: string
not:
- enum: ["asyncapi", "grpc", "http", "openapi", "a2a"]
+ enum: ["asyncapi", "grpc", "http", "openapi", "a2a", "mcp"]
description: The name of the function to call.
with:
type: object
@@ -1823,4 +1858,4 @@ $defs:
export:
$ref: '#/$defs/export'
title: SubscriptionIteratorExport
- description: An object, if any, used to customize the content of the workflow context.
\ No newline at end of file
+ description: An object, if any, used to customize the content of the workflow context.