验证指南.md•3.46 kB
# Logo MCP 验证指南
## 快速验证步骤
### 1. 自动验证(推荐)
```bash
# 运行完整验证
npm run verify
# 测试MCP工具通信
npm run test-mcp
```
### 2. 手动验证步骤
#### 步骤1: 检查构建
```bash
npm run build
# 确认 dist/ 目录下有编译后的文件
```
#### 步骤2: 测试Logo提取功能
```bash
npm run test-extraction
# 应该看到各个网站的Logo提取结果
```
#### 步骤3: 测试MCP服务器启动
```bash
npm start
# 应该看到 "Logo MCP服务器已启动" 消息
# 按 Ctrl+C 停止
```
#### 步骤4: 测试CLI工具
```bash
npm run cli https://www.google.com
# 应该在 ./logos 目录下生成Logo文件
```
## MCP客户端配置验证
### Claude Desktop配置
1. 找到配置文件:
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
- Mac: `~/Library/Application Support/Claude/claude_desktop_config.json`
2. 添加配置:
```json
{
"mcpServers": {
"logo-mcp": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "D:\\Code\\logo-mcp",
"env": {}
}
}
}
```
3. 重启Claude Desktop
4. 在对话中测试:
```
请帮我提取 https://www.google.com 的Logo
```
### 其他MCP客户端
使用生成的 `mcp-config.json` 文件中的配置。
## 验证成功的标志
### ✅ 正常工作的标志:
- `npm run verify` 显示所有检查项为 ✅
- `npm run test-mcp` 显示测试通过率100%
- CLI工具能成功提取并保存Logo文件
- MCP客户端能识别并调用logo-mcp工具
### ❌ 常见问题及解决方案:
#### 问题1: 构建失败
```bash
# 解决方案
rm -rf node_modules dist
npm install
npm run build
```
#### 问题2: Sharp库安装失败
```bash
# Windows解决方案
npm install --platform=win32 --arch=x64 sharp
# 或者
npm rebuild sharp
```
#### 问题3: MCP客户端无法连接
- 检查配置文件路径是否正确
- 确认 `cwd` 路径指向项目根目录
- 重启MCP客户端应用
#### 问题4: Logo提取失败
- 检查网络连接
- 尝试不同的测试网站
- 查看错误日志了解具体原因
## 测试用例
### 基础测试网站:
- https://www.google.com (经典favicon)
- https://www.apple.com (高质量Logo)
- https://github.com (SVG Logo)
### 高级测试网站:
- https://www.microsoft.com
- https://www.baidu.com
- https://www.tencent.com
### MCP工具测试:
#### 测试1: 提取Logo
```json
{
"tool": "extract_logo",
"arguments": {
"url": "https://www.google.com",
"format": "both",
"size": 256
}
}
```
#### 测试2: 分析候选项
```json
{
"tool": "analyze_logo_candidates",
"arguments": {
"url": "https://www.apple.com"
}
}
```
## 性能验证
### 内存使用测试:
```bash
# 监控内存使用
node --max-old-space-size=512 dist/index.js
```
### 并发测试:
```bash
# 同时测试多个网站
npm run cli https://www.google.com &
npm run cli https://www.apple.com &
npm run cli https://github.com &
wait
```
## 日志和调试
### 启用详细日志:
```bash
DEBUG=* npm start
```
### 查看MCP通信日志:
在MCP客户端中查看开发者工具或日志文件。
## 验证清单
- [ ] 项目构建成功
- [ ] Logo提取功能正常
- [ ] MCP服务器启动正常
- [ ] CLI工具工作正常
- [ ] MCP配置文件生成
- [ ] 客户端配置正确
- [ ] 工具调用成功
- [ ] 错误处理正常
- [ ] 性能表现良好
完成所有检查项后,您的Logo MCP系统就可以正常使用了!