Metadata-Version: 2.4
Name: promptloop-mcp
Version: 0.2.0
Summary: PromptLoop MCP Server - AI multi-turn conversation checkpoint for IDE extensions
Project-URL: Homepage, https://promptloop.dev
Project-URL: Repository, https://github.com/promptloop/promptloop-mcp
Project-URL: Issues, https://github.com/promptloop/promptloop-mcp/issues
Author: PromptLoop Team
License: MIT
Keywords: ai,checkpoint,conversation,extension,mcp,promptloop,vscode
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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.115.0
Requires-Dist: fastmcp>=2.0.0
Requires-Dist: mcp>=1.9.3
Requires-Dist: uvicorn>=0.30.0
Requires-Dist: websockets>=13.0.0
Description-Content-Type: text/markdown

# PromptLoop MCP Server

专为 PromptLoop VSCode 插件设计的 MCP 服务器。与原始 `mcp-user-confirm` 的区别：

- **不打开浏览器**：通过 REST API 与插件 Webview 通信
- **WebSocket 实时推送**：新会话即时通知插件
- **精简架构**：只保留核心检查点逻辑

## 架构

```text
AI 助手 ──(stdio)──> PromptLoop MCP ──(HTTP/WS)──> VSCode 插件 Webview
                         │                              │
                    dev_checkpoint()              用户确认 UI
                         │                              │
                    等待确认 <────(POST)──── 提交确认
```

## 安装

```bash
pip install -e .
```

## 配置

在编辑器的 MCP 配置中添加：

```json
{
  "mcpServers": {
    "promptloop": {
      "command": "promptloop-mcp",
      "env": {
        "PROMPTLOOP_API_PORT": "18765",
        "PROMPTLOOP_DEBUG": "false"
      }
    }
  }
}
```

## REST API

| 方法 | 路径 | 说明 |
| ---- | ---- | ---- |
| GET | `/api/health` | 健康检查 |
| GET | `/api/sessions/active` | 获取当前活跃会话 |
| GET | `/api/sessions` | 列出历史会话 |
| GET | `/api/sessions/{id}` | 获取会话详情 |
| POST | `/api/sessions/{id}/confirm` | 提交用户确认 |
| POST | `/api/sessions/{id}/cancel` | 取消会话 |
| WS | `/ws` | WebSocket 实时推送 |

## 环境变量

| 变量 | 默认值 | 说明 |
| ---- | ------ | ---- |
| `PROMPTLOOP_API_PORT` | `18765` | REST API 端口 |
| `PROMPTLOOP_DEBUG` | `false` | 调试日志开关 |

## 项目结构

```text
src/promptloop_mcp/
├── __init__.py        # 包入口
├── __main__.py        # CLI 入口
├── server.py          # MCP 服务器 + dev_checkpoint 工具
├── session.py         # 会话管理器
└── api/
    ├── __init__.py
    └── routes.py      # REST API 路由（FastAPI）
```
