Metadata-Version: 2.4
Name: ltmhub-mcp
Version: 0.1.0
Summary: LTMhub MCP Server - Connect Claude Desktop to your Long-Term Memory
Project-URL: Homepage, https://github.com/ltmhub/ltmhub-mcp
Project-URL: Documentation, https://docs.ltmhub.ai
Project-URL: Repository, https://github.com/ltmhub/ltmhub-mcp
Project-URL: Issues, https://github.com/ltmhub/ltmhub-mcp/issues
Author-email: LTMhub Team <team@ltmhub.ai>
License: MIT
License-File: LICENSE
Keywords: ai,claude,ltmhub,mcp,memory
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: httpx>=0.28.0
Requires-Dist: mcp>=1.0.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# LTMhub MCP Server

[![PyPI version](https://img.shields.io/pypi/v/ltmhub-mcp.svg)](https://pypi.org/project/ltmhub-mcp/)
[![Python](https://img.shields.io/pypi/pyversions/ltmhub-mcp.svg)](https://pypi.org/project/ltmhub-mcp/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Connect Claude Desktop to your LTMhub Long-Term Memory.

## 一键安装

### 方式 1: 使用 uvx (推荐)

```bash
uvx ltmhub-mcp
```

### 方式 2: 使用 pip

```bash
pip install ltmhub-mcp
ltmhub-mcp
```

### 方式 3: 从 GitHub 安装

```bash
pip install git+https://github.com/ltmhub/ltmhub-mcp.git
```

## 配置 Claude Desktop

### 1. 获取 API Key

1. 登录 [LTMhub](https://ltmhub.ai)
2. 进入 **设置** → **API Keys**
3. 创建新的 API Key

### 2. 配置 Claude Desktop

编辑 Claude Desktop 配置文件：

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

添加以下配置：

```json
{
  "mcpServers": {
    "ltmhub": {
      "command": "uvx",
      "args": ["ltmhub-mcp"],
      "env": {
        "LTMHUB_API_KEY": "your_api_key_here",
        "LTMHUB_API_URL": "https://api.ltmhub.ai/api/v1"
      }
    }
  }
}
```

或使用 `pip` 安装方式：

```json
{
  "mcpServers": {
    "ltmhub": {
      "command": "ltmhub-mcp",
      "env": {
        "LTMHUB_API_KEY": "your_api_key_here",
        "LTMHUB_API_URL": "https://api.ltmhub.ai/api/v1"
      }
    }
  }
}
```

### 3. 重启 Claude Desktop

完全退出 Claude Desktop (Cmd+Q / Ctrl+Q)，然后重新启动。

## 可用工具

| 工具 | 描述 |
|------|------|
| `memory_create` | 创建新的记忆条目 |
| `memory_get` | 根据 ID 获取单个记忆 |
| `memory_list` | 列出记忆（支持分页） |
| `memory_search` | 向量相似度搜索 |
| `memory_fork` | Fork 公开项目 |
| `agent_list` | 列出 Agent |
| `project_list` | 列出项目 |

## 使用示例

### 创建问答记忆

```
Use memory_create to save:
- agent_id: <your-agent-id>
- knowledge_type: qa
- knowledge: {"type": "qa", "question": "如何调试 useEffect?", "answer": "检查依赖数组...", "tags": ["react"]}
```

### 搜索记忆

```
Use memory_search with:
- query: "React debugging"
- top_k: 5
```

### 列出记忆

```
Use memory_list with:
- page: 1
- per_page: 10
- knowledge_type: qa
```

## 知识类型

### qa (问答)

```json
{
  "type": "qa",
  "question": "问题",
  "answer": "回答",
  "tags": ["标签1", "标签2"]
}
```

### triple (三元组)

```json
{
  "type": "triple",
  "subject": "主体",
  "predicate": "谓词",
  "object": "客体"
}
```

### document (文档)

```json
{
  "type": "document",
  "title": "标题",
  "content": "内容...",
  "tags": ["标签"]
}
```

### code (代码)

```json
{
  "type": "code",
  "title": "代码标题",
  "description": "描述",
  "code": "def example():\n    pass",
  "language": "python"
}
```

### decision (决策)

```json
{
  "type": "decision",
  "decision": "决策内容",
  "context": "上下文",
  "outcome": "结果"
}
```

## 环境变量

| 变量 | 必填 | 默认值 | 说明 |
|------|------|--------|------|
| `LTMHUB_API_KEY` | 是 | - | LTMhub API Key |
| `LTMHUB_API_URL` | 否 | `http://localhost:8000/api/v1` | API 地址 |

## 本地开发

```bash
# 克隆仓库
git clone https://github.com/ltmhub/ltmhub-mcp.git
cd ltmhub-mcp

# 安装依赖
pip install -e .

# 运行
LTMHUB_API_KEY=your_key LTMHUB_API_URL=http://localhost:8000/api/v1 ltmhub-mcp
```

## 发布到 PyPI

```bash
# 构建
pip install build
python -m build

# 上传
pip install twine
twine upload dist/*
```

## License

MIT License
