MCP Client Integration in FlowMattic
FlowMattic’s MCP Client allows you to connect to any external Model Context Protocol (MCP) server and execute its tools — either as a direct workflow step or as an AI Agent tool. This turns FlowMattic into a universal MCP client that can interact with thousands of MCP-compatible services.
How the MCP Client Works
The MCP Client uses the Streamable HTTP transport protocol to communicate with MCP servers:
- You provide the MCP server’s endpoint URL and optional authentication.
- FlowMattic sends a
tools/listrequest to discover available tools on the server. - You select a tool and configure its parameters (or let the AI Agent choose dynamically).
- FlowMattic sends a
tools/callrequest to execute the selected tool. - The server processes the request and returns the result.
The client supports session management via Mcp-Session-Id headers, automatic reconnection, and configurable timeouts.
Two Usage Contexts
The MCP Client works in two different contexts depending on where you use it:
| Context | Description | Tool Selection | Parameters |
|---|---|---|---|
| AI Agent Tool | Added as a tool inside an AI Agent component | AI chooses from available tools dynamically | AI fills parameters based on its reasoning |
| Regular Workflow Step | Used as a standard action step in a workflow | You select one specific tool from a dropdown | You configure static or dynamic tag values |
Setting Up the MCP Client
Basic Configuration
Every MCP Client configuration requires:
- Endpoint URL — The MCP server’s Streamable HTTP endpoint (e.g.,
https://your-server.com/mcp) - Authentication — Choose from None, Bearer Token, API Key, or Custom Headers
- Tool Selection — Pick a specific tool (workflow step) or configure tool filtering (AI Agent)
- Timeout — Connection timeout in seconds (default: 60)
Authentication Methods
| Method | Fields | Use Case |
|---|---|---|
| None | — | Public MCP servers with no auth |
| Bearer Token | Token value | OAuth2 / JWT bearer authentication |
| API Key (Custom Header) | Header name + Header value | API key passed in a custom header (e.g., X-API-Key) |
| Custom Headers | Key-value pairs | Multiple custom headers for complex auth scenarios |
Tip: You can use dynamic tags in auth fields to pull tokens from previous workflow steps, stored options, or environment variables.
Using MCP Client as an AI Agent Tool
When added as a tool inside an AI Agent, the MCP Client expands into individual tools that the AI can call autonomously.
Configuration
- Open your AI Agent in the Visual Workflow Builder.
- Add a new tool and select MCP Client > Execute Tool.
- Enter the MCP server Endpoint URL.
- Configure Authentication if required.
- Set the Tools to Include mode:
| Mode | Behavior |
|---|---|
| All Tools | All tools from the MCP server are available to the AI |
| Selected Tools Only | Only the tools you check are available |
| All Except | All tools except the ones you check are available |
- For Selected or Except modes:
- Click Fetch & Select Tools to load the tool list from the server.
- Use the search box to filter tools by name or description.
- Check/uncheck tools as needed.
- Click Continue and then Save & Close.
How It Works at Runtime
When the AI Agent executes:
- FlowMattic connects to the MCP server and fetches the tool list.
- Based on your tools mode, it filters the available tools.
- Each MCP tool is converted into a function the AI model can call (with name, description, and input schema).
- The AI decides which tool(s) to call and provides the required parameters.
- FlowMattic executes the tool call against the MCP server and returns the result to the AI.
- The AI can chain multiple tool calls across iterations.
Note: MCP tools are expanded alongside any other tools configured in the AI Agent. The AI can use both MCP tools and regular FlowMattic tools in the same conversation.
Token Usage Optimization
MCP servers can expose tools with large input schemas. FlowMattic automatically optimizes tool schemas to reduce token usage by:
- Stripping non-essential metadata fields (
$schema,title,examples,default,pattern,format) - Truncating tool descriptions to 200 characters
- Collapsing deeply nested schemas (beyond 3 levels)
Using MCP Client as a Workflow Step
When used as a regular workflow step, you select a single tool and configure its parameters manually.
Configuration
- Add a new action step in your workflow.
- Select MCP Client > Execute Tool.
- Enter the MCP server Endpoint URL.
- Configure Authentication if required.
- Click the refresh button next to the Tool dropdown to fetch available tools.
- Select the tool you want to execute.
- Fill in the Tool Parameters that appear based on the tool’s input schema.
- Set the Timeout value if needed.
Parameter Types
Parameters are dynamically generated based on the selected tool’s inputSchema:
| Schema Type | Input Field | Notes |
|---|---|---|
string |
Text input | Supports dynamic tags |
number / integer |
Text input | Enter numeric values |
boolean |
Dropdown (true/false) | — |
enum |
Dropdown with options | Options from the schema |
object / array |
Textarea (JSON) | Enter valid JSON, supports dynamic tags |
Tip: Use dynamic tags (the
+button) to insert values from previous workflow steps into tool parameters.
Response Data
The MCP Client returns the tool’s response as structured data that can be used in subsequent workflow steps via dynamic tags. The response typically includes:
content— Array of content blocks (text, images, resources)isError— Whether the tool execution resulted in an error
Connecting to Popular MCP Servers
FlowMattic MCP Server
Connect one FlowMattic site to another’s MCP server:
Endpoint URL: https://your-site.com/wp-json/flowmattic/v1/mcp-server/{server-id}
Auth: Bearer Token or API Key (as configured on the server)
GitHub MCP Server
Endpoint URL: https://api.githubcopilot.com/mcp/
Auth: Bearer Token (GitHub Personal Access Token)
Zapier MCP Server
Endpoint URL: https://actions.zapier.com/mcp/{your-id}/sse
Auth: Bearer Token (Zapier API Key)
Important: Each MCP server has its own endpoint format and authentication requirements. Refer to the server’s documentation for the correct configuration.
Troubleshooting
Common Issues
“Failed to connect to MCP server”
- Verify the endpoint URL is correct and accessible from your WordPress server.
- Check that your server can make outbound HTTPS requests.
- Ensure the MCP server is running and responding.
“Failed to fetch tools” / Empty tool list
- The MCP server may require authentication. Check your auth configuration.
- The server might not support
tools/list. Verify it implements the MCP protocol. - Check the timeout value — some servers need more time to respond.
“Tool execution failed”
- Verify the parameters match the tool’s expected input schema.
- Check that your authentication token has the required permissions.
- Review the MCP server’s logs for detailed error messages.
AI Agent not using MCP tools
- Ensure the tools mode is set correctly (not “All Tools” with an unreachable server).
- Check that the endpoint URL and auth are configured in the tool settings.
- Verify the MCP server is accessible at the time of AI Agent execution.
High token usage with MCP tools
- Use Selected Tools Only mode to limit the number of tools exposed to the AI.
- MCP servers with many tools (30+) will increase prompt token usage for tool definitions.
- Tool response data from MCP servers contributes to completion tokens — large responses (e.g., full contact lists) will use more tokens.
Summary
| Feature | Details |
|---|---|
| App Name | MCP Client |
| Action | Execute Tool |
| Transport | Streamable HTTP (JSON-RPC 2.0) |
| Auth Methods | None, Bearer Token, API Key, Custom Headers |
| AI Agent Support | Yes — expands into individual callable tools |
| Workflow Step Support | Yes — single tool with configured parameters |
| Tool Filtering | All, Selected Only, All Except |
| Session Management | Automatic via Mcp-Session-Id header |
| Schema Optimization | Automatic — reduces token usage for AI agents |
| Timeout | Configurable (default: 60 seconds) |
| Since | FlowMattic 6.0 |