원클릭으로
claude-agent-ui-ts
Add a React + WebSocket UI on top of Claude Agent SDK agents with tool approval and SQLite persistence
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Add a React + WebSocket UI on top of Claude Agent SDK agents with tool approval and SQLite persistence
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Build AI agents with Claude Agent SDK in TypeScript. Covers V1 query() API for batch workflows and V2 session API for interactive apps. Includes tool configuration, hooks, MCP servers, and multi-turn patterns.
Develop MCP Apps hosts (AppBridge) and access comprehensive MCP Apps reference documentation. Covers host embedding, multi-server routing, sandbox security, and full API reference. Use when building chat applications that embed MCP App UIs, or when you need in-depth MCP Apps architecture/API knowledge without cloning ext-apps.
Build TypeScript MCP clients with composable code snippets. Includes agentic pattern with LLM integration, server-initiated requests (sampling, elicitation), and dynamic discovery. Use when creating applications that connect to MCP servers.
Build TypeScript MCP servers with composable code snippets from the official Everything reference server. Use the add script to selectively copy tool, resource, or prompt modules. Use when creating MCP servers.
Terminal-style React UI for Claude Agent SDK with keyboard navigation, tool approval, and dark theme
| name | claude-agent-ui-ts |
| description | Add a React + WebSocket UI on top of Claude Agent SDK agents with tool approval and SQLite persistence |
Add a web UI to your Claude Agent SDK agents. Includes real-time WebSocket communication, interactive tool approval, and SQLite persistence for chat history.
Copy the snippets to your project:
client.tsx from this skillwebsocket-server-sqlite.ts and websocket-types.ts from claude-agent-sdk-ts skillInstall dependencies:
npm install express cors ws @anthropic-ai/claude-agent-sdk better-sqlite3 react react-dom
npm install -D @types/better-sqlite3 @types/express @types/cors @types/ws
Edit the server CONFIG section (workingDirectory, model, allowedTools, dbPath)
Start server: npx tsx server.ts
Add client.tsx to your React app and open in browser
React Client <--WebSocket--> Express Server <--SDK--> Claude Agent
(client.tsx) (server.ts)
|
v
SQLite DB
(chat.db)
Flow:
| Snippet | Source | Description |
|---|---|---|
client.tsx | This skill | React chat UI with WebSocket and tool approval buttons |
websocket-server-sqlite.ts | claude-agent-sdk-ts | Express + WebSocket + SQLite server with SDK integration |
websocket-types.ts | claude-agent-sdk-ts | Shared TypeScript types for messages |
Edit the CONFIG object in the server:
const CONFIG = {
port: 3001,
workingDirectory: process.cwd(), // Scope file operations
model: "sonnet", // opus, sonnet, or haiku
allowedTools: ["Bash", "Read", "Write", "Edit", "Glob", "Grep"],
systemPrompt: "You are a helpful AI assistant.",
dbPath: "./chat.db", // SQLite database path
};
See claude-agent-sdk-ts skill for detailed configuration options.
The server uses SQLite (via better-sqlite3) to persist:
system/init message for session resumptionDatabase schema:
-- Sessions: stores SDK session ID for multi-turn resumption
CREATE TABLE sessions (
id TEXT PRIMARY KEY,
sdk_session_id TEXT,
created_at TEXT,
updated_at TEXT
);
-- Messages: stores all chat messages
CREATE TABLE messages (
id TEXT PRIMARY KEY,
session_id TEXT,
role TEXT, -- 'user' | 'assistant' | 'tool_use'
content TEXT,
tool_name TEXT, -- for tool_use messages
tool_input TEXT, -- JSON string for tool_use messages
timestamp TEXT
);
Session Resumption: When the server restarts, it:
resume: sdkSessionId to the SDK query optionsThis follows the SDK best practice of capturing session_id from the system/init message and using resume for multi-turn conversations.
The client has no styling (functional HTML only). Options:
For production deployment, consider:
Map<chatId, Session> for multiple conversations| Skill | Use When |
|---|---|
| claude-agent-sdk-ts | SDK API details, tools, hooks, configuration, shared server code |
| claude-agent-terminal-ts | Terminal-styled UI with dark theme and keyboard shortcuts |