Metadata-Version: 2.4
Name: ai-code-recorder-client
Version: 1.0.2
Summary: AI代码记录器 MCP 客户端 - 通过 MCP 协议记录 AI 生成的代码片段
Project-URL: Homepage, https://github.com/ai-code-team/ai-code-recorder
Project-URL: Repository, https://github.com/ai-code-team/ai-code-recorder
Project-URL: Issues, https://github.com/ai-code-team/ai-code-recorder/issues
Project-URL: Documentation, https://github.com/ai-code-team/ai-code-recorder/blob/main/README.md
Author-email: AI Code Recorder Team <contact@aicodeteam.com>
Maintainer-email: AI Code Recorder Team <contact@aicodeteam.com>
License: MIT
License-File: LICENSE
Keywords: ai,code,cursor,development,mcp,recorder
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: fastmcp>=0.1.0
Requires-Dist: requests>=2.31.0
Description-Content-Type: text/markdown

# AI代码记录器客户端

AI代码记录器的 MCP 客户端，运行在本地，通过 MCP 协议与 Cursor 集成，获取 Git 信息并将 AI 生成的代码片段上报到远程服务器。

> **当前版本**: v1.0.2  
> **PyPI**: [ai-code-recorder-client](https://pypi.org/project/ai-code-recorder-client/)  
> **架构**: 客户端本地运行 + 远程API服务器

---

## 目录

1. 介绍与特性
2. 环境要求
3. 安装
4. 在 Cursor 中配置 MCP
5. 可用工具说明
6. 开发与发布
7. 许可证

---

## 1. 介绍与特性

- 自动收集 Git 仓库信息（仓库地址、分支、提交等）
- 记录 AI 生成的代码片段及上下文信息到远程服务器
- 与 Cursor 通过 MCP 协议无缝集成
- 提供基础工具：获取仓库信息、记录代码、生成 AGENTS 指南

## 2. 环境要求

- Python 版本：3.8 ~ 3.12
- 操作系统：Windows / macOS / Linux（推荐 macOS 或 Linux）
- Cursor 已安装并支持 MCP 配置

## 3. 安装

从 PyPI 安装（推荐）：

```bash
pip install ai-code-recorder-client
```

从源码安装（开发用）：

```bash
# 克隆仓库并进入客户端目录
git clone https://github.com/ai-code-team/ai-code-recorder.git
cd ai-code-recorder/client

# 安装开发版本
pip install -e .
```

## 4. 在 Cursor 中配置 MCP

编辑 `~/.cursor/mcp.json`（无则创建）：

```json
{
  "mcpServers": {
    "ai-code-recorder": {
      "command": "uvx",
      "args": ["ai-code-recorder-client"]
    }
  }
}
```

说明：
- 可执行入口为 `ai-code-recorder-client`（`pyproject.toml` 的 `project.scripts` 中定义）
- 该客户端以 stdio 模式运行，无需额外端口配置

## 5. 可用工具说明

### create_agents_guide
- 功能：在项目根目录创建或更新 `AGENTS.md`，给智能体提供使用规范
- 参数：`project_root`（可选）。不指定则使用当前工作目录

### get_repository_info
- 功能：获取本地 Git 仓库与用户信息
- 参数：
  - `project_root`（必填）：客户端项目的根目录绝对路径
  - `file_path`（可选）：文件的相对或绝对路径
- 返回：JSON 字符串，包含 `repository_info` 与 `user_info`

### record_code_snippet
- 功能：记录 AI 生成的代码片段到远端
- 核心参数：`filename`、`language`、`source`、`code`（建议提供完整信息）
- 可选参数：`file_path`、`project_context`、`repository_url`、`git_branch`、`commit_hash`、`meta`
- 说明：工具会自动从本地获取Git信息并上报到远程API服务器进行存储分析

## 6. 开发与发布

本地开发：

```bash
git clone https://github.com/ai-code-team/ai-code-recorder.git
cd ai-code-recorder/client
pip install -e .
```

发布到 PyPI：

1) 安装发布工具

```bash
pip install build twine
```

2) 配置 PyPI API Token（示例）

```bash
export PYPI_API_TOKEN="pypi-your-token-here"
```

3) 一键发布（在 `client/` 目录执行）

```bash
./release.sh
```

发布脚本将执行：清理、构建、检查、安装测试与发布等步骤。

## 7. 许可证

MIT License，详见仓库内 `client/LICENSE`。