Skip to main content
This guide focuses on deploying full mcp-agent applications—projects that use workflows, routers, or multi-agent orchestration. It complements the deployment quickstart with agent-specific advice and links to production-ready examples.

When to use this guide

  • You rely on patterns from Building Effective Agents (router, evaluator-optimizer, orchestrator, swarm).
  • Your workflows call external MCP servers (filesystem, fetch, bespoke services).
  • You need durability (pause/resume, human input, retries) or multiple agents collaborating.
  • You want to expose each workflow as an MCP tool for clients to orchestrate.

Example projects

Clone one of these projects to follow along, or scaffold your own with:

Production-ready checklist

  1. Configexecution_engine: temporal, unique temporal.task_queue, and mcp.servers definitions for all external servers.
  2. Secrets – provider keys in mcp_agent.secrets.yaml, user secrets tagged !user_secret.
  3. Workflows – use WorkflowResult to attach metadata, app.task for reusable steps, and context.logger for progress.
  4. Human inputawait context.request_human_input(...) for approvals; handle resume payloads.
  5. Observability – enable OTEL exporters (otel.enabled: true) and set service_name to identify your app in dashboards.
  6. Resource cleanup – if workflows create files or tickets, add compensating actions to finally blocks or use Temporal activities with retries.

Deployment workflow

Exposing multiple workflows

Every workflow class becomes an MCP tool named workflows-<ClassName>-run. You can expose friendly entrypoints via @app.async_tool as well:
Clients see both:
  • draft_blog_post – easy entrypoint returning {workflow_id, run_id}
  • workflows-BlogAuthorWorkflow-run – low-level interface
  • workflows-get_status, workflows-cancel, workflows-list – generated automatically
Use mcp-agent cloud workflows list to confirm what’s exposed.

Passing data between tasks

  • Use Pydantic models for strong typing (from mcp_agent.executor.workflow import WorkflowResult).
  • Temporal memo is available via WorkflowResult(metadata={"session": "abc"}).
  • For large payloads, store artifacts in external systems (S3, databases) and persist references; avoid payloads that exceed Temporal history limits.

Human-in-the-loop patterns

Users resume with:

Observability for complex agents

  • Attach structured data to logs: context.logger.info("Stage complete", data={"stage": 2}).
  • Enable token counting: token_counter is automatically populated when tracing is on.
  • For long chains, consider writing high-level progress to an external store (Notion, Slack) so operators have context outside the CLI.

Cleanup & rollbacks

  • Redeploying with the same name updates the existing deployment with zero downtime (new containers come online before old ones are drained).
  • Use --git-tag to relate deployments to commits.
  • mcp-agent cloud servers delete <id> removes the runtime; workflows in progress are cancelled.
  • Keep old bundles locally (stored in .mcp-agent/dist/) for debugging.

Next steps