ai-core-mcp-server 1.0.0__tar.gz

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 (29) hide show
  1. ai_core_mcp_server-1.0.0/CHANGELOG.md +98 -0
  2. ai_core_mcp_server-1.0.0/Dockerfile +17 -0
  3. ai_core_mcp_server-1.0.0/EXAMPLES.md +410 -0
  4. ai_core_mcp_server-1.0.0/INSTALL.md +207 -0
  5. ai_core_mcp_server-1.0.0/LICENSE +21 -0
  6. ai_core_mcp_server-1.0.0/MANIFEST.in +14 -0
  7. ai_core_mcp_server-1.0.0/MCP_CONFIG.md +114 -0
  8. ai_core_mcp_server-1.0.0/PKG-INFO +182 -0
  9. ai_core_mcp_server-1.0.0/PROJECT_SUMMARY.md +276 -0
  10. ai_core_mcp_server-1.0.0/README.md +143 -0
  11. ai_core_mcp_server-1.0.0/__init__.py +14 -0
  12. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/PKG-INFO +182 -0
  13. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/SOURCES.txt +27 -0
  14. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/dependency_links.txt +1 -0
  15. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/entry_points.txt +3 -0
  16. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/requires.txt +14 -0
  17. ai_core_mcp_server-1.0.0/ai_core_mcp_server.egg-info/top_level.txt +6 -0
  18. ai_core_mcp_server-1.0.0/ai_core_mcp_server.py +1454 -0
  19. ai_core_mcp_server-1.0.0/main.py +177 -0
  20. ai_core_mcp_server-1.0.0/pyproject.toml +100 -0
  21. ai_core_mcp_server-1.0.0/requirements.txt +4 -0
  22. ai_core_mcp_server-1.0.0/run.py +50 -0
  23. ai_core_mcp_server-1.0.0/run_server.py +53 -0
  24. ai_core_mcp_server-1.0.0/setup.cfg +4 -0
  25. ai_core_mcp_server-1.0.0/setup.py +64 -0
  26. ai_core_mcp_server-1.0.0/test_file_path_security.py +76 -0
  27. ai_core_mcp_server-1.0.0/test_imports.py +44 -0
  28. ai_core_mcp_server-1.0.0/test_module.py +265 -0
  29. ai_core_mcp_server-1.0.0/upload_paths.py +66 -0
@@ -0,0 +1,98 @@
1
+ # 更新日志
2
+
3
+ 所有重要的项目更改都将记录在此文件中。
4
+
5
+ 格式基于 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
6
+ 并且本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
7
+
8
+ ## [1.0.0] - 2024-01-XX
9
+
10
+ ### 新增
11
+ - 初始版本发布
12
+ - Ai-Core MCP Server 核心功能
13
+ - 完整的 Ai-Core API 集成
14
+ - 空间管理工具
15
+ - 知识库管理工具
16
+ - 知识管理工具
17
+ - 模型管理工具
18
+ - 会话管理工具
19
+ - 聊天功能工具
20
+ - 块管理工具
21
+ - 多种启动方式支持
22
+ - 命令行参数支持
23
+ - 环境变量配置
24
+ - 完整的包安装支持
25
+ - 开发和生产模式
26
+ - 详细的文档和安装指南
27
+
28
+ ### 工具列表
29
+ - `create_tenant` - 创建新空间
30
+ - `list_tenants` - 列出所有空间
31
+ - `create_knowledge_base` - 创建知识库
32
+ - `list_knowledge_bases` - 列出知识库
33
+ - `get_knowledge_base` - 获取知识库详情
34
+ - `delete_knowledge_base` - 删除知识库
35
+ - `hybrid_search` - 混合搜索
36
+ - `create_knowledge_from_url` - 从 URL 创建知识
37
+ - `list_knowledge` - 列出知识
38
+ - `get_knowledge` - 获取知识详情
39
+ - `delete_knowledge` - 删除知识
40
+ - `create_model` - 创建模型
41
+ - `list_models` - 列出模型
42
+ - `get_model` - 获取模型详情
43
+ - `create_session` - 创建聊天会话
44
+ - `get_session` - 获取会话详情
45
+ - `list_sessions` - 列出会话
46
+ - `delete_session` - 删除会话
47
+ - `chat` - 发送聊天消息
48
+ - `list_chunks` - 列出知识块
49
+ - `delete_chunk` - 删除知识块
50
+
51
+ ### 文件结构
52
+ ```
53
+ ai-core-mcp-server/
54
+ ├── __init__.py # 包初始化文件
55
+ ├── main.py # 主入口点 (推荐)
56
+ ├── run.py # 便捷启动脚本
57
+ ├── run_server.py # 原始启动脚本
58
+ ├── ai_core_mcp_server.py # MCP 服务器实现
59
+ ├── test_module.py # 模组测试脚本
60
+ ├── requirements.txt # 依赖列表
61
+ ├── setup.py # 安装脚本 (传统)
62
+ ├── pyproject.toml # 现代项目配置
63
+ ├── MANIFEST.in # 包含文件清单
64
+ ├── LICENSE # MIT 许可证
65
+ ├── README.md # 项目说明
66
+ ├── INSTALL.md # 详细安装指南
67
+ └── CHANGELOG.md # 更新日志
68
+ ```
69
+
70
+ ### 启动方式
71
+ 1. `python main.py` - 主入口点 (推荐)
72
+ 2. `python run_server.py` - 原始启动脚本
73
+ 3. `python run.py` - 便捷启动脚本
74
+ 4. `python ai_core_mcp_server.py` - 直接运行
75
+ 5. `python -m ai_core_mcp_server` - 模块运行
76
+ 6. `ai-core-mcp-server` - 安装后命令行工具
77
+ 7. `ai-core-server` - 安装后命令行工具 (别名)
78
+
79
+ ### 技术特性
80
+ - 基于 Model Context Protocol (MCP) 1.0.0+
81
+ - 异步 I/O 支持
82
+ - 完整的错误处理
83
+ - 详细的日志记录
84
+ - 环境变量配置
85
+ - 命令行参数支持
86
+ - 多种安装方式
87
+ - 开发和生产模式
88
+ - 完整的测试覆盖
89
+
90
+ ### 依赖
91
+ - Python 3.10+
92
+ - mcp >= 1.0.0
93
+ - requests >= 2.31.0
94
+
95
+ ### 兼容性
96
+ - 支持 Windows、macOS、Linux
97
+ - 支持 Python 3.10-3.12
98
+ - 兼容现代 Python 包管理工具
@@ -0,0 +1,17 @@
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+ COPY requirements.txt .
5
+ RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
6
+
7
+ COPY . .
8
+ RUN --mount=type=cache,target=/root/.cache/pip pip install -e .
9
+
10
+ ENV AI_CORE_HOST=0.0.0.0
11
+ ENV AI_CORE_PORT=8000
12
+ ENV AI_CORE_BASE_URL=http://app:8080/api/v1
13
+ # Set AI_CORE_AUTH_TOKEN at runtime; HTTP transport refuses to start without it.
14
+
15
+ EXPOSE 8000
16
+
17
+ CMD ["ai-core-mcp-server", "--transport", "http", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,410 @@
1
+ # Ai-Core MCP Server 使用示例
2
+
3
+ 本文档提供了 Ai-Core MCP Server 的详细使用示例。
4
+
5
+ ## 基本使用
6
+
7
+ ### 1. 启动服务器
8
+
9
+ ```bash
10
+ # 推荐方式 - 使用主入口点
11
+ python main.py
12
+
13
+ # 检查环境配置
14
+ python main.py --check-only
15
+
16
+ # 启用详细日志
17
+ python main.py --verbose
18
+ ```
19
+
20
+ ### 2. 环境配置示例
21
+
22
+ ```bash
23
+ # 设置环境变量
24
+ export AI_CORE_BASE_URL="http://localhost:8080/api/v1"
25
+ export AI_CORE_API_KEY="your_api_key_here"
26
+
27
+ # 或者在 .env 文件中设置
28
+ echo "AI_CORE_BASE_URL=http://localhost:8080/api/v1" > .env
29
+ echo "AI_CORE_API_KEY=your_api_key_here" >> .env
30
+ ```
31
+
32
+ ## MCP 工具使用示例
33
+
34
+ 以下是各种 MCP 工具的使用示例:
35
+
36
+ ### 空间管理
37
+
38
+ #### 创建空间
39
+ ```json
40
+ {
41
+ "tool": "create_tenant",
42
+ "arguments": {
43
+ "name": "我的公司",
44
+ "description": "公司知识管理系统",
45
+ "business": "technology",
46
+ "retriever_engines": {
47
+ "engines": [
48
+ {"retriever_type": "keywords", "retriever_engine_type": "postgres"},
49
+ {"retriever_type": "vector", "retriever_engine_type": "postgres"}
50
+ ]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ #### 列出所有空间
57
+ ```json
58
+ {
59
+ "tool": "list_tenants",
60
+ "arguments": {}
61
+ }
62
+ ```
63
+
64
+ ### 知识库管理
65
+
66
+ #### 创建知识库
67
+ ```json
68
+ {
69
+ "tool": "create_knowledge_base",
70
+ "arguments": {
71
+ "name": "产品文档库",
72
+ "description": "产品相关文档和资料",
73
+ "embedding_model_id": "text-embedding-ada-002",
74
+ "summary_model_id": "gpt-3.5-turbo"
75
+ }
76
+ }
77
+ ```
78
+
79
+ #### 列出知识库
80
+ ```json
81
+ {
82
+ "tool": "list_knowledge_bases",
83
+ "arguments": {}
84
+ }
85
+ ```
86
+
87
+ #### 获取知识库详情
88
+ ```json
89
+ {
90
+ "tool": "get_knowledge_base",
91
+ "arguments": {
92
+ "kb_id": "kb_123456"
93
+ }
94
+ }
95
+ ```
96
+
97
+ #### 混合搜索
98
+ ```json
99
+ {
100
+ "tool": "hybrid_search",
101
+ "arguments": {
102
+ "kb_id": "kb_123456",
103
+ "query": "如何使用API",
104
+ "vector_threshold": 0.7,
105
+ "keyword_threshold": 0.5,
106
+ "match_count": 10
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### 知识管理
112
+
113
+ #### 从URL创建知识
114
+ ```json
115
+ {
116
+ "tool": "create_knowledge_from_url",
117
+ "arguments": {
118
+ "kb_id": "kb_123456",
119
+ "url": "https://docs.example.com/api-guide",
120
+ "enable_multimodel": true
121
+ }
122
+ }
123
+ ```
124
+
125
+ #### 列出知识
126
+ ```json
127
+ {
128
+ "tool": "list_knowledge",
129
+ "arguments": {
130
+ "kb_id": "kb_123456",
131
+ "page": 1,
132
+ "page_size": 20
133
+ }
134
+ }
135
+ ```
136
+
137
+ #### 获取知识详情
138
+ ```json
139
+ {
140
+ "tool": "get_knowledge",
141
+ "arguments": {
142
+ "knowledge_id": "know_789012"
143
+ }
144
+ }
145
+ ```
146
+
147
+ ### 模型管理
148
+
149
+ #### 创建模型
150
+ ```json
151
+ {
152
+ "tool": "create_model",
153
+ "arguments": {
154
+ "name": "GPT-4 Chat Model",
155
+ "type": "KnowledgeQA",
156
+ "source": "openai",
157
+ "description": "OpenAI GPT-4 模型用于知识问答",
158
+ "base_url": "https://api.openai.com/v1",
159
+ "api_key": "sk-...",
160
+ "is_default": true
161
+ }
162
+ }
163
+ ```
164
+
165
+ #### 列出模型
166
+ ```json
167
+ {
168
+ "tool": "list_models",
169
+ "arguments": {}
170
+ }
171
+ ```
172
+
173
+ ### 会话管理
174
+
175
+ #### 创建聊天会话
176
+ ```json
177
+ {
178
+ "tool": "create_session",
179
+ "arguments": {
180
+ "kb_id": "kb_123456",
181
+ "max_rounds": 10,
182
+ "enable_rewrite": true,
183
+ "fallback_response": "抱歉,我无法回答这个问题。",
184
+ "summary_model_id": "gpt-3.5-turbo"
185
+ }
186
+ }
187
+ ```
188
+
189
+ #### 获取会话详情
190
+ ```json
191
+ {
192
+ "tool": "get_session",
193
+ "arguments": {
194
+ "session_id": "sess_345678"
195
+ }
196
+ }
197
+ ```
198
+
199
+ #### 列出会话
200
+ ```json
201
+ {
202
+ "tool": "list_sessions",
203
+ "arguments": {
204
+ "page": 1,
205
+ "page_size": 10
206
+ }
207
+ }
208
+ ```
209
+
210
+ ### 聊天功能
211
+
212
+ #### 发送聊天消息
213
+ ```json
214
+ {
215
+ "tool": "chat",
216
+ "arguments": {
217
+ "session_id": "sess_345678",
218
+ "query": "请介绍一下产品的主要功能"
219
+ }
220
+ }
221
+ ```
222
+
223
+ ### 块管理
224
+
225
+ #### 列出知识块
226
+ ```json
227
+ {
228
+ "tool": "list_chunks",
229
+ "arguments": {
230
+ "knowledge_id": "know_789012",
231
+ "page": 1,
232
+ "page_size": 50
233
+ }
234
+ }
235
+ ```
236
+
237
+ #### 删除知识块
238
+ ```json
239
+ {
240
+ "tool": "delete_chunk",
241
+ "arguments": {
242
+ "knowledge_id": "know_789012",
243
+ "chunk_id": "chunk_456789"
244
+ }
245
+ }
246
+ ```
247
+
248
+ ## 完整工作流程示例
249
+
250
+ ### 场景:创建一个完整的知识问答系统
251
+
252
+ ```bash
253
+ # 1. 启动服务器
254
+ python main.py --verbose
255
+
256
+ # 2. 在 MCP 客户端中执行以下步骤:
257
+ ```
258
+
259
+ #### 步骤 1: 创建空间
260
+ ```json
261
+ {
262
+ "tool": "create_tenant",
263
+ "arguments": {
264
+ "name": "技术文档中心",
265
+ "description": "公司技术文档知识管理",
266
+ "business": "technology"
267
+ }
268
+ }
269
+ ```
270
+
271
+ #### 步骤 2: 创建知识库
272
+ ```json
273
+ {
274
+ "tool": "create_knowledge_base",
275
+ "arguments": {
276
+ "name": "API文档库",
277
+ "description": "所有API相关文档"
278
+ }
279
+ }
280
+ ```
281
+
282
+ #### 步骤 3: 添加知识内容
283
+ ```json
284
+ {
285
+ "tool": "create_knowledge_from_url",
286
+ "arguments": {
287
+ "kb_id": "返回的知识库ID",
288
+ "url": "https://docs.company.com/api",
289
+ "enable_multimodel": true
290
+ }
291
+ }
292
+ ```
293
+
294
+ #### 步骤 4: 创建聊天会话
295
+ ```json
296
+ {
297
+ "tool": "create_session",
298
+ "arguments": {
299
+ "kb_id": "知识库ID",
300
+ "max_rounds": 5,
301
+ "enable_rewrite": true
302
+ }
303
+ }
304
+ ```
305
+
306
+ #### 步骤 5: 开始对话
307
+ ```json
308
+ {
309
+ "tool": "chat",
310
+ "arguments": {
311
+ "session_id": "会话ID",
312
+ "query": "如何使用用户认证API?"
313
+ }
314
+ }
315
+ ```
316
+
317
+ ## 错误处理示例
318
+
319
+ ### 常见错误和解决方案
320
+
321
+ #### 1. 连接错误
322
+ ```json
323
+ {
324
+ "error": "Connection refused",
325
+ "solution": "检查 AI_CORE_BASE_URL 是否正确,确认服务正在运行"
326
+ }
327
+ ```
328
+
329
+ #### 2. 认证错误
330
+ ```json
331
+ {
332
+ "error": "Unauthorized",
333
+ "solution": "检查 AI_CORE_API_KEY 是否设置正确"
334
+ }
335
+ ```
336
+
337
+ #### 3. 资源不存在
338
+ ```json
339
+ {
340
+ "error": "Knowledge base not found",
341
+ "solution": "确认知识库ID是否正确,或先创建知识库"
342
+ }
343
+ ```
344
+
345
+ ## 高级配置示例
346
+
347
+ ### 自定义检索配置
348
+ ```json
349
+ {
350
+ "tool": "hybrid_search",
351
+ "arguments": {
352
+ "kb_id": "kb_123456",
353
+ "query": "搜索查询",
354
+ "vector_threshold": 0.8,
355
+ "keyword_threshold": 0.6,
356
+ "match_count": 15
357
+ }
358
+ }
359
+ ```
360
+
361
+ ### 自定义会话策略
362
+ ```json
363
+ {
364
+ "tool": "create_session",
365
+ "arguments": {
366
+ "kb_id": "kb_123456",
367
+ "max_rounds": 20,
368
+ "enable_rewrite": true,
369
+ "fallback_response": "根据现有知识,我无法准确回答您的问题。请尝试重新表述或联系技术支持。"
370
+ }
371
+ }
372
+ ```
373
+
374
+ ## 性能优化建议
375
+
376
+ 1. **批量操作**: 尽量批量处理知识创建和更新
377
+ 2. **缓存策略**: 合理设置搜索阈值以平衡准确性和性能
378
+ 3. **会话管理**: 及时清理不需要的会话以节省资源
379
+ 4. **监控日志**: 使用 `--verbose` 选项监控性能指标
380
+
381
+ ## 集成示例
382
+
383
+ ### 与 Claude Desktop 集成
384
+ 在 Claude Desktop 的配置文件中添加:
385
+ ```json
386
+ {
387
+ "mcpServers": {
388
+ "ai-core": {
389
+ "command": "python",
390
+ "args": ["path/to/main.py"],
391
+ "env": {
392
+ "AI_CORE_BASE_URL": "http://localhost:8080/api/v1",
393
+ "AI_CORE_API_KEY": "your_api_key"
394
+ }
395
+ }
396
+ }
397
+ }
398
+ ```
399
+
400
+
401
+ ### 与其他 MCP 客户端集成
402
+ 参考各客户端的文档,配置服务器启动命令和环境变量。
403
+
404
+ ## 故障排除
405
+
406
+ 如果遇到问题:
407
+ 1. 运行 `python main.py --check-only` 检查环境
408
+ 2. 使用 `python main.py --verbose` 查看详细日志
409
+ 3. 检查 Ai-Core 服务是否正常运行
410
+ 4. 验证网络连接和防火墙设置
@@ -0,0 +1,207 @@
1
+ # Ai-Core MCP Server 安装和使用指南
2
+
3
+ ## 快速开始
4
+
5
+ ### 1. 安装依赖
6
+ ```bash
7
+ pip install -r requirements.txt
8
+ ```
9
+
10
+ ### 2. 设置环境变量
11
+ ```bash
12
+ # Linux/macOS
13
+ export AI_CORE_BASE_URL="http://localhost:8080/api/v1"
14
+ export AI_CORE_API_KEY="your_api_key_here"
15
+
16
+ # Windows PowerShell
17
+ $env:AI_CORE_BASE_URL="http://localhost:8080/api/v1"
18
+ $env:AI_CORE_API_KEY="your_api_key_here"
19
+
20
+ # Windows CMD
21
+ set AI_CORE_BASE_URL=http://localhost:8080/api/v1
22
+ set AI_CORE_API_KEY=your_api_key_here
23
+ ```
24
+
25
+ ### 3. 运行服务器
26
+
27
+ 有多种方式运行服务器:
28
+
29
+ #### 方式 1: 使用主入口点 (推荐)
30
+ ```bash
31
+ python main.py
32
+ ```
33
+
34
+ #### 方式 2: 使用原始启动脚本
35
+ ```bash
36
+ python run_server.py
37
+ ```
38
+
39
+ #### 方式 3: 直接运行服务器模块
40
+ ```bash
41
+ python ai_core_mcp_server.py
42
+ ```
43
+
44
+ #### 方式 4: 作为 Python 模块运行
45
+ ```bash
46
+ python -m ai_core_mcp_server
47
+ ```
48
+
49
+ ## 作为 Python 包安装
50
+
51
+ ### 开发模式安装
52
+ ```bash
53
+ pip install -e .
54
+ ```
55
+
56
+ 安装后可以使用命令行工具:
57
+ ```bash
58
+ ai-core-mcp-server
59
+ # 或
60
+ ai-core-server
61
+ ```
62
+
63
+ ### 生产模式安装
64
+ ```bash
65
+ pip install .
66
+ ```
67
+
68
+ ### 构建分发包
69
+ ```bash
70
+ # 构建源码分发包和轮子
71
+ python setup.py sdist bdist_wheel
72
+
73
+ # 或使用 build 工具
74
+ pip install build
75
+ python -m build
76
+ ```
77
+
78
+ ## 命令行选项
79
+
80
+ 主入口点 `main.py` 支持以下选项:
81
+
82
+ ```bash
83
+ python main.py --help # 显示帮助信息
84
+ python main.py --check-only # 仅检查环境配置
85
+ python main.py --verbose # 启用详细日志
86
+ python main.py --version # 显示版本信息
87
+ ```
88
+
89
+ ## 环境检查
90
+
91
+ 运行以下命令检查环境配置:
92
+ ```bash
93
+ python main.py --check-only
94
+ ```
95
+
96
+ 这将显示:
97
+ - Ai-Core API 基础 URL 配置
98
+ - API 密钥设置状态
99
+ - 依赖包安装状态
100
+
101
+ ## 故障排除
102
+
103
+ ### 1. 导入错误
104
+ 如果遇到 `ImportError`,请确保:
105
+ - 已安装所有依赖:`pip install -r requirements.txt`
106
+ - Python 版本兼容(推荐 3.10+)
107
+ - 没有文件名冲突
108
+
109
+ ### 2. 连接错误
110
+ 如果无法连接到 Ai-Core API:
111
+ - 检查 `AI_CORE_BASE_URL` 是否正确
112
+ - 确认 Ai-Core 服务正在运行
113
+ - 验证网络连接
114
+
115
+ ### 3. 认证错误
116
+ 如果遇到认证问题:
117
+ - 检查 `AI_CORE_API_KEY` 是否设置
118
+ - 确认 API 密钥有效
119
+ - 验证权限设置
120
+
121
+ ## 开发模式
122
+
123
+ ### 项目结构
124
+ ```
125
+ ai-core-mcp-server/
126
+ ├── __init__.py # 包初始化文件
127
+ ├── main.py # 主入口点
128
+ ├── run_server.py # 原始启动脚本
129
+ ├── ai_core_mcp_server.py # MCP 服务器实现
130
+ ├── requirements.txt # 依赖列表
131
+ ├── setup.py # 安装脚本
132
+ ├── MANIFEST.in # 包含文件清单
133
+ ├── LICENSE # 许可证
134
+ ├── README.md # 项目说明
135
+ └── INSTALL.md # 安装指南
136
+ ```
137
+
138
+ ### 添加新功能
139
+ 1. 在 `AiCoreClient` 类中添加新的 API 方法
140
+ 2. 在 `handle_list_tools()` 中注册新工具
141
+ 3. 在 `handle_call_tool()` 中实现工具逻辑
142
+ 4. 更新文档和测试
143
+
144
+ ### 测试
145
+ ```bash
146
+ # 运行基本测试
147
+ python test_imports.py
148
+
149
+ # 测试环境配置
150
+ python main.py --check-only
151
+
152
+ # 测试服务器启动
153
+ python main.py --verbose
154
+ ```
155
+
156
+ ## 部署
157
+
158
+ ### Docker 部署
159
+ 创建 `Dockerfile`:
160
+ ```dockerfile
161
+ FROM python:3.11-slim
162
+
163
+ WORKDIR /app
164
+ COPY requirements.txt .
165
+ RUN pip install -r requirements.txt
166
+
167
+ COPY . .
168
+ RUN pip install -e .
169
+
170
+ ENV AI_CORE_BASE_URL=http://localhost:8080/api/v1
171
+ EXPOSE 8000
172
+
173
+ CMD ["ai-core-mcp-server"]
174
+ ```
175
+
176
+ ### 系统服务
177
+ 创建 systemd 服务文件 `/etc/systemd/system/ai-core-mcp.service`:
178
+ ```ini
179
+ [Unit]
180
+ Description=Ai-Core MCP Server
181
+ After=network.target
182
+
183
+ [Service]
184
+ Type=simple
185
+ User=ai-core
186
+ WorkingDirectory=/opt/ai-core-mcp
187
+ Environment=AI_CORE_BASE_URL=http://localhost:8080/api/v1
188
+ Environment=AI_CORE_API_KEY=your_api_key
189
+ ExecStart=/usr/local/bin/ai-core-mcp-server
190
+ Restart=always
191
+
192
+ [Install]
193
+ WantedBy=multi-user.target
194
+ ```
195
+
196
+ 启用服务:
197
+ ```bash
198
+ sudo systemctl enable ai-core-mcp
199
+ sudo systemctl start ai-core-mcp
200
+ ```
201
+
202
+ ## 支持
203
+
204
+ 如果遇到问题,请:
205
+ 1. 查看日志输出
206
+ 2. 检查环境配置
207
+ 3. 参考故障排除部分