Skip to main content

Integrate Langflow with MCP

Langflow integrates with the Model Context Protocol (MCP). This allows you to use your Langflow flows as tools in client applications that support the MCP, or extend Langflow with the MCP server component to access MCP servers.

You can use Langflow as an MCP server with any MCP client.

For configuring interactions between Langflow flows and MCP tools, see Name and describe your flows for agentic use.

To connect MCP Inspector to Langflow for testing and debugging flows, see Install MCP Inspector to test and debug flows.

Access all of your flows as tools

important

Tool names must contain only letters, numbers, underscores, and dashes. Tool names cannot contain spaces. To re-name flows in the Langflow UI, click Flow Name > Edit Details.

Connect an MCP client to Langflow to use your flows as tools.

  1. Install Cursor or Claude for Desktop.
  2. Install uv to run uvx commands. uvx is included with uv in the Langflow package.
  3. Optional: Install an LTS release of Node.js to run npx commands. For an example npx server, see Connect an Astra DB MCP server to Langflow.
  4. Create at least one flow, and note your host. For example, http://127.0.0.1:7860.

In Cursor, you can configure a Langflow server in the same way as other MCP servers. For more information, see the Cursor MCP documentation.

  1. Open Cursor, and then go to Cursor Settings.
  2. Click MCP, and then click Add New Global MCP Server. Cursor's MCP servers are listed as JSON objects.
  3. To add a Langflow server, add an entry for your Langflow server's /v1/mcp/sse endpoint. This example assumes the default Langflow server address of http://127.0.0.1:7860.

_10
{
_10
"mcpServers": {
_10
"langflow": {
_10
"url": "http://127.0.0.1:7860/api/v1/mcp/sse"
_10
}
_10
}
_10
}

  1. Save the mcp.json file, and then click the Reload icon.
  2. Your Langflow server is now available to Cursor as an MCP server, and all of its flows are registered as tools. You can now use your flows as tools in Cursor. Cursor determines when to use tools based on your queries, and requests permissions when necessary.

Name and describe your flows for agentic use

MCP clients like Claude for Desktop and Cursor "see" Langflow as a single MCP server, with all of your flows listed as tools.

This can confuse agents, who don't know that flow adbbf8c7-0a34-493b-90ea-5e8b42f78b66 is a Document Q&A flow for a specific text file. To prevent this behavior, name and describe your flows clearly for agentic use. Imagine your names and descriptions as function names and code comments, with a clear statement of what problem they solve.

For example, you have created a Document Q&A flow that loads a sample resume for an LLM to chat with, and you want Cursor to use the tool.

  1. Click Flow name, and then select Edit Details.
  2. The Name field should make it clear what the flow does, both to a user and to the agent. For example, name it Document QA for Resume.
  3. The Description field should include a description of what the flow does. For example, describe the flow as OpenAI LLM Chat with Alex's resume. The Endpoint Name field does not affect the agent's behavior.
  4. To see how an MCP client understands your flow, in Cursor, examine the MCP Servers. The tool is listed as:

_10
document_qa_for_resume
_10
e967f47d-6783-4bab-b1ea-0aaa554194a3: OpenAI LLM Chat with Alex's resume.

Your flow name and description provided the agent with a clear purpose for the tool.

  1. Ask Cursor a question specifically about the resume, such as What job experience does Alex have?

_10
I'll help you explore a resume using the Document QA for Resume flow, which is specifically designed for analyzing resumes.
_10
Let me call this tool.

  1. Click Run tool to continue. The agent requests permissions when necessary.

_10
Based on the resume, here's a comprehensive breakdown of the experience:

  1. Ask about a different resume. You've provided enough information in the description for the agent to make the correct decision:

_10
I notice you're asking about Emily's job experience.
_10
Based on the available tools, I can see there is a Document QA for Resume flow that's designed for analyzing resumes.
_10
However, the description mentions it's for "Alex's resume" not Emily's. I don't have access to Emily's resume or job experience information.

Install MCP Inspector to test and debug flows

MCP inspector is the standard tool for testing and debugging MCP servers.

Use MCP Inspector to monitor your Langflow server's flows, and understand how they are being consumed by the MCP.

To install and run MCP inspector, follow these steps:

  1. Install an LTS release of Node.js.
  2. To install and start MCP inspector, in a terminal window, run the following command:

_10
npx @modelcontextprotocol/inspector

MCP inspector starts by default at http://localhost:5173.

tip

Optionally, specify a proxy port when starting MCP Inspector:


_10
SERVER_PORT=9000 npx -y @modelcontextprotocol/inspector

  1. In the browser, navigate to MCP Inspector.
  2. To inspect the Langflow server, enter the values for the Langflow server.
  • In the Transport Type field, select SSE.
  • In the URL field, enter the Langflow server's /mcp/sse endpoint. For a default deployment, the URL is http://127.0.0.1:7860/api/v1/mcp/sse.
  1. Click Connect. MCP Inspector connects to the Langflow server.
  2. To confirm the connection, click the Tools tab. The Langflow server's flows are listed as tools, which confirms MCP Inspector is connected. In the Tools tab, you can monitor how your flows are being registered as tools by MCP, and run flows with input values.

To quit MCP Inspector, in the terminal where it's running, enter Ctrl+C.

Search