MCPcopy Index your code
hub / github.com/dwqdaiwenqi/claude-code-web

github.com/dwqdaiwenqi/claude-code-web @v1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0 ↗ · + Follow
99 symbols 235 edges 326 files 4 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

English | 简体中文

Claude Web

License CI GitHub Release

Claude Code Agent SDK 封装为 REST/SSE HTTP 服务,并附带开箱即用的 Web 界面。

任何语言、任何平台都可以通过 HTTP 接口驱动 Claude Code,无需关心 SDK 细节。

前提:已安装并登录 Claude Code CLI(claude 命令可用)


为什么用 Claude Web?

你的代码 / 脚本 / 工作流
        │  HTTP / SSE
        ▼
  claude-web server          ← 本项目
        │
        ▼
 Claude Code Agent SDK
        │
        ▼
     Claude API
  • API 优先:对外暴露干净的 REST + SSE 接口,curl / Python / Node / 任何 HTTP 客户端直接调用
  • 零数据库:直接复用 Claude CLI 原生 JSONL 格式,无需额外运维
  • Web UI 内置:同一个进程同时提供 API 和可视化界面,部署极简
  • 流式输出:SSE 实时推送 Claude 的思考过程和工具调用

用任意语言调用 Claude Code

用 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

首页显示所有已链接的项目:

点击项目后进入会话页:


Web UI 特性

富文本输入框

功能 说明
@ 文件引用 输入 @ 搜索并引用项目内任意文件,路径自动注入到 prompt
/ 斜杠命令 /init 生成 CLAUDE.md、/cost 查看 Token 消耗、/clear 清空会话
图片粘贴 Ctrl+V / Cmd+V 直接粘贴截图,自动转 base64(多模态)
Shift+Enter 换行而不触发发送

内置终端

连接到项目目录的交互式终端,无需切换窗口。

REST API

完整文档:Swagger → http://127.0.0.1:8003/docs


详细文档

License

MIT

Extension points exported contracts — how you extend this code

RuntimeSession (Interface)
(no doc)
packages/server/src/store.ts
FileIconProps (Interface)
(no doc)
packages/web/src/react-file-icon.d.ts
SseRawMessage (Interface)
(no doc)
packages/server/src/agent.ts
Props (Interface)
(no doc)
packages/web/src/components/Terminal/index.tsx
SsePart (Interface)
(no doc)
packages/server/src/agent.ts
Props (Interface)
(no doc)
packages/web/src/components/FileViewer/index.tsx
SseDone (Interface)
(no doc)
packages/server/src/agent.ts
DisplayMessage (Interface)
(no doc)
packages/web/src/components/ChatPanel/index.tsx

Core symbols most depended-on inside this repo

getRuntimeSession
called by 6
packages/server/src/store.ts
dirNameToCwd
called by 5
packages/server/src/routes/project.ts
sseWrite
called by 4
packages/server/src/agent.ts
resolve
called by 4
packages/server/src/routes/project.ts
getProjectDirName
called by 3
packages/server/src/store.ts
buildSdkPrompt
called by 2
packages/server/src/agent.ts
buildOptions
called by 2
packages/server/src/agent.ts
handleMessage
called by 2
packages/server/src/agent.ts

Shape

Function 79
Interface 20

Languages

TypeScript100%

Modules by API surface

packages/web/src/pages/ProjectPage/index.tsx16 symbols
packages/server/src/store.ts13 symbols
packages/server/src/agent.ts12 symbols
packages/web/src/components/MessageBubble/index.tsx8 symbols
packages/web/src/components/ChatPanel/index.tsx7 symbols
packages/web/src/http/index.ts6 symbols
packages/server/src/routes/project.ts6 symbols
packages/web/src/components/FileViewer/index.tsx5 symbols
packages/web/src/components/ChatInput/index.tsx5 symbols
packages/web/src/pages/HomePage/index.tsx4 symbols
packages/web/src/components/FileTreePanel/index.tsx4 symbols
packages/server/src/utils.ts3 symbols

For agents

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

⬇ download graph artifact

Ask about this repo answers extend the page