前言
来吧,继续CherryStudio的实践,前边给Cherry Studio添加知识库,对接思源笔记,以及obsidian笔记,本节探索mcp-auto-install 自动安装包服务,这个看着很强大,它能让我们通过自然语言与LLMs进行对话,安装和管理其他 MCP 服务器😄😄😄。
准备
CherryStudio安装配置,请参考前期文档:
【AI入门】Cherry入门1:Cherry Studio的安装及配置-CSDN博客
选看内容:
【AI入门】CherryStudio入门2:配置及使用 MCP-CSDN博客
【AI入门】CherryStudio入门3:结合FastMCP创建自己的MCP服务,实现哔哩视频查询-CSDN博客
【AI入门】CherryStudio入门4:创建知识库,对接思源笔记-CSDN博客
【AI入门】CherryStudio入门5:创建知识库,对接Obsidian 笔记-CSDN博客
正经开始
@mcpmarket/auto-install简介
一个强大的 MCP 服务器,具有 CLI,可集成到您的客户端 MCP 生态系统中。它通过自然语言与LLMs进行对话,使您能够安装和管理其他 MCP 服务器。
https://www.npmjs.com/package/@mcpmarket/mcp-auto-install
Cherry Studio配置
MCP配置有两种方式,一🀄️通过修改MCP的json配置文件添加,一种是手动添加,两种作用相同。
通过json配置服务器:
服务器json:
// axun-uUpaWEdMEMU8C61K mcp服务id,自定义即可
"axun-uUp1243235351K": {
"name": "mcp-auto-install",
"type": "stdio",
"description": "Automatically install MCP services (Beta version)",
"isActive": true,
"registryUrl": "https://registry.npmmirror.com",
"command": "npx",
"args": [
"-y",
"@mcpmarket/mcp-auto-install",
"connect",
"--json"
]
}
将mcp服务器是json贴到Cherry Studio的MCP配置文件中:
确定后,会看到MCP服务器列表就多了一个mcp-auto-install服务,把它启动起来就可以了。效果等同于下面手动的方式。
通过手动添加
添加MCP服务器:
填写完成后,点击右上角启动。
mcp-auto-install的可用工具:
自动安装包filesystem
大模型自动安装动作
看看大模型的思考过程:
过程信息:
mcp_auto_install_getAvailableServers , 详细信息:
{
"content": [
{
"type": "text",
"text": "📋 Found 20 MCP servers"
},
{
"type": "text",
"text": "• @modelcontextprotocol/inspector: Model Context Protocol inspector\n• @modelcontextprotocol/create-server: CLI tool to create new MCP servers\n• @modelcontextprotocol/server-postgres: MCP server for interacting with PostgreSQL databases\n• @modelcontextprotocol/server-sequential-thinking: MCP server for sequential thinking and problem solving\n• @modelcontextprotocol/server-brave-search: MCP server for Brave Search API integration\n• @modelcontextprotocol/server-github: MCP server for using the GitHub API\n• @modelcontextprotocol/server-filesystem: MCP server for filesystem access\n• @modelcontextprotocol/inspector-server: Server-side application for the Model Context Protocol inspector\n• @modelcontextprotocol/inspector-client: Client-side application for the Model Context Protocol inspector\n• @modelcontextprotocol/server-puppeteer: MCP server for browser automation using Puppeteer\n• @modelcontextprotocol/inspector-cli: CLI for the Model Context Protocol inspector\n• @modelcontextprotocol/server-google-maps: MCP server for using the Google Maps API\n• @modelcontextprotocol/server-memory: MCP server for enabling memory for Claude through a knowledge graph\n• @modelcontextprotocol/server-slack: MCP server for interacting with Slack\n• @modelcontextprotocol/server-everything: MCP server that exercises all the features of the MCP protocol\n• @modelcontextprotocol/server-everart: MCP server for EverArt API integration\n• @modelcontextprotocol/server-gitlab: MCP server for using the GitLab API\n• @modelcontextprotocol/server-gdrive: MCP server for interacting with Google Drive\n• @modelcontextprotocol/server-redis: MCP server for using Redis\n• @modelcontextprotocol/server-aws-kb-retrieval: MCP server for AWS Knowledge Base retrieval using Bedrock Agent Runtime"
}
],
"success": true
}
mcp_auto_install_configureServer,详细信息
{
"params": {
"serverName": "@modelcontextprotocol/server-filesystem"
},
"response": {
"content": [
{
"type": "text",
"text": "📝 Config guide for '@modelcontextprotocol/server-filesystem'"
},
{
"type": "text",
"text": "Description: MCP server for filesystem access"
},
{
"type": "text",
"text": "# @modelcontextprotocol/server-filesystem README\n\n> MCP server for filesystem access\n\n# Filesystem MCP Server\n\nNode.js server implementing Model Context Protocol (MCP) for filesystem operations.\n\n## Features\n\n- Read/write files\n- Create/list/delete directories\n- Move files/directories\n- Search files\n- Get file metadata\n\n**Note**: The server will only allow operations within directories specified via `args`.\n\n## API\n\n### Resources\n\n- `file://system`: File system operations interface\n\n### Tools\n\n- **read_file**\n - Read complete contents of a file\n - Input: `path` (string)\n - Reads complete file contents with UTF-8 encoding\n\n- **read_multiple_files**\n - Read multiple files simultaneously\n - Input: `paths` (string[])\n - Failed reads won't stop the entire operation\n\n- **write_file**\n - Create new file or overwrite existing (exercise caution with this)\n - Inputs:\n - `path` (string): File location\n - `content` (string): File content\n\n- **edit_file**\n - Make selective edits using advanced pattern matching and formatting\n - Features:\n - Line-based and multi-line content matching\n - Whitespace normalization with indentation preservation\n - Multiple simultaneous edits with correct positioning\n - Indentation style detection and preservation\n - Git-style diff output with context\n - Preview changes with dry run mode\n - Inputs:\n - `path` (string): File to edit\n - `edits` (array): List of edit operations\n - `oldText` (string): Text to search for (can be substring)\n - `newText` (string): Text to replace with\n - `dryRun` (boolean): Preview changes without applying (default: false)\n - Returns detailed diff and match information for dry runs, otherwise applies changes\n - Best Practice: Always use dryRun first to preview changes before applying them\n\n- **create_directory**\n - Create new directory or ensure it exists\n - Input: `path` (string)\n - Creates parent directories if needed\n - Succeeds silently if directory exists\n\n- **list_directory**\n - List directory contents with [FILE] or [DIR] prefixes\n - Input: `path` (string)\n\n- **move_file**\n - Move or rename files and directories\n - Inputs:\n - `source` (string)\n - `destination` (string)\n - Fails if destination exists\n\n- **search_files**\n - Recursively search for files/directories\n - Inputs:\n - `path` (string): Starting directory\n - `pattern` (string): Search pattern\n - `excludePatterns` (string[]): Exclude any patterns. Glob formats are supported.\n - Case-insensitive matching\n - Returns full paths to matches\n\n- **get_file_info**\n - Get detailed file/directory metadata\n - Input: `path` (string)\n - Returns:\n - Size\n - Creation time\n - Modified time\n - Access time\n - Type (file/directory)\n - Permissions\n\n- **list_allowed_directories**\n - List all directories the server is allowed to access\n - No input required\n - Returns:\n - Directories that this server can read/write from\n\n## Usage with Claude Desktop\nAdd this to your `claude_desktop_config.json`:\n\nNote: you can provide sandboxed directories to the server by mounting them to `/projects`. Adding the `ro` flag will make the directory readonly by the server.\n\n### Docker\nNote: all directories must be mounted to `/projects` by default.\n\n```json\n{\n \"mcpServers\": {\n \"filesystem\": {\n \"command\": \"docker\",\n \"args\": [\n \"run\",\n \"-i\",\n \"--rm\",\n \"--mount\", \"type=bind,src=/Users/username/Desktop,dst=/projects/Desktop\",\n \"--mount\", \"type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro\",\n \"--mount\", \"type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt\",\n \"mcp/filesystem\",\n \"/projects\"\n ]\n }\n }\n}\n```\n\n### NPX\n\n```json\n{\n \"mcpServers\": {\n \"filesystem\": {\n \"command\": \"npx\",\n \"args\": [\n \"-y\",\n \"@modelcontextprotocol/server-filesystem\",\n \"/Users/username/Desktop\",\n \"/path/to/other/allowed/dir\"\n ]\n }\n }\n}\n```\n\n## Build\n\nDocker build:\n\n```bash\ndocker build -t mcp/filesystem -f src/filesystem/Dockerfile .\n```\n\n## License\n\nThis MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.\n\n\n---\n<CURRENT_CURSOR_POSITION>\n\nSummary: What does this MCP server do? (1-2 sentences)\n\nSetup: List required/optional parameters, env vars needed.\n\nExamples:\n- Working npx command example\n- JSON config example for integration\n\nNext steps: How to get started quickly?\n\nNote any unclear/missing information.\n"
}
],
"success": true
}
}
mcp_auto_install_saveCommand:
{
"params": {
"serverName": "@modelcontextprotocol/server-filesystem",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
],
"env": {},
"description": "Starts the Filesystem MCP server with two allowed directories"
},
"response": {
"content": [
{
"type": "text",
"text": "✅ Command config generated"
},
{
"type": "text",
"text": "{\"name\":\"@modelcontextprotocol/server-filesystem\",\"command\":\"npx\",\"args\":[\"-y\",\"@modelcontextprotocol/server-filesystem\",\"/Users/username/Desktop\",\"/path/to/other/allowed/dir\"],\"env\":{},\"description\":\"Starts the Filesystem MCP server with two allowed directories\"}"
}
],
"success": true,
"data": {
"name": "@modelcontextprotocol/server-filesystem",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
],
"env": {},
"description": "Starts the Filesystem MCP server with two allowed directories"
}
}
}
插播现在安装的模型
我让大模型补充了一下:请帮忙整理一份刚安装的server-filesystem的详细介绍,返回信息如下:
以下是一份针对
@modelcontextprotocol/server-filesystem
的完整使用手册,适合新手快速入门:🔧 服务简介
这是一个基于 MCP (Model Context Protocol) 协议的轻量级文件系统服务 [fV0sQUZdP2Ll6DFXd1o0wr],允许客户端通过标准 API 对指定目录进行:
- 文件浏览(列出目录内容)
- 文件读取(读取文件内容)
- 文件写入(创建/覆盖文件)
- 文件删除
- 目录操作
📦 工作原理
服务端架构:
- 基于 Node.js 实现
- 使用 MCP 协议进行 JSON-RPC 形式的通信
- 通过 TCP/IP 端口监听客户端请求
- 支持路径白名单机制(防止越权访问)
MCP 协议交互流程:
核心功能映射:
客户端方法 文件系统操作 示例参数 list_files(path)
读取目录内容 {"path": "/Users/username/Desktop"}
read_file(path)
读取文件内容 {"path": "/Users/username/Desktop/file.txt"}
write_file(path, content)
写入文件 {"path": "file.txt", "content": "Hello World"}
delete_file(path)
删除文件 {"path": "file.txt"}
完成模型安装
然后,根据大模型提供的json文件,添加到MCP配置文件中,json配置信息:
{
"name": "@modelcontextprotocol/server-filesystem",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/username/Desktop",
"/path/to/other/allowed/dir"
],
"env": {},
"description": "Starts the Filesystem MCP server with two allowed directories"
}
添加到服务器配置:
其中补充信息:
1、自己给服务器加个系统id系统,我这里是:serverfilesystem9567887
2、修改允许MCP操作的本地文件目录:Windows目录分割用“\\\\”,不知道为什么,不这么写,报错,大家试试
3、服务器直接分割有“,”,不用忽略了
保存启动filesystem MCP服务。
测试
我在本地系统塞了两个测试文件:
配置大模型可以使用mcp服务:
然后,要求大模型查一下:
然后,大模型调用工具的回复:
结尾
官方文档上说,“Cherry Studio 还内置了 @mcpmarket/mcp-auto-install
工具”,我是手动安装了@mcpmarket/auto-install,的确没做太多配置,自动从 @modelcontextprotocol 中进行搜索,但,安装过程,进行的MCP配置,和手动建MCP过程一样,难道只是省去了查询MCP服务的过程?🤔
还没有搞太明白,但好在这么弄,是能用的,这是唯一一点值得庆幸的事了😬😬😬
参考
官网文档:https://docs.cherry-ai.com/advanced-basic/mcp/auto-install
@mcpmarket/auto-install的npmjs地址: https://www.npmjs.com/package/@mcpmarket/mcp-auto-install
@modelcontextprotocol/server-filesystem 的npmjs地址:
https://www.npmjs.com/package/@modelcontextprotocol/server-filesystem
没有成功的尝试记录
安装官方文档的操作界面,我想直接安装工具,在没有安装或删除mcp-auto-install的状态下,配置界面如下
保存,提示: