Skip to content

Commit 8fb27bd

Browse files
authored
Update docs: 2.6.0...2.6.7 changes, update project and feature settings (#254)
Included changes from: - Chainlit/chainlit#2299 - Chainlit/chainlit#2292 - Chainlit/chainlit#2271 - Chainlit/chainlit#2347 - Chainlit/chainlit#2364 Closes #251, #252 Also fixed boolean field values in some files
1 parent 66a1a83 commit 8fb27bd

File tree

13 files changed

+186
-62
lines changed

13 files changed

+186
-62
lines changed

advanced-features/mcp.mdx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: "MCP Servers"
2+
title: "MCP"
33
description: Model Control Protocol (MCP) allows you to integrate external tool providers with your Chainlit application. This enables your AI models to use tools through standardized interfaces.
44
---
55

66
## Overview
77

8-
MCP provides a mechanism for Chainlit applications to connect to either server-sent events (SSE) based services or command-line (stdio) based tools. Once connected, your application can discover available tools, execute them, and integrate their responses into your application's flow.
8+
MCP provides a mechanism for Chainlit applications to connect to either server-sent events (SSE) or streamable HTTP based services, or command-line (stdio) based tools. Once connected, your application can discover available tools, execute them, and integrate their responses into your application's flow.
99

1010
<Card
1111
title="Chainlit MCP Cookbook"
@@ -31,10 +31,15 @@ We're working with companies to create their MCP stacks, enabling AI agents to c
3131

3232
## Connections Types
3333

34-
Chainlit supports two types of MCP connections:
34+
| WebSockets | HTTP+SSE | Streamable HTTP | stdio |
35+
| ---------- | -------- | --------------- | ----- |
36+
|||||
37+
38+
Chainlit supports three types of MCP connections:
3539

3640
1. **SSE (Server-Sent Events)**: Connect to a remote service via HTTP
37-
2. **stdio**: Execute a local command and communicate via standard I/O
41+
2. **Streamable HTTP**: Send HTTP requests to a server and receive JSON responses or connect using SSE streams
42+
3. **stdio**: Execute a local command and communicate via standard I/O
3843

3944
> ⚠️ **Security Warning**: The stdio connection type spawns actual subprocesses on the Chainlit server. Only use this with trusted commands in controlled environments. Ensure proper validation of user inputs to prevent command injection vulnerabilities.
4045
@@ -44,7 +49,7 @@ Chainlit supports two types of MCP connections:
4449

4550
You can control which MCP connection types are enabled globally and restrict allowed stdio commands by modifying your project's `config.toml` file (usually located at the root of your project or `.chainlit/config.toml`).
4651

47-
Under the `[features.mcp]` section, you can configure SSE and stdio separately:
52+
Under the `[features.mcp]` section, you can configure SSE, Streamable HTTP and stdio separately:
4853

4954
```toml
5055
[features]
@@ -54,6 +59,10 @@ Under the `[features.mcp]` section, you can configure SSE and stdio separately:
5459
# Enable or disable the SSE connection type globally
5560
enabled = true
5661

62+
[features.mcp.streamable-http]
63+
# Enable or disable the Streamable HTTP connection type globally
64+
enabled = true
65+
5766
[features.mcp.stdio]
5867
# Enable or disable the stdio connection type globally
5968
enabled = true
@@ -92,8 +101,8 @@ async def on_mcp_disconnect(name: str, session: ClientSession):
92101
The client needs to provide the connection details through the Chainlit interface. This includes:
93102

94103
- Connection name (unique identifier)
95-
- Client type (`sse` or `stdio`)
96-
- For SSE: URL endpoint
104+
- Client type (`sse`, `streamable-http` or `stdio`)
105+
- For SSE and Streamable HTTP: URL endpoint
97106
- For stdio: Full command (e.g., `npx your-tool-package` or `uvx your-tool-package`)
98107

99108
<Frame caption="Adding an MCP">

api-reference/ask/ask-for-action.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ If a project ID is configured, the messages will be uploaded to the cloud storag
2121
<ParamField path="timeout" type="int" optional default={90}>
2222
The number of seconds to wait for an answer before raising a TimeoutError.
2323
</ParamField>
24-
<ParamField path="raise_on_timeout" type="bool" optional default="False">
24+
<ParamField path="raise_on_timeout" type="bool" optional default={false}>
2525
Whether to raise a socketio TimeoutError if the user does not answer in time.
2626
</ParamField>
2727

api-reference/ask/ask-for-element.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ If a project ID is configured, the messages will be uploaded to the cloud storag
2323
<ParamField path="timeout" type="int" optional default={90}>
2424
The number of seconds to wait for an answer before raising a TimeoutError.
2525
</ParamField>
26-
<ParamField path="raise_on_timeout" type="bool" optional default="False">
26+
<ParamField path="raise_on_timeout" type="bool" optional default={false}>
2727
Whether to raise a socketio TimeoutError if the user does not answer in time.
2828
</ParamField>
2929

api-reference/ask/ask-for-file.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If a project ID is configured, the messages will be uploaded to the cloud storag
2828
<ParamField path="timeout" type="int" optional default={90}>
2929
The number of seconds to wait for an answer before raising a TimeoutError.
3030
</ParamField>
31-
<ParamField path="raise_on_timeout" type="bool" optional default="False">
31+
<ParamField path="raise_on_timeout" type="bool" optional default={false}>
3232
Whether to raise a socketio TimeoutError if the user does not answer in time.
3333
</ParamField>
3434

api-reference/ask/ask-for-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If a project ID is configured, the messages will be uploaded to the cloud storag
1818
<ParamField path="timeout" type="int" optional default={60}>
1919
The number of seconds to wait for an answer before raising a TimeoutError.
2020
</ParamField>
21-
<ParamField path="raise_on_timeout" type="bool" optional default="False">
21+
<ParamField path="raise_on_timeout" type="bool" optional default={false}>
2222
Whether to raise a socketio TimeoutError if the user does not answer in time.
2323
</ParamField>
2424

api-reference/step-class.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The `Step` class is a Python Context Manager that can be used to create steps in
2020
https://react-code-blocks-rajinwonderland.vercel.app/?path=/story/codeblock--supported-languages
2121
for a list of supported languages.
2222
</ParamField>
23-
<ParamField path="show_input" type="Union[bool, str]" default="False" optional>
23+
<ParamField path="show_input" type="Union[bool, str]" default={false} optional>
2424
By default only the output of the step is shown. Set this to `True` to also
2525
show the input. You can also set this to a language like `json` or `python` to
2626
syntax highlight the input.

api-reference/step-decorator.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Under the hood, the step decorator is using the [cl.Step](/api-reference/step-cl
1919
https://react-code-blocks-rajinwonderland.vercel.app/?path=/story/codeblock--supported-languages
2020
for a list of supported languages.
2121
</ParamField>
22-
<ParamField path="show_input" type="Union[bool, str]" default="False" optional>
22+
<ParamField path="show_input" type="Union[bool, str]" default={false} optional>
2323
By default only the output of the step is shown. Set this to `True` to also
2424
show the input. You can also set this to a language like `json` or `python` to
2525
syntax highlight the input.

backend/config/features.mdx

Lines changed: 73 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,111 @@
22
title: Features
33
---
44

5-
### Options
5+
## Options
66

7-
<ParamField path="unsafe_allow_html" type="bool" default={false}>
8-
Process and display HTML in messages. This can be a security risk (see
9-
https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript).
10-
</ParamField>
11-
12-
<ParamField path="edit_message" type="bool" default={true}>
13-
Allow the user to edit their messages.
14-
</ParamField>
15-
16-
<ParamField path="latex" type="bool" default={false}>
17-
Process and display mathematical expressions. This can clash with "$"
18-
characters in messages.
19-
</ParamField>
7+
### File Upload
208

21-
<ParamField path="spontaneous_file_upload.enabled" type="bool" default={true}>
9+
<ParamField path="spontaneous_file_upload.enabled" type="bool" optional>
2210
Authorize users to upload files with messages. The files are then accessible
2311
in [cl.on_message](/api-reference/lifecycle-hooks/on-message).
2412
</ParamField>
2513

2614
<ParamField
2715
path="spontaneous_file_upload.accept"
2816
type="Union[List[str], Dict[str, List[str]]]"
29-
default={["*/*"]}
17+
optional
3018
>
3119
Restrict user to only upload accepted mime file types. Example: ["text/plain",
3220
"application/pdf", "image/x-png"]
3321
</ParamField>
3422

35-
<ParamField path="spontaneous_file_upload.max_files" type="int" default={20}>
23+
<ParamField path="spontaneous_file_upload.max_files" type="int" optional>
3624
Restrict user to upload maximum number of files at a time.
3725
</ParamField>
3826

39-
<ParamField path="spontaneous_file_upload.max_size_mb" type="int" default={500}>
27+
<ParamField path="spontaneous_file_upload.max_size_mb" type="int" optional>
4028
Restrict uploading file size (MB).
4129
</ParamField>
4230

43-
<ParamField path="auto_tag_thread" type="bool">
31+
### Audio
32+
33+
<ParamField path="audio.enabled" type="bool" default={false}>
34+
Restrict uploading file size (MB).
35+
</ParamField>
36+
37+
<ParamField path="audio.sample_rate" type="int" default={24000}>
38+
Audio sample rate in hertz. Defaults to 24kHz
39+
</ParamField>
40+
41+
### MCP
42+
43+
See [MCP server-side configuration](/advanced-features/mcp#server-side-configuration-config-toml)
44+
45+
### Slack
46+
47+
See [Slack integration documentation](/deploy/slack)
48+
49+
### Other
50+
51+
<ParamField path="latex" type="bool" default={false}>
52+
Process and display mathematical expressions. This can clash with "$"
53+
characters in messages.
54+
</ParamField>
55+
56+
<ParamField path="user_message_autoscroll" type="bool" default={true}>
57+
Autoscroll new user messages at the top of the window.
58+
</ParamField>
59+
60+
<ParamField path="unsafe_allow_html" type="bool" default={false}>
61+
Process and display HTML in messages. This can be a security risk (see
62+
https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript).
63+
</ParamField>
64+
65+
<ParamField path="auto_tag_thread" type="bool" default={true}>
4466
Automatically tag threads with the current chat profile (if a chat profile is
4567
used)
4668
</ParamField>
4769

48-
### Default configuration
70+
<ParamField path="edit_message" type="bool" default={true}>
71+
Allow the user to edit their messages.
72+
</ParamField>
73+
74+
## Default configuration
4975

5076
```toml
5177
[features]
52-
edit_message = true
78+
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
5379
unsafe_allow_html = false
80+
81+
# Process and display mathematical expressions. This can clash with "$" characters in messages.
5482
latex = false
83+
84+
# Autoscroll new user messages at the top of the window
85+
user_message_autoscroll = true
86+
87+
# Automatically tag threads with the current chat profile (if a chat profile is used)
88+
auto_tag_thread = true
89+
90+
# Allow users to edit their own messages
91+
edit_message = true
92+
93+
# Authorize users to spontaneously upload files with messages
5594
[features.spontaneous_file_upload]
5695
enabled = true
96+
# Define accepted file types using MIME types
97+
# Examples:
98+
# 1. For specific file types:
99+
# accept = ["image/jpeg", "image/png", "application/pdf"]
100+
# 2. For all files of certain type:
101+
# accept = ["image/*", "audio/*", "video/*"]
102+
# 3. For specific file extensions:
103+
# accept = {{ "application/octet-stream" = [".xyz", ".pdb"] }}
104+
# Note: Using "*/*" is not recommended as it may cause browser warnings
57105
accept = ["*/*"]
58106
max_files = 20
59107
max_size_mb = 500
60-
auto_tag_thread = true
108+
109+
[features.audio]
110+
# Sample rate of the audio
111+
sample_rate = 24000
61112
```

backend/config/project.mdx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,52 @@
22
title: Project
33
---
44

5-
### Options
6-
7-
<ParamField path="enable_telemetry" type="bool" default={true}>
8-
Whether to enable telemetry (default: true). No personal data is collected.
9-
</ParamField>
5+
## Options
106

117
<ParamField path="allow_origins" type="List[str]" default={["*"]}>
128
Authorized origins to access the app/copilot.
139
</ParamField>
1410

15-
<ParamField path="user_env" type="List[str]" default={[]}>
16-
List of environment variables to be provided by each user to use the app.
11+
<ParamField path="transports" type="List[str]" optional>
12+
Socket.io client transports option
1713
</ParamField>
1814

19-
<ParamField path="session_timeout" type="int" default={3600}>
20-
Duration (in seconds) during which the session is saved when the connection is
21-
lost
15+
<ParamField path="user_env" type="List[str]" optional>
16+
List of environment variables to be provided by each user to use the app. If empty, no environment variables will be asked to the user.
2217
</ParamField>
2318

24-
<ParamField path="cache" type="bool" default={false}>
25-
Enable third parties caching (e.g LangChain cache)
19+
<ParamField path="lc_cache_path" type="str" optional>
20+
Path to the local langchain cache database
21+
</ParamField>
22+
23+
<ParamField path="session_timeout" type="int" default={300}>
24+
Duration (in seconds) during which the session is saved when the connection is lost
2625
</ParamField>
2726

28-
<ParamField path="follow_symlink" type="bool" default={false}>
29-
Follow symlink for asset mount (see
30-
https://github.com/Chainlit/chainlit/issues/317)
27+
<ParamField path="user_session_timeout" type="int" default={1296000}>
28+
Duration (in seconds) of the user session expiry. 15 days by default
3129
</ParamField>
3230

33-
### Default configuration
31+
<ParamField path="cache" type="bool" default={false}>
32+
Enable third parties caching (e.g LangChain cache)
33+
</ParamField>
34+
35+
## Default configuration
3436

3537
```toml
3638
[project]
37-
# Whether to enable telemetry (default: true). No personal data is collected.
38-
enable_telemetry = true
39-
4039
# List of environment variables to be provided by each user to use the app.
4140
user_env = []
4241

4342
# Duration (in seconds) during which the session is saved when the connection is lost
4443
session_timeout = 3600
4544

46-
# Enable third parties caching (e.g LangChain cache)
45+
# Duration (in seconds) of the user session expiry
46+
user_session_timeout = 1296000 # 15 days
47+
48+
# Enable third parties caching (e.g., LangChain cache)
4749
cache = false
4850

49-
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
50-
# follow_symlink = false
51+
# Authorized origins
52+
allow_origins = ["*"]
5153
```

backend/config/ui.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: UI
33
---
44

5-
### Options
5+
## Options
66

77
<ParamField path="name" type="str" default="'Assistant'">
88
The name of both the application and the chatbot.
@@ -90,7 +90,7 @@ title: UI
9090
</ParamField>
9191

9292

93-
### Default configuration
93+
## Default configuration
9494

9595
```toml
9696
[UI]

0 commit comments

Comments
 (0)