Back to Blog
Use Cases

Using MCPify for Workflow Automation and RPA Enhancements

See how MCPify turns any API into MCP tools so GPT‑5 can read emails, orchestrate multi‑API calls, and take action, upgrading RPA to intelligent automation.

Herman Sjøberg
Herman Sjøberg
AI Integration Expert
August 27, 202514 min read
RPAMCPWorkflow AutomationGPT‑5Email ProcessingPython

Key Takeaways

  • Pair GPT‑5 with MCPify to handle unstructured inputs and complex decisions
  • Complete email‑to‑action workflow: parse, verify, check APIs, decide, and respond
  • Python agent loop with JSON navigation for efficiency
  • MCPify provides tool auto‑generation, pagination, caching, and observability
  • Complements existing RPA platforms like UiPath and Power Automate

Using MCPify for Workflow Automation and RPA Enhancements

TL;DR: Traditional RPA is brittle when inputs are messy or decisions depend on context. Pairing GPT‑5 with MCPify lets your automations understand unstructured inputs (like emails), select the right APIs, and execute multi‑step actions with full transparency. This guide walks through an email‑to‑action workflow where an LLM reads a customer email, calls several APIs via MCPify (CRM, ticketing, product info), decides next steps, updates a ticket, and drafts a reply.

  • Who it's for: Automation engineers, RPA teams, and ops pros searching "use GPT‑5 for RPA" or "AI workflow automation example."
  • What you'll get: A reference architecture, end‑to‑end Python example, and a quick capabilities table for planning production rollouts.

Why add AI to RPA now

RPA excels at structured, repetitive tasks. It struggles when formats vary, inputs are ambiguous, or decisions require judgment. GPT‑5 closes that gap:

  • Understands free text across emails, tickets, and docs.
  • Plans multi‑step processes and chains tool calls in sequence or parallel.
  • Handles API errors gracefully and adapts as schemas evolve.
  • Summarizes, validates, and explains results before acting.

Key idea: Let the LLM be the brains and your scripts be the muscle. Give the model transparent, predictable tools it can call on demand.


Quick primer: Model Context Protocol (MCP)

MCP is an open standard that defines how AI applications discover and call external tools and data sources. In practice:

  • MCP servers expose tools (APIs, databases, file systems).
  • MCP clients (LLM apps, agent runtimes) discover these tools and invoke them with structured parameters.
  • Tools ship with schemas, examples, and metadata so models know what to call and how to call it.

Useful intros: modelcontextprotocol GitHub, Anthropic's MCP announcement, and modelcontextprotocol.io.


Meet MCPify: turn any API into AI‑ready tools

MCPify is the fastest path from "we have APIs" to "our APIs are usable by GPT‑5 and agentic workflows." Send us the description of your REST, GraphQL, or proprietary endpoints (SOAP services via a WSDL→OpenAPI conversion step); we register it, and MCPify generates an MCP service with:

  • Perfect tool descriptions: parameters, response shapes, and examples taken from the API spec.
  • Fine‑grained JSON navigation: JSONPath queries, array slicing, and field extraction.
  • Pagination: the API's own page size and page token parameters appear as tool inputs, and for tools with pagination metadata the gateway can page through results itself and return a compact summary.
  • Per‑tool caching: TTL set per tool, with fresh data on request.
  • Monitoring and analytics: gateway‑side request logs and metrics, available on request.

Explore more: Docs Home, Getting Started. When you're ready, talk to us about your API.


Reference architecture: Email to action (RPA + GPT‑5 + MCPify)

Scenario: A customer emails support about a delayed order. Your automation must parse the email, verify the customer, check order and inventory, decide a remedy, update the ticket, and draft a reply.

High‑level flow

  1. Ingest: Read email body and metadata.
  2. Understand: GPT‑5 extracts intent and entities (customer, orderId, product).
  3. Plan: GPT‑5 decides which tools to call and in what order.
  4. Fetch: Call CRM, orders, and inventory services (via MCPify).
  5. Decide: If backorder, propose upgrade/refund; else trigger expedited shipping.
  6. Act: Update the ticket, create a follow‑up task, draft a customer email.
  7. Confirm: Return a final summary for auto‑send or human approval.

MCPify services used (examples)

  • crm (customer profile and status)
  • orders (order and shipment details)
  • inventory (stock levels and ETAs)
  • tickets (support updates and macros)
  • notifications (email templates and send)

Tutorial: build the loop in Python

Below is a minimal agent loop. The LLM plans and decides; your script executes MCPify calls and feeds results back.

MCPify serves each wrapped API as an MCP service at https://{service}.mcp.mcpify.org/mcp; in production you would connect an MCP client (for example, the official MCP SDK) to those services and let the model call the generated tools directly. To keep this tutorial focused on the agent loop, the example routes tool calls through a small in-house HTTP bridge (bridge.example.com below) that forwards them to your MCP services. Map service + operationId to your MCPified endpoints; you can keep everything behind one generic executor or expose multiple named tools (one per service).

1) Environment and helpers

import os, requests, json, time
from openai import OpenAI

OPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
BRIDGE_API_KEY = os.environ["BRIDGE_API_KEY"]
BRIDGE_URL = os.environ.get("BRIDGE_URL", "https://bridge.example.com/v1")

client = OpenAI(api_key=OPENAI_API_KEY)

def call_mcpify(service: str, operation_id: str, params: dict):
    """Generic executor: forwards a tool call to your bridge."""
    url = f"{BRIDGE_URL}/tools/execute"
    payload = {"service": service, "operationId": operation_id, "params": params}
    headers = {"Authorization": f"Bearer {BRIDGE_API_KEY}", "Content-Type": "application/json"}
    r = requests.post(url, headers=headers, data=json.dumps(payload), timeout=60)
    r.raise_for_status()
    return r.json()

2) Tools advertised to GPT‑5

Expose a generic executor and a helper for JSON slicing. In production, MCPify auto‑generates tool specs per endpoint with input schemas, and output schemas where a tool declares one.

TOOLS = [
    {
        "type": "function",
        "function": {
            "name": "mcpify_call",
            "description": "Call any MCPify-exposed API by service + operationId with explicit params.",
            "parameters": {
                "type": "object",
                "properties": {
                    "service": {"type": "string", "description": "MCPify service id, e.g., 'crm'"},
                    "operation_id": {"type": "string", "description": "OpenAPI operationId, e.g., 'getCustomerByEmail'"},
                    "params": {"type": "object", "description": "JSON payload or query params"}
                },
                "required": ["service", "operation_id", "params"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "json_query",
            "description": "Fine-grained JSON navigation using JSONPath, handled by your bridge.",
            "parameters": {
                "type": "object",
                "properties": {
                    "json": {"type": "object"},
                    "jsonpath": {"type": "string", "description": "e.g. $.orders[?(@.status=='open')].id"}
                },
                "required": ["json", "jsonpath"]
            }
        }
    }
]

3) A compact agent loop

Ask GPT‑5 to plan step‑by‑step, call tools, and stop when it reaches a final answer for the automation.

def run_email_to_action_flow(email_text: str):
    system = (
        "You are an automation orchestrator. "
        "Goal: read a support email, decide required checks, call MCPify tools, "
        "and produce: {ticket_update, customer_email_draft, audit_log}.\n"
        "Constraints: obey rate limits, use pagination if needed, "
        "minimize tokens. Use json_query to slice large responses."
    )

    messages = [
        {"role": "system", "content": system},
        {"role": "user", "content": f"Customer email:\n---\n{email_text}\n---\n"}
    ]

    while True:
        resp = client.chat.completions.create(
            model="gpt-5",
            messages=messages,
            tools=TOOLS,
            tool_choice="auto",
            temperature=0.2
        )
        msg = resp.choices[0].message

        # Final answer?
        if not getattr(msg, "tool_calls", None):
            return msg.content

        # Execute tool calls
        tool_results = []
        for call in msg.tool_calls:
            name = call.function.name
            args = json.loads(call.function.arguments or "{}")

            try:
                if name == "mcpify_call":
                    result = call_mcpify(args["service"], args["operation_id"], args["params"])
                elif name == "json_query":
                    url = f"{BRIDGE_URL}/tools/json/query"
                    headers = {"Authorization": f"Bearer {BRIDGE_API_KEY}", "Content-Type": "application/json"}
                    r = requests.post(url, headers=headers, data=json.dumps(args), timeout=30)
                    r.raise_for_status()
                    result = r.json()
                else:
                    result = {"error": f"Unknown tool {name}"}
            except Exception as e:
                result = {"error": str(e)}

            tool_results.append({"tool_call_id": call.id, "name": name, "result": result})

        # Return tool outputs so GPT-5 can continue reasoning
        for tr in tool_results:
            messages.append({
                "role": "tool",
                "tool_call_id": tr["tool_call_id"],
                "name": tr["name"],
                "content": json.dumps(tr["result"])
            })

        time.sleep(0.1)  # optional throttle

4) Prompting GPT‑5 to plan and paginate

Encourage the model to think in Plan → Actions → Results → Decision → Output form, with explicit pagination and caching.

PLANNING_HINTS = """
- Plan the minimal set of calls you need.
- Use explicit pagination: set page_size and track next_page_token.
- For large JSON, call json_query to extract only the fields you need.
- Produce a final JSON with {ticket_update, customer_email_draft, audit_log}.
"""

sample_email = """
Hi team, this is Jamie at Acme. Order #84721 was due yesterday but the portal shows 'awaiting stock'.
Can you confirm ETA or upgrade shipping? This is urgent for our client demo Friday.
"""

final = run_email_to_action_flow(sample_email + "\n" + PLANNING_HINTS)
print(final)

What you'll see

  • The model typically calls the crm___getCustomerByEmail, orders___getOrderById, and inventory___getSku tools (through mcpify_call).
  • If orders___getOrderById returns a long history, it calls json_query to extract just the fields it needs (status, shipBy, tracking).
  • If multiple pages are needed, it iterates with page_token until complete. See Docs: Pagination.
  • It decides a remedy (expedite or alternative SKU), updates the ticket via tickets___update, and drafts a reply via notifications___sendEmail.

Production tips

  • Schema‑first: Rich OpenAPI/GraphQL types are what give the model enough to construct a valid call without trial‑and‑error. MCPify exposes them to the model.
  • Human‑in‑the‑loop: For sensitive actions (refunds, cancellations), require approval. The loop above can return a summary for review.
  • Observability: Ask for MCPify's gateway‑side metrics — latency, errors, and token accounting per tool call — to tune flows.
  • Platform pairing: This approach complements UiPath, Power Automate, Zapier, Make, n8n, and homegrown schedulers. Let those handle triggers and governance; let GPT‑5 + MCPify handle reasoning and tool use.

Summary table: MCPify capabilities for RPA

CapabilityWhy it matters for RPAWhere you'll use it
Tool auto‑generationZero glue code per endpointOnboarding internal and SaaS APIs fast
Rich metadata (schema, examples)Valid calls without trial‑and‑error, predictable planningModel planning and ops governance
JSON navigation toolsFewer tokens, faster reasoningSlice big payloads to only needed fields
Automatic paginationDeterministic iteration on large datasetsLists of orders, tickets, invoices
Per‑tool caching, fresh data on requestControl freshness vs costStatus checks, dashboards, repetitive lookups
Usage and latency data, on requestTroubleshoot and optimizeSRE, FinOps, platform ops

Where to go next


Call to action

Ready to give your bots real decision‑making power? Talk to sales and ship your first email‑to‑action workflow.


Sources

Who This Article Is For

Automation engineers and RPA teams looking to add AI decision‑making to workflows

About the Author

Herman Sjøberg

Herman Sjøberg

AI Integration Expert

Herman excels at assisting businesses in generating value through AI adoption. With expertise in cloud architecture (Azure Solutions Architect Expert), DevOps, and machine learning, he's passionate about making AI integration accessible to everyone through MCPify.

Connect on LinkedIn