Command Line Interface (CLI)
Relevant source files
The following files were used as context for generating this wiki page:
The superglue CLI is a powerful tool used to build, run, and manage integration tools directly from a terminal or within an AI agent's environment. It provides a more flexible interface than the Model Context Protocol (MCP), allowing for on-the-fly execution of non-persisted tools and direct system management. The CLI authenticates via an API key and inherits all Role-Based Access Control (RBAC) rules defined within the superglue platform.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:143-154, packages/web/src/lib/agent/agent-prompts.ts:316-320
Installation and Setup
You install the CLI globally using the Node Package Manager. Configuration involves an initialization flow or setting environment variables for the API key and endpoint.
- Installation Command:
npm install -g @superglue/cli - Initialization:
sg init
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:143-158
Global Options
The CLI supports several global flags to control behavior and override configurations.
| Option | Description |
|---|---|
-V, --version | Output the version number |
--api-key <key> | Override the superglue API key from config |
--endpoint <url> | Override the superglue API endpoint from config |
--json | Force JSON output (default in non-TTY environments) |
-h, --help | Display help for commands |
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:162-168, packages/web/src/lib/agent/skills/content/superglue-concepts.md:205-207
Command Structure
The CLI organizes functionality into three primary namespaces: tool, system, and run.
Tool Management
The tool command handles the lifecycle of superglue tools, including building from JSON configurations, editing via JSON patches, and executing both saved and draft tools.
This diagram illustrates the tool management lifecycle via the CLI.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:183-191, packages/web/src/lib/agent/registries/tool-registry.ts:1091-1100
System Management
The system namespace allows users to configure external integrations. It supports creating systems from templates, managing credentials, and searching documentation.
| Command | Action |
|---|---|
sg system create | Create from JSON config or flags |
sg system edit | Update existing system configuration |
sg system list/find | Search and retrieve system configurations |
sg system call | Test an API, database, or file server endpoint directly |
sg system oauth | Initiate OAuth authentication for a system |
sg system search-docs | Query the knowledge base of a specific system |
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:193-200
AI Agent Integration
For AI agents with bash access, the CLI serves as a primary "skill" interface. Agents use the sg skill command to print reference documentation for specific topics, ensuring they use correct syntax for tool building and data handling.
Skill Topics
Agents are instructed to read these references before attempting commands:
sg skill: Main referencesg skill databases: SQL and Azure SQL patternssg skill http-apis: REST and GraphQL patternssg skill data-handling: JS sandbox constraints and variablessg skill file-handling:file::syntax and aliases
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:173-181, packages/web/src/lib/agent/agent-prompts.ts:251-264
Security and RBAC
The CLI operates under the same security model as the Web UI and SDKs.
- Authentication: Uses Bearer tokens (API Keys) via headers.
- Access Rules: If a CLI request is blocked, the user receives an error indicating RBAC enforcement (e.g., "Blocked by custom rule").
- Credential Masking:
sg system findreturns masked credentials to prevent exposure of sensitive keys in terminal history. - Sandbox: All user-provided JavaScript (transforms and data selectors) executed via CLI commands runs in an isolated sandbox.
Sources: packages/web/src/lib/agent/agent-prompts.ts:60-65, packages/web/src/lib/agent/skills/content/superglue-concepts.md:148-150, packages/web/src/lib/agent/registries/tool-registry.ts:1049-1051
Execution Monitoring
The sg run command provides visibility into the execution history of tools. This is used for debugging failed runs by retrieving step-level results and error messages.
sg run list [toolId]: Lists recent executions.sg run get <runId>: Retrieves full details, includingtoolPayloadandstepResults.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:202-203, packages/web/src/lib/agent/agent-context.ts:220-230
The CLI is the recommended deployment pattern for developers and agents needing a high-power, flexible interface to superglue's deterministic integration engine.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:143-146