Skip to main content

Overview

The AutoMFlows MCP (Model Context Protocol) server enables AI agents like Claude, Cursor, and other MCP-compatible tools to interact with AutoMFlows. AI agents can generate workflows from natural language, execute them, analyze errors, and automatically fix issues.

AI-Powered Creation

Generate workflows from natural language descriptions

Automatic Execution

Execute workflows directly from AI agents

Error Analysis

Analyze execution errors and get suggestions

Auto-Fix

Automatically fix workflows based on error analysis

Features

Tools

The MCP server provides these executable tools:
ToolDescription
create_workflowGenerate workflows from natural language descriptions
execute_workflowExecute a workflow on the AutoMFlows backend
get_execution_statusGet execution status and results
analyze_workflow_errorsAnalyze errors and provide suggestions
fix_workflowAutomatically fix workflows based on error analysis
validate_workflowValidate workflow structure before execution

Resources

The MCP server exposes these read-only resources:
ResourceURIDescription
Workflow Examplesautomflows://workflow-examplesList of example workflows
Node Documentationautomflows://node-documentationNode type documentation
Project Contextautomflows://project-contextProject structure and conventions

Prerequisites

Before setting up the MCP server, ensure you have:
  • Node.js 18+ and npm 9+
  • AutoMFlows backend running (for workflow execution)
  • MCP-compatible client (Cursor, Claude Desktop, etc.)

Installation

1

Navigate to MCP server directory

cd mcp-server
2

Install dependencies

npm install
3

Build the server

npm run build
This compiles TypeScript to JavaScript in the dist/ directory.
4

Verify build

ls dist/server.js
You should see the compiled server file.

Configuration

The MCP server can be configured using environment variables or a configuration file.

Environment Variables

VariableDefaultDescription
AUTOMFLOWS_BACKEND_URLhttp://localhost:3000Backend server URL
AUTOMFLOWS_WORKFLOWS_PATH./tests/workflows/demoPath to workflow examples
AUTOMFLOWS_VERBOSEfalseEnable verbose logging

Configuration File

Create mcp-server/config.json for persistent configuration:
{
  "backendUrl": "http://localhost:3000",
  "workflowsPath": "./tests/workflows/demo"
}

Cursor IDE Setup

The most common use case is integrating with Cursor IDE for AI-powered workflow development.
1

Open Cursor Settings

  • macOS: Press Cmd + ,
  • Windows/Linux: Press Ctrl + ,
2

Navigate to MCP

Go to Features > MCP or Tools & Integrations > MCP Servers
3

Add new MCP server

Click ”+ Add New MCP Server” button
4

Configure server

Fill in the following fields:
  • Name: automflows (or any name you prefer)
  • Command: node
  • Args: ["/absolute/path/to/autoMflows/mcp-server/dist/server.js"]
  • Environment Variables (optional):
    • AUTOMFLOWS_BACKEND_URL: http://localhost:3000
    • LLM_PROVIDER: none (or openai/local)
    • OPENAI_API_KEY: Your API key (if using OpenAI)
5

Save and restart

Click Save or Apply, then restart Cursor IDE
Replace /absolute/path/to/autoMflows/mcp-server/dist/server.js with your actual absolute path!Example paths:
  • macOS: /Users/username/projects/autoMflows/mcp-server/dist/server.js
  • Linux: /home/username/projects/autoMflows/mcp-server/dist/server.js
  • Windows: C:\\Users\\username\\projects\\autoMflows\\mcp-server\\dist\\server.js

Method 2: Manual Configuration File

Edit the MCP configuration file directly:
Project-specific (Recommended):
# In your project root
mkdir -p .cursor
nano .cursor/mcp.json
Global:
mkdir -p ~/.cursor/config
nano ~/.cursor/config/mcp.json
Add the following configuration:
{
  "mcpServers": {
    "automflows": {
      "command": "node",
      "args": ["/absolute/path/to/autoMflows/mcp-server/dist/server.js"]
    }
  }
}

Getting Your Absolute Path

cd mcp-server
pwd
# Output: /Users/username/projects/autoMflows/mcp-server
# Full path: /Users/username/projects/autoMflows/mcp-server/dist/server.js

Verifying the Connection

1

Restart Cursor IDE

Fully restart Cursor after configuration changes
2

Check MCP status

Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) and type “MCP”Look for “MCP: List Servers” or similar commands
3

Test in Composer

Open Composer (Cmd+I / Ctrl+I) and ask:
What MCP resources are available?
The agent should list AutoMFlows resources and tools

Usage Examples

Creating a Workflow

Ask the AI agent in Cursor Composer:
Create a workflow that:
1. Opens example.com
2. Fills in a login form
3. Clicks the submit button
4. Takes a screenshot of the result
The MCP server will generate a workflow JSON that the backend can execute.

Executing and Monitoring

// Create a workflow
const workflow = await createWorkflow({
  userRequest: "Log into example.com and fill a form",
  useCase: "User login and form submission"
});

// Validate it
const validation = validateWorkflow({ workflow });

// Execute it
const result = await executeWorkflow({ workflow });

// Monitor execution
const status = await getExecutionStatus({
  executionId: result.executionId,
  pollUntilComplete: true
});

Error Handling and Auto-Fix

// If execution fails
if (status.status === 'error') {
  // Analyze errors
  const analysis = analyzeWorkflowErrors({
    workflow,
    errorMessage: status.error!
  });
  
  // Automatically fix workflow
  const fixed = await fixWorkflow({
    workflow,
    errorAnalysis: analysis,
    errorMessage: status.error!
  });
  
  // Re-execute fixed workflow
  await executeWorkflow({ workflow: fixed });
}

Using Resources

In Cursor Composer, ask:
Show me workflow examples

Development

Running in Development Mode

# Watch mode with auto-rebuild
npm run dev

# Type check
npm run type-check

# Build for production
npm run build

Testing the Server

The server communicates via stdio, so it’s typically run by an MCP client. For manual testing:
# Start the server (it will wait for stdio input)
node dist/server.js
Then send MCP protocol messages via stdin.

Architecture

The MCP server is built with:
  • Resources: Read-only data provided to AI agents
    • Workflow examples from tests/workflows/demo
    • Node type documentation
    • Project context and conventions
  • Tools: Executable functions for AI agents
    • Workflow creation (with optional LLM enhancement)
    • Workflow execution via HTTP/WebSocket
    • Error analysis and automatic fixing
  • LLM Integration: Optional enhancement
    • OpenAI for intelligent workflow generation
    • Local LLM (Ollama) for privacy-focused setups
    • Rule-based fallback when no LLM configured
  • Backend Integration
    • HTTP client for REST API calls
    • WebSocket client for real-time execution updates

Troubleshooting

Server Not Found

Checklist:
  • Ensure the path is absolute (starts with / on Unix, C:\ on Windows)
  • Verify you’ve run npm run build in the mcp-server directory
  • Check the file exists: ls dist/server.js (Unix) or dir dist\server.js (Windows)

Node Not Found

# Check Node version (should be 18+)
node --version

# Check Node is in PATH
which node  # Unix
where node  # Windows
If needed, use the full path to Node:
  • Unix: "/usr/local/bin/node"
  • Windows: "C:\\Program Files\\nodejs\\node.exe"

Connection Issues

Common causes:
  • Backend not running: Start with npm run dev:backend
  • Wrong port: Check AUTOMFLOWS_BACKEND_URL matches your backend port
  • Firewall blocking connection
Check Cursor logs:
  • macOS: ~/Library/Logs/Cursor/
  • Windows: %APPDATA%\Cursor\logs\
  • Linux: ~/.config/Cursor/logs/

MCP Server Not Appearing

  1. Restart Cursor completely after configuration changes
  2. Validate JSON syntax (no trailing commas)
  3. Check file is in correct location (.cursor/mcp.json or global config)
  4. Review Cursor logs for error messages

Build Errors

# Clean and rebuild
rm -rf dist node_modules
npm install
npm run build

Advanced Configuration

Custom Workflow Path

Point to your own workflow examples:
{
  "env": {
    "AUTOMFLOWS_WORKFLOWS_PATH": "/path/to/my/workflows"
  }
}

Verbose Logging

Enable detailed logging for debugging:
{
  "env": {
    "AUTOMFLOWS_VERBOSE": "true"
  }
}

Multiple Backend Instances

Configure different backends for different projects:
.cursor/mcp.json
{
  "mcpServers": {
    "automflows-dev": {
      "command": "node",
      "args": ["/path/to/mcp-server/dist/server.js"],
      "env": {
        "AUTOMFLOWS_BACKEND_URL": "http://localhost:3003"
      }
    },
    "automflows-staging": {
      "command": "node",
      "args": ["/path/to/mcp-server/dist/server.js"],
      "env": {
        "AUTOMFLOWS_BACKEND_URL": "http://staging.example.com:3000"
      }
    }
  }
}

Next Steps

Building Plugins

Create custom nodes with plugins

Docker Deployment

Deploy AutoMFlows with Docker

API Reference

Explore the REST API

Creating Workflows

Learn how to create workflows

Build docs developers (and LLMs) love