Skip to content
Merged
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
dcb26ee
langflow-webhook-auth-enable
mendonk Oct 2, 2025
60ca49e
add-not-contains-filter-operator
mendonk Oct 2, 2025
8b8cf22
does-not-contains-operator
mendonk Oct 2, 2025
6ba6126
less-redundant-explanation
mendonk Oct 2, 2025
282165c
docs: add jq and path selection to data operations (#10083)
mendonk Oct 2, 2025
c64f9ef
Merge branch 'main' into docs-1.7-release
mendonk Oct 2, 2025
e8685bf
Merge branch 'main' into docs-1.7-release
mendonk Oct 6, 2025
f6d3a8b
smart transform historical names
aimurphy Oct 6, 2025
2643550
Merge branch 'main' into docs-1.7-release
aimurphy Oct 6, 2025
cea2d8b
change back to smart transform
aimurphy Oct 6, 2025
24ba1b6
jq expression capitalization/package name
aimurphy Oct 6, 2025
04afb78
small edit for clarity of not contains operator
aimurphy Oct 6, 2025
26897ab
Merge branch 'main' into docs-1.7-release
aimurphy Oct 6, 2025
9d35b93
read/write file component name changes
aimurphy Oct 6, 2025
71becc9
docs: add smart router component (#10097)
mendonk Oct 7, 2025
9374bf0
Merge branch 'main' into docs-1.7-release
mendonk Oct 7, 2025
10d293c
Merge branch 'main' into docs-1.7-release
mendonk Oct 7, 2025
47fc582
docs: screenshot audit (#10166)
mendonk Oct 9, 2025
d86cba8
docs: component paths updates for lfx (#10130)
mendonk Oct 14, 2025
5499647
docs: auto-add projects as MCP servers (#10096)
mendonk Oct 14, 2025
2f171e0
Merge branch 'main' into docs-1.7-release
mendonk Oct 15, 2025
845020d
Merge branch 'main' into docs-1.7-release
mendonk Oct 15, 2025
45bc439
docs: amazon bedrock converse (#10289)
mendonk Oct 15, 2025
653f2c8
docs 1.7 release: add mock data component (#10288)
mendonk Oct 15, 2025
4e467c5
Merge branch 'main' into docs-1.7-release
mendonk Oct 17, 2025
28a384c
Merge branch 'main' into docs-1.7-release
mendonk Oct 28, 2025
5e7eb83
docs: update custom component docs (#10323)
mendonk Oct 28, 2025
055f992
Merge branch 'main' into docs-1.7-release
mendonk Oct 29, 2025
9250a5f
docs: add cometapi back for 1.7 release (#10445)
mendonk Oct 29, 2025
83dc0fc
Merge branch 'main' into docs-1.7-release
mendonk Nov 3, 2025
e329cba
docs: add back docling remote vlm for release 1.7 (#10489)
mendonk Nov 3, 2025
514ef3c
Merge branch 'main' into docs-1.7-release
mendonk Nov 3, 2025
642edd3
Merge branch 'main' into docs-1.7-release
mendonk Nov 4, 2025
79d82bf
Merge branch 'main' into docs-1.7-release
mendonk Nov 5, 2025
280c699
Merge branch 'main' into docs-1.7-release
mendonk Nov 6, 2025
7e693dd
docs: ALTK component (#10511)
mendonk Nov 6, 2025
a9497ea
Merge branch 'main' into docs-1.7-release
mendonk Nov 10, 2025
a636eee
Merge branch 'main' into docs-1.7-release
mendonk Nov 12, 2025
10edcc8
docs: SSRF warning (#10573)
mendonk Nov 12, 2025
c11c434
docs: dynamic create data component (#10517)
mendonk Nov 13, 2025
d13fca7
Merge branch 'main' into docs-1.7-release
mendonk Nov 13, 2025
f11b7b1
Merge branch 'main' into docs-1.7-release
mendonk Nov 13, 2025
aefa976
docs: cuga component bundle (#10589)
mendonk Nov 17, 2025
2c24192
Merge branch 'main' into docs-1.7-release
mendonk Nov 17, 2025
001c312
Merge branch 'docs-1.7-release' of https://github.com/langflow-ai/lan…
mendonk Nov 17, 2025
8665757
Merge branch 'main' into docs-1.7-release
mendonk Nov 17, 2025
81ecaf2
Merge branch 'main' into docs-1.7-release
mendonk Nov 17, 2025
a6f5b21
docs: remove docling vlm component from 1.7 release branch (#10630)
mendonk Nov 18, 2025
b784aa8
docs: rename component categories and make all components single page…
mendonk Nov 19, 2025
f3d38a3
Merge branch 'main' into docs-1.7-release
mendonk Nov 19, 2025
6c58c1e
Merge branch 'main' into docs-1.7-release
mendonk Nov 19, 2025
8fa17ca
docs: combined web search component (#10664)
mendonk Nov 20, 2025
16c1176
docs: add altk reflection component (#10660)
mendonk Nov 20, 2025
7de255e
Merge branch 'main' into docs-1.7-release
mendonk Nov 20, 2025
c388162
Merge branch 'main' into docs-1.7-release
mendonk Nov 20, 2025
9e4b217
docs: mcp streamable http client (#10621)
mendonk Nov 21, 2025
db28db0
Merge branch 'main' into docs-1.7-release
mendonk Nov 21, 2025
5c84d8d
Merge branch 'main' into docs-1.7-release
mendonk Nov 21, 2025
1d49247
Merge branch 'main' into docs-1.7-release
mendonk Nov 21, 2025
5e9a449
Merge branch 'docs-1.7-release' of https://github.com/langflow-ai/lan…
mendonk Nov 21, 2025
13da761
docs: add cuga decomposition strategy as advanced parameter (#10672)
mendonk Nov 21, 2025
cb6fa13
docs: datastax bundles page (#10686)
mendonk Nov 24, 2025
931c2db
docs: llm router changed to llm selector (#10663)
mendonk Nov 24, 2025
2d434ff
Merge branch 'main' into docs-1.7-release
mendonk Nov 24, 2025
b5064e0
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 24, 2025
566b03b
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Nov 24, 2025
145c8a0
[autofix.ci] apply automated fixes (attempt 3/3)
autofix-ci[bot] Nov 24, 2025
76cb571
Merge branch 'main' into docs-1.7-release
mendonk Nov 24, 2025
af44766
docs: log alembic to stdout (#10711)
mendonk Nov 24, 2025
3ad76af
Merge branch 'main' into docs-1.7-release
mendonk Nov 25, 2025
ca3b93c
remove-legacy-component-link
mendonk Nov 25, 2025
f96ba98
docs: configure s3 for file storage backend (#10678)
mendonk Nov 25, 2025
cfe94fd
Merge branch 'main' into docs-1.7-release
mendonk Nov 25, 2025
ff88737
Merge branch 'main' into docs-1.7-release
mendonk Dec 1, 2025
49119f1
Merge branch 'main' into docs-1.7-release
mendonk Dec 2, 2025
f09e59c
Merge branch 'main' into docs-1.8-release
mendonk Dec 12, 2025
d0b179d
Merge branch 'main' into docs-1.8-release
mendonk Dec 29, 2025
7ccc8fc
Merge branch 'main' into docs-1.8-release
mendonk Jan 6, 2026
025bb8b
Merge branch 'main' into docs-1.8-release
mendonk Jan 7, 2026
3142b2e
docs: allow rest tweaks to mcp tools component (#10833)
mendonk Jan 7, 2026
a7c348c
Merge branch 'main' into docs-1.8-release
mendonk Jan 7, 2026
4529bc7
Merge branch 'main' into docs-1.8-release
mendonk Jan 8, 2026
89e2589
add-release-note
mendonk Jan 8, 2026
dac5862
Merge branch 'main' into docs-1.8-release
mendonk Jan 9, 2026
0ba3742
Merge branch 'main' into docs-1.8-release
mendonk Jan 13, 2026
beab013
Merge branch 'main' into docs-1.8-release
mendonk Jan 13, 2026
4ea2bac
Merge branch 'main' into docs-1.8-release
mendonk Jan 14, 2026
941337a
docs: use mustache templates in prompts (#11262)
mendonk Jan 14, 2026
612524b
Merge branch 'main' into docs-1.8-release
mendonk Jan 14, 2026
ad83cb3
docs: smart transform supports Message type (#11306)
mendonk Jan 14, 2026
5731c31
Merge branch 'main' into docs-1.8-release
mendonk Jan 15, 2026
5abf7e3
Merge branch 'main' into docs-1.8-release
mendonk Jan 15, 2026
0bd25ab
docs: modular dependency imports for langflow-base (#11250)
mendonk Jan 16, 2026
5e96170
Merge branch 'main' into docs-1.8-release
mendonk Jan 16, 2026
73c03a4
docs: symmetric and asymmetric JWT (#11159)
mendonk Jan 16, 2026
60fff6f
docs: add markdown output to url component (#11336)
mendonk Jan 20, 2026
fb2932a
Merge branch 'main' into docs-1.8-release
mendonk Jan 20, 2026
e6d8dcb
Merge branch 'main' into docs-1.8-release
mendonk Jan 20, 2026
771a552
Merge branch 'main' into docs-1.8-release
mendonk Jan 21, 2026
f02ac25
Merge branch 'main' into docs-1.8-release
mendonk Jan 22, 2026
cc4d0e2
docs: Add global variable support for MCP server headers (#11397)
mendonk Jan 22, 2026
d38ffd5
Merge branch 'main' into docs-1.8-release
mendonk Jan 22, 2026
63c034c
Merge branch 'main' into docs-1.8-release
mendonk Jan 22, 2026
6cdeab6
Update docs/docs/Develop/install-custom-dependencies.mdx
mendonk Jan 22, 2026
2c66ad7
Update docs/docs/Develop/jwt-authentication.mdx
mendonk Jan 22, 2026
eee04bc
Merge branch 'main' into docs-1.8-release
mendonk Jan 22, 2026
92ea645
Merge branch 'main' into docs-1.8-release
mendonk Jan 26, 2026
591859c
Merge branch 'main' into docs-1.8-release
mendonk Jan 27, 2026
ed45c91
Merge branch 'main' into docs-1.8-release
mendonk Jan 27, 2026
c6f4c24
Merge branch 'main' into docs-1.8-release
mendonk Jan 28, 2026
5737d84
Merge branch 'main' into docs-1.8-release
mendonk Feb 2, 2026
92adb19
Merge branch 'main' into docs-1.8-release
mendonk Feb 3, 2026
7e689a3
Merge branch 'main' into docs-1.8-release
mendonk Feb 4, 2026
0f7b3bf
Merge branch 'main' into docs-1.8-release
mendonk Feb 5, 2026
15af147
Merge branch 'main' into docs-1.8-release
mendonk Feb 5, 2026
99fb5c4
Merge branch 'main' into docs-1.8-release
mendonk Feb 6, 2026
cdacc17
Merge branch 'main' into docs-1.8-release
mendonk Feb 6, 2026
703bb8a
docs: global model provider feature (#11231)
mendonk Feb 9, 2026
1e80bba
Merge branch 'main' into docs-1.8-release
mendonk Feb 10, 2026
d3c9d8d
mustache-limitations
mendonk Feb 10, 2026
6aeae8e
release-note-for-jwt
mendonk Feb 10, 2026
eba4764
docs: playground refactor and screenshots (#11639)
mendonk Feb 10, 2026
d99eee6
docs: component inspection panel (#11675)
mendonk Feb 10, 2026
9a5885a
docs: add tool shortlisting and remove web_apps from CUGA component (…
mendonk Feb 10, 2026
64e4328
fix-details-tab-error
mendonk Feb 10, 2026
cfe78c7
docs: workflow API draft build (#11323)
mendonk Feb 10, 2026
9e545d2
Merge branch 'main' into docs-1.8-release
mendonk Feb 10, 2026
ca9dbf0
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 10, 2026
800b74e
docs: add guardrails component (#11674)
mendonk Feb 10, 2026
9fa5ad9
docs: pass env var to run command and endpoint as header (#11447)
mendonk Feb 10, 2026
e933faf
docs: responses api token usage tracking (#11564)
mendonk Feb 10, 2026
0e513a9
Merge branch 'main' into docs-1.8-release
mendonk Feb 11, 2026
ad457f6
Merge branch 'main' into docs-1.8-release
mendonk Feb 11, 2026
85e456b
changes-for-accessing-advanced-parameters
mendonk Feb 12, 2026
4e1b5a1
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 12, 2026
fb3ba4d
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] Feb 12, 2026
484531b
small-playground-changes
mendonk Feb 12, 2026
ba0b18c
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 12, 2026
17062f3
Merge branch 'main' into docs-1.8-release
mendonk Feb 13, 2026
4a03060
Merge branch 'main' into docs-1.8-release
mendonk Feb 17, 2026
d1bc265
Merge branch 'main' into docs-1.8-release
mendonk Feb 18, 2026
ede17f3
Merge branch 'main' into docs-1.8-release
mendonk Feb 18, 2026
8c7fe82
Merge branch 'main' into docs-1.8-release
mendonk Feb 18, 2026
96a9c5a
Revert "docs: OpenAPI spec content updated without version change (#1…
mendonk Feb 18, 2026
5b6ba24
Merge branch 'main' into docs-1.8-release
mendonk Feb 23, 2026
a7f743a
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 23, 2026
321a38d
Merge branch 'main' into docs-1.8-release
mendonk Feb 26, 2026
e145385
Merge branch 'main' into docs-1.8-release
mendonk Feb 27, 2026
4866a72
Merge branch 'main' into docs-1.8-release
mendonk Mar 2, 2026
691b824
docs: add LiteLLM proxy bundle (#11867)
mendonk Mar 2, 2026
b013100
Merge branch 'main' into docs-1.8-release
mendonk Mar 2, 2026
661fa45
Merge branch 'main' into docs-1.8-release
mendonk Mar 2, 2026
12ed4e4
Merge branch 'main' into docs-1.8-release
mendonk Mar 3, 2026
af745d2
docs: 1.8 changes from QA (#11998)
mendonk Mar 3, 2026
cb7512c
docs: pass API keys to args and not env (#11997)
mendonk Mar 3, 2026
c91300f
docs: knowledge bases (#11924)
mendonk Mar 3, 2026
1649ee8
Merge branch 'main' into docs-1.8-release
mendonk Mar 3, 2026
357f885
docs: traces v0 (#12014)
mendonk Mar 3, 2026
bfa4356
Merge branch 'main' into docs-1.8-release
mendonk Mar 4, 2026
20a654f
Merge branch 'main' into docs-1.8-release
mendonk Mar 5, 2026
36ddd9c
docs: remove kb ingestion and rename kb retrieval (#12065)
mendonk Mar 5, 2026
c5d2079
docs: add link to secret key rotation script (#12072)
mendonk Mar 5, 2026
8c28e0e
docs: openlayer follow-on (#12073)
mendonk Mar 5, 2026
5c9f7eb
Merge branch 'main' into docs-1.8-release
mendonk Mar 5, 2026
7e34858
Merge branch 'main' into docs-1.8-release
mendonk Mar 5, 2026
aee7f51
Merge branch 'main' into docs-1.8-release
mendonk Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 174 additions & 13 deletions docs/docs/Agents/mcp-client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ slug: /mcp-client
import Icon from "@site/src/components/icon";
import McpIcon from '@site/static/logos/mcp-icon.svg';
import PartialMcpNodeTip from '@site/docs/_partial-mcp-node-tip.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Langflow integrates with the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) as both an MCP server and an MCP client.

Expand All @@ -24,6 +26,8 @@ This component has two modes, depending on the type of server you want to access

### Connect to a non-Langflow MCP server {#mcp-stdio-mode}

<PartialMcpNodeTip />

1. Add an **MCP Tools** component to your flow.

2. In the **MCP Server** field, select a previously connected server or click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server**.
Expand All @@ -36,35 +40,31 @@ This component has two modes, depending on the type of server you want to access
* **HTTP/SSE**: Enter your MCP server's **Name**, **URL**, and any **Headers** and **Environment Variables** the server uses, and then click **Add Server**.
The default **URL** for Langflow MCP servers is `http://localhost:7860/api/v1/mcp/project/PROJECT_ID/streamable` or `http://localhost:7860/api/v1/mcp/streamable`. For more information, see [Connect to a Langflow MCP server](#mcp-http-mode).

<PartialMcpNodeTip />

3. To use environment variables in your server command, enter each variable in the **Env** fields as key-value pairs.
3. To configure headers for your MCP server, enter each header in the **Headers** fields as key-value pairs.
You can use [global variables](/configuration-global-variables) in header values by entering the global variable name as the header value.
For more information, see [Use global variables in MCP server headers](#use-global-variables-in-mcp-server-headers).

:::tip
Langflow passes environment variables from the `.env` file to MCP, but it doesn't pass global variables declared in your Langflow **Settings**.
To define an MCP server environment variable as a global variable, add it to Langflow's `.env` file at startup.
For more information, see [global variables](/configuration-global-variables).
:::
4. To use environment variables in your server command, enter each variable in the **Env** fields as key-value pairs.

4. In the **Tool** field, select a tool that you want this component to use, or leave the field blank to allow access to all tools provided by the MCP server.
5. In the **Tool** field, select a tool that you want this component to use, or leave the field blank to allow access to all tools provided by the MCP server.

If you select a specific tool, you might need to configure additional tool-specific fields. For information about tool-specific fields, see your MCP server's documentation.

At this point, the **MCP Tools** component is serving a tool from the connected server, but nothing is using the tool. The next steps explain how to make the tool available to an [**Agent** component](/components-agents) so that the agent can use the tool in its responses.

5. In the [component's header menu](/concepts-components#component-menus), enable **Tool mode** so you can use the component with an agent.
6. In the [component's header menu](/concepts-components#component-menus), enable **Tool mode** so you can use the component with an agent.

6. Connect the **MCP Tools** component's **Toolset** port to an **Agent** component's **Tools** port.
7. Connect the **MCP Tools** component's **Toolset** port to an **Agent** component's **Tools** port.

If not already present in your flow, make sure you also attach **Chat Input** and **Chat Output** components to the **Agent** component.

![MCP Tools component in STDIO mode](/img/component-mcp-stdio.png)

7. Test your flow to make sure the MCP server is connected and the selected tool is used by the agent. Open the **Playground**, and then enter a prompt that uses the tool you connected through the **MCP Tools** component.
8. Test your flow to make sure the MCP server is connected and the selected tool is used by the agent. Open the **Playground**, and then enter a prompt that uses the tool you connected through the **MCP Tools** component.

For example, if you use `mcp-server-fetch` with the `fetch` tool, you could ask the agent to summarize recent tech news. The agent calls the MCP server function `fetch`, and then returns the response.

8. If you want the agent to be able to use more tools, repeat these steps to add more tools components with different servers or tools.
9. If you want the agent to be able to use more tools, repeat these steps to add more tools components with different servers or tools.

### Connect a Langflow MCP server {#mcp-http-mode}

Expand Down Expand Up @@ -110,6 +110,167 @@ To add a new MCP server, click **Add MCP Server**, and then follow the steps in

Click <Icon name="Ellipsis" aria-hidden="true"/> **More** to edit or delete an MCP server connection.

## Modify MCP server environment variables with the API {#mcp-api-tweaks}

You can modify MCP server environment variables at runtime when running flows through the [Langflow API](/api-reference-api-examples) by tweaking the **MCP Tools** component.

You can include tweaks with any Langflow API request that supports the `tweaks` parameter, such as POST requests to the `/run` or `/webhook` endpoints.
For more information, see [Input schema (tweaks)](/concepts-publish#input-schema).

To modify the **MCP Tools** component's environment variables with tweaks, do the following:

1. Open the flow that contains your **MCP Tools** component.
2. To find the **MCP Tools** component's unique ID, in your **MCP Tools** component, click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**.
The component's ID is displayed in the **Controls** pane, such as `MCPTools-Bzahc`.
3. Send a POST request to the Langflow server's `/run` endpoint, and include tweaks to the **MCP Tools** component.

The following examples demonstrate a request structure with the `env` object nested under `mcp_server` in the `tweaks` payload:

<Tabs groupId="language">
<TabItem value="python" label="Python" default>

```python
import requests
import os

LANGFLOW_SERVER_ADDRESS = "http://localhost:7860"
FLOW_ID = "your-flow-id"
LANGFLOW_API_KEY = os.getenv("LANGFLOW_API_KEY")
MCP_TOOLS_COMPONENT_ID = "MCPTools-Bzahc"

url = f"{LANGFLOW_SERVER_ADDRESS}/api/v1/run/{FLOW_ID}?stream=false"
headers = {
"Content-Type": "application/json",
"x-api-key": LANGFLOW_API_KEY
}
payload = {
"output_type": "chat",
"input_type": "chat",
"input_value": "What sales data is available to me?",
"tweaks": {
MCP_TOOLS_COMPONENT_ID: {
"mcp_server": {
"env": {
"API_URL": "https://api.example.com",
"API_KEY": "your-mcp-server-api-key",
"ENVIRONMENT": "production"
}
}
}
}
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
Comment thread
mendonk marked this conversation as resolved.

</TabItem>
<TabItem value="typescript" label="TypeScript">

```typescript
const LANGFLOW_SERVER_ADDRESS = "http://localhost:7860";
const FLOW_ID = "your-flow-id";
const LANGFLOW_API_KEY = process.env.LANGFLOW_API_KEY || "";
const MCP_TOOLS_COMPONENT_ID = "MCPTools-Bzahc";

const url = `${LANGFLOW_SERVER_ADDRESS}/api/v1/run/${FLOW_ID}?stream=false`;

const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": LANGFLOW_API_KEY,
},
body: JSON.stringify({
output_type: "chat",
input_type: "chat",
input_value: "What sales data is available to me?",
tweaks: {
[MCP_TOOLS_COMPONENT_ID]: {
mcp_server: {
env: {
API_URL: "https://api.example.com",
API_KEY: "your-mcp-server-api-key",
ENVIRONMENT: "production",
},
},
},
},
}),
});

const data = await response.json();
console.log(data);
```

</TabItem>
<TabItem value="curl" label="cURL">

```bash
curl --request POST \
--url "http://LANGFLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID?stream=false" \
--header "Content-Type: application/json" \
--header "x-api-key: LANGFLOW_API_KEY" \
--data '{
"output_type": "chat",
"input_type": "chat",
"input_value": "What sales data is available to me?",
"tweaks": {
"MCP_TOOLS_COMPONENT_ID": {
"mcp_server": {
"env": {
"API_URL": "https://api.example.com",
"API_KEY": "your-mcp-server-api-key",
"ENVIRONMENT": "production"
}
}
}
}
}'
```

</TabItem>
</Tabs>

Replace `MCP_TOOLS_COMPONENT_ID`, `LANGFLOW_API_KEY`, `LANGFLOW_SERVER_ADDRESS`, and `FLOW_ID` with the actual values from your Langflow deployment.

Langflow doesn't automatically discover or expose which environment variables your MCP server accepts from the **MCP Tools** component.
To determine which environment variables your MCP server accepts, see the MCP server's documentation. For example, the [Astra DB MCP server](https://github.com/datastax/astra-db-mcp) requires `ASTRA_DB_APPLICATION_TOKEN` and `ASTRA_DB_API_ENDPOINT`, with an optional variable for `ASTRA_DB_KEYSPACE`, as documented in its repository.

## Use global variables in MCP server headers {#use-global-variables-in-mcp-server-headers}

You can use [global variables](/configuration-global-variables) in MCP server header values to securely store and reference API keys, authentication tokens, and other sensitive values. This is particularly useful for deployment scenarios where you need to pass user-specific credentials at runtime.

Enter a global variable name as the header value, and Langflow resolves the global variable name to its actual value before making the MCP server request. Langflow only passes the token value to your server; it doesn't validate tokens on behalf of your MCP server.

For example, to create a global variable named `TEST_BEARER_TOKEN` for MCP server bearer authentication, do the following:

1. To open the **Global Variables** pane, click your profile icon, select **Settings**, and then click <Icon name="Globe" aria-hidden="true"/> **Global Variables**.
2. Create a **Credential** global variable named `TEST_BEARER_TOKEN`.
3. In the **Value** field, enter your MCP server's bearer token value. The value must include the `Bearer` prefix with a space, for example: `Bearer eyJhbG...`.
4. Click **Save Variable**.
5. To manage MCP server connections for your Langflow client, click <McpIcon /> **MCP servers** in the visual editor, or click your profile icon, select **Settings**, and then click **MCP Servers**.
6. Click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server**.
7. Select the following:
* **Name**: test-mcp-server
* **Streamable HTTP/SSE URL**: Your MCP server's URL, such as `http://127.0.0.1:8000/mcp`.
* **Headers**: In the key field, enter the literal string `Authorization`. For the key's value, enter `TEST_BEARER_TOKEN`, or the exact name of your global variable.
8. Click **Create Server**.

If the connection succeeds, Langflow shows the number of tools exposed by the server.

After creating the server and global variable, you can connect to the server with the **MCP Tools** component, as explained in the next steps.

9. Add the **MCP Tools** component to a flow.
10. In the **MCP Tools** component, select the **MCP Server** you created.
The MCP server configuration already includes the headers you configured earlier, so no further configuration is needed in the component. The global variable `TEST_BEARER_TOKEN` is automatically resolved when the component makes requests to the MCP server.

11. Optional: To override headers or add additional headers to the **MCP Tools** component, click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus), enable **Show** for the **Headers** parameter, and then add header key values. Headers configured in the component take precedence over the headers configured in the MCP server settings.

12. Test your flow to make sure the agent uses your server to respond to queries. Open the **Playground**, and then enter a prompt that uses a tool that you connected through the **MCP Tools** component.

Langflow automatically resolves `TEST_BEARER_TOKEN` to its actual value before sending the request to the MCP server. When your MCP server receives the request, the `Authorization` header contains the resolved token value.

## See also

- [Use Langflow as an MCP server](/mcp-server)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/Agents/mcp-component-astra.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This guide demonstrates how to [use Langflow as an MCP client](/mcp-client) by u

1. In the **MCP Server** field, click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server**.
2. Select **Stdio** mode.
3. EIn the **Name** field, enter a name for the MCP server.
3. In the **Name** field, enter a name for the MCP server.
4. In the **Commmand** field, add the following code to connect to an Astra DB MCP server:

```bash
Expand Down
41 changes: 37 additions & 4 deletions docs/docs/Components/components-prompts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ The **Prompt Template** component can also output variable instructions to other

## Prompt Template parameters

| Name | Display Name | Description |
|----------|----------------|-------------------------------------------------------------------|
| template | Template | Input parameter. Create a prompt template with dynamic variables in curly braces, such as `{VARIABLE_NAME}`. <PartialCurlyBraces /> |
| prompt | Prompt Message | Output parameter. The built prompt message returned by the `build_prompt` method. |
| Name | Display Name | Description |
|---------------------|---------------------|-------------------------------------------------------------------|
| template | Template | Input parameter. Create a prompt template with dynamic variables in curly braces, such as `{VARIABLE_NAME}`. <PartialCurlyBraces /> |
| use_double_brackets | Use Double Brackets | When enabled, use Mustache syntax `{{variable}}` instead of f-string syntax `{variable}`. For more information, see [Use Mustache templating in prompt templates](#use-mustache-templating-in-prompt-templates). |
Comment thread
mendonk marked this conversation as resolved.

## Define variables in prompts

Expand Down Expand Up @@ -70,6 +70,39 @@ The following steps demonstrate how to add variables to a **Prompt Template** co
You can add as many variables as you like in your template.
For example, you could add variables for `{references}` and `{instructions}`, and then feed that information in from other components, such as **Text Input**, **URL**, or **Read File** components.

### Use Mustache templating in prompt templates

F-string escaping can become confusing when you mix escaped braces with variables in the same template.
For example:

```text
Generate a response in this JSON format:
{{"name": "{name}", "age": {age}, "city": "{city}"}}

The user's name is {name}, age is {age}, and they live in {city}.
```

The characters `{{` and `}}` are escaped literal braces for the JSON structure, but `{name}` is a variable.
This can make prompts error-prone and difficult to parse.
Use [Mustache](https://mustache.github.io) in your prompt templates to make the differences clearer.

To enable Mustache templating, do the following:

1. In the **Prompt Template** component, enable **Use Double Brackets**.
2. In your prompt template, change the variables from `{variable}` to `{{variable}}`.
Mustache uses `{` `}` for literal braces and `{{variable}}` for variables.

```text
Generate a response in this JSON format:
{"name": "{{name}}", "age": {{age}}, "city": "{{city}}"}

The user's name is {{name}}, age is {{age}}, and they live in {{city}}.
```

3. Click **Check & Save**.
The component lints the template code and returns **Prompt is ready** if there are no errors.
Your prompt is now ready to use in a flow.

## See also

* [**LangChain Prompt Hub** component](/bundles-langchain#prompt-hub)
Expand Down
13 changes: 7 additions & 6 deletions docs/docs/Components/smart-transform.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
This component has been renamed multiple times.
Its previous names include **Lambda Filter** and **Smart Function**.

The **Smart Transform** component uses an LLM to generate a Lambda function to filter or transform structured data based on natural language instructions.
The **Smart Transform** component uses an LLM and natural language instructions to generate a Lambda function that can filter or transform [`Data`](/data-types#data), [`DataFrame`](/data-types#dataframe), or [`Message`](/data-types#message) input.
You must connect this component to a [language model component](/components-models), which is used to generate a function based on the natural language instructions you provide in the **Instructions** parameter.
The LLM runs the function against the data input, and then outputs the results as [`Data`](/data-types#data).
The LLM runs the function against the input, and then outputs the results as [`Data`](/data-types#data), [`DataFrame`](/data-types#dataframe), or [`Message`](/data-types#message).

:::tip
Provide brief, clear instructions, focusing on the desired outcome or specific actions, such as `Filter the data to only include items where the 'status' is 'active'`.
One sentence or less is preferred because end punctuation, like periods, can cause errors or unexpected behavior.

If you need to provide more details instructions that aren't directly relevant to the Lambda function, you can input them in the **Language Model** component's **Input** field or through a **Prompt Template** component.

For the most reliable results, the **Smart Transform** component's output type must match the input type. For example, select **Message** output for [`Message`](/data-types#message) input.
:::

The following example uses the **API Request** endpoint to pass JSON data from the `https://jsonplaceholder.typicode.com/users` endpoint to the **Smart Transform** component.
Expand All @@ -35,9 +37,8 @@ From there, the LLM generates a filter function that extracts email addresses fr

| Name | Display Name | Info |
|------|--------------|------|
| data | Data | Input parameter. The structured data to filter or transform using a Lambda function. |
| llm | Language Model | Input parameter. Connect [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component. |
| data | Data | Input parameter. The [`Data`](/data-types#data), [`DataFrame`](/data-types#dataframe), or [`Message`](/data-types#message) input to filter or transform using the generated Lambda function. |
| model | Language Model | Input parameter. Connect [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component. |
| filter_instruction | Instructions | Input parameter. The natural language instructions for how to filter or transform the data. The LLM uses these instructions to create a Lambda function. |
| sample_size | Sample Size | Input parameter. For large datasets, the number of characters to sample from the dataset head and tail. Only applied if the dataset meets or exceeds `max_size`. Default: `1000`. |
| max_size | Max Size | Input parameter. The number of characters for the dataset to be considered large, which triggers sampling by the `sample_size` value. Default: `30000`. |

| max_size | Max Size | Input parameter. The number of characters for the dataset to be considered large, which triggers sampling by the `sample_size` value. Default: `30000`. |
Comment thread
mendonk marked this conversation as resolved.
Loading