# Anteey MCP Client

> 🚀 **Anteey MCP 客户端** - 连接外部 AI 工具与 Anteey 笔记应用的桥梁

[![npm version](https://badge.fury.io/js/%40geekmai%2Fanteey-mcp-client.svg)](https://badge.fury.io/js/%40geekmai%2Fanteey-mcp-client)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 🎯 项目简介

Anteey MCP Client 是一个基于 [Model Context Protocol (MCP)](https://modelcontextprotocol.io) 的客户端，它让外部 AI 工具（如 Raycast、Cursor、Claude Desktop）能够无缝访问和利用你在 Anteey 笔记应用中的笔记内容。

### 🌟 核心特性

- **🔗 多工具支持**：支持 Raycast、Cursor、Claude Desktop 等多种 AI 工具
- **🔍 智能搜索**：在你的笔记中快速查找相关内容
- **📝 笔记获取**：获取特定笔记的详细内容
- **⏰ 最近更新**：查看最近修改的笔记
- **🔒 安全认证**：使用 API 密钥保护你的数据安全
- **⚡ 快速响应**：优化的网络请求和数据处理
- **🎨 用户友好**：简洁的命令行界面和详细的错误提示

## 🚀 快速开始

### 前提条件

- Node.js 18.0 或更高版本
- 运行中的 Anteey 应用（启用 MCP 服务）

### 安装

```bash
# 使用 npm 安装
npm install -g @geekmai/anteey-mcp-client

# 或使用 yarn
yarn global add @geekmai/anteey-mcp-client
```

### 初始配置

1. **自动发现 Anteey 服务**：

   ```bash
   anteey-mcp discover
   ```

2. **手动配置**：

   ```bash
   anteey-mcp config
   ```

3. **测试连接**：
   ```bash
   anteey-mcp test
   ```

## 🛠️ 使用方法

### 命令行工具

```bash
# 显示帮助信息
anteey-mcp --help

# 配置 API 密钥和服务器地址
anteey-mcp config

# 查看当前配置
anteey-mcp config --list

# 自动发现本地 Anteey 实例
anteey-mcp discover

# 测试连接
anteey-mcp test

# 启动 Raycast 适配器
anteey-mcp raycast

# 启动 Cursor 适配器
anteey-mcp cursor

# 启动 Claude Desktop 适配器
anteey-mcp claude
```

### 外部工具集成

#### 🔍 Raycast 集成

1. 启动 Raycast 适配器：

   ```bash
   anteey-mcp raycast
   ```

2. 在 Raycast 中搜索并使用 Anteey 相关命令。

#### 💻 Cursor 集成

1. 在 Cursor 的设置中添加 MCP 服务器配置
2. 启动 Cursor 适配器：
   ```bash
   anteey-mcp cursor
   ```

#### 🤖 Claude Desktop 集成

1. 在 Claude Desktop 的配置文件中添加：

   ```json
   {
     "mcpServers": {
       "anteey": {
         "command": "anteey-mcp",
         "args": ["claude"]
       }
     }
   }
   ```

2. 重启 Claude Desktop 应用。

## 🔧 配置选项

### 配置文件位置

配置文件存储在 `~/.anteey-mcp/config.json`。

### 配置参数

```json
{
  "apiKey": "anteey_your_api_key_here",
  "serverUrl": "http://localhost:43211/api/mcp",
  "timeout": 30000,
  "retries": 3,
  "logLevel": "info"
}
```

| 参数        | 说明                | 默认值                           |
| ----------- | ------------------- | -------------------------------- |
| `apiKey`    | Anteey API 密钥     | -                                |
| `serverUrl` | Anteey 服务器地址   | `http://localhost:43211/api/mcp` |
| `timeout`   | 请求超时时间 (毫秒) | `30000`                          |
| `retries`   | 重试次数            | `3`                              |
| `logLevel`  | 日志级别            | `info`                           |

## 🎨 可用功能

### 搜索笔记

在外部 AI 工具中搜索你的笔记：

```javascript
// 在 Raycast 中
"搜索包含 'JavaScript' 的笔记"

// 在 Cursor 中
@anteey search_notes({ query: "JavaScript", limit: 10 })

// 在 Claude Desktop 中
search_anteey_notes({ query: "JavaScript", limit: 10, tags: ["编程"] })
```

### 获取特定笔记

```javascript
// 获取指定 ID 的笔记详情
get_anteey_note({ noteId: "note_123456" });
```

### 获取最近笔记

```javascript
// 获取最近更新的笔记
get_recent_anteey_notes({ limit: 5 });
```

## 🔐 安全说明

- **API 密钥**：确保你的 API 密钥安全，不要在公共场所分享
- **网络安全**：默认只连接本地 Anteey 实例，如需远程连接请确保网络安全
- **权限控制**：MCP 客户端只能读取笔记，无法修改或删除内容

## 🐛 故障排除

### 常见问题

1. **无法连接到 Anteey 服务器**

   - 确保 Anteey 应用正在运行
   - 检查 MCP 服务是否已启用
   - 验证服务器地址是否正确

2. **API 密钥验证失败**

   - 检查 API 密钥是否正确
   - 确保密钥以 `anteey_` 开头
   - 使用 `anteey-mcp config` 重新设置

3. **搜索结果为空**
   - 检查搜索关键词是否正确
   - 确保 Anteey 中有对应的笔记内容
   - 尝试更宽泛的搜索词

### 日志查看

启用调试日志：

```bash
anteey-mcp config
# 设置 logLevel 为 "debug"
```

## 🤝 贡献指南

欢迎贡献代码！请遵循以下步骤：

1. Fork 本仓库
2. 创建特性分支：`git checkout -b feature/amazing-feature`
3. 提交更改：`git commit -m 'Add amazing feature'`
4. 推送到分支：`git push origin feature/amazing-feature`
5. 创建 Pull Request

## 📄 许可证

本项目使用 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。

## 🙏 致谢

- 感谢 [Model Context Protocol](https://modelcontextprotocol.io) 提供的标准协议
- 感谢 Anteey 团队的支持和反馈
- 感谢所有贡献者的努力

## 📞 联系我们

- **问题报告**：[GitHub Issues](https://github.com/anteey/anteey-mcp-client/issues)
- **功能建议**：[GitHub Discussions](https://github.com/anteey/anteey-mcp-client/discussions)
- **邮件联系**：support@anteey.com

---

<div align="center">
  <p>🌟 如果这个项目对你有帮助，请给我们一个星标！</p>
  <p>Made with ❤️ by the Anteey Team</p>
</div>
