Operate LangFlow Long Flow from Localhost and Remote APIs
2026-05-31 · guide · 12 min read
Summary
This guide records the working setup for controlling a LangFlow long flow from Codex through APIs instead of browser automation. The stable local target is one LangFlow server onlocalhost:7860, with the long flow kept in the Starter Project and controlled through x-api-key authenticated REST calls.
What This Solves
The goal is to avoid a messy setup where multiple LangFlow servers run on different ports such as7861, 7863, and 7865. The working rule is simple: run one local LangFlow instance on localhost:7860, point Codex MCP tools at that instance, and use the same API pattern for remote LangFlow when needed.
The current long flow is:
Agent branch for routine runs. It can consume too many tokens and trigger unnecessary tool loading.
Who This Is For
This is for future me using Codex with LangFlow through MCP and REST APIs. It assumes LangFlow is installed locally, an API key exists, and Codex can run shell commands on the same machine. It is also useful when the same long flow must be operated in two places:- Local development on
http://localhost:7860 - Remote service such as
https://langflow.yitwah.site
Prerequisites
- A local LangFlow virtual environment at
/Users/yitwah/langflow-local/.venv - A LangFlow API key available in the shell as
LANGFLOW_API_KEY - Codex MCP configuration at
/Users/yitwah/.codex/config.toml - The long flow already present in LangFlow
curl,jq, and Python available locally- Optional remote LangFlow endpoint, for example
https://langflow.yitwah.site
The Workflow
Run exactly one local LangFlow server
Use Start LangFlow in a detached Confirm health:Expected result:
localhost:7860 as the only local LangFlow port for this long flow. Stop old servers on 7861, 7863, or 7865 before starting the stable one.screen session:Open the Main Flow directly
Avoid loading through the full project dashboard when working on a heavy canvas. Use the direct flow URL:Direct opening avoids some workspace browsing overhead and keeps the workflow focused.
Configure Codex MCP for localhost
Point the starter project MCP proxy at Point the admin MCP at the same local base URL:Store API keys in environment variables or secure config, not in guide text.
localhost:7860:Run or minimally build the flow through API
Run the flow:For a lighter test, build only until a specific component:The build endpoint returns a job ID. Stream events like this:
Operate the remote LangFlow with the same pattern
For remote work, change only the base URL and API key source:Then use:Remote MCP streamable endpoint pattern:
Common Failure Modes
Final Checklist
-
curl http://127.0.0.1:7860/health_checkreturns{"status":"ok","chat":"ok","db":"ok"} -
7861,7863, and7865are not running old LangFlow servers -
http://localhost:7860/flow/074add69-c4ca-4380-aff6-52b83e0239beopens the long flow -
LANGFLOW_API_KEYis set in the shell or secure Codex config - The MCP starter project URL uses
localhost:7860 - The admin MCP base URL uses
http://localhost:7860 - Agent edge count is
0unless an Agent run is explicitly desired - Remote operations use
LANGFLOW_REMOTE_BASE_URLandLANGFLOW_REMOTE_API_KEY
What To Remember
The durable rule is: one long flow, one local port, one API pattern. Keep local development onlocalhost:7860, use x-api-key for API operations, and do not let heavy Agent branches become part of the default run path.
Metadata
Quick Reference
Type: guide
Tags: langflow · api · mcp · codex · workflow
Related: [[LangFlow]] · [[Codex MCP]] · [[API automation]]
Tags: langflow · api · mcp · codex · workflow
Related: [[LangFlow]] · [[Codex MCP]] · [[API automation]]