salt-api-cli MCP server
Commit 4 Nov 2026Menyediakan command-line interface dan MCP server untuk mengelola infrastruktur SaltStack, mengeksekusi module, dan mengelola minion keys.
Juga dikenal sebagai laurentL/salt-api-cli
- Stars
- 1
- Tools
- 12
- Unduhan, 30 hari
- —
- Versi terbaru
- —
- Commit terakhir
- 4 Nov 2026
- Lisensi
- MIT
Apa itu salt-api-cli MCP?
Menyediakan command-line interface dan MCP server untuk mengelola infrastruktur SaltStack, mengeksekusi module, dan mengelola minion keys. Server ini menyediakan 12 tool, seperti salt_list_profiles, salt_ping, salt_run.
Ringkasan dibuat dari README proyek
Tentang salt-api-cli MCP server
Mengelola infrastruktur SaltStack melalui AI agent kini dimungkinkan dengan salt-api-cli, sebuah tool berbasis Go yang menyediakan command-line interface sekaligus MCP server dengan akses penuh. Tool ini bertindak sebagai wrapper untuk netapi milik SaltStack, yang memungkinkan Anda berinteraksi dengan Salt Masters melalui rest_cherrypy atau rest_tornado. Tool ini mendukung beberapa profile untuk lingkungan yang berbeda seperti production atau staging, yang dikelola melalui file konfigurasi.
Anda dapat menghubungkan AI client seperti Claude Code, Cursor, atau Gemini CLI dengan menjalankan command mcp untuk memulai server melalui stdio. Server ini menyediakan 12 tool spesifik yang memungkinkan agent melakukan operasi kompleks seperti menerapkan state, menjalankan master runners, atau mengelola minion keys. Tool ini menangani autentikasi dengan menyimpan cache token di file lokal yang aman dan dapat menyelesaikan kredensial menggunakan environment variables atau tool secret eksternal. Setup ini memungkinkan manajemen infrastruktur otomatis langsung dari interface chat AI.
Apa yang bisa Anda lakukan dengannya
- 1Automated infrastructure state applicationAI agent dapat menerapkan Salt state tertentu atau highstate ke minion yang ditargetkan menggunakan tool state apply.
- 2Minion key lifecycle managementDeveloper dapat menginstruksikan AI untuk menerima, menolak, atau menghapus minion keys guna menjaga keamanan.
- 3Infrastructure inventory inspectionAnda dapat meminta AI untuk menampilkan daftar semua minion yang terdaftar serta mengambil informasi grains spesifik atau status online mereka.
- 4Executing master-side functionsAI client dapat memicu module Salt Master Runner atau fungsi Wheel untuk menjalankan tugas orkestrasi.
Ditulis berdasarkan README proyek. Setiap use case diperiksa terhadap kutipan dari README tersebut.
Tool salt-api-cli MCP 12
Terdeteksi dari READMEsalt_list_profilessalt_pingsalt_runsalt_state_applysalt_list_minionssalt_get_minion_grainssalt_list_jobssalt_get_jobsalt_runnersalt_wheelsalt_keys_managesalt_send_hook
| salt_list_profiles | — | |
| salt_ping | — | |
| salt_run | — | |
| salt_state_apply | — | |
| salt_list_minions | — | |
| salt_get_minion_grains | — | |
| salt_list_jobs | — | |
| salt_get_job | — | |
| salt_runner | — | |
| salt_wheel | — | |
| salt_keys_manage | — | |
| salt_send_hook | — |
Pengecekan otomatis
Berjalan 14 Nov 2026Laporan lengkap →Belum diverifikasi. Sebuah server memerlukan skor 80, tidak ada temuan serius, dan data yang cukup untuk kami periksa. Cara kerja checks · Yang perlu diperbaiki untuk menambah poin
- Source repository terhubung dan dapat dijangkaulaurentl/salt-api-cli is public and reachablegithub.com/laurentl/salt-api-cli ↗Lolos
- Nama paket mencantumkan repositori ini sebagai sumbernyaTidak diperiksa
- Provenance build (atestasi Sigstore)Tidak diperiksa
- Lisensi open source (OSI)MITspdx.org/licenses/MIT.html ↗Lolos
- Ada commit atau release dalam satu tahun terakhirLast commit or release 2026-11-04github.com/laurentl/salt-api-cli ↗Lolos
- OpenSSF ScorecardTidak diperiksa
- Nama package tidak mirip dengan package populerTidak diperiksa
- Tidak ada advisory kritis pada paket atau dependensinyaTidak diperiksa
- Tidak ada instruksi tersembunyi untuk model12 tool descriptions and the README read; no override phrases, credential paths or hidden charactersLolos
- Tools yang bersifat destruktif telah diberi labelNo tool named like delete, drop or execLolos
- Endpoint remote merespons handshake MCPTidak diperiksa
README
Lihat di GitHubsapi — SaltStack salt-api CLI & Full-Access MCP Server
sapi is a fast, zero-dependency Go command-line client that wraps SaltStack's salt-api (netapi: rest_cherrypy / rest_tornado) and embeds a Full-Access Model Context Protocol (MCP) server (stdio) for AI coding and operations agents (Claude Code, Gemini CLI, Cursor, Google Antigravity).
Key Features
- Hybrid CLI Experience:
- Drop-in
saltShortcut Mode: Runsapi '*' test.ping,sapi -G 'os:Debian' cmd.run 'uptime', orsapi -b 25% '*' state.highstatedirectly without verbose subcommands. - Structured Subcommands:
run,async,batch,job,minion,runner,wheel,key,event,profile,auth,stats, andmcp.
- Drop-in
- Multi-Profile & Flexible Secret Resolution:
- Manage multiple Salt Masters (
prod,staging,dev) in~/.config/sapi/config.toml. - Resolve credentials via
password_env,password_cmd(e.g.,pass,secret-tool,1password), environment variables (SALT_API_*), or interactive terminal prompt.
- Manage multiple Salt Masters (
- Automatic Token Caching & Renewal:
- Caches
X-Auth-Tokenin~/.cache/sapi/tokens.jsonwith strict0600permissions. - Proactively refreshes tokens before expiration and transparently retries once on
HTTP 401 Unauthorized.
- Caches
- Rich Output Renderers:
pretty(colorized tree output matching native Salt CLI + automaticstate.apply/highstatesummary table),json,yaml, andtable.
- Built-in Full-Access MCP Server (
sapi mcp):- Exposes 12 MCP tools over
stdioallowing AI agents to inspect minions/grains/jobs, run execution modules, apply states, execute Master runners/wheel functions, manage minion keys (list,accept,reject,delete,finger), and trigger Salt webhooks across any configured profile.
- Exposes 12 MCP tools over
Architecture
flowchart LR
subgraph Inputs["Interfaces"]
CLI_Sub["Structured CLI\nsapi run / job / key..."]
CLI_Short["Native Shortcut\nsapi '*' test.ping"]
MCP_Stdio["MCP Server (stdio)\nsapi mcp"]
end
subgraph Core["Go Core (internal/)"]
Cfg["Config & Profiles\nconfig.toml + SALT_API_*"]
Auth["Token Cache (0600)\nAuto-renew /login"]
Client["NetAPI HTTP Client\nlocal, async, batch, runner, wheel, SSE"]
Out["Output Renderers\nPretty / JSON / YAML / Table"]
end
subgraph SaltMasters["Salt Infrastructure"]
M1["Salt Master (Prod)\nhttps://salt-prod:8000"]
M2["Salt Master (Staging)\nhttps://salt-stg:8000"]
end
CLI_Sub --> Cfg
CLI_Short --> Cfg
MCP_Stdio --> Cfg
Cfg --> Auth
Auth --> Client
Client --> Out
Client --> M1
Client --> M2
Installation
Via go install
go install github.com/laurentL/salt-api-cli/cmd/sapi@latest
Debian / Ubuntu Package (.deb)
Build and install the native .deb package (includes /usr/bin/sapi, man pages sapi(1) + sapi-*(1), and bash/zsh/fish completions):
make deb
sudo dpkg -i dist/sapi_1.0.0-1_amd64.deb
# Or using standard debhelper:
dpkg-buildpackage -us -uc -b
From Source (Makefile)
git clone https://github.com/laurentL/salt-api-cli.git
cd salt-api-cli
make all
make install
# Installs binary to ~/bin/sapi and man pages to ~/.local/share/man/man1/
Man Pages
man sapi
man sapi-run
man sapi-key
man sapi-mcp
Configuration (~/.config/sapi/config.toml)
Initialize a sample configuration file:
sapi profile init
Or create/update a profile directly from the CLI:
sapi profile set prod \
--url https://salt-master.prod.example.com:8000 \
--user saltadmin \
--eauth pam \
--password-env SALT_PROD_PASSWORD \
--default
Example ~/.config/sapi/config.toml (see config.example.toml):
default_profile = "prod"
default_output = "pretty" # pretty | json | yaml | table
[profiles.prod]
url = "https://salt-master.prod.example.com:8000"
username = "saltadmin"
password_env = "SALT_PROD_PASSWORD" # or password_cmd = "secret-tool lookup service salt-prod"
eauth = "pam" # pam | ldap | file | sharedsecret | auto
verify_ssl = true
timeout = "60s"
[profiles.staging]
url = "https://salt-master.staging.example.com:8000"
username = "saltadmin"
password_env = "SALT_STAGING_PASSWORD"
eauth = "pam"
verify_ssl = false
timeout = "30s"
Environment Variable Overrides
CLI flags take precedence over environment variables, which take precedence over config.toml:
SALT_API_PROFILE: Active profile nameSALT_API_URL: Salt Mastersalt-apiURLSALT_API_USER: UsernameSALT_API_PASSWORD: PasswordSALT_API_EAUTH: External auth backend (pam,ldap,file,sharedsecret)SALT_API_TOKEN: Pre-existingX-Auth-TokenSALT_API_INSECURE: Skip TLS verification (true/1)
CLI Usage
1. Native salt Shortcut Mode
Any command whose first positional argument is not a reserved subcommand is automatically executed against targeted minions:
# Connectivity check
sapi '*' test.ping
# Target by Grain (-G), PCRE (-E), List (-L), Pillar (-I), Compound (-C), Nodegroup (-N), Subnet (-S)
sapi -G 'os_family:Debian' pkg.install htop refresh=True
sapi -L 'web-01,web-02' service.restart nginx
sapi -C 'G@os:Ubuntu and E@db-.*' cmd.run 'df -h'
# Asynchronous execution with live job polling
sapi --async --wait '*' state.apply common test=True
# Progressive batch execution
sapi -b 20% '*' state.highstate
2. Structured Subcommands
# Authentication & token cache inspection
sapi auth login -p prod
sapi auth status
sapi auth logout
# Jobs management
sapi job list --limit 15 --function state.apply
sapi job get 20261015130000123456 --info
sapi job wait 20261015130000123456 --interval 2s --timeout 5m
sapi job active
# Minions & Grains inventory
sapi minion list
sapi minion grains web-01 os ipv4 mem_total
sapi minion status
# Master Runners & Wheel modules
sapi runner manage.up
sapi runner state.orchestrate orch.deploy pillar='{"version":"2.1.0"}'
sapi wheel config.values
# Minion Keys management (via Wheel)
sapi key list
sapi key accept web-new-01
sapi key reject web-unwanted-01
sapi key delete web-old-01
sapi key finger '*'
# Real-time Event Bus (SSE) & Webhooks
sapi event listen --tag 'salt/job/*' --count 10
sapi event hook deploy/app -d '{"env":"staging","version":"1.2.3"}'
# Salt-API server statistics
sapi stats
MCP Server Integration (Claude Code / Gemini CLI / Antigravity / Cursor)
sapi mcp (or sapi --mcp) starts a Model Context Protocol server over stdio. Technical logs are written to /tmp/sapi_mcp.log so stdout remains strictly reserved for JSON-RPC frames.
Add the following entry to your mcp_config.json (or .mcp.json):
{
"mcpServers": {
"salt": {
"command": "sapi",
"args": ["mcp"]
}
}
}
Exposed MCP Tools (Full Access)
Every tool accepts an optional profile parameter so the AI agent can dynamically target prod, staging, or dev:
| Tool Name | Description |
|---|---|
salt_list_profiles |
List configured Salt Master profiles from ~/.config/sapi/config.toml and show the default profile. |
salt_ping |
Test connectivity (test.ping) against targeted minions (tgt, tgt_type). |
salt_run |
Execute any Salt execution module (local, local_async with optional wait, or local_batch). |
salt_state_apply |
Apply a Salt state or highstate (state, test, pillar, saltenv, wait). |
salt_list_minions |
List known minions and their grains or online/offline status (manage.status). |
salt_get_minion_grains |
Fetch full or filtered grains for a specific minion (minion_id, grain). |
salt_list_jobs |
List historical jobs (/jobs) or currently running jobs (active_only=true). |
salt_get_job |
Retrieve full return data for a jid (with optional wait=true polling). |
salt_runner |
Execute any Salt Master Runner module (fun, args, kwargs, async). |
salt_wheel |
Execute any Salt Master Wheel function (fun, args, kwargs, async). |
salt_keys_manage |
Manage minion keys (list, accept, reject, delete, finger). |
salt_send_hook |
Trigger a Salt-API webhook (POST /hook/<tag>) with a JSON payload. |
License
Released under the MIT License.
Pertanyaan tentang salt-api-cli MCP
Tool apa yang disediakan salt-api-cli MCP?
Server ini menyediakan 12 tool, termasuk salt_list_profiles, salt_ping, salt_run, salt_state_apply, salt_list_minions.
Apakah saya bisa mengelola beberapa Salt Masters?
Ya, Anda bisa mengelola beberapa Salt Masters (misalnya, prod, staging, dev) dengan mendefinisikan profile di ~/.config/sapi/config.toml.