@bashcat/ai-image-chat-mcp 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/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 bashcat
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# AI Image Chat MCP 工具
|
|
2
|
+
|
|
3
|
+
這是一個通用的 AI 圖片生成和對話完成 Model Context Protocol (MCP) 工具,支持多種 AI 服務提供商。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 🖼️ **圖片生成**: 使用 AI 模型生成圖片
|
|
8
|
+
- 💬 **對話完成**: 使用 AI 模型進行智能對話
|
|
9
|
+
- 🔐 **安全配置**: API 密鑰安全保存在 `.env` 文件中
|
|
10
|
+
- 🎛️ **自定義提示**: 支持自定義系統提示詞,如未提供則使用預設值
|
|
11
|
+
|
|
12
|
+
## 安裝與設置
|
|
13
|
+
|
|
14
|
+
### 1. 安裝依賴
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. 配置環境變數
|
|
21
|
+
|
|
22
|
+
編輯 `.env` 文件,設置你的 API 密鑰:
|
|
23
|
+
|
|
24
|
+
```env
|
|
25
|
+
AI_API_KEY=your_api_key_here
|
|
26
|
+
AI_API_BASE_URL=https://api.laozhang.ai/v1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**支持的 API 服務商:**
|
|
30
|
+
|
|
31
|
+
- 老張 AI: `https://api.laozhang.ai/v1`
|
|
32
|
+
- OpenAI: `https://api.openai.com/v1`
|
|
33
|
+
- 其他 OpenAI 兼容的 API 服務
|
|
34
|
+
|
|
35
|
+
### 3. 編譯項目
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run build
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 4. 啟動服務
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm start
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 可用工具
|
|
48
|
+
|
|
49
|
+
### 1. generate_image
|
|
50
|
+
|
|
51
|
+
生成圖片的工具。
|
|
52
|
+
|
|
53
|
+
**參數:**
|
|
54
|
+
|
|
55
|
+
- `prompt` (必需): 圖片生成的提示詞
|
|
56
|
+
- `system_prompt` (可選): 系統提示詞,預設為 "You are a helpful assistant that generates images."
|
|
57
|
+
- `model` (可選): 模型名稱,預設為 "gpt-image-1"
|
|
58
|
+
|
|
59
|
+
**範例:**
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"prompt": "生成一張卡通風格的熊貓宇航員圖片,背景是星空",
|
|
64
|
+
"system_prompt": "You are a creative image generator.",
|
|
65
|
+
"model": "gpt-image-1"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. chat_completion
|
|
70
|
+
|
|
71
|
+
進行對話的工具。
|
|
72
|
+
|
|
73
|
+
**參數:**
|
|
74
|
+
|
|
75
|
+
- `message` (必需): 用戶訊息
|
|
76
|
+
- `system_prompt` (可選): 系統提示詞,預設為 "You are a helpful assistant."
|
|
77
|
+
- `model` (可選): 模型名稱,預設為 "gpt-4"
|
|
78
|
+
|
|
79
|
+
**範例:**
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"message": "請幫我寫一首關於春天的詩",
|
|
84
|
+
"system_prompt": "You are a professional poet.",
|
|
85
|
+
"model": "gpt-4"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API 參考
|
|
90
|
+
|
|
91
|
+
本工具使用老張 AI 的聊天完成 API:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
POST https://api.laozhang.ai/v1/chat/completions
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**請求格式:**
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"model": "gpt-image-1",
|
|
102
|
+
"messages": [
|
|
103
|
+
{ "role": "system", "content": "系統提示詞" },
|
|
104
|
+
{ "role": "user", "content": "用戶訊息" }
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 開發
|
|
110
|
+
|
|
111
|
+
### 開發模式
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm run dev
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
這會啟動 TypeScript 編譯器的監聽模式,當你修改代碼時會自動重新編譯。
|
|
118
|
+
|
|
119
|
+
### 項目結構
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
laozhang_mcp/
|
|
123
|
+
├── src/
|
|
124
|
+
│ └── index.ts # 主要服務器代碼
|
|
125
|
+
├── dist/ # 編譯後的輸出
|
|
126
|
+
├── .env # 環境變數配置
|
|
127
|
+
├── package.json # 項目配置
|
|
128
|
+
├── tsconfig.json # TypeScript 配置
|
|
129
|
+
└── README.md # 說明文檔
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 注意事項
|
|
133
|
+
|
|
134
|
+
1. 請確保你有有效的 AI API 密鑰
|
|
135
|
+
2. 不要將 `.env` 文件提交到版本控制系統
|
|
136
|
+
3. 圖片生成可能需要較長時間,請耐心等待
|
|
137
|
+
4. API 有使用限制,請適度使用
|
|
138
|
+
|
|
139
|
+
## 許可證
|
|
140
|
+
|
|
141
|
+
MIT License
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import dotenv from "dotenv";
|
|
5
|
+
import axios from "axios";
|
|
6
|
+
// 載入環境變數
|
|
7
|
+
dotenv.config();
|
|
8
|
+
class AIImageChatMCPServer {
|
|
9
|
+
server;
|
|
10
|
+
apiKey;
|
|
11
|
+
baseUrl;
|
|
12
|
+
constructor() {
|
|
13
|
+
this.server = new Server({
|
|
14
|
+
name: "ai-image-chat-mcp-server",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
}, {
|
|
17
|
+
capabilities: {
|
|
18
|
+
tools: {},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
// 從環境變數獲取 API 配置
|
|
22
|
+
this.apiKey = process.env.AI_API_KEY || "";
|
|
23
|
+
this.baseUrl = process.env.AI_API_BASE_URL || "https://api.laozhang.ai/v1";
|
|
24
|
+
if (!this.apiKey) {
|
|
25
|
+
throw new Error("AI_API_KEY 環境變數未設定");
|
|
26
|
+
}
|
|
27
|
+
this.setupToolHandlers();
|
|
28
|
+
}
|
|
29
|
+
setupToolHandlers() {
|
|
30
|
+
// 列出可用工具
|
|
31
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
32
|
+
return {
|
|
33
|
+
tools: [
|
|
34
|
+
{
|
|
35
|
+
name: "generate_image",
|
|
36
|
+
description: "使用 AI 生成圖片",
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {
|
|
40
|
+
prompt: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "圖片生成的提示詞",
|
|
43
|
+
},
|
|
44
|
+
system_prompt: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "系統提示詞(可選,如未提供將使用預設值)",
|
|
47
|
+
},
|
|
48
|
+
model: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "使用的模型名稱",
|
|
51
|
+
default: "gpt-image-1",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ["prompt"],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "chat_completion",
|
|
59
|
+
description: "使用 AI 進行對話",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
message: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "用戶訊息",
|
|
66
|
+
},
|
|
67
|
+
system_prompt: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "系統提示詞(可選,如未提供將使用預設值)",
|
|
70
|
+
},
|
|
71
|
+
model: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "使用的模型名稱",
|
|
74
|
+
default: "gpt-4",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
required: ["message"],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
// 處理工具調用
|
|
84
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
85
|
+
const { name, arguments: args } = request.params;
|
|
86
|
+
try {
|
|
87
|
+
switch (name) {
|
|
88
|
+
case "generate_image":
|
|
89
|
+
return await this.handleImageGeneration(args);
|
|
90
|
+
case "chat_completion":
|
|
91
|
+
return await this.handleChatCompletion(args);
|
|
92
|
+
default:
|
|
93
|
+
throw new McpError(ErrorCode.MethodNotFound, `未知的工具: ${name}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (error instanceof McpError) {
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
throw new McpError(ErrorCode.InternalError, `工具執行錯誤: ${error instanceof Error ? error.message : String(error)}`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async handleImageGeneration(args) {
|
|
105
|
+
const { prompt, system_prompt = "You are a helpful assistant that generates images.", model = "gpt-image-1" } = args;
|
|
106
|
+
if (!prompt) {
|
|
107
|
+
throw new McpError(ErrorCode.InvalidParams, "需要提供 prompt 參數");
|
|
108
|
+
}
|
|
109
|
+
const messages = [
|
|
110
|
+
{ role: "system", content: system_prompt },
|
|
111
|
+
{ role: "user", content: prompt },
|
|
112
|
+
];
|
|
113
|
+
const requestData = {
|
|
114
|
+
model,
|
|
115
|
+
messages,
|
|
116
|
+
};
|
|
117
|
+
try {
|
|
118
|
+
const response = await axios.post(`${this.baseUrl}/chat/completions`, requestData, {
|
|
119
|
+
headers: {
|
|
120
|
+
"Content-Type": "application/json",
|
|
121
|
+
"Authorization": `Bearer ${this.apiKey}`,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
const result = response.data;
|
|
125
|
+
const generatedContent = result.choices[0]?.message?.content || "未生成內容";
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: `圖片生成結果:\n\n${generatedContent}`,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (axios.isAxiosError(error)) {
|
|
137
|
+
const axiosError = error;
|
|
138
|
+
const errorMessage = axiosError.response?.data?.error?.message || axiosError.message;
|
|
139
|
+
throw new McpError(ErrorCode.InternalError, `API 請求失敗: ${errorMessage}`);
|
|
140
|
+
}
|
|
141
|
+
throw new McpError(ErrorCode.InternalError, `未知錯誤: ${error instanceof Error ? error.message : String(error)}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async handleChatCompletion(args) {
|
|
145
|
+
const { message, system_prompt = "You are a helpful assistant.", model = "gpt-4" } = args;
|
|
146
|
+
if (!message) {
|
|
147
|
+
throw new McpError(ErrorCode.InvalidParams, "需要提供 message 參數");
|
|
148
|
+
}
|
|
149
|
+
const messages = [
|
|
150
|
+
{ role: "system", content: system_prompt },
|
|
151
|
+
{ role: "user", content: message },
|
|
152
|
+
];
|
|
153
|
+
const requestData = {
|
|
154
|
+
model,
|
|
155
|
+
messages,
|
|
156
|
+
};
|
|
157
|
+
try {
|
|
158
|
+
const response = await axios.post(`${this.baseUrl}/chat/completions`, requestData, {
|
|
159
|
+
headers: {
|
|
160
|
+
"Content-Type": "application/json",
|
|
161
|
+
"Authorization": `Bearer ${this.apiKey}`,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
const result = response.data;
|
|
165
|
+
const assistantMessage = result.choices[0]?.message?.content || "未收到回覆";
|
|
166
|
+
return {
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
text: `助手回覆:\n\n${assistantMessage}`,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (axios.isAxiosError(error)) {
|
|
177
|
+
const axiosError = error;
|
|
178
|
+
const errorMessage = axiosError.response?.data?.error?.message || axiosError.message;
|
|
179
|
+
throw new McpError(ErrorCode.InternalError, `API 請求失敗: ${errorMessage}`);
|
|
180
|
+
}
|
|
181
|
+
throw new McpError(ErrorCode.InternalError, `未知錯誤: ${error instanceof Error ? error.message : String(error)}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async run() {
|
|
185
|
+
const transport = new StdioServerTransport();
|
|
186
|
+
await this.server.connect(transport);
|
|
187
|
+
console.error("AI Image Chat MCP 服務器已啟動");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// 啟動服務器
|
|
191
|
+
const server = new AIImageChatMCPServer();
|
|
192
|
+
server.run().catch((error) => {
|
|
193
|
+
console.error("服務器啟動失敗:", error);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
});
|
|
196
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GAET,MAAM,oCAAoC,CAAC;AAC5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,SAAS;AACT,MAAM,CAAC,MAAM,EAAE,CAAC;A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0.0",
|
|
4
|
+
"description": "MCP server for AI image generation and chat completion with support for multiple AI providers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"dev": "tsc --watch",
|
|
10
|
+
"start": "node dist/index.js",
|
|
11
|
+
"prepublishOnly": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
15
|
+
"dotenv": "^16.4.5",
|
|
16
|
+
"axios": "^1.7.7"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^22.0.0",
|
|
20
|
+
"typescript": "^5.5.0"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"model-context-protocol",
|
|
28
|
+
"ai",
|
|
29
|
+
"image-generation",
|
|
30
|
+
"chat",
|
|
31
|
+
"openai-compatible"
|
|
32
|
+
],
|
|
33
|
+
"author": "bashcat",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/bashcat/ai-image-chat-mcp.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/bashcat/ai-image-chat-mcp/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/bashcat/ai-image-chat-mcp#readme",
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"README.md",
|
|
46
|
+
"LICENSE"
|
|
47
|
+
]
|
|
48
|
+
}
|