
Kastell
io.github.kastelldev由 GitHub 账号 kastelldev 发布v1.14.0更新于 Oct 24, 2026
Server security audit (413 checks), hardening, and fleet management across 4 cloud providers.
概览
让助手通过本地 MCP 服务器对四家云厂商的服务器进行安全审计、加固、开通、备份和监控。
- 可以做什么
- Kastell 提供 17 个 MCP 工具,涵盖服务器信息查询、日志与指标、开通、维护、安全加固、防火墙与域名设置、备份与快照、安全审计、证据收集、监控守护进程、诊断、机群总览以及安全自动修复。审计包含数百项检查并可按合规框架过滤,lock 工具执行多步生产加固流程。破坏性操作受安全模式限制。
- 适用场景
- 当你管理 Hetzner、DigitalOcean、Vultr 或 Linode 上的自托管 Linux 服务器,并希望助手通过提示完成审计、加固、备份、更新和健康检查时使用。适合希望用一个工具同时处理开通与持续安全的运维人员。
- 运行要求
- 通过 npx 或全局 npm 安装后在本地运行,需要 Node.js 20 或更高版本。云厂商 API 令牌通过环境变量提供:DIGITALOCEAN_TOKEN、HETZNER_TOKEN、LINODE_TOKEN、VULTR_TOKEN,各自仅用于对应厂商。需要目标服务器的 SSH 访问权限以及到云厂商的网络连接。未声明需要厂商账号。
安装
在 SourceWeft 中
- 打开 控制台中的 Kastell,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Kastell
Your infrastructure, fortified.
English | Türkçe
[Tests] [Coverage] [npm] [Downloads] [License] [GitHub stars] [Socket Badge] [Snyk] [Website] [DeepWiki] [Zero Telemetry]
Why Kastell?
Server security is fragmented. Lynis scans but doesn't fix. OpenSCAP is powerful but complex. Custom scripts work until they don't -- and nobody maintains them. Each tool has its own output format, its own update cycle, its own learning curve.
Kastell takes a different approach: one CLI that audits, fixes, hardens, and monitors. Scan your server, apply safe fixes, lock it down to production standards, and keep watching -- all with the same tool.
AI-native from day one. Kastell ships with a built-in MCP server, so Claude, Cursor, or any MCP-compatible AI agent can manage your servers directly. Go from a prompt to production hardening in seconds.
You don't need four separate tools to secure a server.
Quick Start
Running kastell without any arguments launches an interactive search menu with a gradient ASCII banner and quick-start examples. Browse actions by emoji-categorized groups, type to filter results instantly, and configure options step by step -- no need to remember any command names or flags.
Each action includes sub-options (server mode, template, log source, port number, etc.) and a <- Back option to return to the main menu at any point.
If you already know the commands, you can still use them directly:
Kastell handles server provisioning, SSH key setup, firewall configuration, and platform installation automatically.
What Makes Kastell Different?
Kastell vs Alternatives
What Can You Do?
Deploy
Manage
Update & Maintain
Back Up & Restore
Snapshots
Security
Security Audit
Security Hardening
Monitor & Debug
Supported Providers
Prices reflect the cheapest plan with at least 2 GB RAM (required by Coolify and Dokploy). Bare mode has no minimum requirements -- plans start from ~$2.50/mo depending on provider. You can choose a different size during setup. Linode support is in beta -- community testing welcome.
Supported Platforms
Kastell uses a PlatformAdapter architecture -- the same commands (update, maintain, logs, health) work across all platforms. The platform is stored in your server record and auto-detected on each command.
Developer Experience
YAML Config
Deploy with a single config file:
Templates
Security
Kastell is built with security as a priority -- 12,132 tests across 380 suites, including dedicated security test suites.
- API tokens are never stored on disk -- prompted at runtime or via environment variables
- SSH keys are auto-generated if needed (Ed25519)
- All SSH connections use
StrictHostKeyChecking=accept-newwith IP validation (octet range) and environment filtering - Shell injection protection on all user-facing inputs (
spawn/spawnSync, noexecSync) - Provider error messages are sanitized to prevent token leakage
- stderr sanitization redacts IPs, home paths, tokens, and secrets from error output
- Config file token detection (22+ key patterns, case-insensitive, nested)
- Import/export operations strip sensitive fields and enforce strict file permissions (
0o600) --full-setupenables UFW firewall and SSH hardening automatically- MCP: SAFE_MODE (default: on) blocks all destructive operations, Zod schema validation on all inputs, path traversal protection on backup restore
- Claude Code hooks: destroy-block prevents accidental
kastell destroywithout--force, pre-commit audit guard warns on score drops - Zero Telemetry — Kastell collects no usage data, analytics, or telemetry. Your server data never leaves your machine.
Security behavior (v2.3.1)
This section documents security contracts shipped in v2.3.1. Future work is described elsewhere (see CHANGELOG.md for upcoming entries).
KASTELL_STRICT_HOST_KEY=true— when set, Kastell rejects unknown SSH host keys outright. Direct SSH connections (i.e. those that go throughaccept-new) emit a one-time Trust-On-First-Use (TOFU) warning so operators see the risk; combined withKASTELL_STRICT_HOST_KEY=true, the warning is promoted to a hard error.- Non-TTY destructive commands — in non-interactive environments (CI, scripts, automation), destructive operations require an explicit
--forceflag or the command's documented opt-in flag. Without one, the command exits with a non-zero status and a clear error. - Structured skipped checks — checks that are skipped (e.g. VPS-irrelevant, platform-mismatch, missing prerequisite) appear in audit output as a neutral, visible result rather than being silently dropped. Operators can see exactly which checks did not run and why.
- Windows secret files — secret-bearing files written by Kastell on Windows receive restrictive ACLs (owner-only access).
0o600POSIX permissions remain the source of truth on Linux/macOS; Windows uses the equivalent DACL. - QuickWin JSON shape —
audit --jsonQuickWin entries now include a stableid(check ID) andseverityfield, in addition to the existingdescriptionandcommands. This makes QuickWins programmatically consumable without parsing the human-readable description. - FORBIDDEN previews include reasons — when previewing fixes with
--dry-run(or viaserver_fixMCP dry-run), each FORBIDDEN-tier fix now renders a short reason explaining why the fix is classified FORBIDDEN (e.g. "requires reboot", "disrupts active SSH sessions"). The reason is sourced from the check'sforbiddenReasonfield.
Installation
Requires Node.js 20 or later.
Safety Modes
KASTELL_SAFE_MODE environment variable controls destructive operations:
- MCP default:
true—provision,destroy,restoreare blocked - CLI default:
false— all operations are enabled - Override:
KASTELL_SAFE_MODE=true kastell destroy <server>→ rejected
Affected commands: init, destroy, backup-restore, snapshot-restore, snapshot-delete, restart, maintain.
Troubleshooting
Server creation fails?
Run kastell doctor --check-tokens to verify your API token and local environment.
Server not responding?
Use kastell status my-server --autostart to check platform status and auto-restart if needed, or kastell health to check all servers at once.
Need to start fresh?
kastell destroy my-server removes the cloud server entirely.
Contributing
See CONTRIBUTING.md for development setup, testing, and contribution guidelines.
Kastell uses 11,206 tests across 344 suites. Run npm test before submitting PRs.
MCP Server (AI Integration)
Kastell includes a built-in Model Context Protocol server for AI-powered server management. Works with Claude Code, Cursor, Windsurf, and other MCP-compatible clients.
Available tools:
All destructive operations (destroy, restore, snapshot-delete, provision, restart, maintain, snapshot-create) require
SAFE_MODE=falseto execute.
Claude Code Plugin
Kastell is available as a Claude Code plugin for the Anthropic marketplace. The plugin bundles:
- 4 skills: kastell-ops (architecture reference), kastell-scaffold (component generation), kastell-careful (destructive op guard), kastell-research (codebase exploration)
- 2 agents: kastell-auditor (parallel audit analyzer), kastell-fixer (worktree-isolated auto-fix)
- 5 hooks: destroy-block, session-audit, session-log, pre-commit-audit-guard, stop-quality-check
Install via Claude Code plugin manager or use directly with claude --plugin-dir kastell-plugin.
MCP Platform Setup
More platforms (JetBrains, Windsurf, Gemini, and others) coming in v2.0.
AI Discoverability
Kastell provides llms.txt for AI crawlers and is listed in the MCP Registry as io.github.kastelldev/kastell.
v2.3 Reliability Contracts
These contracts apply to the CLI and the MCP server.
Provisioning behavior
server_provision returns after the provider creates the server and Kastell
durably registers it. readiness.status may be pending; follow with
server_info status or server_info health. The interactive kastell init
command continues waiting through its existing readiness checks.
Automation contracts
- Unsupported and failed CLI operations return exit code
1. - Valid empty results and user cancellation return
0. - Mixed
--allfailures return1. audit --jsonandaudit --cireserve stdout for one JSON payload.
CI/CD Integration
Use kastell audit in your CI pipeline to enforce security baselines:
The --threshold flag causes a non-zero exit code when the score falls below the target, failing the CI job automatically.
What's Next
- Test Excellence: Mutation testing, coverage gaps, integration tests (v1.14)
- Plugin ecosystem with marketplace distribution (v2.0)
- Dashboard and managed service (v3.0)
Philosophy
Infrastructure should be boring, predictable, and safe.
Kastell is not a script. It's your DevOps safety layer for self-hosted infrastructure.
License
Apache 2.0 -- see LICENSE
Support
- GitHub Issues -- Bug reports and feature requests
- Changelog -- Version history
Built by @omrfc
来源:README.md,提交 2d77c61
工具
0版本历史
1- v1.14.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分