@stackgate/cli
v0.5.1
Published
Stackgate CLI for MCP integrations and shared agent skills
Downloads
868
Readme
Stackgate CLI
Stackgate is one gateway for your AI clients. Cloud tools, resources, and prompts run through your website account. Aula and Apple Notes run on your machine. Shared skills sync from the website into Codex, Cursor, and Claude.
Install
The core CLI supports macOS, Windows, and Linux with Node.js 22 or newer. Apple Notes requires macOS. Aula login requires Chrome, Chromium, or Edge.
After publishing the npm package:
npm install --global @stackgate/cli
stackgate setupThe installers in scripts/ can install a private Node runtime when needed. Serve them on the website before advertising these commands. The endpoints and npm publication are separate deployment steps; this checkout does not publish them.
macOS and Linux:
curl -fsSL https://stackgate.ai/install | bashWindows PowerShell:
irm https://stackgate.ai/install.ps1 | iexInstallers use user-owned directories and require no administrator permissions. They verify Node download checksums, check the CLI before switching releases, and preserve the previous release if downloading or installing the package fails. Run stackgate update to install the newest published CLI, or stackgate update --check to check without installing. Managed installs stage and verify the release before switching; npm and pnpm global installs use their original package manager. Your login, skills, and device credentials are preserved. Older CLIs without the update command can rerun the installer once. Set STACKGATE_VERSION to an npm version or release tag to select a release.
Unix installations live in ~/.local/share/stackgate, with a launcher in ~/.local/bin. The Windows installer uses %LOCALAPPDATA%\Stackgate and adds its bin directory to the user PATH. Override these with absolute STACKGATE_INSTALL_DIR and STACKGATE_BIN_DIR paths. Old releases stay installed so running clients and their Node paths keep working.
Connect your AI clients
stackgate setupIn an interactive terminal, setup presents a client checklist and asks whether to enable skills management through MCP. One browser approval grants MCP access and read access for content sync. Selecting skills management adds the authoring permissions to that same approval. Setup syncs skills, and configures one stackgate MCP proxy for the selected clients: Codex, Cursor, Claude Code, or Claude Desktop. Existing unrelated settings stay in place. Restart configured clients to discover the gateway.
Run stackgate configure for the client checklist alone, or select clients explicitly:
stackgate setup --client cursor
stackgate configure --client codexFor scripts, supply the clients and choices explicitly:
stackgate setup --client codex cursor --skills --private-global --yes --no-browserUse --no-skills to skip requesting additional MCP skills permissions. This does
not revoke existing grants or disable content sync. --yes accepts the printed
content changes but does not opt into additional MCP permissions. OAuth still
requires browser authorization when no suitable login is saved; --no-browser
prints the authorization link instead of opening it. A saved login with the required scopes is reused; an older MCP-only login needs one new approval to add content read access.
Interactive prompts support arrow keys, Space for client selection, Enter to
continue, and Escape or Ctrl+C to cancel. Confirmations default to No and show
readable previews. Explicit --client skips the checklist. Piped output,
noninteractive sessions, and dumb terminals never show menus; confirmation
previews remain JSON and writes requiring confirmation need --yes. Without
--client, noninteractive setup reports an error and configure retains its
previous platform defaults. Supply --client in scripts for a fixed target list.
Codex configuration uses the installed Codex CLI. On Windows, native Codex executables and the standard npm installation are supported. A custom package-manager shim may need a native executable on PATH.
Headless login:
stackgate login --no-browserWebsite tokens live in ~/.stackgate/config.json. Local credentials live in ~/.stackgate/integrations.json. Unix files use owner-only permissions. On Windows, these files inherit the user's directory ACLs. Set STACKGATE_HOME to isolate an account or installation; client configuration carries that directory into the MCP process.
stackgate open opens the website to manage cloud integrations and skills. stackgate logout removes the saved website login. It leaves local integrations available.
Gateway behavior
stackgate mcp serve
stackgate tools list
stackgate tools list --integration github
stackgate tools list --search calendar
stackgate tools list --local --json
stackgate tools call aula_get_thread_messages --args '{"thread_id":"123","limit":10}'tools call --args - reads JSON from stdin, which also avoids shell quoting problems on Windows. Tool results print as MCP JSON; a tool error produces a nonzero exit code.
The stdio server starts before contacting the website. Cloud connection happens on demand, tool discovery follows pagination, and the catalog caches for 30 seconds. Website tool-change notifications invalidate the cache. A failed connection can recover on a later request, with a five-second cooldown after connection failures. Tool calls are never retried after a network or protocol failure because the website may already have performed the action.
The gateway proxies resource and prompt requests, including list cursors. Cloud resources and prompts require a website connection. Cloud subscriptions and notification forwarding for resources and prompts are not implemented.
Local tool names beginning with aula_ and apple_notes_ are reserved. They never fall through to cloud execution, even when disabled. Local tool calls validate their arguments and work without a Stackgate website login. Ordinary cloud operations use the authenticated website MCP endpoint.
Aula
stackgate aula login
stackgate aula logoutLogin opens a separate browser profile under ~/.stackgate/browser/aula, waits for a usable Aula session, and saves its cookie only on this machine. It never uploads the cookie to Stackgate. Existing credentials previously uploaded by older CLI versions are not removed from the website automatically; remove them there if present.
Aula exposes read-only profile, daily overview, message, calendar, post, and notification tools. The client reuses its initialized session between calls. Expired sessions require another login; requests that require elevated MitID authentication report that requirement.
Logout removes the CLI's credentials and disables tools. The separate browser profile remains signed in until you sign out in its browser window.
stackgate integrations sync supports legacy website settings. It preserves device-local credentials and ignores any website-supplied Aula or Apple Notes credentials. Cloud gateway access does not require this command.
Apple Notes
stackgate notes enable
stackgate notes disableApple Notes is opt-in and macOS-only. apple_notes_list searches titles and returns paginated IDs. apple_notes_read reads one note's HTML body. There are no create, update, or delete tools.
On first use, macOS may ask to allow your terminal or AI client to control Notes. Permission lives in System Settings > Privacy & Security > Automation. Locked notes may be unavailable. Tool arguments pass separately to a fixed automation script, and execution has a 30-second timeout.
"Local" means the CLI sends no credentials or note contents to the Stackgate website. Your AI client receives tool results and may send them to its model provider. Notes itself may sync through iCloud.
Shared skills and rules
The app's Skills & rules library supports private content, company proposals, reviewed publication, immutable versions, and team/service/tag targeting. Setup shares one verified OAuth login between MCP and content sync, including token refresh. setup --skills also enables content authoring with that login. Existing separate content authorizations and the explicit content login commands remain supported.
stackgate setup --client codex cursor claude --company 123 --skills
stackgate projects init --company 123 --service SERVICE_ULID
stackgate projects register
stackgate sync --check
stackgate sync
stackgate statusSetup enables a per-user schedule, every 15 minutes by default. If the OS scheduler is unavailable, setup reports the failure and manual sync remains available. stackgate sync configure --interval 30, stackgate sync pause, and stackgate sync resume control automatic updates. Each clone or worktree must be registered locally. Review changed manifests with projects register before they take effect. Company global content is explicitly selected because it can affect personal projects.
stackgate skills create release-check --output ./release-check
stackgate skills push ./release-check --private
stackgate skills propose ./release-check --company 123
stackgate skills publish PROPOSAL_ULID
stackgate rules create naming --output ./naming
stackgate skills export CONTENT_ULID --output release-check.zipDrafts stay local until explicitly pushed or proposed. Edit stackgate-content.json for scope, targeting, file lists, and activation. Client variants use variants/<client>/ resources. Import/export packages preserve binary files, executable bits, and rule activation metadata. Unsupported client formats require manual provisioning; a portable Stackgate package is not a promise of direct Claude Desktop Chat/Cowork upload compatibility.
Sync installs owned copies and managed instruction sections. It preserves unmanaged files and edited managed content, reports independent conflicts, and keeps recovery copies outside client discovery. Adding a section to an existing instruction file requires preview approval. A complete authenticated snapshot is required for removal. Network and authentication errors never mean an empty catalog.
Use stackgate conflicts list and stackgate conflicts resolve ID --accept-published or --keep-local. Accepting a published version saves a backup first. stackgate recovery list and stackgate recovery restore ID --output ./recovered expose backups without reactivating them. stackgate cleanup removes owned content and its schedule; MCP removal requires --include-mcp and preserves customized entries. Logout clears both content and gateway authorization while keeping device-local integrations and installed content.
Codex skills use .agents/skills, Claude uses .claude/skills, and Cursor uses .cursor/skills or a selected client's discoverable copy. Some clients also discover each other's directories. Rule modes that cannot be represented are reported and skipped. OS scheduler and client activation behavior must be verified on each supported deployment platform before claiming full compatibility.
Troubleshooting
stackgate doctor
stackgate doctor --offline --json
stackgate integrations listDoctor checks configuration, website authentication, API access, and cloud MCP discovery. Offline mode inspects this machine without contacting services or opening Notes. It does not validate Aula sessions or macOS Automation permission.
Configuration writes use temporary files and locks. After a crash, a leftover .lock file blocks writers. Check that no Stackgate operation is running before removing the named lock and retrying.
For local website development, set STACKGATE_URL and optionally STACKGATE_CLIENT_ID. Production CLI invocations ignore project .env files unless STACKGATE_LOAD_ENV=1; that loader imports only STACKGATE_ variables. HTTPS is required except for loopback HTTP development. OAuth discovery and authenticated requests stay on the configured hub. HTTP redirects do not carry your credentials to another origin.
Use STACKGATE_CA_FILE or NODE_EXTRA_CA_CERTS for a development CA. STACKGATE_CA_FILE requires a Node version with tls.setDefaultCACertificates; on older Node 22 releases use NODE_EXTRA_CA_CERTS before launching the process.
Development and release
pnpm install --frozen-lockfile
npm run check
npm pack --dry-runFor local development, copy .env.example to .env and use pnpm dev. This development command loads that file explicitly.
CI runs checks on macOS, Windows, and Linux with Node 22 and 24. Local tests use mocked website responses and automation runners; they do not prove live website compatibility, Aula access, or Apple Notes permissions.
The website must provide OAuth discovery at /api/cli/oauth-config, device authorization and token endpoints, /api/me, /api/content/*, and the /mcp/private and /mcp/business gateways. GET /api/me/integrations returns credential-free personal profile integration metadata. The legacy integration sync endpoint is /api/me/local-integrations/sync.
For the Laravel website, seed its Passport CLI client with php artisan db:seed --class=CliOAuthClientSeeder, set the resulting CLI_OAUTH_CLIENT_ID, deploy migrations, and clear the configuration cache.
To enable the one-command installers, publish @stackgate/cli publicly on npm, then serve scripts/install.sh as HTTPS /install and scripts/install.ps1 as HTTPS /install.ps1, with Content-Type: text/plain. Serve script bytes directly without an HTML login page. Test fresh installations, updates, login, MCP discovery, and local integrations on all three operating systems before a public rollout.
stackgate integrations list shows all personal profile integrations and this machine’s local integrations. Use --local to browse offline or --json for structured output. stackgate tools list shows counts by integration. Filter with --integration <slug> or --search <text> to browse 25 tools per page, use --offset and --limit to page, or --all to expand the catalog. --json returns every matching tool with its schema.
Import existing skills
Run stackgate scan-skills to list installed skills with their names, descriptions,
locations, and Stackgate ownership. Select numbers to copy skills into your private
Stackgate library. The command keeps original files unchanged and skips importing
Stackgate-managed skills. Company imports use --company <id> and create drafts.
The scan covers personal client directories, the current and registered projects,
and installed Codex/Claude plugin caches. Add other locations with
--root /path/to/skills. Use --list or --json to scan without importing.
For scripts, --select 1,3 --yes explicitly imports those entries from the displayed
list. Importing requires stackgate content login --author.
stackgate skills sync is an alias for stackgate sync. Optional personal projects
can be listed with stackgate content organization; omit --company when running
stackgate projects init for a personal project.
Skills MCP endpoints
The CLI and stackgate mcp serve expose the skills server alongside gateway and
device-local tools. Skills tools have a skills__ prefix to avoid name collisions.
The active personal context uses /mcp/skills; a business context uses
/mcp/company/{company}/skills.
stackgate login --skills
stackgate context show
stackgate context personal
stackgate tools list --integration skills --json
stackgate tools call skills__list_skills --args '{}'
stackgate context business 123
stackgate tools list --integration skills --jsonstackgate login --skills requests MCP and content authoring scopes in addition
to the usual login scopes. A normal gateway login may not include skills access.
The saved bearer token must authorize the selected workspace. Company skills
require a token scoped to that company. Selecting a context does not grant access
or change the token. Restart running MCP clients after changing context.
A missing or inaccessible skills endpoint does not hide other available tools.
Inspect the live schemas before calling skills__create_skill,
skills__get_skill, skills__update_skill, or skills__delete_skill.
Use --args - to pass serialized JSON through stdin. Read before updating or
archiving, and supply the current draft_revision. Updates replace the complete
bundle, so preserve its resources, variants, and targeting. Personal writes create
private releases; company writes save drafts. Deletion archives and retains history.
The existing skills propose, review, and publish commands handle company review.
Bundled management skills
Two skills ship with the CLI: stackgate-create-skill and
stackgate-manage-skills. They instruct agents to use the CLI for authoring,
private uploads, company proposals, updates, archiving, and sync.
stackgate skills list --bundled
stackgate skills install-bundled stackgate-create-skill --output .agents/skills/stackgate-create-skill
stackgate skills install-bundled stackgate-manage-skills --output .agents/skills/stackgate-manage-skillsListing bundled skills works offline. Installation creates a local skill and
editable Stackgate draft without overwriting an existing directory or uploading
anything. Use .claude/skills or .cursor/skills for those clients. To add a
bundled skill to your Stackgate library, use skills push DIRECTORY --private or
skills propose DIRECTORY --company ID after reviewing the draft.
