@hsiehchenwei/mcp-gemini-transcriber 1.0.0
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.
- package/README.md +217 -0
- package/mcp.json.example +14 -0
- package/mcp.json.npx.example +16 -0
- package/package.json +46 -0
- package/server.mjs +1954 -0
package/README.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# MCP Gemini Transcriber
|
|
2
|
+
|
|
3
|
+
音訊轉逐字稿 MCP 工具(使用 Gemini API),支援語者識別與情緒分析。
|
|
4
|
+
|
|
5
|
+
## 功能特色
|
|
6
|
+
|
|
7
|
+
### 🎵 音訊轉逐字稿
|
|
8
|
+
- **自動分段**:長音檔自動切割成 5 分鐘區塊
|
|
9
|
+
- **平行處理**:最多 25 個任務同時進行
|
|
10
|
+
- **時間戳調整**:自動調整各段時間戳,確保連續
|
|
11
|
+
- **語者識別**:識別不同發言者並自動命名
|
|
12
|
+
- **情緒分析**:分析對話情緒流動與關鍵時刻
|
|
13
|
+
- **失敗重試**:自動重試失敗片段(2 次)
|
|
14
|
+
|
|
15
|
+
### 🖼️ 圖片描述
|
|
16
|
+
- **多詳細程度**:簡單/一般/詳細三種模式
|
|
17
|
+
- **Markdown 輸出**:結構化描述
|
|
18
|
+
|
|
19
|
+
## 支援格式
|
|
20
|
+
|
|
21
|
+
### 音訊
|
|
22
|
+
`.mp3`, `.m4a`, `.wav`, `.webm`, `.ogg`, `.flac`, `.aiff`, `.aac`
|
|
23
|
+
|
|
24
|
+
### 圖片
|
|
25
|
+
`.png`, `.jpg`, `.jpeg`, `.webp`, `.heic`, `.heif`
|
|
26
|
+
|
|
27
|
+
## 快速開始(推薦:使用 npx)
|
|
28
|
+
|
|
29
|
+
無需下載或安裝,直接使用 npx 執行:
|
|
30
|
+
|
|
31
|
+
### 1. 設定 Cursor MCP
|
|
32
|
+
|
|
33
|
+
編輯 `~/.cursor/mcp.json`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"gemini-transcriber": {
|
|
39
|
+
"command": "npx",
|
|
40
|
+
"args": [
|
|
41
|
+
"-y",
|
|
42
|
+
"@hsiehchenwei/mcp-gemini-transcriber"
|
|
43
|
+
],
|
|
44
|
+
"env": {
|
|
45
|
+
"GEMINI_API_KEY": "你的-Gemini-API-Key",
|
|
46
|
+
"CURSOR_WORKSPACE_ROOT": "${workspaceFolder}"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 2. 重啟 Cursor
|
|
54
|
+
|
|
55
|
+
完成!工具會自動下載並執行,無需本地安裝。
|
|
56
|
+
|
|
57
|
+
**環境變數說明**:
|
|
58
|
+
- `GEMINI_API_KEY`(必填):你的 Gemini API 金鑰
|
|
59
|
+
- `CURSOR_WORKSPACE_ROOT`(選填):工作區根目錄,用於解析相對路徑
|
|
60
|
+
- `DEFAULT_MODE`(選填):預設轉錄模式,可設定為 `fast` 或 `speaker`
|
|
61
|
+
- 未設定時預設為 `fast`(快速模式)
|
|
62
|
+
- 設定為 `speaker` 時,預設使用語者識別+情緒分析模式
|
|
63
|
+
- 在對話中仍可指定 `mode` 參數覆蓋預設值
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 本地安裝(可選)
|
|
68
|
+
|
|
69
|
+
如果你想在本地安裝:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install -g @hsiehchenwei/mcp-gemini-transcriber
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
然後在 `mcp.json` 中使用:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"gemini-transcriber": {
|
|
81
|
+
"command": "mcp-gemini-transcriber",
|
|
82
|
+
"env": {
|
|
83
|
+
"GEMINI_API_KEY": "你的-Gemini-API-Key",
|
|
84
|
+
"CURSOR_WORKSPACE_ROOT": "${workspaceFolder}",
|
|
85
|
+
"DEFAULT_MODE": "fast"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 系統需求
|
|
93
|
+
|
|
94
|
+
### 需要 FFmpeg
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# macOS
|
|
98
|
+
brew install ffmpeg
|
|
99
|
+
|
|
100
|
+
# Ubuntu/Debian
|
|
101
|
+
sudo apt install ffmpeg
|
|
102
|
+
|
|
103
|
+
# Windows
|
|
104
|
+
# 下載並安裝:https://ffmpeg.org/download.html
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 使用方式
|
|
108
|
+
|
|
109
|
+
### 音訊轉逐字稿
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
請轉錄這個音檔:/path/to/audio.m4a
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**speaker 模式輸出包含**:
|
|
116
|
+
- 摘要
|
|
117
|
+
- 情緒流動(簡短段落,包含經典句子)
|
|
118
|
+
- 語者資訊(辨識出的名字和特徵)
|
|
119
|
+
- 逐字稿(已替換為辨識出的名字,含情緒轉折標記)
|
|
120
|
+
|
|
121
|
+
### 圖片描述
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
請描述這張圖片:/path/to/image.jpg
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 列出支援格式
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
請列出支援的檔案格式
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 分析特定語者
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
分析音頻中 01:18 處的語者資訊
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 工具說明
|
|
140
|
+
|
|
141
|
+
### transcribe_audio
|
|
142
|
+
|
|
143
|
+
| 參數 | 必填 | 說明 |
|
|
144
|
+
|------|------|------|
|
|
145
|
+
| `audio_path` | ✅ | 音訊檔案路徑 |
|
|
146
|
+
| `output_path` | ❌ | 輸出路徑(預設同目錄 .md) |
|
|
147
|
+
| `model` | ❌ | 模型(預設 gemini-3-flash-preview) |
|
|
148
|
+
| `mode` | ❌ | 模式:`fast`(快速,預設)或 `speaker`(語者識別+情緒分析) |
|
|
149
|
+
|
|
150
|
+
**模式說明**:
|
|
151
|
+
- **fast**(預設):快速模式,平行轉錄,不進行語者識別和情緒分析
|
|
152
|
+
- **speaker**:逐段處理,同時進行語者識別和情緒分析,輸出包含語者資訊、情緒流動摘要和逐字稿(含情緒轉折標記)
|
|
153
|
+
|
|
154
|
+
**預設模式設定**:
|
|
155
|
+
- 預設模式為 `fast`
|
|
156
|
+
- 可透過環境變數 `DEFAULT_MODE` 設定預設模式(`fast` 或 `speaker`)
|
|
157
|
+
- 在對話中指定 `mode` 參數可覆蓋預設值
|
|
158
|
+
|
|
159
|
+
### describe_image
|
|
160
|
+
|
|
161
|
+
| 參數 | 必填 | 說明 |
|
|
162
|
+
|------|------|------|
|
|
163
|
+
| `image_path` | ✅ | 圖片路徑 |
|
|
164
|
+
| `output_path` | ❌ | 輸出路徑 |
|
|
165
|
+
| `detail_level` | ❌ | simple/normal/detailed |
|
|
166
|
+
|
|
167
|
+
## 處理流程
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
原始音訊
|
|
171
|
+
↓
|
|
172
|
+
ffprobe 取得總時長
|
|
173
|
+
↓
|
|
174
|
+
ffmpeg 分割(每段 5 分鐘)
|
|
175
|
+
↓
|
|
176
|
+
平行上傳 Gemini Files API
|
|
177
|
+
↓
|
|
178
|
+
平行轉錄(最多 25 並行)
|
|
179
|
+
↓
|
|
180
|
+
調整時間戳 + 合併
|
|
181
|
+
↓
|
|
182
|
+
產生摘要 + 關鍵字
|
|
183
|
+
↓
|
|
184
|
+
輸出 Markdown
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 可用模型
|
|
188
|
+
|
|
189
|
+
| 模型 | 說明 |
|
|
190
|
+
|------|------|
|
|
191
|
+
| `gemini-3-flash-preview` | 預設,速度快 |
|
|
192
|
+
| `gemini-2.5-flash` | Flash 系列 |
|
|
193
|
+
| `gemini-2.5-pro` | 高品質 |
|
|
194
|
+
|
|
195
|
+
## 發布狀態
|
|
196
|
+
|
|
197
|
+
✅ 已發布到 npm:`@chenwei/mcp-gemini-transcriber`
|
|
198
|
+
|
|
199
|
+
使用 npx 即可直接使用,無需本地安裝:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"mcpServers": {
|
|
204
|
+
"gemini-transcriber": {
|
|
205
|
+
"command": "npx",
|
|
206
|
+
"args": ["-y", "@chenwei/mcp-gemini-transcriber"],
|
|
207
|
+
"env": {
|
|
208
|
+
"GEMINI_API_KEY": "your-key"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## 授權
|
|
216
|
+
|
|
217
|
+
MIT License
|
package/mcp.json.example
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"gemini-transcriber": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": [
|
|
6
|
+
"/Users/chenwei/Documents/GitHub/MCPTools/mcp-gemini-transcriber/server.mjs"
|
|
7
|
+
],
|
|
8
|
+
"env": {
|
|
9
|
+
"GEMINI_API_KEY": "your-gemini-api-key-here",
|
|
10
|
+
"CURSOR_WORKSPACE_ROOT": "${workspaceFolder}"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"gemini-transcriber": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": [
|
|
6
|
+
"-y",
|
|
7
|
+
"@hsiehchenwei/mcp-gemini-transcriber"
|
|
8
|
+
],
|
|
9
|
+
"env": {
|
|
10
|
+
"GEMINI_API_KEY": "your-gemini-api-key-here",
|
|
11
|
+
"CURSOR_WORKSPACE_ROOT": "${workspaceFolder}",
|
|
12
|
+
"DEFAULT_MODE": "fast"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hsiehchenwei/mcp-gemini-transcriber",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP 音訊轉逐字稿工具(使用 Gemini API)- 支援語者識別與情緒分析",
|
|
6
|
+
"main": "server.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-gemini-transcriber": "./server.mjs"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node server.mjs"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"model-context-protocol",
|
|
16
|
+
"gemini",
|
|
17
|
+
"transcription",
|
|
18
|
+
"audio",
|
|
19
|
+
"speech-to-text",
|
|
20
|
+
"speaker-identification",
|
|
21
|
+
"emotion-analysis"
|
|
22
|
+
],
|
|
23
|
+
"author": "chenwei",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/chenwei/MCPTools.git",
|
|
28
|
+
"directory": "mcp-gemini-transcriber"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@google/genai": "^1.0.0",
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
33
|
+
"dotenv": "^16.4.5",
|
|
34
|
+
"glob": "^10.3.10",
|
|
35
|
+
"zod": "^3.22.4"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"server.mjs",
|
|
42
|
+
"README.md",
|
|
43
|
+
"mcp.json.example",
|
|
44
|
+
"mcp.json.npx.example"
|
|
45
|
+
]
|
|
46
|
+
}
|