use-acp

mcp
Guvenlik Denetimi
Gecti
Health Gecti
  • License — License: Apache-2.0
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 48 GitHub stars
Code Gecti
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested
Purpose
This package provides React hooks for managing WebSocket connections to Agent Client Protocol (ACP) servers. It handles connection state, notifications, and permission requests within a TypeScript-based front-end application.

Security Assessment
Overall risk is Low. The library acts purely as a client-side WebSocket interface. The light code audit scanned 12 files and found no dangerous patterns, hardcoded secrets, or requests for dangerous permissions. Network requests are entirely expected for this tool, as it needs to communicate over WebSockets (specifically using a user-provided URL). It does not natively execute shell commands or directly access sensitive system data, though the README does show examples of running external command-line agents via `npx` in the terminal to bridge them to WebSockets.

Quality Assessment
The project is in excellent health and actively maintained, with its most recent push occurring today. It benefits from clear, comprehensive documentation and includes utility functions for grouping notifications and merging tool calls. Community trust is starting to build with 48 GitHub stars. Furthermore, it is fully compliant with open-source standards and safely licensed under the permissive Apache-2.0 license.

Verdict
Safe to use.
SUMMARY

React hooks for connecting to Agent Client Protocol (ACP) servers.

README.md

use-acp

React hooks for Agent Client Protocol (ACP) over WebSockets.

Features

  • WebSocket connection management
  • Reactive state management
  • Notifications timeline for ACP events
  • Permission request/response handling
  • Full TypeScript support

Installation

npm install use-acp
# or
pnpm add use-acp

Usage

Basic Usage

import { useAcpClient } from 'use-acp';

function App() {
  const {
    connect,
    disconnect,
    connectionState,
    notifications,
    pendingPermission,
    resolvePermission,
  } = useAcpClient({
    wsUrl: 'ws://localhost:8080',
    autoConnect: true
  });

  return (
    <div>
      <div>Status: {connectionState.status}</div>
      <button onClick={connectionState.status === 'connected' ? disconnect : connect}>
        {connectionState.status === 'connected' ? 'Disconnect' : 'Connect'}
      </button>

      {pendingPermission && (
        <div>
          <h3>Permission Request</h3>
          {pendingPermission.options.map((option) => (
            <button key={option.optionId} onClick={() => resolvePermission(option)}>
              {option.name}
            </button>
          ))}
        </div>
      )}

      <div>Notifications: {notifications.length}</div>
      <ul>
        {notifications.map((notification) => (
          <li key={notification.id}>{JSON.stringify(notification)}</li>
        ))}
      </ul>
    </div>
  );
}

API Reference

useAcpClient({ wsUrl, autoConnect?, reconnectAttempts?, reconnectDelay? })

Returns: { connect(), disconnect(), connectionState, notifications, clearNotifications(), pendingPermission, resolvePermission(), rejectPermission(), agent }

Utils

import { groupNotifications, mergeToolCalls } from 'use-acp';

// Group notifications by their type
// This helps when displaying notifications in a timeline
const groupedNotifications = groupNotifications(notifications);

// Merge tool calls with the same toolCallId
const mergedToolCalls = mergeToolCalls(toolCalls);

Development

pnpm install
pnpm test      # run tests
pnpm build     # build library
pnpm dev       # run demo, http://localhost:5173

Example Agents

# Gemini ACP
npx -y stdio-to-ws "npx @google/gemini-cli --experimental-acp"

# Claude Code ACP
npx -y stdio-to-ws "npx @zed-industries/claude-code-acp"

# Codex ACP
npx -y stdio-to-ws "npx @zed-industries/codex-acp"

License

Apache 2.0

Yorumlar (0)

Sonuc bulunamadi