Factory AI MCP Integration

Factory AI MCP Integration

Prompt-first procedure: Describe the outcome you want in your agent conversation. The agent should select and load the appropriate AIWG assets, explain material changes, request any needed approval, and report verification evidence. Exact commands and flags appear only in the CLI reference.

Status: Supported — Factory AI natively supports MCP with both stdio and HTTP transport.


Local Setup (stdio)

The simplest configuration — Factory runs the AIWG MCP server as a local process:

Use AIWG to complete this documented outcome: The simplest configuration — Factory runs the AIWG MCP server as a local process
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

This creates `~/.factory/mcp.json`:

{
  "mcpServers": {
    "aiwg": {
      "type": "stdio",
      "command": "aiwg",
      "args": ["mcp", "serve"],
      "disabled": false
    }
  }
}

Project-Level Configuration

For team-shared MCP config, create `.factory/mcp.json` in your project root:

{
  "mcpServers": {
    "aiwg": {
      "type": "stdio",
      "command": "aiwg",
      "args": ["mcp", "serve"],
      "disabled": false
    }
  }
}

Project-level config is lower priority than user-level — personal overrides apply.


Remote Setup (HTTP)

For environments where Factory droids execute remotely (cloud sessions, CI), use HTTP transport with a tunnel:

With ngrok

Use AIWG to complete this documented outcome: With ngrok
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

With Cloudflare Tunnel

Use AIWG to complete this documented outcome: With Cloudflare Tunnel
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

Configure Factory

{
  "mcpServers": {
    "aiwg": {
      "type": "http",
      "url": "https://your-tunnel-url.ngrok.io",
      "headers": {
        "Authorization": "Bearer ${AIWG_MCP_TOKEN}"
      },
      "disabled": false
    }
  }
}

Configuration Schema

FieldApplies ToDescription
`type`Both`"stdio"` or `"http"`
`disabled`BothBoolean toggle (default: `false`)
`disabledTools`BothArray of specific tool names to exclude
`command`stdioExecutable to run
`args`stdioArray of arguments
`env`stdioEnvironment variable map (supports `${VAR}` expansion)
`url`httpRemote endpoint URL
`headers`httpHTTP headers (e.g., auth tokens)

Config File Locations

LevelPathPriority
User`~/.factory/mcp.json`Higher — personal overrides
Project`.factory/mcp.json`Lower — team-shared, commit to git

MCP Registry

Factory includes a built-in registry of 40+ pre-configured MCP servers:

/mcp

Browse and install servers for:

CategoryExamples
Dev ToolsSentry, Playwright, Hugging Face
Project MgmtNotion, Linear, ClickUp, Monday
PaymentsStripe, PayPal
DesignFigma, Canva
InfrastructureNetlify, Vercel
DataAirtable, HubSpot, MongoDB

OAuth-based servers use a browser-prompt flow with tokens stored in the system keyring.


AIWG MCP Tools Exposed

When connected, Factory droids gain access to AIWG MCP tools:

ToolPurpose
`discover`Find AIWG capabilities
`command-run`Execute allow-listed AIWG CLI commands
`artifact-read`Read from `.aiwg/` artifact directory
`artifact-write`Write to `.aiwg/` artifact directory
`template-render`Render AIWG templates
`agent-list`List available agents

`workflow-run` has been removed. Use `command-run` for general AIWG CLI execution, or enable `AIWG_MCP_TOOLSETS=flows,missions` for first-class Flow and Mission tools.


Troubleshooting

MCP not connecting?

/mcp
# Check AIWG server status — toggle disabled/enabled

Stdio server not starting?

Use AIWG to complete this documented outcome: Stdio server not starting?
Have it inspect the current state, explain the plan, ask before material
changes, and report the result with verification evidence.

HTTP transport issues?

# Test tunnel connectivity
curl https://your-tunnel-url.ngrok.io/health