Deploy LangFlow On A VPS And Build Flows Through MCP
guide2026-06-0210 min read
Run LangFlow as a persistent VPS service, then let Codex or another MCP client create, edit, and run flows through reproducible API calls.
langflowvpsdockermcp
Summary
This note records a practical way to host LangFlow on a VPS and make it useful from an AI coding agent. The server side runs LangFlow in Docker Compose, while the client side usesx-api-key authenticated REST calls and MCP bridges to list flows, create flows, update flow JSON, run flows, and expose a LangFlow project as MCP tools.
All domains, API keys, project IDs, and flow IDs in this post are example values. Replace them with your own values and keep the real secrets out of public notes.
What This Solves
The goal is to turn LangFlow from a browser-only canvas into a server-side automation platform. After deployment, a beginner should understand three layers:- LangFlow server: runs on the VPS and stores flows.
- Public entry point: a domain such as
https://langflow.example.compoints to the server, usually through a reverse proxy such as Caddy or Nginx. - Automation control plane: REST APIs and MCP tools let Codex or another agent create and operate flows without clicking through the browser.
Think of the browser UI as the visual editor and the API/MCP layer as the repeatable control surface. The same flow can be edited on the canvas or updated as JSON.
Who This Is For
This is for a beginner who already has a VPS and wants a persistent LangFlow instance that can be controlled by Codex, Claude Desktop, Cursor, or another MCP-capable client. It assumes you can SSH into a VPS, install Docker, edit acompose.yml file, and set environment variables on your local machine.
Prerequisites
- A VPS with Docker and Docker Compose installed.
- A domain or subdomain, for example
langflow.example.com. - A reverse proxy that can forward HTTPS traffic to LangFlow on port
7860. - A strong LangFlow admin password.
- A long random
LANGFLOW_SECRET_KEY. - A LangFlow API key created from the LangFlow UI.
- Local tools:
curl,jq,uvx, and an MCP-capable client.
The Workflow
Create the server directory
SSH into the VPS and create a dedicated directory:Keeping the deployment in one directory makes it easier to inspect, restart, and back up.
Write the Docker Compose file
Create
compose.yml:LANGFLOW_AUTO_LOGIN=false matters because a public server should require login instead of silently opening the app.Start LangFlow
Start the container:Check the health endpoint:A healthy server returns JSON similar to:
Expose LangFlow through HTTPS
Point your domain to the VPS, then configure a reverse proxy to forward traffic to LangFlow:Reload the proxy after editing the config:Then open:Log in with the superuser credentials from the Compose file.
Create a LangFlow API key
In the LangFlow UI, create an API key and store it locally as an environment variable:Test the API without printing the key:
Create or inspect flows through REST
List existing flows:Create an empty flow:Fetch one flow as JSON:
Edit a flow as JSON
LangFlow stores the canvas as JSON. The safe edit loop is:Save a full updated flow:Use
jq before saving:Expose a LangFlow project as MCP tools
LangFlow can expose a project through an MCP endpoint:Store the project ID in a variable:Bridge the streamable HTTP endpoint into a local MCP server with In a Codex-style MCP config, the same idea looks like this:
mcp-proxy:Use an admin MCP server for direct flow operations
A separate admin MCP server can wrap LangFlow APIs into tools such as With that in place, Codex can call MCP tools instead of manually writing every
list_flows, create_flow, replace_flow, update_flow, run_flow, and langflow_health.The client-side config should point at the remote LangFlow base URL and read the API key from a secret source:curl request.Common Failure Modes
Final Checklist
- LangFlow starts with
docker compose up -d. -
curl http://127.0.0.1:7860/health_checkreturns healthy JSON on the VPS. -
https://langflow.example.comopens through the reverse proxy. - Auto-login is disabled for the public server.
- The API key is stored in an environment variable or secret manager.
-
GET /api/v1/flows/?get_all=trueworks withx-api-key. - Flow JSON is fetched and backed up before editing.
- MCP project endpoint uses
/api/v1/mcp/project/{project_id}/streamable. - Public documentation contains example values, not real domains, API keys, project IDs, or flow IDs.
What To Remember
The durable pattern is: host LangFlow with Docker, put HTTPS in front of it, keep secrets out of the repo, and treat flows as JSON documents that can be created, edited, tested, and run through APIs. MCP then sits on top as a usability layer, letting an AI coding agent operate LangFlow without depending on browser clicks.Metadata
Quick Reference
Typeguide
Statuspublished
Date2026-06-02
Retrieval Tags
langflowvpsdockermcpautomation
Related
LangFlowMCPAPI automationVPS deployment