Build flows with the LFX MCP server
Use lfx-mcp to connect a coding agent to a running Langflow instance, and then build, validate, and run flows from your terminal.
Your MCP client starts lfx-mcp as a local standard stdio subprocess.
The server calls the Langflow REST API, so flows that the agent creates appear in the Langflow UI.
lfx-mcp differs from these other MCP options:
- Use Langflow as an MCP server: Expose existing flows as tools that clients can call.
- Use Langflow as an MCP client: Call MCP servers from components on the canvas.
For Bob (IBM) and Claude Code, you can also use the guided setup in Langflow under Settings → Langflow MCP Client. For more information, see Langflow MCP Client for coding agents.
Prerequisites
- A running Langflow instance
- A Langflow API key
- An LLM provider API key available in Langflow, typically as a global variable
uv, orlfxinstalled withuv pip install lfx- Claude Code, or another MCP client that supports stdio servers
Connect an agent and build a flow
To connect an agent and create a flow on your Langflow server, follow these steps:
-
Add
lfx-mcpto your MCP client.Use
uvx --from lfx lfx-mcp. There is no standalonelfx-mcppackage on PyPI; the binary ships inside thelfxpackage.To add the server in Claude Code, run:
claude mcp add langflow \
-e LANGFLOW_SERVER_URL=http://localhost:7860 \
-e LANGFLOW_API_KEY=<YOUR_LANGFLOW_API_KEY> \
-- uvx --from lfx lfx-mcpTo add the server in Claude Desktop or another stdio client, create an MCP server entry that runs
lfx-mcpand sets the same environment variables:- uvx (recommended)
- lfx installed
{
"mcpServers": {
"langflow": {
"command": "uvx",
"args": ["--from", "lfx", "lfx-mcp"],
"env": {
"LANGFLOW_SERVER_URL": "http://localhost:7860",
"LANGFLOW_API_KEY": "<YOUR_LANGFLOW_API_KEY>"
}
}
}
}{
"mcpServers": {
"langflow": {
"command": "lfx-mcp",
"env": {
"LANGFLOW_SERVER_URL": "http://localhost:7860",
"LANGFLOW_API_KEY": "<YOUR_LANGFLOW_API_KEY>"
}
}
}
}On macOS, Claude Desktop stores this configuration in
~/Library/Application Support/Claude/claude_desktop_config.json.Variable Description Default LANGFLOW_SERVER_URLURL of your Langflow instance http://localhost:7860LANGFLOW_API_KEYLangflow API key None If you omit
LANGFLOW_API_KEY, the agent can call thelogintool with your Langflow username and password. -
Confirm that the server is registered.
claude mcp listThe output includes an entry similar to the following:
langflow: uvx --from lfx lfx-mcp -
Start the agent, and then ask it to build a flow.
claudeEnter a prompt such as the following:
Create a simple agent chatbot flow in Langflow using OpenAI, validate the flow,
and then run it with the message "What is Langflow?"The agent usually does the following:
- Discovers component types with
search_component_typesordescribe_component_type - Creates the flow in one request with
create_flow_from_spec - Validates connections with
validate_flow - Runs the flow with
run_flow, and then returns the response
The new flow appears in the Langflow UI at your server URL.
The
create_flow_from_spectool accepts a compact text specification for nodes, edges, and configuration:name: My Chatbot
description: A simple chatbot
nodes:
A: ChatInput
B: OpenAIModel
C: ChatOutput
edges:
A.message -> B.input_value
B.text_output -> C.input_value
config:
B.model_name: gpt-4o-miniTo confirm type names and input and output names before you write edges, use
describe_component_type. Connecting throughcomponent_as_toolenables tool mode for agent tool wiring.The MCP client discovers the full tool list from the server. In addition to building and running flows, agents can do the following:
- List, duplicate, rename, export, and delete flows
- Create flows from starter projects
- Batch several tool calls with
$N.fieldreferences between steps - Call
notify_donewhen edits are finished so that the Langflow UI refreshes
- Discovers component types with
See also
Was this page helpful?