From 744df31f182dadaec583b3a5558a72956929312b Mon Sep 17 00:00:00 2001 From: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Date: Tue, 6 May 2025 12:41:07 -0400 Subject: [PATCH] docs: v1.4 features (#7778) * bump-supported-version-to-1.4.x * overview-page * small-naming-changes * change-folders-to-projects * api-examples-folder-to-projects * more * update-screenshots-and-text * sidebars * npx-astra-command * move-and-redirect-outdated-page * sidebars * tools-and-env-var * language * authentication * flow-description-and-tool * mcp-component-astra-db * rename-page * cleanup * update-message * update-for-client-strategy * sse-port-7868-and-api-key-creation * external-deploy * init-ngrok * add-ngrok-deploy * cleanup * cleanup * Minor capitalization fix * Fix message object anchors * Fix indentation of MCP server procedure * Add anchor link for MCP SSE mode * Mild cleanup of concepts overview * Fix indentation issues in mcp-component-astra * Use universal date format on luna-for-langflow * Update mcp-server doc * fix-missed-bracket * change-npx-to-uvx-mcp-proxy * update-screenshots-for-uvx * inspector-with-auth * Apply suggestions from code review Co-authored-by: Eric Schneider <37347760+eric-schneider@users.noreply.github.com> --------- Co-authored-by: Deon Sanchez <69873175+deon-sanchez@users.noreply.github.com> Co-authored-by: Eric Schneider <37347760+eric-schneider@users.noreply.github.com> Co-authored-by: Lucas Oliveira --- .../api-reference-api-examples.md | 67 +++- .../Components/components-embedding-models.md | 2 +- docs/docs/Components/components-io.md | 6 +- docs/docs/Components/components-tools.md | 49 ++- docs/docs/Concepts/concepts-components.md | 4 + docs/docs/Concepts/concepts-overview.md | 63 ++-- docs/docs/Concepts/concepts-publish.md | 6 +- docs/docs/Concepts/mcp-server.md | 302 ++++++++++++++++++ docs/docs/Develop/develop-overview.md | 10 +- docs/docs/Develop/webhook.md | 2 +- .../docs/Integrations/MCP/integrations-mcp.md | 185 ----------- .../Integrations/MCP/mcp-component-astra.md | 40 --- docs/docs/Integrations/mcp-component-astra.md | 64 ++++ docs/docs/Support/luna-for-langflow.md | 4 +- docs/docusaurus.config.js | 6 +- docs/sidebars.js | 14 +- docs/static/img/component-mcp-astra-db.png | Bin 0 -> 1014720 bytes docs/static/img/component-mcp-sse-mode.png | Bin 0 -> 879234 bytes docs/static/img/component-mcp-stdio.png | Bin 0 -> 1043690 bytes docs/static/img/mcp-server-actions.png | Bin 0 -> 342720 bytes docs/static/img/mcp-server-api-key.png | Bin 0 -> 567963 bytes docs/static/img/mcp-server-component-sse.png | Bin 178493 -> 0 bytes docs/static/img/mcp-server-component.png | Bin 383706 -> 0 bytes docs/static/img/mcp-server.png | Bin 0 -> 546927 bytes docs/static/img/my-projects.png | Bin 406915 -> 392220 bytes docs/static/img/workspace-basic-prompting.png | Bin 600305 -> 1145598 bytes docs/static/img/workspace.png | Bin 299092 -> 626114 bytes 27 files changed, 516 insertions(+), 308 deletions(-) create mode 100644 docs/docs/Concepts/mcp-server.md delete mode 100644 docs/docs/Integrations/MCP/integrations-mcp.md delete mode 100644 docs/docs/Integrations/MCP/mcp-component-astra.md create mode 100644 docs/docs/Integrations/mcp-component-astra.md create mode 100644 docs/static/img/component-mcp-astra-db.png create mode 100644 docs/static/img/component-mcp-sse-mode.png create mode 100644 docs/static/img/component-mcp-stdio.png create mode 100644 docs/static/img/mcp-server-actions.png create mode 100644 docs/static/img/mcp-server-api-key.png delete mode 100644 docs/static/img/mcp-server-component-sse.png delete mode 100644 docs/static/img/mcp-server-component.png create mode 100644 docs/static/img/mcp-server.png diff --git a/docs/docs/API-Reference/api-reference-api-examples.md b/docs/docs/API-Reference/api-reference-api-examples.md index 08c070e58..2d10f52ef 100644 --- a/docs/docs/API-Reference/api-reference-api-examples.md +++ b/docs/docs/API-Reference/api-reference-api-examples.md @@ -32,14 +32,14 @@ export FLOW_ID="359cd752-07ea-46f2-9d3b-a4407ef618da" ``` - Export the `project-id` in your terminal. - To find your project ID, call the Langflow [/api/v1/projects/](#read-projects) endpoint for a list of projects. - +To find your project ID, call the Langflow [/api/v1/projects/](#read-projects) endpoint for a list of projects. ```bash curl -X GET \ + "$LANGFLOW_URL/api/v1/projects/" \ "$LANGFLOW_URL/api/v1/projects/" \ -H "accept: application/json" ``` @@ -50,7 +50,7 @@ curl -X GET \ [ { "name": "My Projects", - "description": "Manage your own flows. Download and upload projects.", + "description": "Manage your own projects. Download and upload projects.", "id": "1415de42-8f01-4f36-bf34-539f23e47466", "parent_id": null } @@ -59,8 +59,9 @@ curl -X GET \ Export the `project-id` as an environment variable. +Export the `project-id` as an environment variable. ```bash -export PROJECT_ID="1415de42-8f01-4f36-bf34-539f23e47466" +export project_ID="1415de42-8f01-4f36-bf34-539f23e47466" ``` - Export the Langflow API key as an environment variable. @@ -1053,7 +1054,7 @@ To retrieve only the flows from a specific project, pass `project_id` in the que ```bash curl -X GET \ - "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=$PROJECT_ID&header_flows=false&page=1&size=1" \ + "$LANGFLOW_URL/api/v1/flows/?remove_example_flows=true&components_only=false&get_all=false&project_id=$project_ID&header_flows=false&page=1&size=1" \ -H "accept: application/json" ``` @@ -1122,6 +1123,7 @@ curl -X PATCH \ "description": "string", "data": {}, "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "endpoint_name": "my_new_endpoint_name", "locked": true }' @@ -1147,6 +1149,7 @@ curl -X PATCH \ "id": "01ce083d-748b-4b8d-97b6-33adbb6a528a", "user_id": "f58396d4-a387-4bb8-b749-f40825c3d9f3", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } ``` @@ -1210,6 +1213,7 @@ curl -X POST \ "locked": false, "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }, { "name": "string", @@ -1228,6 +1232,7 @@ curl -X POST \ "locked": false, "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" + "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } ] }' @@ -1258,7 +1263,7 @@ This example uploads a local file named `agent-with-astra-db-tool.json`. ```bash curl -X POST \ - "$LANGFLOW_URL/api/v1/flows/upload/?project_id=$PROJECT_ID" \ + "$LANGFLOW_URL/api/v1/flows/upload/?project_id=$project_ID" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ -F "file=@agent-with-astra-db-tool.json;type=application/json" @@ -1284,12 +1289,14 @@ curl -X POST \ +To specify a target project for the flow, include the query parameter `project_id`. +The target `project_id` must already exist before uploading a flow. Call the [/api/v1/projects/](#read-projects) endpoint for a list of available projects. To specify a target project for the flow, include the query parameter `project_id`. The target `project_id` must already exist before uploading a flow. Call the [/api/v1/projects/](#read-projects) endpoint for a list of available projects. ```bash curl -X POST \ - "$LANGFLOW_URL/api/v1/flows/upload/?project_id=$PROJECT_ID" \ + "$LANGFLOW_URL/api/v1/flows/upload/?project_id=$project_ID" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ -F "file=@agent-with-astra-db-tool.json;type=application/json" @@ -1353,6 +1360,8 @@ A list of example flows. ## Projects +## Projects + Use the `/projects` endpoint to create, read, update, and delete projects. Projects store your flows and components. @@ -1366,6 +1375,7 @@ Get a list of Langflow projects. ```bash curl -X GET \ + "$LANGFLOW_URL/api/v1/projects/" \ "$LANGFLOW_URL/api/v1/projects/" \ -H "accept: application/json" ``` @@ -1377,7 +1387,7 @@ curl -X GET \ [ { "name": "My Projects", - "description": "Manage your own flows. Download and upload projects.", + "description": "Manage your own projects. Download and upload projects.", "id": "1415de42-8f01-4f36-bf34-539f23e47466", "parent_id": null } @@ -1389,6 +1399,9 @@ curl -X GET \ ### Create project +### Create project + +Create a new project. Create a new project. @@ -1396,11 +1409,13 @@ Create a new project. ```bash curl -X POST \ + "$LANGFLOW_URL/api/v1/projects/" \ "$LANGFLOW_URL/api/v1/projects/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": "new_project_name", + "name": "new_project_name", "description": "string", "components_list": [], "flows_list": [] @@ -1412,6 +1427,7 @@ curl -X POST \ ```json { + "name": "new_project_name", "name": "new_project_name", "description": "string", "id": "b408ddb9-6266-4431-9be8-e04a62758331", @@ -1422,17 +1438,21 @@ curl -X POST \ +To add flows and components at project creation, retrieve the `components_list` and `flows_list` values from the [/api/v1/store/components](#get-all-components) and [/api/v1/flows/read](#read-flows) endpoints and add them to the request body. To add flows and components at project creation, retrieve the `components_list` and `flows_list` values from the [/api/v1/store/components](#get-all-components) and [/api/v1/flows/read](#read-flows) endpoints and add them to the request body. +Adding a flow to a project moves the flow from its previous location. The flow is not copied. Adding a flow to a project moves the flow from its previous location. The flow is not copied. ```bash curl -X POST \ + "$LANGFLOW_URL/api/v1/projects/" \ "$LANGFLOW_URL/api/v1/projects/" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "name": "new_project_name", + "name": "new_project_name", "description": "string", "components_list": [ "3fa85f64-5717-4562-b3fc-2c963f66afa6" @@ -1445,8 +1465,12 @@ curl -X POST \ ### Read project +### Read project + +Retrieve details of a specific project. Retrieve details of a specific project. +To find the UUID of your project, call the [read projects](#read-projects) endpoint. To find the UUID of your project, call the [read projects](#read-projects) endpoint. @@ -1454,7 +1478,7 @@ To find the UUID of your project, call the [read projects](#read-projects) endpo ```bash curl -X GET \ - "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \ + "$LANGFLOW_URL/api/v1/projects/$project_ID" \ -H "accept: application/json" ``` @@ -1464,8 +1488,8 @@ curl -X GET \ ```json [ { - "name": "My projects", - "description": "Manage your own flows. Download and upload projects.", + "name": "My Projects", + "description": "Manage your own projects. Download and upload projects.", "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "parent_id": null } @@ -1477,8 +1501,12 @@ curl -X GET \ ### Update project +### Update project + +Update the information of a specific project with a `PATCH` request. Update the information of a specific project with a `PATCH` request. +Each PATCH request updates the project with the values you send. Each PATCH request updates the project with the values you send. Only the fields you include in your request are updated. If you send the same values multiple times, the update is still processed, even if the values are unchanged. @@ -1488,6 +1516,7 @@ If you send the same values multiple times, the update is still processed, even ```bash curl -X PATCH \ + "$LANGFLOW_URL/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331" \ "$LANGFLOW_URL/api/v1/projects/b408ddb9-6266-4431-9be8-e04a62758331" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ @@ -1521,6 +1550,9 @@ curl -X PATCH \ ### Delete project +### Delete project + +Delete a specific project. Delete a specific project. @@ -1528,7 +1560,7 @@ Delete a specific project. ```bash curl -X DELETE \ - "$LANGFLOW_URL/api/v1/projects/$PROJECT_ID" \ + "$LANGFLOW_URL/api/v1/projects/$project_ID" \ -H "accept: */*" ``` @@ -1544,6 +1576,9 @@ curl -X DELETE \ ### Download project +### Download project + +Download all flows from a project as a zip file. Download all flows from a project as a zip file. The `--output` flag is optional. @@ -1553,9 +1588,11 @@ The `--output` flag is optional. ```bash curl -X GET \ + "$LANGFLOW_URL/api/v1/projects/download/b408ddb9-6266-4431-9be8-e04a62758331" \ "$LANGFLOW_URL/api/v1/projects/download/b408ddb9-6266-4431-9be8-e04a62758331" \ -H "accept: application/json" \ --output langflow-project.zip + --output langflow-project.zip ``` @@ -1563,6 +1600,7 @@ curl -X GET \ ```text The project contents. +The project contents. ``` @@ -1570,6 +1608,9 @@ The project contents. ### Upload project +### Upload project + +Upload a project to Langflow. Upload a project to Langflow. @@ -1577,6 +1618,7 @@ Upload a project to Langflow. ```bash curl -X POST \ + "$LANGFLOW_URL/api/v1/projects/upload/" \ "$LANGFLOW_URL/api/v1/projects/upload/" \ -H "accept: application/json" \ -H "Content-Type: multipart/form-data" \ @@ -1589,6 +1631,7 @@ curl -X POST \ ```text The project contents are uploaded to Langflow. +The project contents are uploaded to Langflow. ``` diff --git a/docs/docs/Components/components-embedding-models.md b/docs/docs/Components/components-embedding-models.md index ecbe4dfb2..8c6801ef1 100644 --- a/docs/docs/Components/components-embedding-models.md +++ b/docs/docs/Components/components-embedding-models.md @@ -354,7 +354,7 @@ This value is set as the `OLLAMA_HOST` environment variable in Ollama. The defau 2. To refresh the server's list of models, click . 3. In the **Ollama Model** field, select an embeddings model. This example uses `all-minilm:latest`. 4. Connect the **Ollama** embeddings component to a flow. -For example, this flow connects a local Ollama server running a `all-minilm:latest` embeddings model to a [Chroma DB](/components-vector-stores#chroma) vector store to generate embeddings for split text. +For example, this flow connects a local Ollama server running a `all-minilm:latest` embeddings model to a [Chroma DB](/components-vector-stores#chroma-db) vector store to generate embeddings for split text. ![Ollama embeddings connected to Chroma DB](/img/component-ollama-embeddings-chromadb.png) diff --git a/docs/docs/Components/components-io.md b/docs/docs/Components/components-io.md index b8ab58335..93540392b 100644 --- a/docs/docs/Components/components-io.md +++ b/docs/docs/Components/components-io.md @@ -19,7 +19,7 @@ The **Chat Input** component provides an interactive chat interface in the **Pla ## Chat Input -This component collects user input as `Text` strings from the chat and wraps it in a [Message](/concepts-objects) object that includes the input text, sender information, session ID, file attachments, and styling properties. +This component collects user input as `Text` strings from the chat and wraps it in a [Message](/concepts-objects#message-object) object that includes the input text, sender information, session ID, file attachments, and styling properties. It can optionally store the message in a chat history. @@ -115,7 +115,7 @@ The component accepts the following input types. ## Text Output -The **Text Output** takes a single input of text and returns a [Message](/concepts-objects) object containing that text. +The **Text Output** takes a single input of text and returns a [Message](/concepts-objects#message-object) object containing that text. The output does not appear in the **Playground**. @@ -133,7 +133,7 @@ The output does not appear in the **Playground**. ## Chat components example flow -1. To use the **Chat Input** and **Chat Output** components in a flow, connect them to components that accept or send the [Message](/concepts-objects#message) type. +1. To use the **Chat Input** and **Chat Output** components in a flow, connect them to components that accept or send the [Message](/concepts-objects#message-object) type. For this example, connect a **Chat Input** component to an **OpenAI** model component's **Input** port, and then connect the **OpenAI** model component's **Message** port to the **Chat Output** component. diff --git a/docs/docs/Components/components-tools.md b/docs/docs/Components/components-tools.md index 62da77f2a..b756d01c9 100644 --- a/docs/docs/Components/components-tools.md +++ b/docs/docs/Components/components-tools.md @@ -188,6 +188,7 @@ This component allows you to evaluate basic arithmetic expressions. It supports ## Combinatorial Reasoner This component runs Icosa's Combinatorial Reasoning (CR) pipeline on an input to create an optimized prompt with embedded reasons. For more information, see [Icosa Computing](https://www.icosacomputing.com/). + ### Inputs | Name | Display Name | Description | @@ -309,40 +310,62 @@ This component allows you to call the Serper.dev Google Search API. ## MCP server -This component connects to a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server and exposes the MCP server's tools as tools. +This component connects to a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server and exposes the MCP server's tools as tools for Langflow agents. -In addition to being an MCP client that can leverage MCP servers, Langflow is also an MCP server that exposes flows as tools through the `/api/v1/mcp/sse` API endpoint. For more information, see [MCP integrations](/integrations-mcp). +In addition to being an MCP client that can leverage MCP servers, the MCP component's [SSE mode](#mcp-sse-mode) allows you to connect your flow to the Langflow MCP server at the `/api/v1/mcp/sse` API endpoint, exposing all flows within your [project](/concepts-overview#projects) as tools within a flow. To use the MCP server component with an agent component, follow these steps: 1. Add the MCP server component to your workflow. + 2. In the MCP server component, in the **MCP Command** field, enter the command to start your MCP server. For example, to start a [Fetch](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch) server, the command is: -```bash -uvx mcp-server-fetch -``` + ```bash + uvx mcp-server-fetch + ``` -`uvx` is included with `uv` in the Langflow package. -To use `npx` server commands, you must first install an LTS release of [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). -For an example of starting `npx` MCP servers, see [Connect an Astra DB MCP server to Langflow](/mcp-component-astra). + `uvx` is included with `uv` in the Langflow package. + To use `npx` server commands, you must first install an LTS release of [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). + For an example of starting `npx` MCP servers, see [Connect an Astra DB MCP server to Langflow](/mcp-component-astra). + + To include environment variables with your server command, add them to the **Env** field like this: + + ```bash + ASTRA_DB_APPLICATION_TOKEN=AstraCS:... + ``` + + :::important + Langflow passes environment variables from the `.env` file to MCP, but not global variables declared in the UI. + To add a value for an environment variable as a global variable, add it to Langflow's `.env` file at startup. + For more information, see [global variables](/configuration-global-variables). + ::: 3. Click to get the server's list of **Tools**. + 4. In the **Tool** field, select the server tool you want the component to use. The available fields change based on the selected tool. For information on the parameters, see the MCP server's documentation. + 5. In the MCP server component, enable **Tool mode**. Connect the MCP server component's **Toolset** port to an **Agent** component's **Tools** port. -The flow looks similar to this: -![MCP server component](/img/mcp-server-component.png) + The flow looks similar to this: + ![MCP server component](/img/component-mcp-stdio.png) 6. Open the **Playground**. Ask the agent to summarize recent tech news. The agent calls the MCP server function `fetch` and returns the summary. This confirms the MCP server is connected, and its tools are being used in Langflow. -For more information, see [MCP integrations](/integrations-mcp). +For more information, see [MCP server](/mcp-server). -### MCP Server-Sent Events (SSE) mode +### MCP Server-Sent Events (SSE) mode {#mcp-sse-mode} + +:::important +If you're using **Langflow for Desktop**, the default address is `http://127.0.0.1:7868/`. +::: + +The MCP component's SSE mode connects your flow to the Langflow MCP server through the component. +This allows you to use all flows within your [project](/concepts-overview#projects) as tools within a flow. 1. In the **MCP Server** component, select **SSE**. A default address appears in the **MCP SSE URL** field. @@ -353,7 +376,7 @@ The default value is `http://localhost:7860/api/v1/mcp/sse`. All of your flows are listed as tools. 5. Enable **Tool Mode**, and then connect the **MCP Server** component to an agent component's tool port. The flow looks like this: -![MCP server component](/img/mcp-server-component-sse.png) +![MCP server component](/img/component-mcp-sse-mode.png) 6. Open the **Playground** and chat with your tool. The agent chooses the correct tool based on your query. diff --git a/docs/docs/Concepts/concepts-components.md b/docs/docs/Concepts/concepts-components.md index 201a4c720..5bcece261 100644 --- a/docs/docs/Concepts/concepts-components.md +++ b/docs/docs/Concepts/concepts-components.md @@ -64,6 +64,8 @@ A component inherits from a base `Component` class that defines its interface an For example, the [Recursive character text splitter](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/components/langchain_utilities/recursive_character.py) is a child of the [LCTextSplitterComponent](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/base/textsplitters/model.py) class. +
+Recursive character text splitter code ```python from typing import Any @@ -126,6 +128,8 @@ class RecursiveCharacterTextSplitterComponent(LCTextSplitterComponent): ``` +
+ Components include definitions for inputs and outputs, which are represented in the UI with color-coded ports. **Input Definition:** Each input (like `IntInput` or `DataInput`) specifies an input's type, name, and display properties, which appear as configurable fields in the component's UI panel. diff --git a/docs/docs/Concepts/concepts-overview.md b/docs/docs/Concepts/concepts-overview.md index 343cc58d2..2eb96dbfd 100644 --- a/docs/docs/Concepts/concepts-overview.md +++ b/docs/docs/Concepts/concepts-overview.md @@ -18,17 +18,17 @@ Flows are created in the **workspace** with components dragged from the componen A flow can be as simple as the [basic prompting flow](/get-started-quickstart), which creates an OpenAI chatbot with four components. - Each component in a flow is a **node** that performs a specific task, like an AI model or a data source. -- Each component has a **Configuration** menu. Click the **Code** pane to see a component's underlying Python code. +- Each component has a **Configuration** menu. Click the