Integrate Langflow with MCP (Model context protocol)
Langflow integrates with the Model Context Protocol (MCP). This allows you to use your Langflow flows as tools in other applications that support the MCP, or extend Langflow with the MCP stdio component to access MCP servers.
You can use Langflow as an MCP server with any MCP client. For example purposes, this guide presents two ways to interact with the MCP:
- Access all of your flows as tools from Claude for Desktop
- Use the MCP stdio component to connect Langflow to a Datastax Astra DB MCP server
Access all of your flows as tools from Claude for Desktop
-
Install Claude for Desktop.
-
Install uv so that you can run
uvx
commands. -
Create at least one flow, and note your host. For example,
http://127.0.0.1:7863
. -
Open Claude for Desktop, and then go to the program settings. For example, on the MacOS menu bar, click Claude, and then select Settings.
-
In the Settings dialog, click Developer, and then click Edit Config. This creates a
claude_desktop_config.json
file if you don't already have one. -
Add the following code to
claude_desktop_config.json
. Your args may differ for youruvx
andPython
installations. To find the correct paths:- For
uvx
: Runwhich uvx
in your terminal - For Python: Run
which python
in your terminal
- For
Replace /path/to/uvx
and /path/to/python
with the paths from your system:
_12{_12 "mcpServers": {_12 "langflow": {_12 "command": "/bin/sh",_12 "args": ["-c", "/path/to/uvx --python /path/to/python mcp-sse-shim@latest"],_12 "env": {_12 "MCP_HOST": "http://127.0.0.1:7864",_12 "DEBUG": "true"_12 }_12 }_12 }_12}
This code adds a new MCP server called langflow
and starts the mcp-sse-shim package using the specified Python interpreter and uvx.
- Restart Claude for Desktop. Your new tools are available in your chat window. Click the tools icon to see a list of your flows.
You can now use your flows as tools in Claude for Desktop. Claude determines when to use tools based on your queries, and will request permissions when necessary.
Connect an Astra DB MCP server to Langflow
Use the MCP stdio component to connect Langflow to a Datastax Astra DB MCP server.
- Install an LTS release of Node.js.
- Create an OpenAI API key.
- Create an Astra DB Serverless (Vector) database, if you don't already have one.
- Get your database's Astra DB API endpoint and an Astra DB application token with the Database Administrator role. For more information, see Generate an application token for a database.
- Add your Astra DB application token and Astra API endpoint to Langflow as global variables.
- Create a Simple agent starter project.
- Remove the URL tool and replace it with an MCP stdio component component.
The flow should look like this:
- In the MCP stdio component, in the MCP command field, add the following code:
_10npx -y @datastax/astra-db-mcp
- In the Agent component, add your OpenAI API key.
- Open the Playground. Langflow is now connected to your Astra DB database through the MCP. You can use the MCP to create, read, update, and delete data from your database.