English | 简体中文
将 Claude Code Agent SDK 封装为 REST/SSE HTTP 服务,并附带开箱即用的 Web 界面。
任何语言、任何平台都可以通过 HTTP 接口驱动 Claude Code,无需关心 SDK 细节。
前提:已安装并登录 Claude Code CLI(
claude命令可用)

你的代码 / 脚本 / 工作流
│ HTTP / SSE
▼
claude-web server ← 本项目
│
▼
Claude Code Agent SDK
│
▼
Claude API
用 curl / Python 直接发 HTTP 请求:
# 新建会话,让 Claude 帮你分析代码
curl -X POST 'http://127.0.0.1:8003/api/session/new/message' \
-H 'Content-Type: application/json' \
-d '{"cwd":"/your/project","prompt":"帮我找出这个项目里所有潜在的内存泄漏"}'
# Python 示例
import requests, json
resp = requests.post("http://127.0.0.1:8003/api/session/new/message", json={
"cwd": "/your/project",
"prompt": "帮我写完整的单元测试覆盖 src/utils.py"
})
print(resp.json()["messages"][-1])
// Node.js 示例
const response = await fetch('http://127.0.0.1:8003/api/session/new/message', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream' },
body: JSON.stringify({ cwd: '/your/project', prompt: '帮我重构 src/index.js' }),
}).then((res) => res.json())
console.log(response)
1. 安装
npm install -g @claude-web/server
2. 启动服务
claude-web start
→ server: http://127.0.0.1:8003
→ docs: http://127.0.0.1:8003/docs
3. 打开 Web UI
访问 http://127.0.0.1:8003
首页显示所有已链接的项目:

点击项目后进入会话页:


| 功能 | 说明 |
|---|---|
@ 文件引用 |
输入 @ 搜索并引用项目内任意文件,路径自动注入到 prompt |
/ 斜杠命令 |
/init 生成 CLAUDE.md、/cost 查看 Token 消耗、/clear 清空会话 |
| 图片粘贴 | Ctrl+V / Cmd+V 直接粘贴截图,自动转 base64(多模态) |
Shift+Enter |
换行而不触发发送 |
连接到项目目录的交互式终端,无需切换窗口。
完整文档:Swagger → http://127.0.0.1:8003/docs

MIT
$ claude mcp add claude-code-web \
-- python -m otcore.mcp_server <graph>