xiaozhi-client 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +53 -112
  2. package/package.json +4 -1
package/README.md CHANGED
@@ -1,68 +1,82 @@
1
1
  # Xiaozhi Client
2
2
 
3
+ [![npm version](https://badge.fury.io/js/xiaozhi-client.svg)](https://badge.fury.io/js/xiaozhi-client)
4
+ [![codecov](https://codecov.io/gh/shenjingnan/xiaozhi-client/branch/main/graph/badge.svg)](https://codecov.io/gh/shenjingnan/xiaozhi-client)
5
+ [![CI](https://github.com/shenjingnan/xiaozhi-client/workflows/Release/badge.svg)](https://github.com/shenjingnan/xiaozhi-client/actions)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
3
8
  小智 AI 客户端,目前主要用于 MCP 的对接
4
9
 
5
- ![效果图](./docs/images/preview.png)
10
+ ![效果图](https://raw.githubusercontent.com/shenjingnan/xiaozhi-client/main/docs/images/preview.png)
11
+
12
+ ## 功能特性
6
13
 
7
- ## 安装和使用
14
+ - 支持 小智(xiaozhi.me) 官方服务器接入点
15
+ - 支持 自定义 MCP 服务
16
+ - 支持 使用标准 MCP 配置方式多个 MCP Server
17
+ - 支持 聚合多个 MCP Server
18
+ - 支持 动态控制 MCP Server 提供的工具
19
+ - 支持 通过模板创建
20
+ - 支持 后台运行
8
21
 
9
- ### 开发环境
22
+ ## 快速上手
10
23
 
11
- 1. 克隆项目:
24
+ ### 全局安装 xiaozhi-client 命令行工具
12
25
 
13
26
  ```bash
14
- git clone <repository-url>
15
- cd xiaozhi-client
16
- ```
27
+ ## 安装
28
+ npm i -g xiaozhi-client
17
29
 
18
- 2. 安装依赖:
30
+ ## 创建项目
31
+ xiaozhi create my-app --template hello-world
19
32
 
20
- ```bash
33
+ ## 进入项目
34
+ cd my-app
35
+
36
+ ## 安装依赖(主要是示例代码中mcp服务所使用的依赖)
21
37
  pnpm install
22
- ```
23
38
 
24
- 3. 构建项目:
39
+ # 修改 xiaozhi.config.json 中的 mcpEndpoint 为你的接入点地址(需要自行前往xiaozhi.me获取)
40
+ # 小智AI配置MCP接入点使用说明:https://ccnphfhqs21z.feishu.cn/wiki/HiPEwZ37XiitnwktX13cEM5KnSb
25
41
 
26
- ```bash
27
- pnpm run build
42
+ ## 运行
43
+ xiaozhi start
28
44
  ```
29
45
 
30
- 4. 本地安装(用于开发测试):
46
+ ### 通过 npx 直接运行
31
47
 
32
48
  ```bash
33
- npm link
34
- ```
49
+ # 创建项目
50
+ npx -y xiaozhi-client create --template hello-world
35
51
 
36
- 现在你可以在任何地方使用 `xiaozhi` 命令了。
52
+ # 进入项目目录
53
+ cd hello-world
37
54
 
38
- ### 生产环境
39
-
40
- 项目使用 tsup 打包成单个可执行的 JavaScript 文件,所有依赖都被正确处理。
55
+ # 安装依赖
56
+ pnpm install
41
57
 
42
- 构建后的文件位于 `dist/cli.js`,这是一个完整的可执行文件,包含:
58
+ # 修改 xiaozhi.config.json 中的 mcpEndpoint 为你的接入点地址(需要自行前往xiaozhi.me获取)
59
+ # 小智AI配置MCP接入点使用说明:https://ccnphfhqs21z.feishu.cn/wiki/HiPEwZ37XiitnwktX13cEM5KnSb
43
60
 
44
- - 正确的 shebang (`#!/usr/bin/env node`)
45
- - 所有必要的代码(除了外部依赖)
46
- - 可执行权限
61
+ # 启动服务
62
+ npx -y xiaozhi-client start
63
+ ```
47
64
 
48
- ### 可用命令
65
+ ## 可用命令
49
66
 
50
67
  ```bash
51
68
  # 查看帮助
52
69
  xiaozhi --help
53
70
 
54
- # 配置端点
55
- xiaozhi set-config xiaozhi.endpoint=wss://your-endpoint
56
-
57
- # 查看配置
58
- xiaozhi get-config
59
-
60
71
  # 启动服务
61
72
  xiaozhi start
62
73
 
63
74
  # 后台启动服务
64
75
  xiaozhi start --daemon
65
76
 
77
+ # 将后台服务转到前台运行
78
+ xiaozhi attach
79
+
66
80
  # 查看服务状态
67
81
  xiaozhi status
68
82
 
@@ -71,89 +85,16 @@ xiaozhi stop
71
85
 
72
86
  # 重启服务
73
87
  xiaozhi restart
74
- ```
75
-
76
- ## 开发
77
-
78
- ### 构建脚本
79
-
80
- - `pnpm run build` - 使用 tsup 构建项目(推荐)
81
- - `pnpm run build:tsc` - 使用 TypeScript 编译器构建(备用)
82
- - `pnpm run clean` - 清理构建文件
83
- - `pnpm run dev` - 开发模式(监听文件变化)
84
- - `pnpm run type-check` - 仅进行类型检查
85
- - `pnpm run start` - 编译并启动服务
86
-
87
- ### 技术栈
88
88
 
89
- - TypeScript
90
- - tsup (打包工具)
91
- - Commander.js (CLI 框架)
92
- - Chalk (终端颜色)
93
- - Ora (加载动画)
94
- - Biome (代码格式化和检查)
95
- - Vitest (单元测试)
89
+ # 列出所有使用的mcp服务
90
+ xiaozhi mcp list
96
91
 
97
- ### 代码质量
98
-
99
- 项目使用完整的 CI/CD 流程确保代码质量:
100
-
101
- #### 测试
102
-
103
- ```bash
104
- # 运行所有测试
105
- pnpm run test
106
-
107
- # 运行测试并生成覆盖率报告
108
- pnpm run test:coverage
109
-
110
- # 监听模式运行测试
111
- pnpm run test:watch
112
-
113
- # 运行测试UI界面
114
- pnpm run test:ui
115
- ```
116
-
117
- #### 代码检查和格式化
118
-
119
- ```bash
120
- # 运行Biome代码检查(CI模式)
121
- pnpm run ci
122
-
123
- # 格式化代码
124
- pnpm run format
125
-
126
- # 检查格式(不修改文件)
127
- pnpm run format:check
128
-
129
- # 运行lint检查
130
- pnpm run lint:check
131
-
132
- # 运行lint并自动修复
133
- pnpm run lint
134
-
135
- # TypeScript类型检查
136
- pnpm run type-check
92
+ # 列出所有mcp所提供的tools
93
+ xiaozhi mcp --tools
137
94
  ```
138
95
 
139
- #### CI/CD 流程
140
-
141
- 每次向 main 分支提交 PR 时,会自动运行以下检查:
142
-
143
- 1. **TypeScript 类型检查** - 确保没有类型错误
144
- 2. **Biome 代码检查** - 确保代码格式和质量符合规范
145
- 3. **单元测试** - 运行所有测试用例并生成覆盖率报告
146
- 4. **覆盖率检查** - 确保测试覆盖率不低于配置的阈值
147
- 5. **构建验证** - 确保项目能够正确构建
148
- 6. **产物验证** - 验证所有必要的构建产物都已生成
149
- 7. **CLI 可执行性测试** - 确保 CLI 工具可以正常执行
150
-
151
- 只有所有检查都通过,PR 才能被合并到 main 分支。
152
-
153
- ### 打包特性
96
+ ## 路线图
154
97
 
155
- - 使用 tsup 进行快速打包
156
- - 自动处理 shebang 重复问题
157
- - 自动添加可执行权限
158
- - 支持 ES 模块
159
- - 生成 source maps 和类型定义文件
98
+ - 支持 通过 SSE 类型的 MCP Server
99
+ - 支持 直接使用 [modelscope](https://www.modelscope.cn/mcp) 中托管的 MCP 服务
100
+ - 支持 通过使用网页进行 MCP 配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaozhi-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "小智 AI 客户端 命令行工具",
5
5
  "main": "dist/cli.cjs",
6
6
  "files": [
@@ -51,6 +51,7 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@biomejs/biome": "1.9.4",
54
+ "@codecov/vite-plugin": "^1.9.1",
54
55
  "@semantic-release/changelog": "^6.0.3",
55
56
  "@semantic-release/commit-analyzer": "^13.0.1",
56
57
  "@semantic-release/git": "^10.0.1",
@@ -60,6 +61,8 @@
60
61
  "@types/node": "^24.0.1",
61
62
  "@types/ws": "^8.18.1",
62
63
  "@vitest/coverage-v8": "^3.2.3",
64
+ "codecov": "^3.8.3",
65
+ "conventional-changelog-conventionalcommits": "^9.0.0",
63
66
  "esbuild": "^0.25.5",
64
67
  "glob": "^11.0.3",
65
68
  "semantic-release": "^24.2.5",