ydc-mcp-server 1.6.1
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 +140 -0
- package/README_JA.md +138 -0
- package/README_ZH_CN.md +138 -0
- package/README_ZH_TW.md +138 -0
- package/index.js +604 -0
- package/lib/advanced-versions.js +113 -0
- package/lib/api-client.js +134 -0
- package/lib/auth-middleware.js +44 -0
- package/lib/conversation-store.js +271 -0
- package/lib/openai-mapper.js +215 -0
- package/lib/routes/chat.js +199 -0
- package/lib/routes/conversations.js +94 -0
- package/lib/routes/health.js +31 -0
- package/lib/routes/models.js +111 -0
- package/openai-server.js +93 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# ydc-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
4
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
5
|
+
|
|
6
|
+
MCP server for You.com AI agents with OpenAI-compatible API.
|
|
7
|
+
|
|
8
|
+
> 📖 Other languages: 繁體中文 | 简体中文 | 日本語 (see README_ZH_TW.md, README_ZH_CN.md, README_JA.md)
|
|
9
|
+
|
|
10
|
+
## MCP Configuration
|
|
11
|
+
|
|
12
|
+
### Claude Desktop / Cursor / Windsurf
|
|
13
|
+
|
|
14
|
+
Add to your MCP config file:
|
|
15
|
+
|
|
16
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
17
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
18
|
+
**Cursor/Windsurf**: `.cursor/mcp.json` or `.windsurf/mcp.json`
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"ydc-mcp-server": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
26
|
+
"env": {
|
|
27
|
+
"YDC_API_KEY": "your-api-key"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### With Multiple API Keys
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"ydc-mcp-server": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
42
|
+
"env": {
|
|
43
|
+
"YDC_API_KEYS": "key1,key2,key3",
|
|
44
|
+
"YDC_KEY_MODE": "round-robin"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Key modes: `round-robin` (default), `sequential`, `random`
|
|
52
|
+
|
|
53
|
+
## Available MCP Tools
|
|
54
|
+
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
|------|-------------|
|
|
57
|
+
| `you_search` | Web and news search |
|
|
58
|
+
| `you_express` | Fast AI answers |
|
|
59
|
+
| `you_advanced` | Complex reasoning with compute/research tools |
|
|
60
|
+
| `you_chat` | OpenAI-compatible chat with conversation history |
|
|
61
|
+
| `you_conversation_list` | List active conversations |
|
|
62
|
+
| `you_conversation_get` | Get conversation history |
|
|
63
|
+
| `you_conversation_delete` | Delete conversation |
|
|
64
|
+
| `you_key_status` | API key usage statistics |
|
|
65
|
+
| `openai_server_control` | Start/stop OpenAI-compatible HTTP server |
|
|
66
|
+
|
|
67
|
+
## Models / Agent Types
|
|
68
|
+
|
|
69
|
+
| Model | Description |
|
|
70
|
+
|-------|-------------|
|
|
71
|
+
| `express` | Fast responses |
|
|
72
|
+
| `research` | Deep analysis |
|
|
73
|
+
| `advanced-3.0-high` | Compute tools (default) |
|
|
74
|
+
| `advanced-4.5-high-research` | Full tools (compute + research) |
|
|
75
|
+
| `<custom-agent-id>` | Any custom You.com agent ID |
|
|
76
|
+
|
|
77
|
+
### Custom Agent ID
|
|
78
|
+
|
|
79
|
+
You can use any custom You.com agent ID as the model name:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
83
|
+
-H "Authorization: Bearer token" \
|
|
84
|
+
-H "Content-Type: application/json" \
|
|
85
|
+
-d '{"model":"your-custom-agent-uuid","messages":[{"role":"user","content":"Hello"}]}'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## OpenAI-Compatible Server
|
|
89
|
+
|
|
90
|
+
Start via npx:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Start with single API key
|
|
94
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY
|
|
95
|
+
|
|
96
|
+
# Start with multiple API keys (round-robin)
|
|
97
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2,KEY3
|
|
98
|
+
|
|
99
|
+
# With custom port and key mode
|
|
100
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2 --port 3003 --key-mode random
|
|
101
|
+
|
|
102
|
+
# With access token authentication
|
|
103
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --access-token SECRET
|
|
104
|
+
|
|
105
|
+
# With custom agents (name:id format)
|
|
106
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --agent mybot:uuid-here --agent another:uuid2
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Or via MCP tool `openai_server_control`.
|
|
110
|
+
|
|
111
|
+
### Endpoints
|
|
112
|
+
|
|
113
|
+
- `POST /v1/chat/completions` - Chat completions
|
|
114
|
+
- `GET /v1/models` - List models
|
|
115
|
+
- `GET /health` - Health check
|
|
116
|
+
|
|
117
|
+
### Usage
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
121
|
+
-H "Authorization: Bearer token" \
|
|
122
|
+
-H "Content-Type: application/json" \
|
|
123
|
+
-d '{"model":"express","messages":[{"role":"user","content":"Hello"}]}'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Environment Variables
|
|
127
|
+
|
|
128
|
+
| Variable | Description | Default |
|
|
129
|
+
|----------|-------------|---------|
|
|
130
|
+
| `YDC_API_KEY` | You.com API key | required |
|
|
131
|
+
| `YDC_API_KEYS` | Multiple keys (comma-separated) | - |
|
|
132
|
+
| `YDC_KEY_MODE` | round-robin / sequential / random | round-robin |
|
|
133
|
+
| `YDC_OPENAI_PORT` | HTTP server port | 3002 |
|
|
134
|
+
| `YDC_CONVERSATION_STORE` | sqlite / memory | sqlite |
|
|
135
|
+
| `YDC_OPENAI_ACCESS_TOKENS` | Allowed tokens (comma-separated) | - |
|
|
136
|
+
| `YDC_CUSTOM_AGENTS` | Custom agents (name:id,name2:id2) | - |
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT
|
package/README_JA.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# ydc-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
4
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
5
|
+
|
|
6
|
+
You.com AI エージェント用 MCP サーバー、OpenAI 互換 API 対応。
|
|
7
|
+
|
|
8
|
+
## MCP 設定
|
|
9
|
+
|
|
10
|
+
### Claude Desktop / Cursor / Windsurf
|
|
11
|
+
|
|
12
|
+
MCP 設定ファイルに追加:
|
|
13
|
+
|
|
14
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
15
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
16
|
+
**Cursor/Windsurf**: `.cursor/mcp.json` または `.windsurf/mcp.json`
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"ydc-mcp-server": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
24
|
+
"env": {
|
|
25
|
+
"YDC_API_KEY": "your-api-key"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 複数 API Key 設定
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"ydc-mcp-server": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
40
|
+
"env": {
|
|
41
|
+
"YDC_API_KEYS": "key1,key2,key3",
|
|
42
|
+
"YDC_KEY_MODE": "round-robin"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Key モード:`round-robin`(デフォルト)、`sequential`、`random`
|
|
50
|
+
|
|
51
|
+
## 利用可能な MCP ツール
|
|
52
|
+
|
|
53
|
+
| ツール | 説明 |
|
|
54
|
+
|--------|------|
|
|
55
|
+
| `you_search` | ウェブ・ニュース検索 |
|
|
56
|
+
| `you_express` | 高速 AI 回答 |
|
|
57
|
+
| `you_advanced` | 複雑な推論(計算/リサーチツール付き) |
|
|
58
|
+
| `you_chat` | OpenAI 互換チャット(会話履歴付き) |
|
|
59
|
+
| `you_conversation_list` | 会話一覧 |
|
|
60
|
+
| `you_conversation_get` | 会話履歴取得 |
|
|
61
|
+
| `you_conversation_delete` | 会話削除 |
|
|
62
|
+
| `you_key_status` | API Key 使用統計 |
|
|
63
|
+
| `openai_server_control` | OpenAI 互換 HTTP サーバーの起動/停止 |
|
|
64
|
+
|
|
65
|
+
## モデル / Agent タイプ
|
|
66
|
+
|
|
67
|
+
| モデル | 説明 |
|
|
68
|
+
|--------|------|
|
|
69
|
+
| `express` | 高速レスポンス |
|
|
70
|
+
| `research` | 深い分析 |
|
|
71
|
+
| `advanced-3.0-high` | 計算ツール(デフォルト) |
|
|
72
|
+
| `advanced-4.5-high-research` | フルツール(計算 + リサーチ) |
|
|
73
|
+
| `<custom-agent-id>` | 任意のカスタム You.com agent ID |
|
|
74
|
+
|
|
75
|
+
### カスタム Agent ID
|
|
76
|
+
|
|
77
|
+
任意の You.com カスタム agent ID をモデル名として使用可能:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
81
|
+
-H "Authorization: Bearer token" \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-d '{"model":"your-custom-agent-uuid","messages":[{"role":"user","content":"こんにちは"}]}'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## OpenAI 互換サーバー
|
|
87
|
+
|
|
88
|
+
npx で起動:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# 単一 API key
|
|
92
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY
|
|
93
|
+
|
|
94
|
+
# 複数 API keys(ローテーション)
|
|
95
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2,KEY3
|
|
96
|
+
|
|
97
|
+
# カスタムポートと key モード
|
|
98
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2 --port 3003 --key-mode random
|
|
99
|
+
|
|
100
|
+
# アクセストークン認証付き
|
|
101
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --access-token SECRET
|
|
102
|
+
|
|
103
|
+
# カスタム agents 付き(name:id 形式)
|
|
104
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --agent mybot:uuid-here --agent another:uuid2
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
または MCP ツール `openai_server_control` 経由。
|
|
108
|
+
|
|
109
|
+
### API エンドポイント
|
|
110
|
+
|
|
111
|
+
- `POST /v1/chat/completions` - チャット完了
|
|
112
|
+
- `GET /v1/models` - モデル一覧
|
|
113
|
+
- `GET /health` - ヘルスチェック
|
|
114
|
+
|
|
115
|
+
### 使用例
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
119
|
+
-H "Authorization: Bearer token" \
|
|
120
|
+
-H "Content-Type: application/json" \
|
|
121
|
+
-d '{"model":"express","messages":[{"role":"user","content":"こんにちは"}]}'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 環境変数
|
|
125
|
+
|
|
126
|
+
| 変数 | 説明 | デフォルト |
|
|
127
|
+
|------|------|------------|
|
|
128
|
+
| `YDC_API_KEY` | You.com API キー | 必須 |
|
|
129
|
+
| `YDC_API_KEYS` | 複数キー(カンマ区切り) | - |
|
|
130
|
+
| `YDC_KEY_MODE` | round-robin / sequential / random | round-robin |
|
|
131
|
+
| `YDC_OPENAI_PORT` | HTTP サーバーポート | 3002 |
|
|
132
|
+
| `YDC_CONVERSATION_STORE` | sqlite / memory | sqlite |
|
|
133
|
+
| `YDC_OPENAI_ACCESS_TOKENS` | 許可トークン(カンマ区切り) | - |
|
|
134
|
+
| `YDC_CUSTOM_AGENTS` | カスタム agents(name:id,name2:id2) | - |
|
|
135
|
+
|
|
136
|
+
## ライセンス
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README_ZH_CN.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# ydc-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
4
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
5
|
+
|
|
6
|
+
You.com AI 代理的 MCP 服务器,支持 OpenAI 兼容 API。
|
|
7
|
+
|
|
8
|
+
## MCP 配置
|
|
9
|
+
|
|
10
|
+
### Claude Desktop / Cursor / Windsurf
|
|
11
|
+
|
|
12
|
+
添加到 MCP 配置文件:
|
|
13
|
+
|
|
14
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
15
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
16
|
+
**Cursor/Windsurf**: `.cursor/mcp.json` 或 `.windsurf/mcp.json`
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"ydc-mcp-server": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
24
|
+
"env": {
|
|
25
|
+
"YDC_API_KEY": "your-api-key"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 多 API Key 配置
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"ydc-mcp-server": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
40
|
+
"env": {
|
|
41
|
+
"YDC_API_KEYS": "key1,key2,key3",
|
|
42
|
+
"YDC_KEY_MODE": "round-robin"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Key 模式:`round-robin`(默认)、`sequential`、`random`
|
|
50
|
+
|
|
51
|
+
## 可用 MCP 工具
|
|
52
|
+
|
|
53
|
+
| 工具 | 说明 |
|
|
54
|
+
|------|------|
|
|
55
|
+
| `you_search` | 网页与新闻搜索 |
|
|
56
|
+
| `you_express` | 快速 AI 回答 |
|
|
57
|
+
| `you_advanced` | 复杂推理(含计算/研究工具) |
|
|
58
|
+
| `you_chat` | OpenAI 兼容聊天(含对话历史) |
|
|
59
|
+
| `you_conversation_list` | 列出对话 |
|
|
60
|
+
| `you_conversation_get` | 获取对话历史 |
|
|
61
|
+
| `you_conversation_delete` | 删除对话 |
|
|
62
|
+
| `you_key_status` | API Key 使用统计 |
|
|
63
|
+
| `openai_server_control` | 启动/停止 OpenAI 兼容 HTTP 服务器 |
|
|
64
|
+
|
|
65
|
+
## 模型 / Agent 类型
|
|
66
|
+
|
|
67
|
+
| 模型 | 说明 |
|
|
68
|
+
|------|------|
|
|
69
|
+
| `express` | 快速响应 |
|
|
70
|
+
| `research` | 深度分析 |
|
|
71
|
+
| `advanced-3.0-high` | 计算工具(默认) |
|
|
72
|
+
| `advanced-4.5-high-research` | 完整工具(计算 + 研究) |
|
|
73
|
+
| `<custom-agent-id>` | 任意自定义 You.com agent ID |
|
|
74
|
+
|
|
75
|
+
### 自定义 Agent ID
|
|
76
|
+
|
|
77
|
+
可使用任意 You.com 自定义 agent ID 作为 model 名称:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
81
|
+
-H "Authorization: Bearer token" \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-d '{"model":"your-custom-agent-uuid","messages":[{"role":"user","content":"你好"}]}'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## OpenAI 兼容服务器
|
|
87
|
+
|
|
88
|
+
通过 npx 启动:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# 单个 API key
|
|
92
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY
|
|
93
|
+
|
|
94
|
+
# 多个 API keys(轮换)
|
|
95
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2,KEY3
|
|
96
|
+
|
|
97
|
+
# 自定义 port 和 key 模式
|
|
98
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2 --port 3003 --key-mode random
|
|
99
|
+
|
|
100
|
+
# 带 access token 验证
|
|
101
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --access-token SECRET
|
|
102
|
+
|
|
103
|
+
# 带自定义 agents(name:id 格式)
|
|
104
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --agent mybot:uuid-here --agent another:uuid2
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
或通过 MCP 工具 `openai_server_control`。
|
|
108
|
+
|
|
109
|
+
### API 端点
|
|
110
|
+
|
|
111
|
+
- `POST /v1/chat/completions` - 聊天完成
|
|
112
|
+
- `GET /v1/models` - 列出模型
|
|
113
|
+
- `GET /health` - 健康检查
|
|
114
|
+
|
|
115
|
+
### 使用示例
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
119
|
+
-H "Authorization: Bearer token" \
|
|
120
|
+
-H "Content-Type: application/json" \
|
|
121
|
+
-d '{"model":"express","messages":[{"role":"user","content":"你好"}]}'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 环境变量
|
|
125
|
+
|
|
126
|
+
| 变量 | 说明 | 默认值 |
|
|
127
|
+
|------|------|--------|
|
|
128
|
+
| `YDC_API_KEY` | You.com API 密钥 | 必填 |
|
|
129
|
+
| `YDC_API_KEYS` | 多个密钥(逗号分隔) | - |
|
|
130
|
+
| `YDC_KEY_MODE` | round-robin / sequential / random | round-robin |
|
|
131
|
+
| `YDC_OPENAI_PORT` | HTTP 服务器端口 | 3002 |
|
|
132
|
+
| `YDC_CONVERSATION_STORE` | sqlite / memory | sqlite |
|
|
133
|
+
| `YDC_OPENAI_ACCESS_TOKENS` | 允许的 token(逗号分隔) | - |
|
|
134
|
+
| `YDC_CUSTOM_AGENTS` | 自定义 agents(name:id,name2:id2) | - |
|
|
135
|
+
|
|
136
|
+
## 许可证
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README_ZH_TW.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# ydc-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
4
|
+
[](https://www.npmjs.com/package/ydc-mcp-server)
|
|
5
|
+
|
|
6
|
+
You.com AI 代理的 MCP 伺服器,支援 OpenAI 相容 API。
|
|
7
|
+
|
|
8
|
+
## MCP 設定
|
|
9
|
+
|
|
10
|
+
### Claude Desktop / Cursor / Windsurf
|
|
11
|
+
|
|
12
|
+
加入 MCP 設定檔:
|
|
13
|
+
|
|
14
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
15
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
16
|
+
**Cursor/Windsurf**: `.cursor/mcp.json` 或 `.windsurf/mcp.json`
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"ydc-mcp-server": {
|
|
22
|
+
"command": "npx",
|
|
23
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
24
|
+
"env": {
|
|
25
|
+
"YDC_API_KEY": "your-api-key"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 多 API Key 設定
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"ydc-mcp-server": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "ydc-mcp-server"],
|
|
40
|
+
"env": {
|
|
41
|
+
"YDC_API_KEYS": "key1,key2,key3",
|
|
42
|
+
"YDC_KEY_MODE": "round-robin"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Key 模式:`round-robin`(預設)、`sequential`、`random`
|
|
50
|
+
|
|
51
|
+
## 可用 MCP 工具
|
|
52
|
+
|
|
53
|
+
| 工具 | 說明 |
|
|
54
|
+
|------|------|
|
|
55
|
+
| `you_search` | 網頁與新聞搜尋 |
|
|
56
|
+
| `you_express` | 快速 AI 回答 |
|
|
57
|
+
| `you_advanced` | 複雜推理(含計算/研究工具) |
|
|
58
|
+
| `you_chat` | OpenAI 相容聊天(含對話歷史) |
|
|
59
|
+
| `you_conversation_list` | 列出對話 |
|
|
60
|
+
| `you_conversation_get` | 取得對話歷史 |
|
|
61
|
+
| `you_conversation_delete` | 刪除對話 |
|
|
62
|
+
| `you_key_status` | API Key 使用統計 |
|
|
63
|
+
| `openai_server_control` | 啟動/停止 OpenAI 相容 HTTP 伺服器 |
|
|
64
|
+
|
|
65
|
+
## 模型 / Agent 類型
|
|
66
|
+
|
|
67
|
+
| 模型 | 說明 |
|
|
68
|
+
|------|------|
|
|
69
|
+
| `express` | 快速回應 |
|
|
70
|
+
| `research` | 深度分析 |
|
|
71
|
+
| `advanced-3.0-high` | 計算工具(預設) |
|
|
72
|
+
| `advanced-4.5-high-research` | 完整工具(計算 + 研究) |
|
|
73
|
+
| `<custom-agent-id>` | 任意自定義 You.com agent ID |
|
|
74
|
+
|
|
75
|
+
### 自定義 Agent ID
|
|
76
|
+
|
|
77
|
+
可使用任意 You.com 自定義 agent ID 作為 model 名稱:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
81
|
+
-H "Authorization: Bearer token" \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-d '{"model":"your-custom-agent-uuid","messages":[{"role":"user","content":"你好"}]}'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## OpenAI 相容伺服器
|
|
87
|
+
|
|
88
|
+
透過 npx 啟動:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# 單個 API key
|
|
92
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY
|
|
93
|
+
|
|
94
|
+
# 多個 API keys(輪換)
|
|
95
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2,KEY3
|
|
96
|
+
|
|
97
|
+
# 自訂 port 和 key 模式
|
|
98
|
+
npx ydc-mcp-server --openai --api-keys KEY1,KEY2 --port 3003 --key-mode random
|
|
99
|
+
|
|
100
|
+
# 帶 access token 驗證
|
|
101
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --access-token SECRET
|
|
102
|
+
|
|
103
|
+
# 帶自定義 agents(name:id 格式)
|
|
104
|
+
npx ydc-mcp-server --openai --api-key YOUR_API_KEY --agent mybot:uuid-here --agent another:uuid2
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
或透過 MCP 工具 `openai_server_control`。
|
|
108
|
+
|
|
109
|
+
### API 端點
|
|
110
|
+
|
|
111
|
+
- `POST /v1/chat/completions` - 聊天完成
|
|
112
|
+
- `GET /v1/models` - 列出模型
|
|
113
|
+
- `GET /health` - 健康檢查
|
|
114
|
+
|
|
115
|
+
### 使用範例
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
curl -X POST http://localhost:3002/v1/chat/completions \
|
|
119
|
+
-H "Authorization: Bearer token" \
|
|
120
|
+
-H "Content-Type: application/json" \
|
|
121
|
+
-d '{"model":"express","messages":[{"role":"user","content":"你好"}]}'
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 環境變數
|
|
125
|
+
|
|
126
|
+
| 變數 | 說明 | 預設值 |
|
|
127
|
+
|------|------|--------|
|
|
128
|
+
| `YDC_API_KEY` | You.com API 金鑰 | 必填 |
|
|
129
|
+
| `YDC_API_KEYS` | 多個金鑰(逗號分隔) | - |
|
|
130
|
+
| `YDC_KEY_MODE` | round-robin / sequential / random | round-robin |
|
|
131
|
+
| `YDC_OPENAI_PORT` | HTTP 伺服器埠 | 3002 |
|
|
132
|
+
| `YDC_CONVERSATION_STORE` | sqlite / memory | sqlite |
|
|
133
|
+
| `YDC_OPENAI_ACCESS_TOKENS` | 允許的 token(逗號分隔) | - |
|
|
134
|
+
| `YDC_CUSTOM_AGENTS` | 自定義 agents(name:id,name2:id2) | - |
|
|
135
|
+
|
|
136
|
+
## 授權
|
|
137
|
+
|
|
138
|
+
MIT
|