Skip to content

Commit 9f04d55

Browse files
committed
docs(ecosystem): update MCP Client documentation with usage instructions and configuration examples
- Added detailed usage instructions for the MCP Client plugin, including server configuration examples. - Included new images to illustrate the configuration process. - Updated existing documentation to clarify the requirements for using the plugin mode in ChatLuna.
1 parent ecd4178 commit 9f04d55

7 files changed

Lines changed: 125 additions & 5 deletions

File tree

.cursor/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"cSpell.words": [
3+
"Dify",
4+
"newbing",
5+
"Ollama",
6+
"onappear",
7+
"Redisearch",
8+
"Stackoverflow",
9+
"vectorstore"
10+
],
11+
"typescript.tsdk": "node_modules/typescript/lib",
12+
"markdown.copyFiles.destination": {
13+
"**/*": "${documentWorkspaceFolder}/docs/public/images/image.png"
14+
}
15+
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"onappear",
77
"Redisearch",
88
"Stackoverflow",
9-
"vectorstore"
9+
"vectorstore",
10+
"chatluna"
1011
],
1112
"typescript.tsdk": "node_modules/typescript/lib",
1213
"markdown.copyFiles.destination": {

docs/ecosystem/plugin/mcp-client.md

Lines changed: 104 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# MCP 协议客户端 (MCP Client)
22

3+
MCP 协议是 Model Context Protocol 的缩写,是 LangChain 提供的一种协议,用于在不同的模型之间传递上下文。
4+
35
此插件为 ChatLuna 的插件模式提供了 MCP 协议支持。
46

57
## 配置
@@ -17,11 +19,110 @@
1719
以下是推荐的一些插件源:
1820

1921
- [https://koishi-registry.yumetsuki.moe/index.json](https://koishi-registry.yumetsuki.moe/index.json)
20-
- [https://kp.itzdrli.cc]([https://kp.itzdrli.cc)
22+
- [https://kp.itzdrli.cc](https://kp.itzdrli.cc)
2123

2224
:::
2325

24-
> [!NOTE]
25-
> 文档正在完善中...
26+
安装后启用插件即可。
27+
28+
## 使用
29+
30+
> [!TIP]
31+
> 启用此插件时,请确保你当前聊天房间的聊天模式为 `plugin` 插件模式。
32+
> 可以查看 [聊天模式](../../guide/chat-chain/chat-mode.md) 了解如何切换聊天模式。
33+
34+
你需要在 `chatluna-mcp-client` 插件的配置中设置 `servers` 选项,来指定你想要连接的 MCP 服务器。
35+
36+
启用插件后,按照下图去编辑 JSON 来配置需要连接到的 MCP 服务器:
37+
38+
![alt text](../../public/images/image-85.png)
39+
40+
![alt text](../../public/images/image-86.png)
41+
42+
这里的参数基本和 `Claude Desktop``Cursor``mcpServers` 参数一致。
43+
44+
`Claude Desktop` 的一个配置如下:
45+
46+
```json
47+
{
48+
"mcpServers": {
49+
"exa": {
50+
"command": "npx",
51+
"args": ["/path/to/exa-mcp-server/build/index.js"],
52+
"env": {
53+
"EXA_API_KEY": "your-api-key-here"
54+
}
55+
}
56+
}
57+
}
58+
```
59+
60+
转换为下面的格式,编辑到 `chatluna-mcp-client` 插件的 `server` 配置中即可。
61+
62+
```json
63+
{
64+
"exa": {
65+
"command": "npx",
66+
"args": ["/path/to/exa-mcp-server/build/index.js"],
67+
"env": {
68+
"EXA_API_KEY": "your-api-key-here"
69+
}
70+
}
71+
}
72+
```
73+
74+
完成后重载插件,如果成功,则会在日志中看到如下信息(会列出可用的工具数目):
75+
76+
![alt text](../../public/images/image-87.png)
77+
78+
> [!TIP]
79+
> 请确保你的环境下支持可执行文件的运行。如果不存在,请安装对应的依赖。
80+
81+
## 配置项
82+
83+
此处列举了 `chatluna-mcp-client` 插件的配置项。
84+
85+
### servers
86+
87+
* 类型:`object`
88+
* 默认值:`{}`
89+
90+
MCP 服务器配置。此配置项用于定义需要连接的 MCP 服务器。每个服务器以键值对的形式配置,键为服务器名称,值为服务器配置对象。
91+
92+
服务器配置对象支持以下字段:
93+
94+
#### command
95+
96+
* 类型:`string`
97+
* 必填:是
98+
99+
执行的命令。可以是可执行文件的路径或者命令名称。
100+
101+
#### args
102+
103+
* 类型:`string[]`
104+
* 默认值:`[]`
105+
106+
执行命令的参数列表。
107+
108+
#### env
109+
110+
* 类型:`object`
111+
* 默认值:`{}`
112+
113+
执行环境变量。用于设置 MCP 服务器运行时所需的环境变量,如 API 密钥等。
114+
115+
#### cwd
116+
117+
* 类型:`string`
118+
* 默认值:``
119+
120+
执行命令的当前工作目录。
121+
122+
#### url
123+
124+
* 类型:`string`
125+
* 默认值:``
26126

127+
MCP 服务器的 URL。当使用 HTTP/HTTPS 连接时使用此字段。
27128

docs/guide/chat-chain/chat-mode.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ plugin 模式也是 ChatLuna 主插件中内置的聊天模式。
2828

2929
plugin 模式基于 LangChain 的 `Agent``Tool`,需要有相关的工具才能让模型调用它们。
3030

31-
但 ChatLuna 主插件中并没有内置可供 plugin 使用的工具,因此你需要安装 [`chatluna-plugin-common`](../../ecosystem/introduction.md) 插件,来为 plugin 模式提供一些工具。
31+
> [!TIP]
32+
> ChatLuna 主插件中没有内置可供 plugin 聊天模式使用的工具。
33+
>
34+
> 因此你需要安装 [`chatluna-plugin-common`](../../ecosystem/introduction.md)[`chatluna-mcp-client`](../../ecosystem/plugin/mcp-client.md) 插件来为 plugin 模式提供可用的工具。
3235
3336
### browsing
3437

docs/public/images/image-85.png

126 KB
Loading

docs/public/images/image-86.png

87.9 KB
Loading

docs/public/images/image-87.png

62.8 KB
Loading

0 commit comments

Comments
 (0)