Skip to main content
The Palyra CLI serves as a protocol bridge between external environments (IDEs, LLM clients, and terminal-based tools) and the core Palyra Daemon. It implements two primary interoperability standards: the Agent Control Protocol (ACP) for stateful, editor-native agent control, and the Model Context Protocol (MCP) for tool-driven, stdio-based client integrations.

Agent Control Protocol (ACP) Bridge

The ACP bridge is the preferred mechanism for IDE-style integrations where the client expects a stateful session lifecycle, reconnect-friendly prompts, and inline approval mediation crates/palyra-cli/data/docs/cli-v1-acp-shim.md#38-42. It operates as a bidirectional stdio bridge, translating ACP JSON-RPC requests into Palyra gRPC gateway calls.

Implementation and State Management

The bridge is implemented in crates/palyra-cli/src/acp_bridge.rs. It maintains a BridgeState to track the mapping between ACP session identifiers and Palyra-specific identifiers crates/palyra-cli/src/acp_bridge.rs#39-44.

Data Flow: ACP to Gateway

The following diagram illustrates how an ACP prompt request is transformed into a Palyra RunStream. Diagram: ACP Request Translation Sources: crates/palyra-cli/src/acp_bridge.rs#47-60, crates/palyra-cli/src/acp_bridge.rs#134-150

Model Context Protocol (MCP) Facade

The MCP facade provides a narrower, stdio-oriented interface for tools that expect the tools/list and tools/call pattern crates/palyra-cli/data/docs/cli-mcp-interop-playbook.md#36-41. Unlike the stateful ACP bridge, the MCP facade is often used for indexing, retrieval, and specific mutation tasks.

Tool Surface

The MCP server exposes several tools mapped to internal Palyra services:
Tool NamePurposeBackend Method
sessions_listList active/archived sessionsLiveMcpBackend::sessions_list
session_transcript_readFetch full session historyLiveMcpBackend::session_transcript_read
memory_searchSearch RAG memory itemsLiveMcpBackend::memory_search
session_promptTrigger a new agent runLiveMcpBackend::session_prompt
approval_decideResolve a pending human-in-the-loop promptLiveMcpBackend::approval_decide
Sources: crates/palyra-cli/src/commands/mcp.rs#13-20, crates/palyra-cli/src/commands/mcp.rs#95-107

Security Posture

The MCP facade enforces strict security boundaries:
  1. Read-Only Mode: Running with --read-only disables all mutation tools (session_create, session_prompt, etc.) crates/palyra-cli/src/commands/mcp.rs#24-25.
  2. Sensitive Tools: Mutation tools require the --allow-sensitive-tools flag crates/palyra-cli/data/docs/cli-mcp-interop-playbook.md#16-18.
  3. Policy Alignment: MCP mutations reuse the existing run-stream and approval machinery. If a tool call requires human approval, the MCP result reports status=approval_required crates/palyra-cli/data/docs/cli-mcp-interop-playbook.md#32-34.
Diagram: MCP Tool Routing Sources: crates/palyra-cli/src/commands/mcp.rs#30-63, crates/palyra-cli/src/commands/mcp.rs#111-114, crates/palyra-cli/src/commands/mcp.rs#150-156

Daemon Management & Diagnostics

The palyra gateway (formerly palyra daemon) command family manages the lifecycle and health of the bridge targets crates/palyra-cli/src/commands/daemon.rs#23-25.

Key Operations

Support Bundle

For troubleshooting protocol failures, the support-bundle command aggregates diagnostics from multiple subsystems: Sources: crates/palyra-cli/src/commands/daemon.rs#72-73, crates/palyra-cli/src/commands/system.rs#151-170, crates/palyra-daemon/src/transport/http/handlers/console/system.rs#113-154

CLI-v1-ACP-Shim

The cli-v1-acp-shim.md documentation defines the canonical command families for the Palyra ecosystem. It establishes a preference for modern command names over legacy aliases to ensure stability for automated integrations crates/palyra-cli/data/docs/cli-v1-acp-shim.md#69-77.
Modern CommandLegacy AliasPurpose
palyra setuppalyra initBootstrap and packaged installation
palyra gatewaypalyra daemonRuntime and administrative control
palyra onboarding wizardpalyra onboardInitial user configuration
Sources: crates/palyra-cli/data/docs/cli-v1-acp-shim.md#35-36, crates/palyra-cli/data/docs/cli-v1-acp-shim.md#71-74