MCP Overview

Call external tools as workflow steps with Model Context Protocol (MCP).

What is MCP?

Model Context Protocol (MCP) is an open standard for connecting AI systems with external tools and data sources. RelayPlane integrates MCP support, allowing you to call external APIs, databases, CRMs, and other services directly within your AI workflows.

With MCP, you can:

  • Call external tools as workflow steps alongside AI steps
  • Connect to CRMs, databases, GitHub, Slack, and more
  • Mix AI reasoning with external API calls in a single DAG
  • Use any MCP-compatible server
MCP is optional. Most workflows only use AI steps. MCP is useful when you need to integrate external tools like CRMs, databases, or APIs into your workflow.

How It Works

MCP steps work just like AI steps in your workflow, but instead of calling an LLM, they call an external MCP server to execute a tool. The result is then available to subsequent steps.

1import { relay } from '@relayplane/sdk'
2
3// Configure MCP server
4relay.configure({
5 providers: { openai: { apiKey: process.env.OPENAI_API_KEY! } },
6 mcp: {
7 servers: {
8 crm: { url: 'https://mcp.salesforce.com' }
9 }
10 }
11})
12
13// Use MCP in workflow
14const result = await relay
15 .workflow('lead-enrichment')
16 .step('extract')
17 .with('openai:gpt-4o')
18 .prompt('Extract company name from: {{input.email}}')
19 .step('lookup')
20 .mcp('crm:searchCompany')
21 .params({ name: '{{extract.output}}' })
22 .depends('extract')
23 .step('summarize')
24 .with('openai:gpt-4o')
25 .depends('lookup')
26 .prompt('Summarize this company: {{lookup.output}}')
27 .run({ email: 'john@acme.com' })

Key Concepts

MCP Servers

An MCP server exposes tools that can be called via HTTP. Each server has a manifest describing available tools and their parameters. RelayPlane loads this manifest and validates tool calls at runtime.

Tool Format

MCP tools are referenced in server:tool format, similar to how AI models use provider:model format.

1// Format: server:tool
2.mcp('crm:searchCompany')
3.mcp('github:createIssue')
4.mcp('slack:sendMessage')

Parameter Interpolation

MCP parameters support the same template syntax as AI prompts. Reference previous step outputs with {{stepName.output}}.

1.mcp('github:createIssue')
2.params({
3 title: '{{analyze.title}}',
4 body: '{{analyze.description}}',
5 labels: ['bug', 'automated']
6})

MCP vs AI Steps

FeatureAI StepsMCP Steps
PurposeLLM inferenceExternal tool calls
Syntax.with('provider:model').mcp('server:tool')
OutputGenerated text/JSONTool response
Dependencies.depends().depends()

Next Steps